prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: <|fim_middle|> # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index"))
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: <|fim_middle|> response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter)
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: <|fim_middle|> if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital)
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: <|fim_middle|> if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital)
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: <|fim_middle|> response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter)
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: <|fim_middle|> response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter)
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) <|fim_middle|> return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: <|fim_middle|> return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None <|fim_middle|> return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ]
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation <|fim_middle|> # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename))
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: <|fim_middle|> return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ]
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": <|fim_middle|> return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
if r.name == "req": req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": <|fim_middle|> return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
req_record = r.record if req_record: _next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader
<|file_name|>rms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Functions' Views) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Requests"), False, URL(r=request, f="req"), [ [T("List"), False, URL(r=request, f="req")], [T("Add"), False, URL(r=request, f="req", args="create")], # @ToDo Search by priority, status, location #[T("Search"), False, URL(r=request, f="req", args="search")], ]], [T("All Requested Items"), False, URL(r=request, f="ritem")], ] if session.rcvars: if "hms_hospital" in session.rcvars: hospital = db.hms_hospital query = (hospital.id == session.rcvars["hms_hospital"]) selection = db(query).select(hospital.id, hospital.name, limitby=(0, 1)).first() if selection: menu_hospital = [ [selection.name, False, URL(r=request, c="hms", f="hospital", args=[selection.id])] ] menu.extend(menu_hospital) if "cr_shelter" in session.rcvars: shelter = db.cr_shelter query = (shelter.id == session.rcvars["cr_shelter"]) selection = db(query).select(shelter.id, shelter.name, limitby=(0, 1)).first() if selection: menu_shelter = [ [selection.name, False, URL(r=request, c="cr", f="shelter", args=[selection.id])] ] menu.extend(menu_shelter) response.menu_options = menu def index(): """ Module's Home Page Default to the rms_req list view. """ request.function = "req" request.args = [] return req() #module_name = deployment_settings.modules[prefix].name_nice #response.title = module_name #return dict(module_name=module_name, a=1) def req(): """ RESTful CRUD controller """ resourcename = request.function # check again in case we're coming from index() tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] # Pre-processor def prep(r): response.s3.cancel = r.here() if r.representation in shn_interactive_view_formats and r.method != "delete": # Don't send the locations list to client (pulled by AJAX instead) r.table.location_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "gis_location.id")) #if r.method == "create" and not r.component: # listadd arrives here as method=None if not r.component: table.datetime.default = request.utcnow table.person_id.default = s3_logged_in_person() # @ToDo Default the Organisation too return True response.s3.prep = prep # Post-processor def postp(r, output): if r.representation in shn_interactive_view_formats: #if r.method == "create" and not r.component: # listadd arrives here as method=None if r.method != "delete" and not r.component: # Redirect to the Assessments tabs after creation r.next = r.other(method="ritem", record_id=s3xrc.get_session(prefix, resourcename)) # Custom Action Buttons if not r.component: response.s3.actions = [ dict(label=str(T("Open")), _class="action-btn", url=str(URL(r=request, args=["[id]", "update"]))), dict(label=str(T("Items")), _class="action-btn", url=str(URL(r=request, args=["[id]", "ritem"]))), ] return output response.s3.postp = postp s3xrc.model.configure(table, #listadd=False, #@todo: List add is causing errors with JS - FIX editable=True) return s3_rest_controller(prefix, resourcename, rheader=shn_rms_req_rheader) def shn_rms_req_rheader(r): """ Resource Header for Requests """ if r.representation == "html": if r.name == "req": req_record = r.record if req_record: <|fim_middle|> return None def ritem(): """ RESTful CRUD controller """ tablename = "%s_%s" % (prefix, resourcename) table = db[tablename] s3xrc.model.configure(table, insertable=False) return s3_rest_controller(prefix, resourcename) def store_for_req(): store_table = None return dict(store_table = store_table) <|fim▁end|>
_next = r.here() _same = r.same() try: location = db(db.gis_location.id == req_record.location_id).select(limitby=(0, 1)).first() location_represent = shn_gis_location_represent(location.id) except: location_represent = None rheader_tabs = shn_rheader_tabs( r, [(T("Edit Details"), None), (T("Items"), "ritem"), ] ) rheader = DIV( TABLE( TR( TH( T("Message") + ": "), TD(req_record.message, _colspan=3) ), TR( TH( T("Time of Request") + ": "), req_record.datetime, TH( T( "Location") + ": "), location_represent, ), TR( TH( T("Priority") + ": "), req_record.priority, TH( T("Document") + ": "), document_represent(req_record.document_id) ), ), rheader_tabs ) return rheader
<|file_name|>test_e_invoice_request_log.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors<|fim▁hole|># See license.txt from __future__ import unicode_literals # import frappe import unittest class TestEInvoiceRequestLog(unittest.TestCase): pass<|fim▁end|>
<|file_name|>test_e_invoice_request_log.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt from __future__ import unicode_literals # import frappe import unittest class TestEInvoiceRequestLog(unittest.TestCase): <|fim_middle|> <|fim▁end|>
pass
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|>import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() <|fim▁hole|>lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])<|fim▁end|>
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): <|fim_middle|> <|fim▁end|>
def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): <|fim_middle|> def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, []) <|fim▁end|>
self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap)
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): <|fim_middle|> def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, []) <|fim▁end|>
oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): <|fim_middle|> <|fim▁end|>
oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def <|fim_middle|>(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, []) <|fim▁end|>
setUp
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def <|fim_middle|>(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_300(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, []) <|fim▁end|>
test_rule_300
<|file_name|>test_rule_300.py<|end_file_name|><|fim▁begin|> import os import unittest from vsg.rules import iteration_scheme from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected) class test_iteration_scheme_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_300(self): oRule = iteration_scheme.rule_300() self.assertTrue(oRule) self.assertEqual(oRule.name, 'iteration_scheme') self.assertEqual(oRule.identifier, '300') lExpected = [13, 17] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def <|fim_middle|>(self): oRule = iteration_scheme.rule_300() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, []) <|fim▁end|>
test_fix_rule_300
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic")<|fim▁hole|> def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination)<|fim▁end|>
self.setName(name)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): <|fim_middle|> <|fim▁end|>
""" Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): <|fim_middle|> def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
""" init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): <|fim_middle|> def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
WrapperXml.__init__(self,node=node)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): <|fim_middle|> def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
WrapperXml.__init__(self,nodestring=nodestring)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): <|fim_middle|> def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
WrapperXml.__init__(self,nodename="generic") self.setName(name)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): <|fim_middle|> def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return self.getAttributeValue("op")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): <|fim_middle|> def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("op",op)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): <|fim_middle|> def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return self.getAttributeValue("target")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): <|fim_middle|> def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("target",target)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): <|fim_middle|> def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
if self.getAttributeValue("public")=="true": return "true" else: return "false"
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): <|fim_middle|> def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): <|fim_middle|> def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): <|fim_middle|> def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("type",type)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): <|fim_middle|> def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): <|fim_middle|> def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("match",match)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): <|fim_middle|> def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
""" return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): <|fim_middle|> def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): <|fim_middle|> def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
""" return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): <|fim_middle|> <|fim▁end|>
destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: <|fim_middle|> elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.__initnode(keys["node"])
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: <|fim_middle|> elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.__initnodestring(keys["nodestring"])
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: <|fim_middle|> else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.__initname(keys["name"])
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: <|fim_middle|> def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Keys unknown in Generic init()",0)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": <|fim_middle|> else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return "true"
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: <|fim_middle|> def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return "false"
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: <|fim_middle|> self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Public value "+str(public)+" wrong")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: <|fim_middle|> else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: <|fim_middle|> def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return the_type
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: <|fim_middle|> else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return self.getAttributeValue("value")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: <|fim_middle|> def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin <|fim_middle|> else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: <|fim_middle|> def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Operator unknown "+self.getOp(),1)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: <|fim_middle|> elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("value",value)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): <|fim_middle|> else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
self.setAttribute("value",value)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: <|fim_middle|> def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Value doesn't match for attribute "+str(value),0)
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: <|fim_middle|> self.setAttribute("destination",destination) <|fim▁end|>
raise Error("Destination value "+str(destination)+\ " unknown")
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def <|fim_middle|>(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
__init__
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def <|fim_middle|>(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
__initnode
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def <|fim_middle|>(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
__initnodestring
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def <|fim_middle|>(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
__initname
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def <|fim_middle|>(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getOp
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def <|fim_middle|>(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setOp
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def <|fim_middle|>(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getTarget
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def <|fim_middle|>(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setTarget
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def <|fim_middle|>(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
isPublic
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def <|fim_middle|>(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setPublic
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def <|fim_middle|>(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getType
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def <|fim_middle|>(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setType
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def <|fim_middle|>(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getMatch
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def <|fim_middle|>(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setMatch
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def <|fim_middle|>(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getValue
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def <|fim_middle|>(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setValue
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def <|fim_middle|>(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def setDestination(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
getDestination
<|file_name|>generic.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Generic.py # Purpose: # Author: Fabien Marteau <[email protected]> # Created: 21/05/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __version__ = "1.0.0" __author__ = "Fabien Marteau <[email protected]>" import re from periphondemand.bin.utils.wrapperxml import WrapperXml from periphondemand.bin.utils.error import Error DESTINATION = ["fpga","driver","both"] PUBLIC = ["true","false"] class Generic(WrapperXml): """ Manage generic instance value """ def __init__(self,parent,**keys): """ init Generic, __init__(self,parent,node) __init__(self,parent,nodestring) __init__(self,parent,name) """ self.parent=parent if "node" in keys: self.__initnode(keys["node"]) elif "nodestring" in keys: self.__initnodestring(keys["nodestring"]) elif "name" in keys: self.__initname(keys["name"]) else: raise Error("Keys unknown in Generic init()",0) def __initnode(self,node): WrapperXml.__init__(self,node=node) def __initnodestring(self,nodestring): WrapperXml.__init__(self,nodestring=nodestring) def __initname(self,name): WrapperXml.__init__(self,nodename="generic") self.setName(name) def getOp(self): return self.getAttributeValue("op") def setOp(self,op): self.setAttribute("op",op) def getTarget(self): return self.getAttributeValue("target") def setTarget(self,target): self.setAttribute("target",target) def isPublic(self): if self.getAttributeValue("public")=="true": return "true" else: return "false" def setPublic(self,public): public = public.lower() if not public in PUBLIC: raise Error("Public value "+str(public)+" wrong") self.setAttribute("public",public) def getType(self): the_type = self.getAttributeValue("type") if the_type == None: raise Error("Generic "+self.getName()+\ " description malformed, type must be defined",0) else: return the_type def setType(self,type): self.setAttribute("type",type) def getMatch(self): try: return self.getAttributeValue("match").encode("utf-8") except AttributeError: return None def setMatch(self,match): self.setAttribute("match",match) def getValue(self): """ return the generic value """ component = self.getParent() if self.getOp() == None: return self.getAttributeValue("value") else: target = self.getTarget().split(".") if self.getOp() == "realsizeof": # return the number of connected pin return str(int(component.getInterface(target[0]).getPort(target[1]).getMaxPinNum())+1) else: raise Error("Operator unknown "+self.getOp(),1) def setValue(self,value): if self.getMatch() == None: self.setAttribute("value",value) elif re.compile(self.getMatch()).match(value): self.setAttribute("value",value) else: raise Error("Value doesn't match for attribute "+str(value),0) def getDestination(self): """ return the generic destination (fpga,driver or both) """ return self.getAttributeValue("destination") def <|fim_middle|>(self,destination): destination = destination.lower() if not destination in DESTINATION: raise Error("Destination value "+str(destination)+\ " unknown") self.setAttribute("destination",destination) <|fim▁end|>
setDestination
<|file_name|>002.py<|end_file_name|><|fim▁begin|><|fim▁hole|> #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src def main(islinput, inputfile, pluginData, globalData): currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData<|fim▁end|>
blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def normalizeEnter(src):
<|file_name|>002.py<|end_file_name|><|fim▁begin|>blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def normalizeEnter(src): #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output <|fim_middle|> def main(islinput, inputfile, pluginData, globalData): currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData <|fim▁end|>
for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src
<|file_name|>002.py<|end_file_name|><|fim▁begin|>blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def normalizeEnter(src): #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src def main(islinput, inputfile, pluginData, globalData): <|fim_middle|> <|fim▁end|>
currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData
<|file_name|>002.py<|end_file_name|><|fim▁begin|>blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def <|fim_middle|>(src): #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src def main(islinput, inputfile, pluginData, globalData): currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData <|fim▁end|>
normalizeEnter
<|file_name|>002.py<|end_file_name|><|fim▁begin|>blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"] def normalizeEnter(src): #Deletes all user defined for readability reason existing line breaks that are issues for the HTML output for elem in blocklevel: while src.find("\r<" + elem) > -1: src = src.replace("\r<" + elem, "<" + elem) while src.find("</" + elem + ">\r") > -1: src = src.replace("</" + elem + ">\r", "</" + elem + ">") while src.find(">\r") > -1: src = src.replace(">\r", ">") #It is really needed, it created some other bugs?! while src.find("\r</") > -1: src = src.replace("\r</", "</") ##It is really needed, it created some other bugs?! return src def <|fim_middle|>(islinput, inputfile, pluginData, globalData): currentIndex = 0 for item in islinput: item = normalizeEnter(item) #Deletes not wanted line breaks in order to prevent the problem we have with Markdown. islinput[currentIndex] = item currentIndex += 1 return islinput, pluginData, globalData <|fim▁end|>
main
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5),<|fim▁hole|> beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init)<|fim▁end|>
"""The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): <|fim_middle|> def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
__doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip()
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): <|fim_middle|> ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
assert chart_object.T.check_integrity(self)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): <|fim_middle|> def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): <|fim_middle|> def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line <|fim_middle|> def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip()
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): <|fim_middle|> theme.add_reinitialization_hook(init) <|fim▁end|>
global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate()
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': <|fim_middle|> else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
return pychart_util.get_data_range(self.data, self.xcol)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: <|fim_middle|> def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
return pychart_util.get_data_range(self.data, self.ycol)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: <|fim_middle|> return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: <|fim_middle|> return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.'
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: <|fim_middle|> return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
raise Exception, 'Line plot has label, but an empty line style and error bar.'
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: <|fim_middle|> can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points)
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): <|fim_middle|> can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
points.append((ar.x_pos(xval), ar.y_pos(yval)))
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): <|fim_middle|> x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus)) if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
continue
<|file_name|>line_plot.py<|end_file_name|><|fim▁begin|># # Copyright (C) 2000-2005 by Yasushi Saito ([email protected]) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import error_bar import chart_object import legend import object_set import line_plot_doc import theme from pychart_types import * from types import * default_width = 1.2 line_style_itr = None _keys = { 'data' : (AnyType, None, pychart_util.data_desc), 'label': (StringType, '???', pychart_util.label_desc), 'data_label_offset': (CoordType, (0, 5), """The location of data labels relative to the sample point. Meaningful only when data_label_format != None."""), 'data_label_format': (FormatType, None, """The format string for the label printed beside a sample point. It can be a `printf' style format string, or a two-parameter function that takes the (x, y) values and returns a string. """ + pychart_util.string_desc), 'xcol' : (IntType, 0, pychart_util.xcol_desc), 'ycol': (IntType, 1, pychart_util.ycol_desc), 'y_error_minus_col': (IntType, 2, """The column (within "data") from which the depth of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_error_plus_col': (IntType, -1, """The column (within "data") from which the height of the errorbar is extracted. Meaningful only when error_bar != None. <<error_bar>>"""), 'y_qerror_minus_col': (IntType, -1, '<<error_bar>>'), 'y_qerror_plus_col': (IntType, -1, '<<error_bar>>'), 'line_style': (line_style.T, lambda: line_style_itr.next(), pychart_util.line_desc, "By default, a style is picked from standard styles round-robin. <<line_style>>"), 'tick_mark': (tick_mark.T, None, pychart_util.tick_mark_desc), 'error_bar': (error_bar.T, None, 'The style of the error bar. <<error_bar>>'), } class T(chart_object.T): __doc__ = line_plot_doc.doc keys = _keys def check_integrity(self): assert chart_object.T.check_integrity(self) ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def get_data_range(self, which): if which == 'X': return pychart_util.get_data_range(self.data, self.xcol) else: return pychart_util.get_data_range(self.data, self.ycol) def get_legend_entry(self): if self.label: line_style = self.line_style if not line_style and self.error_bar: line_style = getattr(self.error_bar, 'line_style', None) or \ getattr(self.error_bar, 'hline_style', None) or \ getattr(self.error_bar, 'vline_style', None) if not line_style: raise Exception, 'Line plot has label, but an empty line style and error bar.' return legend.Entry(line_style=line_style, tick_mark=self.tick_mark, fill_style=None, label=self.label) return None def draw(self, ar, can): # Draw the line clipbox = theme.adjust_bounding_box([ar.loc[0], ar.loc[1], ar.loc[0] + ar.size[0], ar.loc[1] + ar.size[1]]); can.clip(clipbox[0],clipbox[1],clipbox[2],clipbox[3]) if self.line_style: points = [] for pair in self.data: yval = pychart_util.get_sample_val(pair, self.ycol) xval = pair[self.xcol] if None not in (xval, yval): points.append((ar.x_pos(xval), ar.y_pos(yval))) can.lines(self.line_style, points) can.endclip() # Draw tick marks and error bars can.clip(ar.loc[0] - 10, ar.loc[1] - 10, ar.loc[0] + ar.size[0] + 10, ar.loc[1] + ar.size[1] + 10) for pair in self.data: x = pair[self.xcol] y = pychart_util.get_sample_val(pair, self.ycol) if None in (x, y): continue x_pos = ar.x_pos(x) y_pos = ar.y_pos(y) if self.error_bar: <|fim_middle|> if self.tick_mark: self.tick_mark.draw(can, x_pos, y_pos) if self.data_label_format: can.show(x_pos + self.data_label_offset[0], y_pos + self.data_label_offset[1], '/hC' + pychart_util.apply_format(self.data_label_format, (x, y), 1)) can.endclip() def init(): global line_style_itr line_styles = object_set.T() for org_style in line_style.standards.list(): style = line_style.T(width = default_width, color = org_style.color, dash = org_style.dash) line_styles.add(style) line_style_itr = line_styles.iterate() theme.add_reinitialization_hook(init) <|fim▁end|>
plus = pair[self.y_error_plus_col or self.y_error_minus_col] minus = pair[self.y_error_minus_col or self.y_error_plus_col] if self.y_qerror_minus_col or self.y_qerror_plus_col: q_plus = pair[self.y_qerror_plus_col or self.y_qerror_minus_col] q_minus = pair[self.y_qerror_minus_col or self.y_qerror_plus_col] if None not in (minus,plus,q_minus,q_plus): self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus), ar.y_pos(y - q_minus), ar.y_pos(y + q_plus)) else: if None not in (minus,plus): #PDS self.error_bar.draw(can, (x_pos, y_pos), ar.y_pos(y - minus), ar.y_pos(y + plus))