403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/twisted/python/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/twisted/python/test/__pycache__/test_shellcomp.cpython-314.pyc
+
Dfj�R��$�Rt^RIt^RIHt^RIHtHt^RIHtH	t	H
t
^RIHtH
t
HtHt^RIHt!RR]4t!R	R
]R7tRt!R
R]P,4t!RR]P,4t!RR]P,4t!RR]
P44t!RR]
P44t!RR]4tRt!RR]
P44t!RR]
P44t !RR]
P44t!!R R!]4t"R"t#R#t$R#)$z*
Test cases for twisted.python._shellcomp
N)�BytesIO)�List�Optional)�
_shellcomp�reflect�usage)�
CompleteFiles�CompleteList�	Completer�Completions)�unittestc�*a�]tRt^toRtRtRtVtR#)�ZshScriptTestMetaz"
Metaclass of ZshScriptTestMixin.
c��RpRV9d&VR,FwrVV!WV4pWsRV,&K	\PWW#4#)c�aa�VV3RlpV#)c�<�\VSS4#)N)�test_genZshFunction)�self�cmdName�optionsFQPNs&���D/usr/lib/python3/dist-packages/twisted/python/test/test_shellcomp.py�runTest�<ZshScriptTestMeta.__new__.<locals>.makeTest.<locals>.runTests���*�4��+�F�F��)rrrsff r�makeTest�+ZshScriptTestMeta.__new__.<locals>.makeTests���
G��Nr�generateFor�test_genZshFunction_)�type�__new__)�cls�name�bases�attrsrrr�tests&&&&    rr �ZshScriptTestMeta.__new__sQ��	��E�!�(-�m�(<�(<�$����5��:>�,�w�6�7�)=��|�|�C�u�4�4rrN)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r �__static_attributes__�__classdictcell__��
__classdict__s@rrrs�����5�5rrc��]tRt^(tRtRtR#)�ZshScriptTestMixinaw
Integration test helper to show that C{usage.Options} classes can have zsh
completion functions generated for them without raising errors.

In your subclasses set a class variable like so::

  #            | cmd name | Fully Qualified Python Name of Options class |
  #
  generateFor = [('conch',  'twisted.conch.scripts.conch.ClientOptions'),
                 ('twistd', 'twisted.scripts.twistd.ServerOptions'),
                 ]

Each package that contains Twisted scripts should contain one TestCase
subclass which also inherits from this mixin, and contains a C{generateFor}
list appropriate for the scripts in that package.
rN)r'r(r)r*r+r,rrrr1r1(s��rr1)�	metaclassc	�F�\4pVP\PRV4\P
!V4!4pTP.RO4TPR4TP^4TP^\TP!^444TP^4TP#4\%TR4'd�TP&F�wrgr�TPTRRR	.4TPR4TP^4TP^\TP!^444TP^4TP#4K�	TP)4R# \d p\P!RT:24hRp?ii;i \dp\P!RT34hRp?i\dELzi;i \dp\P!R
T34hRp?i\dELi;i)a)
Generate completion functions for given twisted command - no errors
should be raised

@type cmdName: C{str}
@param cmdName: The name of the command-line utility e.g. 'twistd'

@type optionsFQPN: C{str}
@param optionsFQPN: The Fully Qualified Python Name of the C{Options}
    class to be tested.
�_shellCompFilez.Couldn't import or instantiate Options class: N��--_shell-completionzSystemExit not raisedz&ImportError calling parseOptions(): %s�subCommandszzsh:3z4ImportError calling parseOptions() on subcommand: %s�r5r6�zsh:2)r�patchr�Optionsr�namedAny�	Exceptionr�SkipTest�parseOptions�fail�ImportError�
SystemExit�seek�assertEqual�len�read�truncate�hasattrr7�
flushWarnings)
rrr�
outputFile�o�e�cmd�short�parser�docs
&&&       rrr;s�����J��J�J�u�}�}�.�
�;�
����[�)�+��
+�	���;�<�	
�	�	�)�*��O�O�A�����Q��J�O�O�A�.�/�0��O�O�A�������q�-� � �'(�}�}�#�C��
3�����R�)>��H�I��	�	�1�2��O�O�A�����Q��J�O�O�A�$6� 7�8��O�O�A�����!�%(5�,	�����]�
����EF�H�
�	
��
���P���� H�1�$�O�O���
��
���
��'�'�M�PQ�t�����
��
�s_�F�	F3�.G+�F0�F+�+F0�3G(�>G�G(�#G(�'G(�+H �6H�H �H �H c�ra�]tRt^toRtRtRtRtRtRt	Rt
RtR	tR
t
RtRtR
tRtRtVtR#)�ZshTestsz
Tests for zsh completion code
c�X�\4p\P!VR\44p\P
PP4pVP\P
P4VPVPV4VPVP\\P
P44VPVP\P
P4\P
PP4pVP\P
P4VPVPV4VPVP\P
P4R#)zQ
Are `compData' attributes you can place on Options classes
picked up correctly?
�aceN)�FighterAceExtendedOptionsr�ZshArgumentsGeneratorr�FighterAceOptions�compData�descriptions�copy�updaterD�multiUse�set�mutuallyExclusive�
optActions�extraActions)r�opts�agrYr_s&    r�test_accumulateMetadata� ZshTests.test_accumulateMetadata�s#��
)�*��
�
-�
-�d�E�7�9�
E��(�1�1�>�>�C�C�E�����5�>�>�K�K�L�������,�7�������c�*;�*D�*D�*M�*M�&N�O����� � �"3�"<�"<�"N�"N�	
�'�/�/�:�:�?�?�A�
����3�<�<�G�G�H�������
�3�������*;�*D�*D�*Q�*Q�Rrc���!RR\4pV!4p\P!VR\44pR0R
mR0RmR0RmR0R
mR0Rm/pVP	VP
V4R	#)z�
Exercise a corner-case of ZshArgumentsGenerator.makeExcludesDict()
where the long option name already exists in the `excludes` dict being
built.
c�8�]tRt^�t.RO.t]!.RO.R7tRtR#)�GZshTests.test_mutuallyExclusiveCornerCase.<locals>.OddFighterAceOptionsN�r^r)�anatraNz0Select the Anatra DS as your dogfighter aircraft)ri�fokker�albatros�spad�bristol)r'r(r)r*�optFlagsrrXr,rrr�OddFighterAceOptionsrg�s!��
U��H�#�#V�"W��HrrorTrkrirmrjrlN>�b�f�srlrirjrm>�arprqrrrlrjrmrk>rsrqrrrlrirjrk>rsrprrrlrirmrk>rsrprqrirjrmrk)rUrrVrrD�excludes)rrorarb�expecteds&    r� test_mutuallyExclusiveCornerCase�)ZshTests.test_mutuallyExclusiveCornerCase�sl��		�#<�		�$�%��
�
-�
-�d�E�7�9�
E��
�N��S��N��N��N�
��	
������h�/rc�:�\4p\P!VR\44pVP	RVP
4VP	RVP4VP	RVP4VP	RVP4R#)z�
We pick up options that are only defined by having an
appropriately named method on your Options class,
e.g. def opt_foo(self, foo)
rT�nocrash�
difficultyN)rUrrVr�assertIn�flagNameToDefinition�allOptionsNameToDefinition�paramNameToDefinition)rrarbs&  r� test_accumulateAdditionalOptions�)ZshTests.test_accumulateAdditionalOptions�sr��)�*��
�
-�
-�d�E�7�9�
E���
�
�i��!8�!8�9��
�
�i��!>�!>�?��
�
�l�B�$<�$<�=��
�
�l�B�$A�$A�Brc��!RR\4pVP\\PV!4R\44!RR\4pVP\\PV!4R\44R#)zD
Using a parameter/flag name that doesn't exist
will raise an error
c�,�]tRt^�t]!RR/R7tRtR#)�0ZshTests.test_verifyZshNames.<locals>.TmpOptions�detaillN)r_r�r'r(r)r*rrXr,rrr�
TmpOptionsr��s��"�y�$�.?�@�Hrr�rTc�*�]tRt^�t]!R.R7tRtR#)�1ZshTests.test_verifyZshNames.<locals>.TmpOptions2rhrN)�foo�barr�rrr�TmpOptions2r��s��#�n�5E�F�Hrr�N)rU�assertRaises�
ValueErrorrrVr)rr�r�s&  r�test_verifyZshNames�ZshTests.test_verifyZshNames�sn��	A�2�	A�	
����
�8�8�*�,��w�y�	
�	G�3�	G�
	
�����,�,��M���I�	
rc�*�\4pVP\PRV4VP\R.RO4\4pVP
\VP4VP\VP44R#)z\
Generate a completion function, and test the textual output
against a known correct output
r4�argvN)�sillyr5r6r9)rr:rr;�sys�SimpleProgOptionsr�rBr?rD�testOutput1�getvalue�rrJras&  r�test_zshCode�ZshTests.test_zshCode�sh��
�Y�
��
�
�5�=�=�"2�J�?��
�
�3�� M�N� �"�����*�d�&7�&7�8�����j�&9�&9�&;�<rc�*�\4pVP\PRV4VP\R.RO4\4pVP
\VP4VP\VP44R#)zm
Generate a completion function with subcommands,
and test the textual output against a known correct output
r4r�N)�silly2r5r6r9)rr:rr;r��SimpleProgWithSubcommandsr�rBr?rD�testOutput2r�r�s&  r�test_zshCodeWithSubs�ZshTests.test_zshCodeWithSubs�sh��
�Y�
��
�
�5�=�=�"2�J�?��
�
�3�� N�O�(�*�����*�d�&7�&7�8�����j�&9�&9�&;�<rc�,�\4pVP\PRV4\	4pVP\VP.RO4VP^4VP^\VP^444R#)z`
Completion still happens even if a command-line is given
that would normally throw UsageError.
r4N)�--fokker�server�--unknown-optionz--unknown-option2r6�zsh:5�rr:rr;rWr�rBr?rCrDrErFr�s&  r�test_incompleteCommandLine�#ZshTests.test_incompleteCommandLine�ss��
�Y�
��
�
�5�=�=�"2�J�?� �"���������
�	
�	���������C�
���� 2�3�4rc�n�\4pVP\PRV4\	4pVP\VP.RO4VP^4VP^\VP^444VP^4VP4R#)z�
Completion still happens even if a command-line is given
that would normally throw UsageError.

The existence of --unknown-option prior to the subcommand
will break subcommand detection... but we complete anyway
r4N)r�r�r��
--list-serverr6r�)
rr:rr;rWr�rBr?rCrDrErFrGr�s&  r� test_incompleteCommandLine_case2�)ZshTests.test_incompleteCommandLine_case2s����Y�
��
�
�5�=�=�"2�J�?� �"���������
�	
�	���������C�
���� 2�3�4���������rc�,�\4pVP\PRV4\	4pVP\VP.RO4VP^4VP^\VP^444R#)z�
Completion still happens even if a command-line is given
that would normally throw UsageError.

Break subcommand detection in a different way by providing
an invalid subcommand name.
r4N)r�zunknown-subcommandr�r6zzsh:4r�r�s&  r� test_incompleteCommandLine_case3�)ZshTests.test_incompleteCommandLine_case34ss���Y�
��
�
�5�=�=�"2�J�?� �"���������
�
	
�	���������C�
���� 2�3�4rc�,�\4pVP\PRV4\	4pVP\VP.RO4VP^4VP^\VP^444R#)zi
Ensure the optimization which skips building the subcommand list
under certain conditions isn't broken.
r4N)z--albar6r9r�r�s&  r�test_skipSubcommandList� ZshTests.test_skipSubcommandListOsp��
�Y�
��
�
�5�=�=�"2�J�?� �"�������)�)�+U�	
�	���������C�
���� 2�3�4rc��\4p\P!VRR4pVPR4pVP	VR4R#)zI
Test corner case fetching an option description from a method docstring
rTNr�)rWrrV�getDescriptionrD)rra�argGen�descrs&   r�test_poorlyDescribedOptMethod�&ZshTests.test_poorlyDescribedOptMethod_sB��!�"���1�1�$��t�D���%�%�g�.��	
�����(rc���!RR\P4p\4pV!4pVPVRV4VP	\
VP.RO4R#)z]
A C{Completer} with repeat=True may only be used as the
last item in the extraActions list.
c��]tRtRt]P
!]P!RR7]P!4.R7tRtR#)�2ZshTests.test_brokenActions.<locals>.BrokenActionsirT)�repeat)r`rN)	r'r(r)r*rrr
rXr,rrr�
BrokenActionsr�rs*���(�(�#�o�o�T�:�E�O�O�<M�N��Hrr�r4Nr8)rr;rr:r�r�r?)rr�rJras&   r�test_brokenActions�ZshTests.test_brokenActionslsO��	�E�M�M�	�
�Y�
�����
�
�4�)�:�6������)�)�+O�	
rc��!RR\P4pV!4p\P!VRR4pVP	VPR4R4VP	VPR4R4R#)	zf
opt_* methods on Options classes should not override the
data provided in optFlags or optParameters.
c�@a�]tRtRto.RO.t.RO.tRtRtRtVt	R#)�5ZshTests.test_optMethodsDontOverride.<locals>.Optionsi�Nc��R#�zjunk descriptionNr�rs&r�opt_flag�>ZshTests.test_optMethodsDontOverride.<locals>.Options.opt_flag���rc��R#r�r)r�params&&r�	opt_param�?ZshTests.test_optMethodsDontOverride.<locals>.Options.opt_param�r�rr)�flagrq�A flag)r��pN�A param)
r'r(r)r*rn�
optParametersr�r�r,r-r.s@rr;r��s$����/�0�H�<�=�M�
'�
'�
'rr;rTNr�r�r�r�)rr;rrVrDr�)rr;rar�s&   r�test_optMethodsDontOverride�$ZshTests.test_optMethodsDontOverride~se��	'�e�m�m�	'��y���1�1�$��t�D������.�.�v�6��A�����.�.�w�7��CrrN)r'r(r)r*r+rcrvrr�r�r�r�r�r�r�r�r�r�r,r-r.s@rrRrRsT�����S�.0�>
C�
�6
=�
=�5�2�>5�65� )�
�$D�DrrRc�&a�]tRtRtoRtRtVtR#)�EscapeTestsi�c��\PpRpVPV!V4R4RpVPV!V4R4R#)z%
Verify _shellcomp.escape() function
�$z'$'zA--'$"\`--Bz"A--'\$\"\\\`--B"N)r�escaperD)r�escr%s&  r�test_escape�EscapeTests.test_escape�sB������������T��E�*�������T��$=�>rrN)r'r(r)r*r�r,r-r.s@rr�r��s����
?�
?rr�c�*a�]tRtRtoRtRtRtVtR#)�CompleterNotImplementedTestsi�z�
Test that using an unknown shell constant with SubcommandAction
raises NotImplementedError

The other Completer() subclasses are tested in test_usage.py
c�t�\P!4pVP\VPRR4R#)z=
Using an unknown shellType should raise NotImplementedError
N�bad_shell_type)r�SubcommandActionr��NotImplementedError�
_shellCode)r�actions& r�test_unknownShell�.CompleterNotImplementedTests.test_unknownShell�s0���,�,�.�������!2�!2�D�:J�	
rrN)r'r(r)r*r+r�r,r-r.s@rr�r��s�����
�
rr�c�.�]tRtRtRt.RO.t.RO.tRtR#)�FighterAceServerOptionsi�z,
Options for FighterAce 'server' subcommand
Nr)zlist-serverNz3List this server with the online FighterAce network)zpackets-per-secondNz+Number of update packets to send per second�20)r'r(r)r*r+rnr�r,rrrr�r��s ���
	U��H�	
��Mrr�c
��a�]tRtRtoRt.RO.RO.RO.RO.RO.RO.RO.t.RO.RO.tRR]R..t]	!RR	RR
/R..RO.R]
!R.4/]!RR
7.R7tRt
V3RltRtVtR#)rWi�z:
Command-line options for an imaginary `Fighter Ace` game
�physics�verboseN�detailr�zStart FighterAce game-server.zTwisted-PhysicszRendering detail level�12345zsaved game file to load�r��rYr\r^r_r`c��R#)r5Nrr�s&r�	opt_silly�FighterAceOptions.opt_silly�r�rc�<�V^8�dQh/S[S[S[S[,,,;R&S[S[S[S[,,,;R&#)�rnr�)rr�str)�formatr/s"�r�__annotate__�FighterAceOptions.__annotate__�s?����
�4���
�&�'�����X�c�]�+�,��rr)rjrqz2Select the Fokker Dr.I as your dogfighter aircraft)rkrsz5Select the Albatros D-III as your dogfighter aircraft)rlrrz1Select the SPAD S.VII as your dogfighter aircraft)rmrpz4Select the Bristol Scout as your dogfighter aircraft)r�r�z$Enable secret Twisted physics engine)�jam�jz6Enable a small chance that your machine guns will jam!�r��vz1Verbose logging (may be specified more than once))z
pilot-nameNzWhat's your name, Ace?zManfred von Richthofen)r��dz*Select the level of rendering detail (1-5)�3)rjrkrlrm)r'r(r)r*r+rnr�r�r7rr	rrXr��__annotate_func__r,r-r.s@rrWrW�s������
	N�R�J�P�@�N�M�+�H�	Q�J�0�M�
�4�0�2Q�R��K���!2�H�>V�W���D�E��l�,?�+@�A�B�#�*C�D�E��H��A�rrWc�na�]tRtRtoRt.R
O.t.RO.t]!RR/R]!RR7/R	7t	R
t
RtRtVt
R#)rUi�z�
Extend the options and zsh metadata provided by FighterAceOptions.
_shellcomp must accumulate options and metadata from all classes in the
hiearchy so this is important to test.
�	no-stallsN�
reality-levelzCan't stall your planezPhysics reality levelr�)rYr_c��R#)z(
Select that you can't crash your plane
Nrr�s&r�opt_nocrash�%FighterAceExtendedOptions.opt_nocrash�r�rc��R#)z
How tough are you? (1-10)
Nr)rrzs&&r�opt_difficulty�(FighterAceExtendedOptions.opt_difficultyr�rr)rNz+Turn off the ability to stall your aircraft)rNz)Select the level of physics reality (1-5)�5)r'r(r)r*r+rnr�rr
rXrrr,r-r.s@rrUrU�sQ�����S�S�H�Q��M��!�#;�<�#�Y�5L�%M�N��H�
�
�rrUc� �\.RORR7#)�1zAccuracy'`?r�)r
�2r�)r	rrr�_accuracyActionr	s����}�=�=rc�a�]tRtRtoRt.RO.RO.RO.t.RO.RO.t]!RR	RR
/R.RR..R]!.RORR7R]	/]
!R
R7.R7tRtRt
VtR#)r�iz6
Command-line options for a `Silly` imaginary program
�color�grayr��optimizationN�accuracyzColor onzOptimization levelz
Optimization?r�zoutput filer�c��R#)z=
usage.Options does not recognize single-letter opt_ methods
Nrr�s&r�opt_X�SimpleProgOptions.opt_X+r�rr)r�czTurn on color output)r�gzTurn on gray-scale outputr�)rNrz&Select the level of optimization (1-5))rrsr�z"Select the level of accuracy (1-3))r
rr��4r)r'r(r)r*r+rnr�rr	rrrXrr,r-r.s@rr�r�s������
	/�2�M��H�	N�D��M�
��z�>�;O�P���#�V�,�-��L�)���
��	
�$�-�8�9��H��rr�c� �]tRtRt.RO.tRtR#)�SimpleProgSub1i1rN)�sub-optrrzSub Opt One�r'r(r)r*rnr,rrrrr1�
��/�0�Hrrc� �]tRtRt.RO.tRtR#)�SimpleProgSub2i5rN)rrrzSub Opt Tworrrrrr5rrrc�P�]tRtRtR.RR..tR.RR..RO.tRR	]R
.RR	]R..tR
t	R	#)r�i9zsome-optionzother-optionrKz
some-paramzother-paramr��sub1Nz
Sub Command 1�sub2z
Sub Command 2r)z
another-param�PzYet Another Param)
r'r(r)r*rnr�rrr7r,rrrr�r�9sM����.�#�!6�7�H�
��	���3��M�
��~��7�	��~��7��Krr�s�#compdef silly

_arguments -s -A "-*" \
':output file (*):_files -g "*"' \
"(--accuracy)-a[Select the level of accuracy (1-3)]:Accuracy'\`?:(1 2 3)" \
"(-a)--accuracy=[Select the level of accuracy (1-3)]:Accuracy'\`?:(1 2 3)" \
'(--color --gray -g)-c[Color on]' \
'(--gray -c -g)--color[Color on]' \
'(--color --gray -c)-g[Turn on gray-scale output]' \
'(--color -c -g)--gray[Turn on gray-scale output]' \
'--help[Display this help and exit.]' \
'--optimization=[Optimization level]:Optimization?:(1 2 3 4 5)' \
'*-v[Verbose logging (may be specified more than once)]' \
'*--verbose[Verbose logging (may be specified more than once)]' \
'--version[Display Twisted version and exit.]' \
&& return 0
s�#compdef silly2

_arguments -s -A "-*" \
'*::subcmd:->subcmd' \
':output file (*):_files -g "*"' \
"(--accuracy)-a[Select the level of accuracy (1-3)]:Accuracy'\`?:(1 2 3)" \
"(-a)--accuracy=[Select the level of accuracy (1-3)]:Accuracy'\`?:(1 2 3)" \
'(--another-param)-P[another-param]:another-param:_files' \
'(-P)--another-param=[another-param]:another-param:_files' \
'(--color --gray -g)-c[Color on]' \
'(--gray -c -g)--color[Color on]' \
'(--color --gray -c)-g[Turn on gray-scale output]' \
'(--color -c -g)--gray[Turn on gray-scale output]' \
'--help[Display this help and exit.]' \
'--optimization=[Optimization level]:Optimization?:(1 2 3 4 5)' \
'(--other-option)-o[other-option]' \
'(-o)--other-option[other-option]' \
'(--other-param)-p[other-param]:other-param:_files' \
'(-p)--other-param=[other-param]:other-param:_files' \
'--some-option[some-option]' \
'--some-param=[some-param]:some-param:_files' \
'*-v[Verbose logging (may be specified more than once)]' \
'*--verbose[Verbose logging (may be specified more than once)]' \
'--version[Display Twisted version and exit.]' \
&& return 0
local _zsh_subcmds_array
_zsh_subcmds_array=(
"sub1:Sub Command 1"
"sub2:Sub Command 2"
)

_describe "sub-command" _zsh_subcmds_array
)%r+r��ior�typingrr�twisted.pythonrrr�twisted.python.usagerr	r
r�
twisted.trialrrrr1r�TestCaserRr�r�r;r�rWrUrr�rrr�r�r�rrr�<module>r)s����
��!�5�5�T�T�"�5��5�,�#4��&A�HSD�x� � �SD�l?�(�#�#�?�
�8�#4�#4�
�&�e�m�m��$"��
�
�"�J� 1��8>�
 ��
�
� �F1�U�]�]�1�1�U�]�]�1�� 1����& �r

Youez - 2016 - github.com/yon3zu
LinuXploit