How to use save_config method in ATX

Best Python code snippet using ATX

Configure.py

Source:Configure.py Github

copy

Full Screen

...149 config.set_wire(args.wire)150 save_config = True151 # If any of the configuration values changed, save the configuration.152 if save_config:153 config.save_config()154 except Exception as ex:155 print("Error processing arguments: {}".format(ex))156 sys.exit(1)157 if GUI and args.gui_config:158 try:159 root = tk.Tk()160 root.overrideredirect(1)161 root.withdraw()162 menu = tk.Menu()163 root.config(menu=menu)164 fileMenu = tk.Menu(menu)165 menu.add_cascade(label='File', menu=fileMenu)166 fileMenu.add_command(label='Preferences...', command=_doFilePreferences)167 fileMenu.add_separator()...

Full Screen

Full Screen

bot_settings.py

Source:bot_settings.py Github

copy

Full Screen

...7 return self.config.get("bot", {}).get("token")8 @bot_token.setter9 def bot_token(self, value):10 self.config["bot"]["token"] = value11 self.save_config()12 @property13 def group_chat_name(self):14 return self.config.get("bot", {}).get("group_chat_name")15 @group_chat_name.setter16 def group_chat_name(self, value):17 self.config["bot"]["group_chat_name"] = value18 self.save_config()19 @property20 def group_chat_id(self):21 return self.config.get("bot", {}).get("approved_chat")22 @group_chat_id.setter23 def group_chat_id(self, value):24 self.config["bot"]["approved_chat"] = value25 self.save_config()26 @property27 def paused(self):28 return self.config.get("bot", {}).get("paused")29 @paused.setter30 def paused(self, value):31 self.config["bot"]["paused"] = value32 self.save_config()33 @property34 def connection_problems(self):35 return self.config.get("bot", {}).get("connection_problems")36 @connection_problems.setter37 def connection_problems(self, value):38 self.config["bot"]["connection_problems"] = value39 self.save_config()40 @property41 def updates_path(self):42 return self.config.get("bot", {}).get("updates-path")43 @property44 def users_path(self):45 return self.config.get("bot", {}).get("users-path")46 @property47 def send_document_path(self):48 return self.config.get("bot", {}).get("send-document-path")49 @property50 def send_message_path(self):51 return self.config.get("bot", {}).get("send-message-path")52 @property53 def get_file_path(self):54 return self.config.get("bot", {}).get("get-file-path")55 @property56 def download_file_path(self):57 return self.config.get("bot", {}).get("download-file-path")58 @property59 def answer_unknown(self):60 return self.config.get("bot", {}).get("answer-unknown")61 @property62 def answer_forbidden(self):63 return self.config.get("bot", {}).get("answer-forbidden")64 @property65 def passphrases(self):66 return [self.admin_passphrase, self.field_passphrase, self.kc_passphrase]67 @property68 def admin_passphrase(self):69 raw = self.config.get("bot", {}).get("admin_passphrase")70 return base64.decodestring(raw)71 @property72 def field_passphrase(self):73 raw = self.config.get("bot", {}).get("field_passphrase")74 return base64.decodestring(raw)75 @property76 def kc_passphrase(self):77 raw = self.config.get("bot", {}).get("kc_passphrase")78 return base64.decodestring(raw)79 @admin_passphrase.setter80 def admin_passphrase(self, passphrase):81 self.config["bot"]["admin_passphrase"] = base64.encodestring(passphrase)82 self.save_config()83 @field_passphrase.setter84 def field_passphrase(self, passphrase):85 self.config["bot"]["field_passphrase"] = base64.encodestring(passphrase)86 self.save_config()87 @kc_passphrase.setter88 def kc_passphrase(self, passphrase):89 self.config["bot"]["kc_passphrase"] = base64.encodestring(passphrase)90 self.save_config()91 @property92 def admin_ids(self):93 raw = self.config.get("bot", {}).get("obfuscation_id")94 if raw is None:95 return []96 decoded = base64.decodestring(raw)97 admins = msgpack.loads(decoded)98 return admins99 @admin_ids.setter100 def admin_ids(self, ids):101 self.config["bot"]["obfuscation_id"] = ids102 self.save_config()103 def add_admin_id(self, admin_id):104 admin_ids = self.admin_ids + [admin_id]105 encoded = msgpack.dumps(admin_ids)106 self.admin_ids = base64.encodestring(encoded)107 self.save_config()108 def delete_admin_id(self, admin_id):109 admin_ids = self.admin_ids[:]110 admin_ids.remove(admin_id)111 encoded = msgpack.dumps(admin_ids)112 self.admin_ids = base64.encodestring(encoded)113 self.save_config()114 def clean_admins(self):115 encoded = msgpack.dumps([])116 self.admin_ids = base64.encodestring(encoded)117 self.save_config()118 def clean_fields(self):119 encoded = msgpack.dumps([])120 self.field_ids = base64.encodestring(encoded)121 self.save_config()122 def clean_kcs(self):123 encoded = msgpack.dumps([])124 self.kc_ids = base64.encodestring(encoded)125 self.save_config()126 @property127 def field_ids(self):128 raw = self.config.get("bot", {}).get("field_ids")129 if raw is None:130 return []131 decoded = base64.decodestring(raw)132 fields = msgpack.loads(decoded)133 return fields134 @field_ids.setter135 def field_ids(self, ids):136 self.config["bot"]["field_ids"] = ids137 self.save_config()138 def add_field_id(self, field_id):139 field_ids = self.field_ids + [field_id]140 encoded = msgpack.dumps(field_ids)141 self.field_ids = base64.encodestring(encoded)142 self.save_config()143 def delete_field_id(self, field_id):144 field_ids = self.field_ids[:]145 field_ids.remove(field_id)146 encoded = msgpack.dumps(field_ids)147 self.field_ids = base64.encodestring(encoded)148 self.save_config()149 @property150 def kc_ids(self):151 raw = self.config.get("bot", {}).get("kc_ids")152 if raw is None:153 return []154 decoded = base64.decodestring(raw)155 kcs = msgpack.loads(decoded)156 return kcs157 @kc_ids.setter158 def kc_ids(self, ids):159 self.config["bot"]["kc_ids"] = ids160 self.save_config()161 def add_kc_id(self, kc_id):162 kc_ids = self.kc_ids + [kc_id]163 encoded = msgpack.dumps(kc_ids)164 self.kc_ids = base64.encodestring(encoded)165 self.save_config()166 def delete_kc_id(self, kc_id):167 kc_ids = self.kc_ids[:]168 kc_ids.remove(kc_id)169 encoded = msgpack.dumps(kc_ids)170 self.kc_ids = base64.encodestring(encoded)171 self.save_config()172 def is_user(self, from_id):173 return from_id in self.admin_ids + self.field_ids + self.kc_ids174 def is_admin(self, from_id):175 return from_id in self.admin_ids176 def is_field(self, from_id):177 return from_id in self.field_ids178 def is_kc(self, from_id):...

Full Screen

Full Screen

deploy.py

Source:deploy.py Github

copy

Full Screen

1#!/usr/bin/env python2.72# Copyright (C) 2014-2015 Job Snijders <job@instituut.net>3#4# This file is part of ACLHound5#6# Redistribution and use in source and binary forms, with or without7# modification, are permitted provided that the following conditions are met:8#9# 1. Redistributions of source code must retain the above copyright notice,10# this list of conditions and the following disclaimer.11#12# 2. Redistributions in binary form must reproduce the above copyright notice,13# this list of conditions and the following disclaimer in the documentation14# and/or other materials provided with the distribution.15#16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE26# POSSIBILITY OF SUCH DAMAGE.27import sys28from targets import deploy_arista29from targets import deploy_asa30from targets import deploy_ios31from targets import deploy_junos32class Deploy():33 def __init__(self,34 hostname=None,35 acls=[],36 vendor=None,37 transport='ssh',38 save_config=False,39 timeout=60):40 self.hostname = hostname41 self.acls = acls42 self.vendor = vendor43 self.transport = transport44 self.save_config = save_config45 self.timeout = timeout46 def deploy(self):47 if not self.vendor:48 sys.exit(2)49 return getattr(self, 'deploy_' + self.vendor)()50 def deploy_arista(self):51 return deploy_arista.deploy(hostname=self.hostname,52 acls=self.acls,53 transport=self.transport,54 save_config=self.save_config,55 timeout=self.timeout)56 def deploy_ios(self):57 return deploy_ios.deploy(hostname=self.hostname,58 acls=self.acls,59 transport=self.transport,60 save_config=self.save_config,61 timeout=self.timeout)62 def deploy_junos(self):63 return deploy_junos.deploy(hostname=self.hostname,64 acls=self.acls,65 transport=self.transport,66 save_config=self.save_config,67 timeout=self.timeout)68 def deploy_asa(self):69 return deploy_asa.deploy(hostname=self.hostname,70 acls=self.acls,71 transport=self.transport,72 save_config=self.save_config)73# TODO add juniper support74# def deploy_junos(self, **kwargs):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful