3 D\u@s8dZddlZddlmZddlmZGdddeZdS)a Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. N)CloudFormationLintRule) RuleMatchc@s0eZdZdZdZdZdZdZddgZdd Z d S) Splitz!Check if Split values are correctZE1018zSplit validation of parametersz5Making sure the split function is properly configuredzfhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.htmlZ functionssplitc Csg}|jd}dddddddd d d g }x|D]}|d}|d d}t|trt|dkrp|d}|d } t|tjsd} |jt|dg| jdj t t |t| t r:t| d krxr| j D]>\} } | |krd} |jt|| g| j| dj t t |qWn&d} |jt|| jdj t t |n4t| tjsd} |jt|| jdj t t |n&d} |jt|| jdj t t |q.d} |jt|| jdj t t |q.W|S)zCheck CloudFormation Joinz Fn::Splitz Fn::Base64z Fn::FindInMapz Fn::GetAttz Fn::GetAZszFn::ImportValuezFn::IfzFn::Joinz Fn::SelectzFn::SubZRefNrz0Split delimiter has to be of type string for {0}/z1Fn::Split doesn't support the function {0} at {1}z1Split list of singular function or string for {0}z8Split has to be of type string or valid function for {0}z%Split should be an array of 2 for {0}r )Zsearch_deep_keys isinstancelistlensix string_typesappendrformatjoinmapstrdictitems) selfZcfnmatchesZ split_objsZsupported_functionsZ split_objZsplit_value_objtreeZsplit_delimiterZ split_stringmessagekey_rw/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/cfn-lint/cfnlint/rules/functions/Split.pymatchsX    " * z Split.matchN) __name__ __module__ __qualname____doc__idZ shortdesc descriptionZ source_urltagsrrrrrrsr)r"r Zcfnlintrrrrrrrs