コード例 #1
0
 def multiple_choices(self, choices, response):
     """
         not documented yet
         
         Parameters
         ----------
         
         choices : not documented yet
         
         response : not documented yet
         
         """
     while True:
         for n, elem in enumerate(choices):
             print("({num:d}) {choice!s}".format(num=n + 1, choice=elem))
         try:
             choice = input("Method number: ")
         except KeyboardInterrupt:
             raise NoData
         if not choice:
             raise NoData
         try:
             choice = int(choice) - 1
         except ValueError:
             continue
         if choice == -1:
             raise NoData
         elif choice >= 0:
             try:
                 return [choices[choice]]
             except IndexError:
                 continue
コード例 #2
0
    def multiple_choices(self, choices, response):
        """
        not documented yet

        Parameters
        ----------

            choices : not documented yet

            response : not documented yet

        """
        while True:
            for n, elem in enumerate(choices):
                print("({num:d}) {choice!s}".format(num=n + 1, choice=elem))
            try:
                choice = input("Method number: ")
            except KeyboardInterrupt:
                raise NoData
            if not choice:
                raise NoData
            try:
                choice = int(choice) - 1
            except ValueError:
                continue
            if choice == -1:
                raise NoData
            elif choice >= 0:
                try:
                    return [choices[choice]]
                except IndexError:
                    continue
コード例 #3
0
    def make_table_list(self):
        """
        Creates a list of table names and prompts the user for a choice

        This takes the table of table names from get_table_names(), creates a
        list of the names, sorts them, then presents the tables in a
        convenient menu for the user to choose from. It returns a string
        containing the name of the table that the user picked.

        Returns
        -------
        temp: `str`
            contains the name of the table that the user picked.

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA
        >>> hc.make_table_list()  # doctest: +SKIP

        """
        table_list = []
        tables = self.get_table_names()
        for i in tables:
            table = i[0]
            if len(table) > 0:
                table_list.append(table)
        table_list.sort()
        for index, table in enumerate(table_list):
            print(('{number:3d}) {table}'.format(number=index + 1,
                                                 table=table)))

        while True:
            stdinput = input("\nPlease enter a table number between 1 and "
                             "{elem:d} "
                             "('e' to exit): ".format(elem=len(table_list)))
            if stdinput.lower() == "e" or stdinput.lower() == "exit":
                temp = None
                break
            temp = [int(s) for s in stdinput.split() if s.isdigit()]
            temp = temp[0] - 1
            if temp in range(0, len(table_list)):
                temp = table_list[temp]
                break
            else:
                print("Choice outside of bounds")
        return temp
コード例 #4
0
ファイル: hec.py プロジェクト: Alex-Ian-Hamilton/sunpy
    def make_table_list(self):
        """
        Creates a list of table names and prompts the user for a choice

        This takes the table of table names from get_table_names(), creates a
        list of the names, sorts them, then presents the tables in a
        convenient menu for the user to choose from. It returns a string
        containing the name of the table that the user picked.

        Returns
        -------
        temp: `str`
            contains the name of the table that the user picked.

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()
        >>> hc.make_table_list()   # doctest: +SKIP

        """
        table_list = []
        tables = self.get_table_names()
        for i in tables:
            table = i[0]
            if len(table) > 0:
                table_list.append(table)
        table_list.sort()
        for index, table in enumerate(table_list):
            print(('{number:3d}) {table}'.format(number=index + 1,
                                                 table=table)))

        while True:
            stdinput = input("\nPlease enter a table number between 1 and "
                             "{elem:d} "
                             "('e' to exit): ".format(elem=len(table_list)))
            if stdinput.lower() == "e" or stdinput.lower() == "exit":
                temp = None
                break
            temp = [int(s) for s in stdinput.split() if s.isdigit()]
            temp = temp[0] - 1
            if temp in range(0, len(table_list)):
                temp = table_list[temp]
                break
            else:
                print("Choice outside of bounds")
        return temp
コード例 #5
0
ファイル: vso.py プロジェクト: AlmightyFuzz/sunpy
    def missing_information(self, info, field):
        """
        not documented yet

        Parameters
        ----------
        info : not documented yet
                not documented yet
        field : not documented yet
            not documented yet

        Returns
        -------
        choice : not documented yet

        .. todo::
            improve documentation. what does this function do?

        """
        choice = input(field + ': ')
        if not choice:
            raise NoData
        return choice
コード例 #6
0
def missing_information(self, info, field):
    """
        not documented yet
        
        Parameters
        ----------
        info : not documented yet
        not documented yet
        field : not documented yet
        not documented yet
        
        Returns
        -------
        choice : not documented yet
        
        .. todo::
        improve documentation. what does this function do?
        
        """
            choice = input(field + ': ')
            if not choice:
            raise NoData
                return choice