def __init__(self, spec): Base.__init__(self) self.spec = spec self.tags = {} self.macros = {} self.subpackages = {} self.changelogs = []
def __init__(self, core, manager, user=None): Base.__init__(self, core, user) #: Provide information in dict here, usable by API `getInfo` self.info = None #: Callback of periodical job task, used by addonmanager self.cb = None #: `AddonManager` self.manager = manager #register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): for f in funcs: self.evm.addEvent(event, getattr(self,f)) else: self.evm.addEvent(event, getattr(self,funcs)) #delete for various reasons self.event_map = None if self.event_list: for f in self.event_list: self.evm.addEvent(f, getattr(self,f)) self.event_list = None self.initPeriodical() self.init() self.setup()
def __init__(self, core, package=None, password=None): Base.__init__(self, core) self.req = None # load account if set if self.USE_ACCOUNT: self.account = self.core.accountManager.selectAccount(self.USE_ACCOUNT, self.user) if self.account: self.req = self.account.getAccountRequest() if self.req is None: self.req = core.requestFactory.getRequest() # Package the plugin was initialized for, don't use this, its not guaranteed to be set self.package = package #: Password supplied by user self.password = password #: Propose a renaming of the owner package self.rename = None # For old style decrypter, do not use these! self.packages = [] self.urls = [] self.pyfile = None self.init()
def resolve_xlr_template_variables_in_settings(self, input_object, release_id): ''' resolve xlr variables in dictionaries :param release_id: :param input_dictionary: :return: ''' output_list = [] output_dict = {} # step through the dictionary if type(input_object) == str or type(input_object) == unicode: if '${' in input_object: Base.info("found variable in %s" % input_object) input_object = self.replace_xlr_variable_in_string(input_object, release_id) return input_object if isinstance(input_object, dict): for k,v in input_object.items(): output_dict[k] = self.resolve_xlr_template_variables_in_settings(v, release_id) return output_dict if isinstance(input_object, list): for v in input_object: output_list.append(self.resolve_xlr_template_variables_in_settings(v, release_id)) return output_list
def __init__(self, manager, loginname, password, options): Base.__init__(self, manager.core) if "activated" in options: self.activated = from_string(options["activated"], "bool") else: self.activated = Account.activated for opt in self.known_opt: if opt not in options: options[opt] = "" for opt in options.keys(): if opt not in self.known_opt: del options[opt] self.loginname = loginname self.options = options self.manager = manager self.lock = RLock() self.timestamp = 0 self.login_ts = 0 # timestamp for login self.cj = CookieJar(self.__name__) self.password = password self.error = None self.init()
def handle_profile(profile, targetPhase): """ parse the loaded profile and add a task for each item in it :param profile: json or dict :param targetPhase: phase to add the steps to :return: """ loaded_profile = load_profile(profile) phaseId = get_target_phase(targetPhase) title_nr = 0 for type, data in loaded_profile.items(): if __type_step_dict.has_key(type): taskTypeValue = __type_step_dict[type] else: taskTypeValue = type for data_item in data: final_data_items = dict(data_item.items() + __default_data_items.items()) title_nr += 1 title = get_title("dar_build_task_%s_%i" % (type, title_nr), taskTypeValue, data_item) Base.info("creating step: %s" % title) createSimpleTask(phaseId, taskTypeValue, title, final_data_items)
def OnInputChanged(self, *args): #args just catches tkinter arguments. I don't need them self.operand1 = (self.input_operand1.get(), Base.stringToBase(self.input_base1.get())) self.operand2 = (self.input_operand2.get(), Base.stringToBase(self.input_base2.get())) operator = Operator.stringToOperator(self.operator.get()) if self.canCalculate(operator): operand1 = convert(self.operand1[0], self.operand1[1], Base.decimal) # edge case not operation, operand2 could be invalid if operator != Operator.NOT: operand2 = convert(self.operand2[0], self.operand2[1], Base.decimal) else: operand2 = None # edge case div by zero if operator == Operator.DIV and float(operand2) == 0: self.outputError('2', "Can't divide by 0") self.outputResults('result', clear=True) return try: self.result = (result(operand1, operand2, operator), Base.decimal) self.outputResults('result') except Exception as e: print("Calculation: ", e) else: self.outputResults('result', clear=True)
def createSimpleTask(phaseId, taskTypeValue, title, propertyMap): """ adds a custom task to a phase in the release :param phaseId: id of the phase :param taskTypeValue: type of task to add :param title: title of the task :param propertyMap: properties to add to the task :return: """ # print propertyMap parenttaskType = Type.valueOf("xlrelease.CustomScriptTask") parentTask = parenttaskType.descriptor.newInstance("nonamerequired") parentTask.setTitle(title) childTaskType = Type.valueOf(taskTypeValue) childTask = childTaskType.descriptor.newInstance("nonamerequired") for item in propertyMap: if childTask.hasProperty(item): childTask.setProperty(item, propertyMap[item]) else: Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue)) parentTask.setPythonScript(childTask) print str(parentTask) taskApi.addTask(str(phaseId), parentTask)
def load_from_url(self, url): """ reaches out to a url and loads the profile :param url: :return: dict: profile """ print type(url) if type(url) == list: # if we are fed a list of urls # resolve each one and merge them with the later url taking precedence outputDict = {} for u in url : Base.info("Attempting to fetch profile at: %s" % u) response = requests.get(u, verify=False) response.raise_for_status() print json.loads(str(response.text)) outputDict = dict(self.merge_profiles(outputDict, json.loads(str(response.text)))) pprint.pprint(outputDict) return outputDict else: response = requests.get(url, verify=False) response.raise_for_status() return json.loads(str(response.text))
def get_target_phase(self, targetPhase, release): """ search the release for the targetPhase by string name for some stupid reason we can't address it by its name .. :param targetPhase:string :return:phaseId """ phaseList = self.__phaseApi.searchPhasesByTitle(str(targetPhase), release.id) if len(phaseList) == 1: return phaseList[0] else: print "Requested phase: %s not found. Creating it in the template first" % targetPhase self.create_phase(targetPhase, release) phaseList = self.__phaseApi.searchPhasesByTitle(str(targetPhase), release.id) if len(phaseList) == 1: return phaseList[0] else: Base.fatal( "unable to create phase %s.. there is something seriously wrong with your installation" % str(targetPhase) )
def __init__(self, localDownloadQueue = "PendingDownloadQueue"): Base.__init__(self) self.download_queue = localDownloadQueue self.ftp_sync = FileSyncer() self.move_file_into_processing() Extractor(self.local_directory_to_sync) Cleaner(self.local_directory_to_sync)
def __init__(self, core, manager, user=None): Base.__init__(self, core, user) #: Callback of periodical job task, used by addonManager self.cb = None #: `AddonManager` self.manager = manager #register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): for f in funcs: self.evm.listenTo(event, getattr(self, f)) else: self.evm.listenTo(event, getattr(self, funcs)) #delete for various reasons self.event_map = None self.init() # start periodically if set self.startPeriodical(self.interval, 0)
def createSimpleTaskObject(self, taskTypeValue, title, propertyMap={}, parentTypeValue = None ): """ adds a custom task to a phase in the release :param phaseId: id of the phase :param taskTypeValue: type of task to add :param title: title of the task :param propertyMap: properties to add to the task :return: """ if parentTypeValue == None: taskType = Type.valueOf(str(taskTypeValue)) Task = taskType.descriptor.newInstance("nonamerequired") Task.setTitle(title) for item in propertyMap: if Task.hasProperty(item): type = Task.getType() desc = type.getDescriptor() pd = desc.getPropertyDescriptor(item) if str(pd.getKind()) == "CI": Task.setProperty(item, self.find_ci_id(str(item), pd.getReferencedType())) else: Task.setProperty(item, propertyMap[item]) else: Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue)) return Task else: # print propertyMap parenttaskType = Type.valueOf(str(parentTypeValue)) parentTask = parenttaskType.descriptor.newInstance("nonamerequired") parentTask.setTitle(title) childTaskType = Type.valueOf(taskTypeValue) childTask = childTaskType.descriptor.newInstance("nonamerequired") for item in propertyMap: if childTask.hasProperty(item): type = childTask.getType() desc = type.getDescriptor() pd = desc.getPropertyDescriptor(item) if str(pd.getKind()) == "CI": childTask.setProperty(item, self.find_ci_id(str(item), pd.getReferencedType())) else: childTask.setProperty(item, propertyMap[item]) else: Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue)) parentTask.setPythonScript(childTask) return parentTask
def __init__(self, manager, loginname, password, options): Base.__init__(self, manager.core) if "activated" in options: activated = from_string(options["activated"], "bool") else: activated = Account.activated for opt in self.known_opt: if opt not in options: options[opt] = "" for opt in options.keys(): if opt not in self.known_opt: del options[opt] # default account attributes AccountInfo.__init__(self, self.__name__, loginname, Account.valid, Account.validuntil, Account.trafficleft, Account.maxtraffic, Account.premium, activated, options) self.manager = manager self.lock = RLock() self.timestamp = 0 self.login_ts = 0 # timestamp for login self.cj = CookieJar(self.__name__) self.password = password self.error = None self.init()
def resolve_settings(self, inputDict, inputSettings): ''' scan the inputDict for variable markers and look for resolution in the settings section of the template :param inputDict: Dictionary to scan :param inputSettings: settings that pertain to this input dictionary :return: dictionary with resolution information ''' vars_list = [] resolve_dict = {} output_dict = {} if inputSettings != None: # find all the variables in the target dictionary for k, v in inputDict.items(): if isinstance(v, unicode) or isinstance(v, str): x = self.find_all_variables(str(v)) if x: vars_list = vars_list + list(set(x) - set(vars_list)) # loop over the list with found variables for v in vars_list: # check if we can find a resolution in the settings for this app if inputSettings.has_key(v): # if we find a list in settings for this variable concatenate and dump if type(inputSettings[v]) is list: resolve_dict[v] = ",".join(inputSettings[v]) else: resolve_dict[v] = inputSettings[v] # loop over the resolve_dict and check it for stuff that could trigger a more specific set of variables if inputSettings.has_key('specific_settings'): specific_dict = inputSettings['specific_settings'] for k, v in resolve_dict.items(): if specific_dict.has_key(k): if specific_dict[k].has_key(v): resolve_dict.update(specific_dict[k][v]) # do one last loop over the dictionaries non list/dict objects and replace the placeholders/variables with te result for k, v in inputDict.items(): if isinstance(v, unicode) or isinstance(v, str): # loop over the keys of the resolve dict for s in resolve_dict.keys(): ps = self.__variable_start_string + str(s) + self.__variable_end_string v = v.replace(ps, resolve_dict[s]) output_dict[k] = v for k, v in output_dict.items(): Base.info("Key: %s resolved to: %s" % (k, v)) return output_dict else: return inputDict
def replace_xlr_variable_in_string(self, input_string, release_id): xlr_variables = self.get_release_variables(release_id) pprint.pprint(xlr_variables) for x, y in xlr_variables.items(): if x in input_string and y != "": Base.info("replacing variable %s with value %s" % (x, y)) input_string = input_string.replace(x, y) return input_string
def __init__(self,pgString="",f=""): Base.__init__(self) self.pgString=pgString if os.path.exists(f): os.remove(f) self.f=open(f,'w') self.osmids={} #self.__connect() #self.logger.info("creating new file") pass
def handle_template(self, releaseId): if self.template_plan() == None: Base.fatal("no template plan found.. we can't continue") if self.variables() != None: self.handle_variables(releaseId) if self.settings() != None: self.set_settings_from_dict(self.resolve_xlr_template_variables_in_settings(self.settings(), releaseId)) if self.template_plan(): self.handle_template_plan(releaseId)
def __init__(self): Base.__init__(self) self.listing_data_object_path = os.path.join( self.data_object_path, 'category_list.p') self.category_done_list_object_path = os.path.join( self.data_path, 'category_done_list.p') self.category_list = {} self.category_done_list = [] self.categories = CATEGORIES
def resolve_variables(self): for key, val in self.variables(): if type(val) == dict: solution = self.resolve_variable(val) if solution == None: Base.fatal("value for %s could not be found using the specified collector" % key) sys.exit(2) else: Base.info("retrieved value: %s for %s" % (solution, key)) self.set_variable(key, solution)
def find_template_id_by_name(self, name): sp = SearchParameters() sp.setType(Type.valueOf(str('xlrelease.Release'))) for p in XLReleaseServiceHolder.getRepositoryService().listEntities(sp): if p.isTemplate() == True: if str(p.getTitle()) == str(name): Base.info("Found id: %s for name %s" % (str(p.getId()), name)) return str(p.getId()) return None
def load_profile(profile): """ returns a dict .. if input is json it will return ad dict .. if dict it will return the dict :param profile: :return: """ if type(profile) is dict: return profile else: Base.info("loading profile from json") return json.loads(profile.replace("\n", "").replace("\t", "").replace("\r", ""))
def load_ci_from_repo(storeName, type): sp = SearchParameters() sp.setType(Type.valueOf(type)) for p in __repositoryService.listEntities(sp): print p.getId() if str(p.getTitle()) == storeName: return p Base.fatal("unable to find json data repository: %s" % storeName) sys.exit(2)
def __init__(self, pyfile): Base.__init__(self, pyfile.m.core) self.wantReconnect = False #: enables simultaneous processing of multiple downloads self.limitDL = 0 #: chunk limit self.chunkLimit = 1 #: enables resume (will be ignored if server dont accept chunks) self.resumeDownload = False #: plugin is waiting self.waiting = False self.ocr = None #captcha reader instance #: account handler instance, see :py:class:`Account` self.account = self.core.accountManager.getAccountForPlugin(self.__name__) #: premium status self.premium = False #: username/login self.user = None if self.account and not self.account.isUsable(): self.account = None if self.account: self.user = self.account.loginname #: Browser instance, see `network.Browser` self.req = self.account.getAccountRequest() # Default: -1, True, True self.chunkLimit, self.limitDL, self.resumeDownload = self.account.getDownloadSettings() self.premium = self.account.isPremium() else: self.req = self.core.requestFactory.getRequest(klass=self.REQUEST_CLASS) #: Will hold the download class self.dl = None #: associated pyfile instance, see `PyFile` self.pyfile = pyfile self.thread = None # holds thread in future #: location where the last call to download was saved self.lastDownload = "" #: re match of the last call to `checkDownload` self.lastCheck = None #: js engine, see `JsEngine` self.js = self.core.js self.retries = 0 # amount of retries already made self.html = None # some plugins store html code here self.init()
def __init__(self, verbose=False, cache=False, loops=False): Base.__init__(self) self.warn = [] self.verbose = verbose self.cache = cache self.loops = loops # list of package names self.nodes = [] # adjacency list self.edges = {} # {..., 'subpackage': 'package', ...} # subpackage \in package relationship self.pkg_devel_main_pkg = {}
def get_target_phase(targetPhase): """ search the release for the targetPhase by string name for some stupid reason we can't address it by its name .. :param targetPhase:string :return:phaseId """ phaseList = phaseApi.searchPhasesByTitle(targetPhase, release.id) if len(phaseList) == 1: return phaseList[0] else: Base.fatal("Requested phase: %s not found. Create it in the template first" % targetPhase)
def __init__(self, core, manager, user=None): Base.__init__(self, core, user) #: Callback of periodical job task, used by addonManager self.cb = None #: `AddonManager` self.manager = manager self.init() # start periodically if set self.startPeriodical(self.interval, 0)
def __init__(self,XAPIurl="",bbox="",maxSize=1): Base.__init__(self) self.url=XAPIurl self.bbox=bbox self.maxSize=float(maxSize) self.requests=[] if len(bbox)>0: self.bboxes=self.__getBBoxes() for bboxParam in self.bboxes: self.requests.append("%s*[addr:housenumber]%s" % (self.url,bboxParam)) else: bboxParam="" self.requests.append("%s*[addr:housenumber]%s" % (self.url,bboxParam)) pass
def get_path(self, json, path): """ traverses the dictionary derived from the json to look if it can satisfy the requested path :param json: :param path: :return: """ if (type(path) is str) or (type(path) is unicode): path = str(path).split('/') field = path.pop(0) try: if json.has_key(field): if type(json[field]) == dict: return self.get_path(json[field], path) elif type(json[field]) == list: if len(json[field]) < 2: Base.info("found %s" % (json[field][0])) return str(json[field][0]) elif len(path) == 0: Base.info("found %s using path %s" % (field, path)) return str(json[field]) else: Base.warning("the requested path of %s could not be found in the json document. returning None instead") return None except Exception: Base.error("Error encountered during resolution")
class Awesomeness: def __init__(self, pick_id=0, place_id=1): self.pick_object = trackObject(pick_id) self.place_object = trackObject(place_id) #self.pap = PickAndPlace() self.pick_success = True #self.arm = Arm('l_arm') self.table_point = PointStamped() self.table_point.header.frame_id = 0 self.table_point.point.x = 0.475179451085 self.table_point.point.y = 0.283060568718 self.table_point.point.z = -0.407675985492 self.placer = Place() self.head = Head() self.base = Base() def run(self): self.pick_up() self.place() def pick_up(self): self.pick_success = False self.pick_success = self.placer.pick_up() return self.pick_success def papmpick_up(self): self.pick_success = False point = self.pick_object.get_point() #self.pick_success = self.pap.pick_up_object_near_point(self.table_point) self.pick_success = self.pap.pick_up_object_near_point(point) def place(self): self.place_success = False return self.placer.place_can() def papmplace(self): if self.pick_success: #square of size 10 cm by 10 cm place_rect_dims = [.1, .1] place_rect_center = self.place_object.get_pose() self.pap.place_object(place_rect_dims, place_rect_center) def drop(self): self.pap.papm.open_gripper(1) # 1 is for left arm def rotate(self, amount): self.base.rotateBase(amount)
def create_instance(c_instance): """ Creates and returns the Base script """ return Base(c_instance)
def __init__(self, domain): self.domain = domain self.ip_history_record = [] Base.__init__(self) self.get_data()
def main(): previous = [] clock = pygame.time.Clock() score = 0 pipes = [Pipe(600)] inputs = np.array([ 0, pipes[-1].x - pipes[-1].PIPE_TOP.get_width(), pipes[-1].top + pipes[-1].PIPE_TOP.get_height(), pipes[-1].bottom, ]) population = Population(inputs) birds = population.members[:] base = Base(730) win = pygame.display.set_mode((500, 800)) run = True while run: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if len(birds) == 0: population.previous = previous[:] previous = [] pipes = [Pipe(600)] inputs = np.array([ 0, pipes[-1].x - pipes[-1].PIPE_TOP.get_width(), pipes[-1].top + pipes[-1].PIPE_TOP.get_height(), pipes[-1].bottom, ]) population.reseed(inputs) birds = population.members[:] base = Base(730) population.generation += 1 score = 0 rem_birds = [] for bird in birds: closest_pipe = min(pipes, key=lambda pipe: abs(pipe.x - bird.x)) # closest_pipe = pipes[-1] inputs = np.array([ bird.y - (closest_pipe.top + closest_pipe.PIPE_TOP.get_height() + closest_pipe.bottom)/2, closest_pipe.x - bird.x, closest_pipe.top + closest_pipe.PIPE_TOP.get_height(), closest_pipe.bottom, ]) # print(inputs) bird.nn.X = inputs bird.move() if bird.y + bird.img.get_height() > 730 or bird.y + bird.img.get_height() < 0: bird.alive -= 10 rem_birds.append(bird) base.move() add_pipe = False rem_pipes = [] for pipe in pipes: for bird in birds: if pipe.collide(bird): rem_birds.append(bird) if not pipe.passed and pipe.x < bird.x: # if bird.x > pipe.x + pipe.PIPE_BOTTOM.get_width(): # bird.alive += 100 bird.pipes_passed += 1 pipe.passed = True add_pipe = True if pipe.x + pipe.PIPE_TOP.get_width() < 0: rem_pipes.append(pipe) pipe.move() if add_pipe: score += 1 pipes.append(Pipe(600)) for r in rem_pipes: pipes.remove(r) for r in rem_birds: try: previous.append(r) birds.remove(r) except: pass draw_window(win, base, birds, pipes, score, population.generation) pygame.quit() quit()
for i in range(len(enemys), Constants.ENEMYS_NUM): enemys.append( Enemy(enemy_points[random.randint(0, len(enemy_points) - 1)])) return enemys video_capture = cv2.VideoCapture(0) ret, average_frame = video_capture.read() average_frame = cv2.cvtColor(average_frame, cv2.COLOR_BGR2GRAY) moving_provider = MovingProvider(average_frame) HEIGTH, WIDTH = average_frame.shape CENTER = Vector(WIDTH // 2, HEIGTH // 2) base = Base(CENTER, CENTER, WIDTH // 2, HEIGTH // 2) enemy_points = [ Vector(0, 0), Vector(0, HEIGTH), Vector(WIDTH, 0), Vector(WIDTH, HEIGTH) ] enemys = [] for i in range(Constants.ENEMYS_NUM): enemys.append(Enemy(enemy_points[random.randint(0, len(enemy_points) - 1)])) while True: # Capture frame-by-frame ret, frame = video_capture.read()
def addBase(self): b = Base(self.map.pickEmpty()) self.bases.append(b) self.map[b.coordinate] = b
def __init__(self): Base.__init__(self)
def main(genomes, config): global GEN GEN += 1 nets = [] ge = [] birds = [] for _, genome in genomes: genome.fitness = 0 net = neat.nn.FeedForwardNetwork.create(genome, config) nets.append(net) birds.append(Bird(230, 350)) ge.append(genome) base = Base(730) pipes = [Pipe(700)] score = 0 win = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT)) run = True clock = pygame.time.Clock() while run and len(birds) > 0: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False pygame.quit() quit() break pipe_ind = 0 if len(birds) > 0: if len(pipes) > 1 and birds[ 0].x > pipes[0].x + pipes[0].PIPE_TOP.get_width(): pipe_ind = 1 for x, bird in enumerate(birds): ge[x].fitness += 0.1 bird.move() output = nets[birds.index(bird)].activate( (bird.y, abs(bird.y - pipes[pipe_ind].height), abs(bird.y - pipes[pipe_ind].bottom))) if output[0] > 0.5: bird.jump() base.move() rem = [] add_pipe = False for pipe in pipes: pipe.move() for bird in birds: if pipe.collide(bird): ge[birds.index(bird)].fitness -= 1 nets.pop(birds.index(bird)) ge.pop(birds.index(bird)) birds.pop(birds.index(bird)) if pipe.x + pipe.PIPE_TOP.get_width() < 0: rem.append(pipe) if not pipe.passed and pipe.x < bird.x: pipe.passed = True add_pipe = True if add_pipe: score += 1 for genome in ge: genome.fitness += 5 pipes.append(Pipe(WIN_WIDTH)) for r in rem: pipes.remove(r) for bird in birds: if bird.y + bird.img.get_height() - 10 >= 730 or bird.y < -50: nets.pop(birds.index(bird)) ge.pop(birds.index(bird)) birds.pop(birds.index(bird)) draw_win(win, birds, pipes, base, score, GEN, pipe_ind)
def __init__(self, domain): self.domain = domain Base.__init__(self)
def test_percentage_growth(self): self.assertEqual(Base.percentage_growth([1, 2, 3, 4]), [100., 50., 33.33333333333333])
def __init__(self, domain): self.domain = domain self.return_data = {} Base.__init__(self) self.get_data_from_mongo()
def __init__(self, # possible atom types atomLAMMPSRealFull=None, atomGeometrical=None, atomPhysical=None, # physical variables atomNumber=None, atomX=None, atomY=None, atomZ=None, atomVx=None, atomVy=None, atomVz=None, atomMolecule=None, atomMass=None, atomType=None, atomCharge=None, atomFlagOne=None, atomFlagTwo=None, atomFlagThree=None, # drawn variables drawnRadius=None, atomOffsetX = None, atomOffsetY = None, atomOffsetZ = None, selectionState=None, # atomState = active/passive # (is it selected or not) paintingVisibility=None): Base.__init__(self) self.__setProperties = dict() if atomLAMMPSRealFull is not None: atomProp = atomLAMMPSRealFull.getProperty self.updateProperty('atomX', atomProp('atomX')) self.updateProperty('atomY', atomProp('atomY')) self.updateProperty('atomZ', atomProp('atomZ')) self.updateProperty('atomNumber', atomProp('atomNumber')) if atomProp('atomMolecule') is not None: self.updateProperty('atomMolecule', atomProp('atomMolecule')) if atomProp('atomCharge') is not None: self.updateProperty('atomCharge', atomProp('atomCharge')) if atomProp('atomType') is not None: self.updateProperty('atomType', atomProp('atomType')) if atomProp('atomVx') is not None: self.updateProperty('atomVx', atomProp('atomVx')) if atomProp('atomVy') is not None: self.updateProperty('atomVy', atomProp('atomVy')) if atomProp('atomVz') is not None: self.updateProperty('atomVz', atomProp('atomVz')) if atomProp('atomFlagOne') is not None: self.updateProperty('atomFlagOne', atomProp('atomFlagOne')) if atomProp('atomFlagTwo') is not None: self.updateProperty('atomFlagTwo', atomProp('atomFlagTwo')) if atomProp('atomFlagThree') is not None: self.updateProperty('atomFlagThree', atomProp('atomFlagThree')) else: print('ERROR, DrawnAtom.__init__():', 'this atom type is not supported') if atomNumber is not None: self.updateProperty('atomNumber', atomNumber) if atomMolecule is not None: self.updateProperty('atomMolecule', atomMolecule) if atomMass is not None: self.updateProperty('atomMass', atomMass) if atomType is not None: self.updateProperty('atomType', atomType) if atomCharge is not None: self.updateProperty('atomCharge', atomCharge) if selectionState is not None: self.updateProperty('selectionState', atomState) if atomVx is not None: self.updateProperty('atomVx', atomVx) if atomVy is not None: self.updateProperty('atomVy', atomVy) if atomVz is not None: self.updateProperty('atomVz', atomVz) if atomFlagOne is not None: self.updateProperty('atomFlagOne', atomFlagOne) if atomFlagOne is not None: self.updateProperty('atomFlagTwo', atomFlagTwo) if atomFlagOne is not None: self.updateProperty('atomFlagThree', atomFlagThree)
def __init__(self, sources): Base.__init__(self) self.sources = sources self.files = {}