403Webshell
Server IP : 123.56.80.60  /  Your IP : 216.73.216.78
Web Server : Apache/2.4.54 (Win32) OpenSSL/1.1.1s PHP/7.4.33 mod_fcgid/2.3.10-dev
System : Windows NT iZhx3sob14hnz7Z 10.0 build 14393 (Windows Server 2016) i586
User : SYSTEM ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files/python/Lib/site-packages/Naked/toolshed/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Program Files/python/Lib/site-packages/Naked/toolshed//casts.py
#!/usr/bin/env python
# encoding: utf-8
# tests in test_CASTS.py

from Naked.toolshed.types import NakedObject, XFSet, XDict, XList, XQueue, XSet, XString, XTuple
from Naked.settings import debug as DEBUG_FLAG

#------------------------------------------------------------------------------
# [ nobj ] (NakedObject)
#  Cast a dictionary of attributes to a NakedObject with key>attribute mapping
#------------------------------------------------------------------------------
def nobj(attributes={}):
    try:
        return NakedObject(attributes)
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to create a NakedObject with the requested argument using the nobj() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xd function ] (XDict)
#   Cast a Python dictionary to a XDict
#------------------------------------------------------------------------------
def xd(dictionary_arg, attributes={}):
    try:
        return XDict(dictionary_arg, attributes)
    except TypeError:
        raise TypeError("Attempted to cast to a XDict with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XDict with the xd() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xl function ] (XList)
#  Cast a Python list, set, or tuple to a XList
#------------------------------------------------------------------------------
def xl(list_arg, attributes={}):
    try:
        return XList(list_arg, attributes)
    except TypeError:
        raise TypeError("Attempted to cast to a XList with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XList with the xl() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xq function ] (XQueue)
#  Cast a Python list, set, tuple to a XQueue
#------------------------------------------------------------------------------
def xq(queue_arg, attributes={}):
    try:
        return XQueue(queue_arg, attributes)
    except TypeError:
        raise TypeError("Attempted to cast to a XQueue with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XQueue with the xq() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xset function ] (XSet)
#   Cast a Python set to a XSet
#------------------------------------------------------------------------------
def xset(set_arg, attributes={}):
    try:
        return XSet(set_arg, attributes)
    except TypeError:
        raise TypeError("Attempted to cast to a XSet with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XSet with the xset() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xfset function ] (XFSet)
#   Cast a Python set to a XFSet
#------------------------------------------------------------------------------
def xfset(set_arg, attributes={}):
    try:
        return XFSet(set_arg, attributes)
    except TypeError:
        raise TypeError("Attempted to cast to a XSet with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XSet with the xset() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xstr function ] (XString)
#  Cast a Python string to a XString
#------------------------------------------------------------------------------
def xstr(string_arg, attributes={}):
    try:
        return XString(string_arg, attributes)
    except TypeError as te:
        raise TypeError("Attempted to cast to a XString with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XString with the xstr() function (Naked.toolshed.casts.py).")
        raise e

#------------------------------------------------------------------------------
# [ xt function ] (XTuple)
#  Cast a Python list, set, tuple to a XTuple
#------------------------------------------------------------------------------
def xt(tup_arg, attributes={}):
    try:
        return XTuple(tup_arg, attributes)
    except TypeError as te:
        raise TypeError("Attempted to cast to a XTuple with an incompatible type")
    except Exception as e:
        if DEBUG_FLAG:
            print("Naked Framework Error: unable to cast object to a XTuple with the xt() function (Naked.toolshed.casts.py).")
        raise e

if __name__ == '__main__':
    pass

Youez - 2016 - github.com/yon3zu
LinuXploit