Exemplo n.º 1
0
def help(name=None):
    """Display help for an action.

    If "commands" is passed, list possible commands.
    If no action is given, display general help."""
    print(
        '+++ Attention: passwords are *never* taken directly as parameters +++'
    )
    print('+++ Achtung: Passwörter *nie* direkt als Parameter angeben +++\n\n')

    def getsig(func):
        try:
            return str(inspect.signature(func))
        except (ValueError, TypeError):
            return '(<?>)'

    if name is None:
        parser.print_help()
        return
    elif name == 'commands':
        print('\n\n'.join('{}{}: {}'.format(n, getsig(f), (
            inspect.getdoc(f) or 'No docstring').split('\n\n')[0])
                          for n, f in COMMANDS.items() if callable(f)))
        return
    elif name in COMMANDS:
        obj = COMMANDS[name]
    else:
        obj = name  # it gets passed through eval-val before
    builtins.help(obj)
Exemplo n.º 2
0
async def help(function_str=None):
    if not function_str:
        builtins.help(globals()[function_str])
    else:
        tprint(
            "You need to specify the function you need information on (example: help cancel_all)!"
        )
Exemplo n.º 3
0
    def help(self, arg=None):
        """
        @brief Overloads the built-in help function.
        help() prints the help text for Interactive mode;
        help(foo) calls the standard help routine for thing 'foo'.
        @param[in] self Pointer to the current object
        @param[in] arg = None
        """
        if arg is not None:
            return builtins.help(arg)

        print(self._get_help_string())
Exemplo n.º 4
0
    def help(self, arg=None):
        """
        Prints the help text

        This Overloads the built-in help function.
        help() prints the help text for Interactive mode;
        help(foo) calls the standard help routine for thing 'foo'.
        @param[in] self Pointer to the current object
        @param[in] arg = None
        """
        if len(self._user_namespace) == 0:
            self._populate_namespace()

        if arg is not None:
            return builtins.help(arg)

        else:
            self._print_help()
Exemplo n.º 5
0
    def help(self, arg=None):
        """Prints the help text.

        This Overloads the built-in help function. ``help()`` prints the help
        text for Interactive mode. ``help(foo)`` calls the standard help
        routine for thing ``foo``.

        Args:
            arg
        """
        if len(self._user_namespace) == 0:
            self._populate_namespace()

        if arg is not None:
            return builtins.help(arg)

        else:
            self._print_help()
Exemplo n.º 6
0
'''
Created on 2018年8月17日

@author: lixue
'''
'''
字符串本省就是可以迭代的
'''

from collections import Counter
from builtins import help
help(Counter)
c = Counter("safsdafsdagdsgsdaflksajklfsdjafkszanf")
print(c)  #对其中每一个字符或者数字进行统计,键为字符,值为个数
#Counter({'s': 8, 'a': 7, 'f': 6, 'd': 5, 'k': 3, 'g': 2, 'l': 2, 'j': 2, 'z': 1, 'n': 1})
s = ['rwer', 'fsdfs', 'rwer']
print(Counter(s))  # Counter({'rwer': 2, 'fsdfs': 1})
Exemplo n.º 7
0
import builtins
print(builtins.help(print(end="")))
print(float.as_integer_ratio(1.5))  #ondalikli olarka gosterim
print(float.is_integer(3.0))  #verilen ondalikli sayi tam sayi mi
print(float.hex(4.0))  #floati hexadecimale cevirme
print(float.fromhex("a70"))  #hexadecimali floata cevirme
x = [[]] * 3
x[0].append("a")
print(
    x
)  #olusturulan ilk listeden uretilen 3 liste,ilk listeden referans aldigi icin degerleri ayni oluyor.
print("yahya".center(20, "a"))
a = 3
b = 3
liste = ["a", "b", "c"]
print(a.__eq__(b))  #equal/a==b/esit
print(a.__le__(b))  #less than or equal/a<=b/kucuk esit
print(a.__lt__(b))  #less than/a<b/kucuktur
print(a.__ge__(b))  #greater than or equal/a>=b/buyuk esit
print(a.__gt__(b))  #greater than/a>b/buyuktur
print(a.__ne__(b))  #not equal/a!=b/esit degildir
print(liste.__contains__("a"))  #in/"a" in liste)/iceriyor mu
print(format(1234567, "8.2f"))
print(f'{255:X}')  #Format'in bir diger kullanim sekli
print(int(33).__format__("X"))  #format bir diger kullanim sekli
print(globals())
print(locals())
Exemplo n.º 8
0
'''
Created on 2019年7月29日
文件的操作的方法环`
@author: Administrator
'''
from builtins import help
print(help(open))
Exemplo n.º 9
0
while words[i] != 'c':
  print( 'i %d %s' % ( i, words[i] ) )
  i = inc( i )
for l in "python":
  if l == "o":
    continue
  print( l )
try:
  print( 'a' + 1 )
except:
  print( 'problem' )
upperName( "nate" )
print( "%d" % abs( -4 ) )
print( dir( [] ) )
array = []
print( help( array.count ) )
print( eval( "4+5+5" ) )
print( float( "8" ) )
print( list( range( 0, 3 ) ) )
print( sum( tup ) )
afile = open( "/root/pytest", 'r' )
ftext = afile.read()
print( ftext )
afile.seek( 0, 0 )
ftext = afile.read()
print( ftext )
afile.close()
wfile = open( "/root/pytestw", 'w' )
wfile.write( 'sfuff\n' )
wfile.close()
wfile = open( "/root/pytestw", 'a' )