Python future.builtins.input() Examples
The following are 21
code examples of future.builtins.input().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
future.builtins
, or try the search function
.
Example #1
Source File: __main__.py From news-please with Apache License 2.0 | 6 votes |
def start_crawler(self, index, daemonize=False): """ Starts a crawler from the input-array. :param int index: The array-index of the site :param int daemonize: Bool if the crawler is supposed to be daemonized (to delete the JOBDIR) """ call_process = [sys.executable, self.__single_crawler, self.cfg_file_path, self.json_file_path, "%s" % index, "%s" % self.shall_resume, "%s" % daemonize] self.log.debug("Calling Process: %s", call_process) crawler = Popen(call_process, stderr=None, stdout=None) crawler.communicate() self.crawlers.append(crawler)
Example #2
Source File: scaffold.py From databench with MIT License | 6 votes |
def check_folders(name): """Only checks and asks questions. Nothing is written to disk.""" if os.getcwd().endswith('analyses'): correct = input('You are in an analyses folder. This will create ' 'another analyses folder inside this one. Do ' 'you want to continue? (y/N)') if correct != 'y': return False if not os.path.exists(os.path.join(os.getcwd(), 'analyses')): correct = input('This is the first analysis here. Do ' 'you want to continue? (y/N)') if correct != 'y': return False if os.path.exists(os.path.join(os.getcwd(), 'analyses', name)): correct = input('An analysis with this name exists already. Do ' 'you want to continue? (y/N)') if correct != 'y': return False return True
Example #3
Source File: request.py From blackmamba with MIT License | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #4
Source File: request.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #5
Source File: request.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #6
Source File: request.py From arissploit with GNU General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #7
Source File: request.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #8
Source File: __main__.py From news-please with Apache License 2.0 | 5 votes |
def reset_elasticsearch(self): """ Resets the Elasticsearch Database. """ print(""" Cleanup Elasticsearch database: This will truncate all tables and reset the whole Elasticsearch database. """) confirm = self.no_confirm if not confirm: confirm = 'yes' in builtins.input( """ Do you really want to do this? Write 'yes' to confirm: {yes}""" .format(yes='yes' if confirm else '')) if not confirm: print("Did not type yes. Thus aborting.") return try: # initialize DB connection es = Elasticsearch([self.elasticsearch["host"]], http_auth=(self.elasticsearch["username"], self.elasticsearch["secret"]), port=self.elasticsearch["port"], use_ssl=self.elasticsearch["use_ca_certificates"], verify_certs=self.elasticsearch["use_ca_certificates"], ca_certs=self.elasticsearch["ca_cert_path"], client_cert=self.elasticsearch["client_cert_path"], client_key=self.elasticsearch["client_key_path"]) print("Resetting Elasticsearch database...") es.indices.delete(index=self.elasticsearch["index_current"], ignore=[400, 404]) es.indices.delete(index=self.elasticsearch["index_archive"], ignore=[400, 404]) except ConnectionError as error: self.log.error("Failed to connect to Elasticsearch. " "Please check if the database is running and the config is correct: %s" % error)
Example #9
Source File: __main__.py From news-please with Apache License 2.0 | 5 votes |
def reset_mysql(self): """ Resets the MySQL database. """ confirm = self.no_confirm print(""" Cleanup MySQL database: This will truncate all tables and reset the whole database. """) if not confirm: confirm = 'yes' in builtins.input( """ Do you really want to do this? Write 'yes' to confirm: {yes}""" .format(yes='yes' if confirm else '')) if not confirm: print("Did not type yes. Thus aborting.") return print("Resetting database...") try: # initialize DB connection self.conn = pymysql.connect(host=self.mysql["host"], port=self.mysql["port"], db=self.mysql["db"], user=self.mysql["username"], passwd=self.mysql["password"]) self.cursor = self.conn.cursor() self.cursor.execute("TRUNCATE TABLE CurrentVersions") self.cursor.execute("TRUNCATE TABLE ArchiveVersions") self.conn.close() except (pymysql.err.OperationalError, pymysql.ProgrammingError, pymysql.InternalError, pymysql.IntegrityError, TypeError) as error: self.log.error("Database reset error: %s", error)
Example #10
Source File: __main__.py From news-please with Apache License 2.0 | 5 votes |
def init_config_file_path_if_empty(self): """ if the config file path does not exist, this function will initialize the path with a default config file :return """ if os.path.exists(self.cfg_directory_path): return user_choice = 'n' if self.no_confirm: user_choice = 'y' else: sys.stdout.write( "Config directory does not exist at '" + os.path.abspath(self.cfg_directory_path) + "'. " + "Should a default configuration be created at this path? [Y/n] ") if sys.version_info[0] < 3: user_choice = raw_input() else: user_choice = input() user_choice = user_choice.lower().replace("yes", "y").replace("no", "n") if not user_choice or user_choice == '': # the default is yes user_choice = "y" if "y" not in user_choice and "n" not in user_choice: sys.stderr.write("Wrong input, aborting.") sys.exit(1) if "n" in user_choice: sys.stdout.write("Config file will not be created. Terminating.") sys.exit(1) # copy the default config file to the new path copy_tree(os.environ['CColon'] + os.path.sep + 'config', self.cfg_directory_path) return
Example #11
Source File: request.py From verge3d-blender-addon with GNU General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #12
Source File: fabfile.py From ansible-mezzanine with MIT License | 5 votes |
def deploy(): """ Deploy latest version of the project. Check out the latest version of the project from version control, install new requirements, sync and migrate the database, collect any new static assets, and restart gunicorn's work processes for the project. """ if not exists(env.venv_path): prompt = input("\nVirtualenv doesn't exist: %s" "\nWould you like to create it? (yes/no) " % env.proj_name) if prompt.lower() != "yes": print("\nAborting!") return False create() for name in get_templates(): upload_template_and_reload(name) with project(): backup("last.db") static_dir = static() if exists(static_dir): run("tar -cf last.tar %s" % static_dir) git = env.git last_commit = "git rev-parse HEAD" if git else "hg id -i" run("%s > last.commit" % last_commit) with update_changed_requirements(): run("git pull origin master -f" if git else "hg pull && hg up -C") manage("collectstatic -v 0 --noinput") manage("syncdb --noinput") manage("migrate --noinput") restart() return True
Example #13
Source File: request.py From addon with GNU General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #14
Source File: request.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #15
Source File: emote.py From emoter with MIT License | 5 votes |
def getInput(self, _message): global firstTime global runningScript global runningImport if runningScript == True: if firstTime == False: self.message = input('\n\tWrite message to be analyzed: ') _message = self.message self.countPunct(_message) self.countWordSent(_message) self.runAnalysis(_message) else: print("""\n\tNow starting Emote as a script. Use Emote Mass Analyzer to break down a text into individual sentence classifications, or import Emote as a library.""") print("\n\tThe first time you run the analysis will be a little bit slower.") firstTime = False self.initialTrain() else: if firstTime == True: # print("\nFIRST TIME IS TRUE") print("\n\tRunning Emote as a library..") self.message = _message runningImport = True self.countPunct(_message) self.countWordSent(_message) self.runAnalysis(_message) else: # print("\nFIRST TIME IS FALSE") runningImport = True self.message = _message self.countPunct(_message) self.countWordSent(_message) self.runAnalysis(_message)
Example #16
Source File: request.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #17
Source File: request.py From kgsgo-dataset-preprocessor with Mozilla Public License 2.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #18
Source File: request.py From deepWordBug with Apache License 2.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #19
Source File: request.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #20
Source File: request.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions
Example #21
Source File: __main__.py From news-please with Apache License 2.0 | 4 votes |
def reset_postgresql(self): """ Resets the Postgresql database. """ confirm = self.no_confirm print(""" Cleanup Postgresql database: This will truncate all tables and reset the whole database. """) if not confirm: confirm = 'yes' in builtins.input( """ Do you really want to do this? Write 'yes' to confirm: {yes}""" .format(yes='yes' if confirm else '')) if not confirm: print("Did not type yes. Thus aborting.") return print("Resetting database...") try: # initialize DB connection self.conn = psycopg2.connect(host=self.postgresql["host"], port=self.postgresql["port"], database=self.postgresql["database"], user=self.postgresql["user"], password=self.postgresql["password"]) self.cursor = self.conn.cursor() self.cursor.execute("TRUNCATE TABLE CurrentVersions RESTART IDENTITY") self.cursor.execute("TRUNCATE TABLE ArchiveVersions RESTART IDENTITY") self.conn.commit() self.cursor.close() except psycopg2.DatabaseError as error: self.log.error("Database reset error: %s", error) finally: if self.conn is not None: self.conn.close()