internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: aws-cloudformation/cfn-lint

Issue:
E3002 - Template that is valid with 0.78.2 fails with E3002 in 0.79.3
### CloudFormation Lint Version

0.78.2 / 0.79.3

### What operating system are you using?

Mac

### Describe the bug

I have a template that was linted correctly using `cfn-lint@0.78.2`, but it started failing using `cfn-lint@0.79.3`.

It's failing with the following error:

```
E3002 Property is an object instead of String at Resources/RDSDBClusterParameterGroup/Properties/Family
/tmp/stack.yaml:29:7
```

### Expected behavior

Expected it to be a valid template, following the same behavior as the old version.

### Reproduction template

```yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: "CloudFormation Template to create Aurora Postgresql Cluster DB Instance"
Transform:
  - AWS::LanguageExtensions
  - AWS::Serverless-2016-10-31
Parameters:
  DBEngineVersion:
    Description: Select Database Engine Version
    Type: String
    Default: 12.8
    AllowedValues:
      - 12.8
      - 12.12
Mappings:
  DBFamilyMap:
    "11.13":
      "family": "aurora-postgresql11"
    "12.8":
      "family": "aurora-postgresql12"
    "12.12":
      "family": "aurora-postgresql12"
    "13.4":
      "family": "aurora-postgresql13"
Resources:
  RDSDBClusterParameterGroup:
    Type: AWS::RDS::DBClusterParameterGroup
    Properties:
      Description: !Join ["- ", ["Description ", !Ref 'AWS::StackName']]
      Family: !FindInMap [DBFamilyMap, !Ref DBEngineVersion, "family"]
      Parameters:
        rds.force_ssl: 1
        apg_ccm_enabled: 1
```


Discussion:

Resolving patch:
diff --git a/src/cfnlint/template/transforms/_language_extensions.py b/src/cfnlint/template/transforms/_language_extensions.py
--- a/src/cfnlint/template/transforms/_language_extensions.py
+++ b/src/cfnlint/template/transforms/_language_extensions.py
@@ -141,14 +141,15 @@ def _walk(self, item: Any, params: MutableMapping[str, Any], cfn: Any):
                             return obj[k]
                     if isinstance(v, list):
                         only_string, obj[k][0] = self._replace_string_params(
-                            v[0], params
+                            v[0],
+                            params,
                         )
                         if only_string:
                             return obj[k][0]
                 elif k == "Fn::FindInMap":
                     try:
                         mapping = _ForEachValueFnFindInMap(get_hash(v), v)
-                        map_value = mapping.value(cfn, params)
+                        map_value = mapping.value(cfn, params, True)
                         if map_value is None:
                             del obj[k]
                             continue


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
E2520 raised for mutually exclusive properties when using Conditions
### CloudFormation Lint Version

cfn-lint 0.80.2

### What operating system are you using?

Windows

### Describe the bug

[E2520](https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md#E2520) is raised for mutually exclusive properties when using Conditions

```
cfn-lint -t ./template.yaml
E2520 Property SourceSecurityGroupId should NOT exist with CidrIp for Resources/Ingress/Properties
.\template.yaml:13:7
```

The same was working prior `0.79.11`. PR  [2875](https://github.com/aws-cloudformation/cfn-lint/pull/2875) seems to be the cause.

```
> cfn-lint --version            
cfn-lint 0.79.10
> cfn-lint -t ./template.yaml   
> echo $lastexitcode
0
```

### Expected behavior

E2520 is ignored for mutually exclusive properties that use the same Condition and Fn::If intrinsic function which makes sure only one of the properties has value.

### Reproduction template

```yaml
AWSTemplateFormatVersion: 2010-09-09
Parameters:
  pCidr:
    Type: String
    Default: ''
Conditions:
  cIsCidr: !Not [!Equals [!Ref pCidr, '']]
Resources:
  Ingress:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      SourceSecurityGroupId: !If [ cIsCidr, !Ref AWS::NoValue, sg-abc12345 ]
      CidrIp: !If [ cIsCidr, !Ref pCidr, !Ref AWS::NoValue ]
      IpProtocol: "-1"
      GroupId: sg-abc1234567
```


Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/properties/Exclusive.py b/src/cfnlint/rules/resources/properties/Exclusive.py
--- a/src/cfnlint/rules/resources/properties/Exclusive.py
+++ b/src/cfnlint/rules/resources/properties/Exclusive.py
@@ -38,7 +38,7 @@ def check(self, properties, exclusions, path, cfn):
                 for property_set in property_sets:
                     obj = property_set["Object"].clean()
                     for prop in obj:
-                        if prop in exclusions:
+                        if prop == k:
                             for excl_property in exclusions[prop]:
                                 if excl_property in obj:
                                     if property_set["Scenario"] is None:


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Using AWS::LanguageExtensions breaks VPCAccessPolicy usage
### CloudFormation Lint Version

0.79.10

### What operating system are you using?

Regolith

### Describe the bug

Adding the `AWS::LanguageExtensions` transformation before the SAM transformation causes cfn-lint to fail on a template that contains the `VPCAccessPolicy` policy template.  Removing the transformation allows cfn-lint to succeed as expected.

I tried updating the spec files but `cfn-lint -u` hangs.  (I waited ~> 30 min.)

```
$ cfn-lint mse.yaml
$ cfn-lint mfe.yaml
E0001 Error transforming template: Resource with id [MyFunction] is invalid. Policy at index 0 in the 'Policies' property is not valid
mfe.yaml:1:1

$ diff mse.yaml mfe.yaml 
2a3
>   - AWS::LanguageExtensions
```

### Expected behavior

I expect cfn-lint to succeed whether or not the `AWS::LanguageExtensions` transformation is specified.

### Reproduction template

```yaml
AWSTemplateFormatVersion: 2010-09-09
Transform:
  - AWS::LanguageExtensions
  - AWS::Serverless-2016-10-31

Resources:
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: bootstrap
      Runtime: provided.al2
      Policies:
        - VPCAccessPolicy: {}
```


Discussion:

Resolving patch:
diff --git a/src/cfnlint/template/transforms/_language_extensions.py b/src/cfnlint/template/transforms/_language_extensions.py
--- a/src/cfnlint/template/transforms/_language_extensions.py
+++ b/src/cfnlint/template/transforms/_language_extensions.py
@@ -181,10 +181,11 @@ def _walk(self, item: Any, params: MutableMapping[str, Any], cfn: Any):
                     # a sub object may be none or we have returned
                     # an empty object.  We don't want to remove empty
                     # strings "" or 0 (zeros)
-                    if sub_value is None or sub_value == {}:
+                    # Remove `or sub_value == {}` for issue #2896
+                    if sub_value is None:
                         del obj[k]
                     else:
-                        obj[k] = self._walk(v, params, cfn)
+                        obj[k] = sub_value
         elif isinstance(obj, list):
             for i, v in enumerate(obj):
                 obj[i] = self._walk(v, params, cfn)


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
E1017 Select does not find already supported function when using complex list with nested Selects
### CloudFormation Lint Version

cfn-lint 0.80.4

### What operating system are you using?

Mac

### Describe the bug

When launching a template with complex nested Selects and list to extract value from, it seems to be reporting E1017 while it should not. Templates are correctly deployed and work fine on my side.

Output from command
```
E1017 Select should use a supported function of Fn::FindInMap, Fn::GetAtt, Fn::GetAZs, Fn::If, Fn::Split, Fn::Cidr, Ref
/file1.yml:3189:11
```

### Expected behavior

No E1017 reported by cfn-lint.
Template is working fine in Cloudformation, E1017 should not be reported.

### Reproduction template

AWSTemplateFormatVersion: '2010-09-09'
Description: 'Build EC2 instance'

Resources:
  MountTarget1:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: fs-1234567svsdabsf76s
# E1017 STARTS HERE
      SubnetId: !Select
        - 0
        - !Select
          - 0
          - [
              [
                "subnet-0987sknlnsdoi9j76",
                "subnet-875jgyjlpzj75j8k0",
                "subnet-5447hnd6hI8js45js"
            ],
            [
                "subnet-0987sknlnsdoi9j76",
                "subnet-875jgyjlpzj75j8k0",
                "subnet-5447hnd6hI8js45js"
            ],
            [
                "subnet-0987sknlnsdoi9j76",
                "subnet-875jgyjlpzj75j8k0",
                "subnet-5447hnd6hI8js45js"
            ] 
          ]
      SecurityGroups: [sg-00qdqeef0a5c345gf]



Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/functions/Select.py b/src/cfnlint/rules/functions/Select.py
--- a/src/cfnlint/rules/functions/Select.py
+++ b/src/cfnlint/rules/functions/Select.py
@@ -20,6 +20,7 @@ class Select(CloudFormationLintRule):
         "Fn::If",
         "Fn::Split",
         "Fn::Cidr",
+        "Fn::Select",  # issue: 2895
         "Ref",
     ]
 


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Fn::Sub with Fn::GetAtt dot notation fails when AWS::LanguageExtensions Transform is included
### CloudFormation Lint Version

cfn-lint 0.80.2

### What operating system are you using?

Mac

### Describe the bug

Receiving the following exception when including an Fn::Sub intrinsic function with Fn::GetAtt dot notation (Ex: `{"Fn::Sub": "${Role.Arn}"}`) when passed to the Role property of Lambda AND when the `AWS::LanguageExtensions` Transform is included within the template (where removing the `AWS::LanguageExtensions` Transform reference causes it to succeed):

```
E3031: Role contains invalid characters (Pattern: ^arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+$) at Resources/Function/Properties/Role
```

### Expected behavior

Expect to no longer receive an error when the AWS::LanguageExtensions Transform is included with an Fn::Sub with Fn::GetAtt intrinsic function dot notation.

### Reproduction template

```yaml
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::LanguageExtensions
Resources:
  Role:
    Type: AWS::IAM::Role
    Properties:
      RoleName: myrolename
      AssumeRolePolicyDocument: InsertRole
  Function:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: Bucket
        S3Key: Key
      Handler: index.handler
      Runtime: java8
      Role:
        "Fn::Sub": "${Role.Arn}"
```

where when the `AWS::LanguageExtensions` Transform is removed, the cfn-lint error is no longer shown.


Discussion:

Resolving patch:
diff --git a/src/cfnlint/template/transforms/_language_extensions.py b/src/cfnlint/template/transforms/_language_extensions.py
--- a/src/cfnlint/template/transforms/_language_extensions.py
+++ b/src/cfnlint/template/transforms/_language_extensions.py
@@ -194,7 +194,7 @@ def _walk(self, item: Any, params: MutableMapping[str, Any], cfn: Any):
     def _replace_string_params(
         self, s: str, params: Mapping[str, Any]
     ) -> Tuple[bool, str]:
-        pattern = r"\${[a-zA-Z0-9:]+}"
+        pattern = r"\${[a-zA-Z0-9\.:]+}"
         if not re.search(pattern, s):
             return (True, s)
         for k, v in params.items():


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Use samtranslate `passthrough_metadata` to support ignoring checks on Serverless resources
### Is this feature request related to a new rule or cfn-lint capabilities?

_No response_

### Describe the feature you'd like to request

Based on this: https://github.com/aws/serverless-application-model/pull/2224, it looks like it should be possible to ask SAM to bring all the Metadata stored on the original AWS::Serverless::* resources through to the translated resources. Doing that should allow cfn-lint to check the Metadata section for resource level ignores.

I actually tried changing the parameter myself but couldn't get it working. I must be missing something....

### Describe the solution you'd like

Enable `passthrough_metadata` on the samtranslate `translate` call to bring ALL the metadata through and properly support resource level ignores on serverless resources.

### Additional context

This is where I tried to add the parameter: https://github.com/aws-cloudformation/cfn-lint/blob/main/src/cfnlint/template/transforms/_sam.py#L155

### Is this something that you'd be interested in working on?

- [X] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change


Discussion:

Resolving patch:
diff --git a/src/cfnlint/template/transforms/_sam.py b/src/cfnlint/template/transforms/_sam.py
--- a/src/cfnlint/template/transforms/_sam.py
+++ b/src/cfnlint/template/transforms/_sam.py
@@ -152,7 +152,9 @@ def transform_template(self):
 
             self._template = convert_dict(
                 sam_translator.translate(
-                    sam_template=self._template, parameter_values=self._parameters
+                    sam_template=self._template,
+                    parameter_values=self._parameters,
+                    passthrough_metadata=True,
                 )
             )
 


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Condition Specified but with no condition passes linting but fails deploy
### CloudFormation Lint Version

0.83.1

### What operating system are you using?

mac/ubuntu

### Describe the bug

in a cfn template if you specify root level item `Conditions` but have no conditions this passes cfn-lint but always fails on deploy

### Expected behavior

cfn-lint should fail if there is a Conditions root level object but no array entries under it.

### Reproduction template

```
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  myParam
Conditions:
Resources:
  myTopic:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: mytopic
      TopicName: mytopic
```


Discussion:
This breaks pretty hard in v1 but yea we are missing some extra logic here in v0.  Probably an unfortunate change to allowing null values and not building up some of the other logic.

Resolving patch:
diff --git a/src/cfnlint/rules/conditions/Configuration.py b/src/cfnlint/rules/conditions/Configuration.py
--- a/src/cfnlint/rules/conditions/Configuration.py
+++ b/src/cfnlint/rules/conditions/Configuration.py
@@ -26,8 +26,10 @@ class Configuration(CloudFormationLintRule):
     def match(self, cfn):
         matches = []
 
-        conditions = cfn.template.get("Conditions", {})
-        if conditions:
+        if "Conditions" not in cfn.template:
+            return matches
+        conditions = cfn.template.get("Conditions", None)
+        if isinstance(conditions, dict):
             for condname, condobj in conditions.items():
                 if not isinstance(condobj, dict):
                     message = "Condition {0} has invalid property"
@@ -52,5 +54,12 @@ def match(self, cfn):
                                         message.format(condname, k),
                                     )
                                 )
+        else:
+            matches.append(
+                RuleMatch(
+                    ["Conditions"],
+                    "Condition must be an object",
+                )
+            )
 
         return matches


Test patch:
diff --git a/test/fixtures/templates/bad/conditions_type.yaml b/test/fixtures/templates/bad/conditions_type.yaml
new file mode 100644
--- /dev/null
+++ b/test/fixtures/templates/bad/conditions_type.yaml
@@ -0,0 +1,8 @@
+AWSTemplateFormatVersion: "2010-09-09"
+Conditions:
+Resources:
+    myTopic:
+      Type: AWS::SNS::Topic
+      Properties:
+        DisplayName: mytopic
+        TopicName: mytopic
diff --git a/test/unit/rules/conditions/test_configuration.py b/test/unit/rules/conditions/test_configuration.py
--- a/test/unit/rules/conditions/test_configuration.py
+++ b/test/unit/rules/conditions/test_configuration.py
@@ -22,6 +22,10 @@ def test_file_positive(self):
         """Test Positive"""
         self.helper_file_positive()
 
+    def test_file_negative_type(self):
+        """Test failure"""
+        self.helper_file_negative("test/fixtures/templates/bad/conditions_type.yaml", 1)
+
     def test_file_negative(self):
         """Test failure"""
         self.helper_file_negative("test/fixtures/templates/bad/conditions.yaml", 4)
Repository: cupy/cupy

Issue:
UnicodeDecodeError in compiler.py
Reported here: https://stackoverflow.com/questions/45473903/unicodedecodeerror-when-i-use-cuda-to-train-dataset

Versions:
- chainer (2.0.2)
- cupy (1.0.2)

It seems `nvcc` generated non-UTF8 output.


Discussion:

Resolving patch:
diff --git a/cupy/cuda/compiler.py b/cupy/cuda/compiler.py
--- a/cupy/cuda/compiler.py
+++ b/cupy/cuda/compiler.py
@@ -93,9 +93,8 @@ def preprocess(source, options=()):
         cmd.append(cu_path)
         pp_src = _run_nvcc(cmd, root_dir)
 
-        if isinstance(pp_src, six.binary_type):
-            pp_src = pp_src.decode('utf-8')
-        return re.sub('(?m)^#.*$', '', pp_src)
+        assert isinstance(pp_src, six.binary_type)
+        return re.sub(b'(?m)^#.*$', b'', pp_src)
 
 
 _default_cache_dir = os.path.expanduser('~/.cupy/kernel_cache')


Test patch:
Repository: cupy/cupy

Issue:
Output of cupy.get_array_module is not correct
When the input to cupy.get_array_module is a "cupy.sparse" matrix, this function returns  "numpy". 

```
>>> import cupy
>>> a = cupy.array([0,0,1], dtype=xp.float32)
>>> a = cupy.sparse.csr_matrix(a)
>>> cupy.get_array_module(a)
<module 'numpy' from '.../numpy/__init__.py'>
```
I think the output should be "cupy".
cupy version: 2.0.0rc1


Discussion:

Resolving patch:
diff --git a/cupy/__init__.py b/cupy/__init__.py
--- a/cupy/__init__.py
+++ b/cupy/__init__.py
@@ -40,6 +40,7 @@ def is_available():
 from cupy import padding  # NOQA
 from cupy import random  # NOQA
 from cupy import sorting  # NOQA
+from cupy import sparse  # NOQA
 from cupy import statistics  # NOQA
 from cupy import testing  # NOQA  # NOQA
 from cupy import util  # NOQA
@@ -518,7 +519,7 @@ def get_array_module(*args):
 
     """
     for arg in args:
-        if isinstance(arg, ndarray):
+        if isinstance(arg, (ndarray, sparse.spmatrix)):
             return _cupy
     return numpy
 


Test patch:
diff --git a/tests/cupy_tests/test_numpy_interop.py b/tests/cupy_tests/test_numpy_interop.py
new file mode 100644
--- /dev/null
+++ b/tests/cupy_tests/test_numpy_interop.py
@@ -0,0 +1,49 @@
+import unittest
+
+import numpy
+
+import cupy
+from cupy import testing
+
+
+try:
+    import scipy.sparse
+    scipy_available = True
+except ImportError:
+    scipy_available = False
+
+
+@testing.gpu
+class TestGetArrayModule(unittest.TestCase):
+
+    def test_get_array_module_1(self):
+        n1 = numpy.array([2], numpy.float32)
+        c1 = cupy.array([2], numpy.float32)
+        csr1 = cupy.sparse.csr_matrix((5, 3), dtype=numpy.float32)
+
+        self.assertIs(numpy, cupy.get_array_module())
+        self.assertIs(numpy, cupy.get_array_module(n1))
+        self.assertIs(cupy, cupy.get_array_module(c1))
+        self.assertIs(cupy, cupy.get_array_module(csr1))
+
+        self.assertIs(numpy, cupy.get_array_module(n1, n1))
+        self.assertIs(cupy, cupy.get_array_module(c1, c1))
+        self.assertIs(cupy, cupy.get_array_module(csr1, csr1))
+
+        self.assertIs(cupy, cupy.get_array_module(n1, csr1))
+        self.assertIs(cupy, cupy.get_array_module(csr1, n1))
+        self.assertIs(cupy, cupy.get_array_module(c1, n1))
+        self.assertIs(cupy, cupy.get_array_module(n1, c1))
+        self.assertIs(cupy, cupy.get_array_module(c1, csr1))
+        self.assertIs(cupy, cupy.get_array_module(csr1, c1))
+
+        if scipy_available:
+            csrn1 = scipy.sparse.csr_matrix((5, 3), dtype=numpy.float32)
+
+            self.assertIs(numpy, cupy.get_array_module(csrn1))
+            self.assertIs(cupy, cupy.get_array_module(csrn1, csr1))
+            self.assertIs(cupy, cupy.get_array_module(csr1, csrn1))
+            self.assertIs(cupy, cupy.get_array_module(c1, csrn1))
+            self.assertIs(cupy, cupy.get_array_module(csrn1, c1))
+            self.assertIs(numpy, cupy.get_array_module(n1, csrn1))
+            self.assertIs(numpy, cupy.get_array_module(csrn1, n1))
Repository: cupy/cupy

Issue:
cupy.array(cupy_array, oder=None) raises error
When I do this:
```python
>>> x = cupy.ones(3)
>>> xx = cupy.array(x, order=None)
```
I get this traceback:
```

  File "[...]/cupy/cupy/creation/from_data.py", line 41, in array
    return core.array(obj, dtype, copy, order, subok, ndmin)

  File "cupy/core/core.pyx", line 2026, in cupy.core.core.array
    cpdef ndarray array(obj, dtype=None, bint copy=True, str order='K',

  File "cupy/core/core.pyx", line 2039, in cupy.core.core.array
    a = src.astype(dtype, order=order, copy=copy)

  File "cupy/core/core.pyx", line 276, in cupy.core.core.ndarray.astype
    cpdef ndarray astype(

  File "cupy/core/core.pyx", line 313, in cupy.core.core.ndarray.astype
    raise TypeError('order not understood')

TypeError: order not understood
```


Discussion:

Resolving patch:
diff --git a/cupy/indexing/generate.py b/cupy/indexing/generate.py
--- a/cupy/indexing/generate.py
+++ b/cupy/indexing/generate.py
@@ -275,7 +275,7 @@ def unravel_index(indices, dims, order='C'):
     .. seealso:: :func:`numpy.unravel_index`
 
     """
-    if order == 'C':
+    if order in ('C', None):
         dims = reversed(dims)
     elif order == 'F':
         pass


Test patch:
diff --git a/tests/cupy_tests/core_tests/test_ndarray.py b/tests/cupy_tests/core_tests/test_ndarray.py
--- a/tests/cupy_tests/core_tests/test_ndarray.py
+++ b/tests/cupy_tests/core_tests/test_ndarray.py
@@ -63,6 +63,13 @@ def test_order(self):
         self.assertTrue(a.flags.f_contiguous)
         self.assertTrue(not a.flags.c_contiguous)
 
+    def test_order_none(self):
+        a = core.ndarray(self.shape, order=None)
+        a_cpu = numpy.ndarray(self.shape, order=None)
+        self.assertEqual(a.flags.c_contiguous, a_cpu.flags.c_contiguous)
+        self.assertEqual(a.flags.f_contiguous, a_cpu.flags.f_contiguous)
+        self.assertTupleEqual(a.strides, a_cpu.strides)
+
 
 @testing.gpu
 class TestNdarrayInitRaise(unittest.TestCase):
diff --git a/tests/cupy_tests/core_tests/test_ndarray_copy_and_view.py b/tests/cupy_tests/core_tests/test_ndarray_copy_and_view.py
--- a/tests/cupy_tests/core_tests/test_ndarray_copy_and_view.py
+++ b/tests/cupy_tests/core_tests/test_ndarray_copy_and_view.py
@@ -70,7 +70,7 @@ def test_transposed_fill(self, xp, dtype):
         b.fill(1)
         return b
 
-    @testing.for_orders('CFAK')
+    @testing.for_orders(['C', 'F', 'A', 'K', None])
     @testing.for_all_dtypes(name='src_dtype', no_complex=True)
     @testing.for_all_dtypes(name='dst_dtype')
     @testing.numpy_cupy_array_equal()