def __init__(self, sender_id=None, status=None, name=None, email=None, local_vars_configuration=None): # noqa: E501 """EmailSender - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._sender_id = None self._status = None self._name = None self._email = None self.discriminator = None self.sender_id = sender_id if status is not None: self.status = status self.name = name self.email = email
def __init__(self, sender_id=None, status=None, phone=None, file=None, local_vars_configuration=None): # noqa: E501 """PhoneSender - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._sender_id = None self._status = None self._phone = None self._file = None self.discriminator = None self.sender_id = sender_id if status is not None: self.status = status self.phone = phone self.file = file
def __init__(self, message=None, sender=None, message_type=None, local_vars_configuration=None): # noqa: E501 """PhoneCampaignTemplateAllOf - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._message = None self._sender = None self._message_type = None self.discriminator = None if message is not None: self.message = message if sender is not None: self.sender = sender if message_type is not None: self.message_type = message_type
def __init__(self, date=None, action_name=None, action_data=None, local_vars_configuration=None): # noqa: E501 """ContactActivityClick - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._date = None self._action_name = None self._action_data = None self.discriminator = None if date is not None: self.date = date if action_name is not None: self.action_name = action_name if action_data is not None: self.action_data = action_data
def __init__(self, segment_id=None, name=None, type=None, local_vars_configuration=None): # noqa: E501 """AutomaticSegment - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._segment_id = None self._name = None self._type = None self.discriminator = None if segment_id is not None: self.segment_id = segment_id if name is not None: self.name = name if type is not None: self.type = type
def __init__(self, site_id=None, list_id=None, app_code=None, local_vars_configuration=None): # noqa: E501 """WebPushSite - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._site_id = None self._list_id = None self._app_code = None self.discriminator = None if site_id is not None: self.site_id = site_id if list_id is not None: self.list_id = list_id if app_code is not None: self.app_code = app_code
def __init__(self, type=None, audio=None, template_id=None, local_vars_configuration=None): # noqa: E501 """ContentVoice - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._audio = None self._template_id = None self.discriminator = 'type' if type is not None: self.type = type if audio is not None: self.audio = audio if template_id is not None: self.template_id = template_id
def __run_glexec(self): """Start the sandboxed process for the job. See usage examples in: http://wiki.nikhef.nl/grid/GLExec_Environment_Wrap_and_Unwrap_scripts """ pUtil.tolog('correcting env vars before running glexec!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') # Store actual workdir in order to restore it later on env = Configuration.Configuration() self.__actual_workdir = env['workdir'] env['workdir'] = self.sandbox_path + '/output' if not os.path.exists(env['workdir']): os.makedirs(env['workdir']) os.chmod(env['workdir'],0777) env['thisSite'].wntmpdir = env['workdir'] env['PilotHomeDir'] = self.sandbox_path env['inputDir'] = self.sandbox_path env['outputDir'] = self.sandbox_path env['pilot_initdir'] = self.sandbox_path pUtil.tolog('Pilot home dir is %s '%env['PilotHomeDir']) self.__site_workdir = re.split('Panda_Pilot',env['thisSite'].workdir) env['thisSite'].workdir = env['workdir'] + '/Panda_Pilot' + self.__site_workdir[1] env['job'].datadir = env['thisSite'].workdir + '/PandaJob_' + env['job'].jobId + '_data' if not os.path.exists(env['thisSite'].workdir): os.makedirs(env['thisSite'].workdir) os.chmod(env['thisSite'].workdir,0777) self.__dump_current_configuration() pUtil.tolog('dumping debug info') debug_cmd = "ls -ld `pwd`; ls -ld %s ; ls -la %s/glexec*; ls -ld %s" %(self.__target_path, self.__target_path, env['thisSite'].workdir) self.output, self.error, self.status = execute(debug_cmd) pUtil.tolog(self.output) pUtil.tolog("cding and running GLEXEC!") cmd = "export GLEXEC_ENV=`%s`; \ %s %s -- 'cd %s; \ %s 2>&1;'" % (self.__wrapper_path, self.__glexec_path, self.__unwrapper_path, self.__target_path, self.payload) self.output, self.error, self.status = execute(cmd) pUtil.tolog(self.error) pUtil.tolog(self.output)
def main(): # Parse arguments. from optparse import OptionParser usageString = "usage: %prog [options] webidldir [files]" o = OptionParser(usage=usageString) o.add_option("--cachedir", dest='cachedir', default=None, help="Directory in which to cache lex/parse tables.") o.add_option("--verbose-errors", action='store_true', default=False, help="When an error happens, display the Python traceback.") (options, args) = o.parse_args() if len(args) < 2: o.error(usageString) configFile = args[0] baseDir = args[1] fileList = args[2:] # Parse the WebIDL. parser = WebIDL.Parser(options.cachedir) for filename in fileList: fullPath = os.path.normpath(os.path.join(baseDir, filename)) f = open(fullPath, 'rb') lines = f.readlines() f.close() parser.parse(''.join(lines), fullPath) parserResults = parser.finish() # Write the parser results out to a pickle. resultsFile = open('ParserResults.pkl', 'wb') cPickle.dump(parserResults, resultsFile, -1) resultsFile.close() # Load the configuration. config = Configuration(configFile, parserResults) # Generate the prototype list. generate_file(config, 'PrototypeList', 'declare+define') # Generate the common code. generate_file(config, 'RegisterBindings', 'declare+define')
def __init__(self, field_id=None, name=None, format=None, unique=None, local_vars_configuration=None): # noqa: E501 """Field - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._field_id = None self._name = None self._format = None self._unique = None self.discriminator = None if field_id is not None: self.field_id = field_id self.name = name self.format = format if unique is not None: self.unique = unique
def __init__(self, app_id=None, segments=None, notify=None, schedule_date=None, local_vars_configuration=None): # noqa: E501 """CampaignPushSendRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._app_id = None self._segments = None self._notify = None self._schedule_date = None self.discriminator = None self.app_id = app_id self.segments = segments if notify is not None: self.notify = notify if schedule_date is not None: self.schedule_date = schedule_date
def __init__(self, internal_name=None, campaign_hash=None, send_date=None, group=None, sender=None, local_vars_configuration=None): # noqa: E501 """SmsEventsCampaignFields - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._internal_name = None self._campaign_hash = None self._send_date = None self._group = None self._sender = None self.discriminator = None self.internal_name = internal_name self.campaign_hash = campaign_hash self.send_date = send_date self.group = group self.sender = sender
def predict(image_name): config_path = "./config/config.ini" configuration = Configuration.Configuration(config_path) port = configuration.server_detail['port'] ip = configuration.server_detail['ip'] # Make socket transport = TSocket.TSocket(ip, port) # Buffering is critical. Raw sockets are very slow transport = TTransport.TBufferedTransport(transport) # Wrap in a protocol protocol = TBinaryProtocol.TBinaryProtocol(transport) client = OccupationService.Client(protocol) transport.open() req = Req() base64_str = image_to_base64(image_name) req.base64_img = base64_str response = client.predict(req) return [response.occupation]
def __init__(self, type=None, file=None, plain_text=None, snippet=None, local_vars_configuration=None): # noqa: E501 """CampaignEmailContentFile - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._file = None self._plain_text = None self._snippet = None self.discriminator = None self.type = type self.file = file if plain_text is not None: self.plain_text = plain_text if snippet is not None: self.snippet = snippet
def __init__(self, sent=None, opens=None, clicks=None, soft_bounces=None, hard_bounces=None, forwards=None, conversions=None, social_actions=None, last_send_date=None, last_open_date=None, last_click_date=None, last_open_country=None, last_open_region=None, last_open_city=None, local_vars_configuration=None): # noqa: E501 """ComplexContactAllOfEmailStats - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._sent = None self._opens = None self._clicks = None self._soft_bounces = None self._hard_bounces = None self._forwards = None self._conversions = None self._social_actions = None self._last_send_date = None self._last_open_date = None self._last_click_date = None self._last_open_country = None self._last_open_region = None self._last_open_city = None self.discriminator = None if sent is not None: self.sent = sent if opens is not None: self.opens = opens if clicks is not None: self.clicks = clicks if soft_bounces is not None: self.soft_bounces = soft_bounces if hard_bounces is not None: self.hard_bounces = hard_bounces if forwards is not None: self.forwards = forwards if conversions is not None: self.conversions = conversions if social_actions is not None: self.social_actions = social_actions self.last_send_date = last_send_date self.last_open_date = last_open_date self.last_click_date = last_click_date self.last_open_country = last_open_country self.last_open_region = last_open_region self.last_open_city = last_open_city
def run_portfolio(rangevalue, trade_infos, raw_parameter, name_to_change, port_start_time, port_end_time, print_result_local, output_file, config): i, value = rangevalue parameter = raw_parameter.change_property(name_to_change, value) config_local = Configuration.Configuration(config=config) if print_result_local: config_local.log[ 'tradef'] = fr"{sub_directory}\{output_file}({parameter}).csv" config_local.log[ 'capitalg'] = fr"{sub_directory}\{output_file}({parameter})Capital.png" else: config_local.log['tradef'] = None config_local.log['capitalg'] = None trades = signal_to_trades(trade_infos, parameter) portfolio = Portfolio(trades, config_local) result = portfolio.run(port_start_time, port_end_time) # print(f"finished {parameter}") return i, value, result
def signal_param_table(): output_file = fr"{sub_directory}\{filew2}{algo_name}.csv" config_local = Configuration.Configuration(config=config) if print_result: config_local.log['output file'] = output_file try: os.remove(output_file) except OSError: pass else: output_file = None returns = {v: {} for v in param_range} with futures.ProcessPoolExecutor(8) as pool: for i, value, result in pool.map( functools.partial(run_portfolio, trade_infos=trade_info, raw_parameter=hyper_parameter, name_to_change=param_name[0], port_start_time=start_time, port_end_time=end_time, print_result_local=print_result, output_file=filew, config=config), enumerate(param_range)): if returns[value] != {}: raise Exception("should not be here") returns[value] = result[0] if output_file is not None: with open(output_file, 'a', newline="") as csv_file: writer = csv.writer(csv_file) if i == 0: writer.writerow( (param_name, "total_return", "cash_return", "borrow_cost", "tran_cost", "trades")) writer.writerow((value, ) + result) print(f"{value:.2f}:{result[0]}") # plot plt.plot(list(returns.keys()), list(returns.values())) if print_result: plot_file = fr"{sub_directory}\{algo_name}.png" plt.savefig(plot_file) else: plt.show()
def init_first_time(self): '''Set up all kinds of information collecting and database building for CTC Screening ''' # Backup the old file. if os.path.exists( os.path.join(INFORMATION_FILE_DIR, 'database_info.csv')): shutil.move( os.path.join(INFORMATION_FILE_DIR, 'database_info.csv'), os.path.join(INFORMATION_FILE_DIR, 'database_info.csv.old')) self.set_up_from_volume_record() self.build_polyp_info() self.build_cross_validation_split_randomly() self.df.to_csv(os.path.join(INFORMATION_FILE_DIR, 'database_info.csv'), index=False) self.df.to_excel(os.path.join(INFORMATION_FILE_DIR, 'database_info.xls'), index=False) config = Configuration.Configuration() self.set_up_screen_database(config.polypdata_fold_url)
def __init__(self, format=None, callback_url=None, segments=None, fields=None, local_vars_configuration=None): # noqa: E501 """ContactExportRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._format = None self._callback_url = None self._segments = None self._fields = None self.discriminator = None self.format = format if callback_url is not None: self.callback_url = callback_url if segments is not None: self.segments = segments if fields is not None: self.fields = fields
def __init__(self, sender_id=None, status=None, type=None, cellphone=None, file=None, local_vars_configuration=None): # noqa: E501 """AlphanumericCellphoneSender - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._sender_id = None self._status = None self._type = None self._cellphone = None self._file = None self.discriminator = None self.sender_id = sender_id if status is not None: self.status = status self.type = type self.cellphone = cellphone self.file = file
def __init__(self, localSwapSpace, globalSwapSpace, topK=10, global_proposal=1.0): self.global_proposal = global_proposal #Global proposal probability self.localSwapSpace = localSwapSpace #Local Swap Space. Dict with keys being support feature name and respective label generators self.globalSwapSpace = globalSwapSpace #Local Swap Space. Dict with keys being support feature name and generators self.initConf = conf.Configuration(0, "Init") self.init_state = list(range(0, 10)) self.topK = topK self.PT_Inf = MCMC_Inference(self.init_state, self.initConf, self.global_proposal, self.localSwapSpace, self.globalSwapSpace, self.topK) self.PT_Inf.Tmax = 25000.0 # Max (starting) temperature self.PT_Inf.Tmin = 2.5 # Min (ending) temperature self.PT_Inf.steps = 10000 # Number of iterations self.PT_Inf.updates = 100 # Number of updates (by default an update prints to stdout) # since our state is just a list, slice is the fastest way to copy self.PT_Inf.copy_strategy = "slice"
def __init__(self, automation_id=None, action_id=None, success=None, error=None, local_vars_configuration=None): # noqa: E501 """StartAutomationResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._automation_id = None self._action_id = None self._success = None self._error = None self.discriminator = None if automation_id is not None: self.automation_id = automation_id if action_id is not None: self.action_id = action_id if success is not None: self.success = success if error is not None: self.error = error
def __init__(self, field_id=None, format=None, value=None, status=None, local_vars_configuration=None): # noqa: E501 """ContactExtraFieldPhone - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._field_id = None self._format = None self._value = None self._status = None self.discriminator = None if field_id is not None: self.field_id = field_id if format is not None: self.format = format if value is not None: self.value = value if status is not None: self.status = status
def __init__(self, name=None, website=None, cellphone=None, client_id=None, local_vars_configuration=None): # noqa: E501 """GeneralInfoAllOfGeneralInfo - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._name = None self._website = None self._cellphone = None self._client_id = None self.discriminator = None if name is not None: self.name = name if website is not None: self.website = website if cellphone is not None: self.cellphone = cellphone if client_id is not None: self.client_id = client_id
def __init__(self, list_id=None, destination_field=None, segments=None, notify=None, schedule_date=None, local_vars_configuration=None): # noqa: E501 """CampaignSmartSmsSendRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._list_id = None self._destination_field = None self._segments = None self._notify = None self._schedule_date = None self.discriminator = None self.list_id = list_id self.destination_field = destination_field self.segments = segments if notify is not None: self.notify = notify if schedule_date is not None: self.schedule_date = schedule_date
def __init__(self, internal_name=None, group_id=None, message=None, sender_id=None, local_vars_configuration=None): # noqa: E501 """VoicePatchCampaignAllOf - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._internal_name = None self._group_id = None self._message = None self._sender_id = None self.discriminator = None if internal_name is not None: self.internal_name = internal_name if group_id is not None: self.group_id = group_id if message is not None: self.message = message if sender_id is not None: self.sender_id = sender_id
def __init__(self, language=None, timezone=None, show_removed_contacts=True, gender=None, local_vars_configuration=None): # noqa: E501 """ComplexUserAllOf - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._language = None self._timezone = None self._show_removed_contacts = None self._gender = None self.discriminator = None if language is not None: self.language = language if timezone is not None: self.timezone = timezone if show_removed_contacts is not None: self.show_removed_contacts = show_removed_contacts if gender is not None: self.gender = gender
def __init__(self, list_id=None, internal_name=None, content=None, sender_id=None, options=None, local_vars_configuration=None): # noqa: E501 """SmsCampaign - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._list_id = None self._internal_name = None self._content = None self._sender_id = None self._options = None self.discriminator = None self.list_id = list_id self.internal_name = internal_name self.content = content if sender_id is not None: self.sender_id = sender_id if options is not None: self.options = options
def __init__(self, contact_id=None, unsubscription_method=None, unsubscription_reason=None, unsubscription_observation=None, local_vars_configuration=None): # noqa: E501 """RequestItemsUnsubscribe - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._contact_id = None self._unsubscription_method = None self._unsubscription_reason = None self._unsubscription_observation = None self.discriminator = None if contact_id is not None: self.contact_id = contact_id if unsubscription_method is not None: self.unsubscription_method = unsubscription_method if unsubscription_reason is not None: self.unsubscription_reason = unsubscription_reason if unsubscription_observation is not None: self.unsubscription_observation = unsubscription_observation
def __init__(self, type=None, title=None, status=None, detail=None, local_vars_configuration=None): # noqa: E501 """EnableTeConflict - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._type = None self._title = None self._status = None self._detail = None self.discriminator = None if type is not None: self.type = type if title is not None: self.title = title if status is not None: self.status = status if detail is not None: self.detail = detail