Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
config.cpython-313.pyc170 linesDownload Raw Back to __pycache__
1�

2��j2��F�%SSKJr SSKJr SSKrSSKrSSKrSSKJr SSKJr SSKJ	r	 SSKJ3r4 SSKJr SS	KJr SS5KJ
r
 SSKJr SS
KJr SSKJr SSKJr SSKJr \R*"5rSqSqSqSrSqSqSqSqSrSrS\ S'\RB(aSSK"J#r# S\ S'O"SS5r$\$"5r%\
"S\S\4S9r&SSS.S.Sjjr'S/S jr("S!S"5r)S0S#jr*S1S$jr+S2S%jr,S3S&jr-S4S'jr."S(S)5r/\/"5r0"S*S+5r1S,r2S-r3g)5�)�annotations)�	NamespaceN)�Any)�Callable)�Iterable)�NoReturn)�Optional)�Tuple)�TypeVar)�Union�)�mock)�requirements��fail�)�utilF�mainr�options)�FixtureFunctionsr�_fixture_functionsc�T�\rSrSrSrSr\S5rSrSr	Sr6SrS	rS7r
Srg)
�_NullFixtureFunctions�3c��SnU$)Nc��U$�N���fns �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\sqlalchemy/testing/config.py�go�1_NullFixtureFunctions._null_decorator.<locals>.go5s���	�r)�selfr"s  r!�_null_decorator�%_NullFixtureFunctions._null_decorator4s��
��Ir$c��[5$r)�	Exception�r%�arg�kws   r!�skip_test_exception�)_NullFixtureFunctions.skip_test_exception:s8���;�r$c�,�[R"5$r)r�Mock�r%s r!�
add_to_marker�#_NullFixtureFunctions.add_to_marker=s���9�9�;�r$c�"�UR5$r�r&r1s r!�mark_base_test_class�*_NullFixtureFunctions.mark_base_test_classA����'�'�)�)r$c�"�UR5$rr5)r%�arg_setsr,s   r!�combinations�"_NullFixtureFunctions.combinationsDr8r$c�"�UR5$rr5)r%�9parameterss  r!�param_ident�!_NullFixtureFunctions.param_identGr8r$c�"�UR5$rr5r*s   r!�fixture�_NullFixtureFunctions.fixtureJr8r$c��grrr1s r!�get_current_test_name�+_NullFixtureFunctions.get_current_test_nameMs��r$c��U$rr)r%r s  r!�10async_test� _NullFixtureFunctions.async_testPs���Ir$rN)�__name__�11__module__�__qualname__�__firstlineno__r&r-�propertyr2r6r;r?rBrErH�__static_attributes__rr$r!rr3s>��	�	�12�	�13�	�	*�	*�	*�	*�	�	r$r�_FN.)�bound)�argnames�id_c�2�[R"X!US.UD6$)ab	Deliver multiple versions of a test based on positional combinations.14 15This is a facade over pytest.mark.parametrize.16 17 18:param \*comb: argument combinations.  These are tuples that will be passed19 positionally to the decorated function.20 21:param argnames: optional list of argument names.   These are the names22 of the arguments in the test function that correspond to the entries23 in each argument tuple.   pytest.mark.parametrize requires this, however24 the combinations function will derive it automatically if not present25 by using ``inspect.getfullargspec(fn).args[1:]``.  Note this assumes the26 first argument is "self" which is discarded.27 28:param id\_: optional id template.  This is a string template that29 describes how the "id" for each parameter set should be defined, if any.30 The number of characters in the template should match the number of31 entries in each argument tuple.   Each character describes how the32 corresponding entry in the argument tuple should be handled, as far as33 whether or not it is included in the arguments passed to the function, as34 well as if it is included in the tokens used to create the id of the35 parameter set.36 37 If omitted, the argument combinations are passed to parametrize as is.  If38 passed, each argument combination is turned into a pytest.param() object,39 mapping the elements of the argument tuple to produce an id based on a40 character value in the same position within the string template using the41 following scheme:42 43 .. sourcecode:: text44 45    i - the given argument is a string that is part of the id only, don't46        pass it as an argument47 48    n - the given argument should be passed and it should be added to the49        id by calling the .__name__ attribute50 51    r - the given argument should be passed and it should be added to the52        id by calling repr()53 54    s - the given argument should be passed and it should be added to the55        id by calling str()56 57    a - (argument) the given argument should be passed and it should not58        be used to generated the id59 60 e.g.::61 62    @testing.combinations(63        (operator.eq, "eq"),64        (operator.ne, "ne"),65        (operator.gt, "gt"),66        (operator.lt, "lt"),67        id_="na",68    )69    def test_operator(self, opfunc, name):70        pass71 72The above combination will call ``.__name__`` on the first member of73each tuple and use that as the "id" to pytest.param().74 75 76�rSrR)rr;)rRrS�combr,s    r!r;r;[s%��L�*�*�	
���-/��r$c��[U0UD6$)z+As combination, but takes a single iterable)r;)�arg_iterabler,s  r!�combinations_listrY�s����,��,�,r$c��\rSrSrSrSr\R(aSSjr\	S5r77SrSrSr
S	rSS78jr\S5r\S5rS
rg)�	Variation���_name�_argnamec�J�XlX lUHn[XXA:H5 M gr)r^r_�setattr)r%�case�argname�79case_names�casenames     r!�__init__�Variation.__init__�s#���80��
�"�H��D�H�$4�5�#r$c��grr)r%�keys  r!�__getattr__�Variation.__getattr__�s��r$c��UR$r)r^r1s r!�name�Variation.name�s���z�z�r$c�4�URUR:H$rr]r1s r!�__bool__�Variation.__bool__�s���z�z�T�]�]�*�*r$c�,�UR5(+$r)rpr1s r!�__nonzero__�Variation.__nonzero__�s���=�=�?�"�"r$c�:�URSUR<3$)N�=�r_r^r1s r!�__str__�Variation.__str__�s���-�-���$�*�*��0�0r$c��[U5$r��strr1s r!�__repr__�Variation.__repr__�s���4�y�r$c� �[SU35 g)NzUnknown rr1s r!r�Variation.fail�s���x��v�
�r$c��UR$r)rm)�cls�	variations  r!�idfn�Variation.idfn�s���~�~�r$c���UVs/sHnUSLaUOUSLaSU-OUPM nn[U[4S[U505nUVs/sHoe"XaU5PM
 sn$s snfs snf)NTF�not_�	__slots__)�typer[�tuple)r�rc�cases�crd�typres       r!�generate_cases�Variation.generate_cases�s����81����D�y�G�!�u�*�f�w�&6�!�K��	�82�83��
�L��U�:�.�
�84��DN�N�:�x��H�z�2�:�N�N��85��Os�A�ArwN)rir|�return�bool)r�r)rJrKrLrMr�rf�typing�
TYPE_CHECKINGrjrNrmrprsrxr}r�classmethodr�r�rOrr$r!r[r[�so��%�I�6����4�
����+�#�1�� ������O��Or$r[c86��[R"U5(a'URnU"S5n[X!5S5nU$UnUVs/sH-n[	U[875(a[
U5S:XaUOUS4PM/ nn[RX%VVs/sHupgUPM	 snn5n[[X�5V	V88Vs/sH'un	up�UbU	RX�4O
U	RU	4PM) snn89n	SUS.6$s snfs snnfs snn90n	f)aia helper around testing.combinations that provides a single namespace91that can be used as a switch.92 93e.g.::94 95    @testing.variation("querytyp", ["select", "subquery", "legacy_query"])96    @testing.variation("lazy", ["select", "raise", "raise_on_sql"])97    def test_thing(self, querytyp, lazy, decl_base):98        class Thing(decl_base):99            __tablename__ = "thing"100 101            # use name directly102            rel = relationship("Rel", lazy=lazy.name)103 104        # use as a switch105        if querytyp.select:106            stmt = select(Thing)107        elif querytyp.subquery:108            stmt = select(Thing).subquery()109        elif querytyp.legacy_query:110            stmt = Session.query(Thing)111        else:112            querytyp.fail()113 114The variable provided is a slots object of boolean variables, as well115as the name of the case itself under the attribute ".name"116 117Nc3�(# �URv� g7fr)�param)r%�requests  r!r"�variation.<locals>.gos����-�-��s�r�iarU)�inspect�118isfunctionrJ�variation_fixture�119isinstancer��lenr[r�r;�zipr^)�
argname_or_fnr�rcr"�entry�cases_plus_limitationsr��l�120variationsr�rb�121limitations            r!r�r��s<��<���-�(�(��(�(���d�#��	�7�	*�	 �122+�	 ��	����
��E��5�%�(�(�S��Z�1�_�
����
��
���)�)�� 6�7� 6���!� 6�7��J��25��2�
	123 124�2�-�	�-�D��)����)�8��o�o�y�1�2�2�
	125 126�
��
�
����8��	127 128s�	4C5�C:�=.Dc�Z�[[RX5[RUS9$)N)�params�ids�scope)rBr[r�r�)rcr�r�s   r!r�r�&s'����'�'��7��N�N���r$c�.�[R"U0UD6$r)rrB)r+r,s  r!rBrB.s���%�%�s�1�b�1�1r$c�*�[R5$r)rrErr$r!rErE2s���3�3�5�5r$c�*�[R5$r)rr6rr$r!r6r66s���2�2�4�4r$c��\rSrSrSSjrSrg)�_AddToMarkeri:c�6�[[RU5$r)�getattrrr2)r%�attrs  r!rj�_AddToMarker.__getattr__;s���)�7�7��>�>r$rN)r�r|r�r)rJrKrLrMrjrOrr$r!r�r�:s��?r$r�c���\rSrSrSr\R"5r\"5r	Sr129Sr\S5r
\S5r\S5r\S5r\S	5r\S1305r\S5r\S5rS
rSrg)�ConfigiBc�l�URU5 XlX lX0lX@lSUlSUlURR=(a? [R"URRRSS55(+UlSSKJn UR!X5Ulg)N�test_schema�
test_schema_2�async_fallbackFr
)�	provision)�	_set_name�db�db_optsr�file_configr�r��dialect�is_asyncr�asbool�url�query�get�r��is_preferred_driver�is_default_dialect)r%r�r�rr�r�s      r!rf�Config.__init__Cs������r��������&��(���,����131�132�+�+�133�D�K�K��F�F�L�L���-�u�5�5134�1135��
�	 �"+�"?�"?��"I��r$c��SURRSURRSURRRS3$)Nz!sqlalchemy.testing.config.Config(�+z, �))r�rm�driverr��server_version_infor1s r!r}�Config.__repr__WsE��������~�Q�t�w�w�~�~�.�b��w�w���2�2�3�1�
6�	136r$c�p�URR(aSOSnURR(aWSRSURR55nUR<SUR137<U<SU<S3UlgUR<SUR138<U<3Ulg)N�_asyncr��.c3�8# �UHn[U5v� M g7frr{)�.0�toks  r!�	<genexpr>�#Config._set_name.<locals>.<genexpr>as���N�/M��3�s�8�8�/M�s�r�z_[�])r�r�r��joinrmr�)r%r��suffix�svis    r!r��Config._set_name^sn���Z�Z�0�0��b��
�:�:�)�)��(�(�N�r�z�z�/M�/M�N�N�C�*,�'�'�2�9�9�f�c�J�D�I�%'�W�W�b�i�i��@�D�Ir$c��[XX45n[=(d URqURR	U5 U$)z}add a config as one of the global configs.139 140If there are no configs set up yet, this config also141gets set as the "_current".142)r��	any_asyncr��_configs�add)r�r�r�rr��cfgs      r!�register�Config.registerfs7���R�'�7��143�-����	���������144r$c��UqURRqURqUR145qURqUR=Ulqgr)�_currentr�r��db_urlr�r�r��r��config�	namespaces   r!�set_as_current�Config.set_as_currentysE�����������.�.���(�(���,�,�
�"�I�I�%�	��rr$c��[(dS5eUR[U[R[R[R1465U5 g)Nz*Can't push without a default Config set up)r��pushr�r�rr�)r�r�r�s   r!�push_engine�Config.push_engine�sF���x�E�E�E�x������H�$�$�h�&6�&6��8L�8L�
�
�		147r$c�d�URR[5 URX5 gr)�_stack�appendr�r�r�s   r!r��Config.push�s"���148�149���(�#����6�-r$c��UR(a.URSnURS	URX!5 gg)N�����)r�r�)r�r�r�s   r!�pop�150Config.pop�s4���:�:��z�z�"�~�H��151�152�2�����x�3�	r$c��UR(a:URURSU5 URR5 gg)Nr)r�r��clear)r�r�s  r!�reset�Config.reset�s6���:�:����s�z�z�!�}�i�8��J�J����r$c��UR$r)r�)r�s r!�all_configs�Config.all_configs�s���|�|�r$c#�V# �UR5HnURv� M g7fr)r�r�)r�r�s  r!�all_dbs�Config.all_dbs�s����?�?�$�C��&�&�L�%�s�')c��[U5 gr)�	skip_test)r%�msgs  r!r�Config.skip_test�s	���#�r$)	r�r�r�r�r�rmrr�r�N)rJrKrLrMrf�collections�dequer��setr�r}r�r�r�r�r�r�r�r�r�r�rrOrr$r!r�r�Bs���J�"�
�
�
 �F��u�H�153�A�����$�&��&��154��155��.��.��4��4�����156��������r$r�c�,�[RU5er)rr-)rs r!rr�s��157�1580�1590��1605�5r$c�,�[RU5$r)rrHrs r!rHrH�s���(�(��,�,r$)161rVzUnion[Any, Tuple[Any, ...]]rR�
Optional[str]rSr162r,r|r�zCallable[[_FN], _FN])rXzIterable[Tuple[Any, ...]]r)�function)r+rr,rr�r)r�r|)r�r)4�163__future__r�argparserrr�r�rrrrr	r164rrr�rr�
_requirementsrr�SuiteRequirementsr�r�r�r�r�r�r�r��identr�__annotations__r��plugin.plugin_baserrrrPr;rYr[r�r�rBrEr6r�r2r�rrHrr$r!�<module>rsY��#����
����������+����.�.�0��	��	
��165�������
��	���������	���4�(�(���D/�0���e�8�C��H�-�.��166#��H�&�H��H�167�H��	H�168�H�V-�1693O�3O�lB�J�2�6�5�?�?�170��
�h�h�V6�-r$
codekingpro/portable-devtools · Team Ai