nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: mikedh/trimesh
Pull request #348 (2019-03-18 12:19:56)

Enhance arguments to PointCloud.__init__()
- color is renamed to colors
- checks invalid (unused) args and kwargs

For me, `colors` looks better. What do you think? @mikedh 


Patch:
diff --git a/trimesh/points.py b/trimesh/points.py
index 3821e982..27203ec8 100644
--- a/trimesh/points.py
+++ b/trimesh/points.py
@@ -5,9 +5,11 @@ points.py
 Functions dealing with (n, d) points.
 """
 import copy
+import warnings
 
 import numpy as np
 
+from .constants import log
 from .constants import tol
 from .geometry import plane_transform
 from .parent import Geometry
@@ -347,7 +349,7 @@ class PointCloud(Geometry):
     in a scene.
     """
 
-    def __init__(self, vertices, *args, **kwargs):
+    def __init__(self, vertices, colors=None, color=None):
         self._data = caching.DataStore()
         self._cache = caching.Cache(self._data.md5)
         self.metadata = {}
@@ -355,8 +357,13 @@ class PointCloud(Geometry):
         # load vertices
         self.vertices = vertices
 
-        if 'color' in kwargs:
-            self.colors = kwargs['color']
+        if colors is not None:
+            self.colors = colors
+        elif color is not None:
+            warnings.warn(
+                "argument 'color' is deprecated, use 'colors' instead",
+                DeprecationWarning)
+            self.colors = color
 
     def __setitem__(self, *args, **kwargs):
         return self.vertices.__setitem__(*args, **kwargs)


Test patch:
diff --git a/tests/generic.py b/tests/generic.py
index 533f1fc5..e8067ebe 100644
--- a/tests/generic.py
+++ b/tests/generic.py
@@ -17,6 +17,7 @@ import itertools
 import subprocess
 import contextlib
 import threading
+import warnings
 
 try:
     # Python 3
diff --git a/tests/test_points.py b/tests/test_points.py
index ddad7358..bb2e723d 100644
--- a/tests/test_points.py
+++ b/tests/test_points.py
@@ -66,6 +66,20 @@ class PointsTest(g.unittest.TestCase):
         assert g.np.allclose(cloud.vertices,
                              cloud.copy().vertices)
 
+    def test_init_arguments(self):
+        vertices = [[0, 0, 0], [1, 1, 1]]
+        colors = [[0, 0, 1.0], [1.0, 0, 0]]
+        # deprecated color -> colors
+        with g.warnings.catch_warnings(record=True) as w:
+            g.warnings.simplefilter('always')
+            p = g.trimesh.PointCloud(vertices=vertices, color=colors)
+        self.assertEqual(len(w), 1)
+        self.assertIs(w[0].category, DeprecationWarning)
+        g.np.testing.assert_allclose(p.colors, colors)
+        # introduced colors
+        p = g.trimesh.PointCloud(vertices=vertices, colors=colors)
+        g.np.testing.assert_allclose(p.colors, colors)
+
     def test_empty(self):
         p = g.trimesh.PointCloud(None)
         assert p.is_empty
Repository: postcss/autoprefixer
Pull request #1054 (2018-05-31 19:26:00)

[css-grid] Grid-gap: two values, gap prop
* Support two values #1044 
* Support new `gap` property #1046 

ai: Looks good. Will merge and release few hours later.

Patch:
diff --git a/lib/hacks/grid-utils.js b/lib/hacks/grid-utils.js
index bd4ce2a..e380e8e 100644
--- a/lib/hacks/grid-utils.js
+++ b/lib/hacks/grid-utils.js
@@ -357,16 +357,19 @@ function insertAreas(areas, decl, result) {
 
 function getGridGap(decl) {
 
-    let gap = {};
+    const gap = {};
 
     // try to find gap
-    decl.parent.walkDecls(/grid(-(row|column))?-gap/, ({ prop, value }) => {
-        if (prop === 'grid-gap') {
-            gap.column = value;
-            gap.row = value;
+    const testGap = /^(grid-)?((row|column)-)?gap$/;
+    decl.parent.walkDecls(testGap, ({ prop, value }) => {
+        if (/^(grid-)?gap$/.test(prop)) {
+            const [row = {},, column = {}] = parser(value).nodes;
+
+            gap.row = row.value;
+            gap.column = column.value || row.value;
         }
-        if (prop === 'grid-row-gap') gap.row = value;
-        if (prop === 'grid-column-gap') gap.column = value;
+        if (/^(grid-)?row-gap$/.test(prop)) gap.row = value;
+        if (/^(grid-)?column-gap$/.test(prop)) gap.column = value;
     });
 
     return gap;


Test patch:
diff --git a/test/cases/grid-gap.css b/test/cases/grid-gap.css
index b1011ac..91a47a0 100644
--- a/test/cases/grid-gap.css
+++ b/test/cases/grid-gap.css
@@ -25,7 +25,7 @@
 }
 
 .f {
-    grid-gap: 10px;
+    gap: 10px 20px;
     grid-template-columns: 1fr 1fr 1fr;
     grid-template-areas:
         "head head head"
@@ -34,7 +34,7 @@
 }
 
 .a-shortcut {
-    grid-gap: 1rem;
+    grid-gap: 1rem 2rem;
     grid-template:
         "head-shortcut head-shortcut  head-shortcut" 1fr
         "nav-shortcut  main-shortcut  main-shortcut" minmax(100px, 1fr)
diff --git a/test/cases/grid-gap.out.css b/test/cases/grid-gap.out.css
index bd81c88..c3c837b 100644
--- a/test/cases/grid-gap.out.css
+++ b/test/cases/grid-gap.out.css
@@ -39,8 +39,8 @@
 }
 
 .f {
-    grid-gap: 10px;
-    -ms-grid-columns: 1fr 10px 1fr 10px 1fr;
+    gap: 10px 20px;
+    -ms-grid-columns: 1fr 20px 1fr 20px 1fr;
     grid-template-columns: 1fr 1fr 1fr;
     -ms-grid-rows: auto 10px auto 10px auto;
     grid-template-areas:
@@ -50,9 +50,9 @@
 }
 
 .a-shortcut {
-    grid-gap: 1rem;
+    grid-gap: 1rem 2rem;
     -ms-grid-rows: 1fr 1rem minmax(100px, 1fr) 1rem 2fr;
-    -ms-grid-columns: 1fr 1rem 100px 1rem 1fr;
+    -ms-grid-columns: 1fr 2rem 100px 2rem 1fr;
     grid-template:
         "head-shortcut head-shortcut  head-shortcut" 1fr
         "nav-shortcut  main-shortcut  main-shortcut" minmax(100px, 1fr)
Repository: postcss/autoprefixer
Pull request #1159 (2018-11-27 04:58:22)

Remove warning from grid-[column/row]-end: span X; + grid-area combo …
…(#1157)

* Add clause to warnIfGridRowColumnExists method in lib/hacks/grid-utils.js

* Update tests


Patch:
diff --git a/lib/hacks/grid-utils.js b/lib/hacks/grid-utils.js
index 825224f..9d22523 100644
--- a/lib/hacks/grid-utils.js
+++ b/lib/hacks/grid-utils.js
@@ -741,7 +741,9 @@ function warnIfGridRowColumnExists (decl, result) {
   let rule = decl.parent
   let decls = []
   rule.walkDecls(/^grid-(row|column)/, d => {
-    decls.push(d)
+    if (!/-end$/.test(d.prop) && !/^span/.test(d.value)) {
+      decls.push(d)
+    }
   })
   if (decls.length > 0) {
     decls.forEach(d => {


Test patch:
diff --git a/test/autoprefixer.test.js b/test/autoprefixer.test.js
index d7f0c8e..bad53e7 100644
--- a/test/autoprefixer.test.js
+++ b/test/autoprefixer.test.js
@@ -619,6 +619,9 @@ describe('hacks', () => {
         'grid-area or grid-row, not both',
         'autoprefixer: <css input>:29:3: You already have a grid-area ' +
         'declaration present in the rule. You should use either ' +
+        'grid-area or grid-column, not both',
+        'autoprefixer: <css input>:34:3: You already have a grid-area ' +
+        'declaration present in the rule. You should use either ' +
         'grid-area or grid-column, not both'
       ])
   })
diff --git a/test/cases/grid-area.css b/test/cases/grid-area.css
index 7c8340a..01345c4 100644
--- a/test/cases/grid-area.css
+++ b/test/cases/grid-area.css
@@ -28,3 +28,19 @@
   grid-row: 1;
   grid-column: 2;
 }
+
+.h {
+  grid-area: 3 / 1;
+  grid-column: 1 / span 4;
+}
+
+/* there should be no warning */
+.i {
+  grid-area: 3 / 1;
+  grid-column-end: span 4;
+}
+
+.j {
+  grid-area: 3 / 1;
+  grid-row-end: span 4;
+}
diff --git a/test/cases/grid-area.out.css b/test/cases/grid-area.out.css
index 580766e..43ceebe 100644
--- a/test/cases/grid-area.out.css
+++ b/test/cases/grid-area.out.css
@@ -47,3 +47,28 @@
   grid-row: 1;
   grid-column: 2;
 }
+
+.h {
+  -ms-grid-row: 3;
+  -ms-grid-column: 1;
+  grid-area: 3 / 1;
+  -ms-grid-column-span: 4;
+  grid-column: 1 / span 4;
+}
+
+/* there should be no warning */
+.i {
+  -ms-grid-row: 3;
+  -ms-grid-column: 1;
+  grid-area: 3 / 1;
+  -ms-grid-column-span: 4;
+  grid-column-end: span 4;
+}
+
+.j {
+  -ms-grid-row: 3;
+  -ms-grid-column: 1;
+  grid-area: 3 / 1;
+  -ms-grid-row-span: 4;
+  grid-row-end: span 4;
+}
Repository: postcss/autoprefixer
Pull request #1172 (2018-12-16 18:02:02)

Add warning for some content-distribution and alignement properties
The values `start` and `end` for the properties `justify-content` and `align-content` has [mixed support in Flexbox layout](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content#Support_in_Flex_layout) and behave the same as `flex-start` and `flex-end`. This PR warns the user the Flexbox specific value has better support and should be preferred.

Fixes: https://github.com/postcss/autoprefixer/issues/1170


Patch:
diff --git a/lib/processor.js b/lib/processor.js
index 771f249..66918fa 100644
--- a/lib/processor.js
+++ b/lib/processor.js
@@ -87,6 +87,12 @@ class Processor {
         return displayGrid || gridTemplate || gridGap
       })
     }
+    function insideFlex (decl) {
+      return decl.parent.some(
+        subDecl =>
+          subDecl.prop === 'display' && /(inline-)?flex/.test(subDecl.value)
+      )
+    }
 
     let gridPrefixes = this.gridStatus(css, result) &&
                        this.prefixes.add['grid-area'] &&
@@ -125,6 +131,17 @@ class Processor {
             { node: decl }
           )
         }
+      } else if (
+        /^(align|justify|place)-(items|content)$/.test(prop) &&
+        insideFlex(decl)
+      ) {
+        if (value === 'start' || value === 'end') {
+          result.warn(
+            `${ value } value has mixed support, consider using ` +
+              `flex-${ value } instead`,
+            { node: decl }
+          )
+        }
       } else {
         if (gridPrefixes) {
           if (/^(align|justify|place)-items$/.test(prop) && insideGrid(decl)) {


Test patch:
diff --git a/test/autoprefixer.test.js b/test/autoprefixer.test.js
index dc0de10..63ad525 100644
--- a/test/autoprefixer.test.js
+++ b/test/autoprefixer.test.js
@@ -547,6 +547,23 @@ describe('hacks', () => {
     ])
   })
 
+  it('warns on mixed support usage', () => {
+    let css =
+      'a { display: flex; align-content: start; justify-content: end; }'
+    let result = postcss([
+      autoprefixer({
+        browsers: ['IE 11']
+      })
+    ]).process(css)
+    expect(result.css).toEqual(css)
+    expect(result.warnings().map(i => i.toString())).toEqual([
+      'autoprefixer: <css input>:1:20: start value has mixed support, ' +
+        'consider using flex-start instead',
+      'autoprefixer: <css input>:1:42: end value has mixed support, ' +
+        'consider using flex-end instead'
+    ])
+  })
+
   it('supports intrinsic sizing', () => {
     let input = read('intrinsic')
     let output = read('intrinsic.out')
Repository: postcss/autoprefixer
Pull request #1182 (2019-01-20 11:13:16)

Fix 'implement' typo
I think there was a small typo: `impliment` instead of `implement`.


Patch:
diff --git a/lib/hacks/grid-utils.js b/lib/hacks/grid-utils.js
index e4d6e0a..3c7ba42 100644
--- a/lib/hacks/grid-utils.js
+++ b/lib/hacks/grid-utils.js
@@ -943,7 +943,7 @@ function warnGridGap ({
     delete gap.column
     decl.warn(
       result,
-      'Can not impliment grid-gap without grid-template-columns'
+      'Can not implement grid-gap without grid-template-columns'
     )
   }
 }


Test patch:
diff --git a/test/autoprefixer.test.js b/test/autoprefixer.test.js
index ec9ee5f..93ad04e 100644
--- a/test/autoprefixer.test.js
+++ b/test/autoprefixer.test.js
@@ -605,14 +605,14 @@ describe('hacks', () => {
         'without grid-template-columns property',
       'autoprefixer: <css input>:36:3: Can not prefix grid-column-end ' +
         '(grid-column-start is not found)',
-      'autoprefixer: <css input>:39:3: Can not impliment grid-gap ' +
+      'autoprefixer: <css input>:39:3: Can not implement grid-gap ' +
         'without grid-template-columns',
       'autoprefixer: <css input>:39:3: Can not find grid areas: ' +
         'head, nav, main, foot',
-      'autoprefixer: <css input>:47:3: Can not impliment grid-gap ' +
+      'autoprefixer: <css input>:47:3: Can not implement grid-gap ' +
         'without grid-template-columns',
       'autoprefixer: <css input>:47:3: Can not find grid areas: a',
-      'autoprefixer: <css input>:55:3: Can not impliment grid-gap ' +
+      'autoprefixer: <css input>:55:3: Can not implement grid-gap ' +
         'without grid-template-columns',
       'autoprefixer: <css input>:55:3: Can not find grid areas: b',
       'autoprefixer: <css input>:63:3: Can not find grid areas: c',
Repository: postcss/autoprefixer
Pull request #1378 (2020-11-26 17:43:53)

fixed misspelling of "subtract" for mask-composite
Just changed "substract" to "subtract" so `mask-composite: subtract` outputs `-webkit-mask-composite: source-out`


Patch:
diff --git a/lib/hacks/mask-composite.js b/lib/hacks/mask-composite.js
index 824acc5..67b6902 100644
--- a/lib/hacks/mask-composite.js
+++ b/lib/hacks/mask-composite.js
@@ -73,7 +73,7 @@ MaskComposite.names = ['mask', 'mask-composite']
 
 MaskComposite.oldValues = {
   add: 'source-over',
-  substract: 'source-out',
+  subtract: 'source-out',
   intersect: 'source-in',
   exclude: 'xor'
 }


Test patch:
diff --git a/test/cases/mask-composite.css b/test/cases/mask-composite.css
index 9a9953b..287d590 100644
--- a/test/cases/mask-composite.css
+++ b/test/cases/mask-composite.css
@@ -19,5 +19,5 @@ a {
 }
 
 a {
-  mask-composite: add, substract, exclude;
+  mask-composite: add, subtract, exclude;
 }
\ No newline at end of file
diff --git a/test/cases/mask-composite.out.css b/test/cases/mask-composite.out.css
index dacc77f..9a8b505 100644
--- a/test/cases/mask-composite.out.css
+++ b/test/cases/mask-composite.out.css
@@ -27,5 +27,5 @@ a {
 
 a {
   -webkit-mask-composite: source-over, source-out, xor;
-          mask-composite: add, substract, exclude;
+          mask-composite: add, subtract, exclude;
 }
\ No newline at end of file
Repository: postcss/autoprefixer
Pull request #1398 (2021-03-04 06:52:24)

Fix error throwing when `supports-selector-fn` has pseudo-classes or pseudo-elements as argument.
Related to #1391


Semigradsky: @dvoytenko @cpmsmith Could you please try this change?

Patch:
diff --git a/lib/supports.js b/lib/supports.js
index b80c765..fb979f7 100644
--- a/lib/supports.js
+++ b/lib/supports.js
@@ -223,10 +223,18 @@ class Supports {
     }
 
     nodes = nodes.filter(i => i !== '')
-    if (typeof nodes[0] === 'string' && nodes[0].includes(':')) {
-      return [brackets.stringify(nodes)]
-    }
 
+    if (typeof nodes[0] === 'string') {
+      let firstNode = nodes[0].trim()
+
+      if (
+        firstNode.includes(':') ||
+        firstNode === 'selector' ||
+        firstNode === 'not selector'
+      ) {
+        return [brackets.stringify(nodes)]
+      }
+    }
     return nodes.map(i => this.normalize(i))
   }
 


Test patch:
diff --git a/test/supports.test.js b/test/supports.test.js
index deda4fa..80d9d61 100644
--- a/test/supports.test.js
+++ b/test/supports.test.js
@@ -155,4 +155,18 @@ describe('process()', () => {
     supports.process(rule)
     expect(rule.params).toEqual('(color black) and not ((-moz-a: 1) or (a: 1))')
   })
+
+  it("shouldn't throw errors", () => {
+    let rule = { params: 'not selector(:is(a, b))' }
+    supports.process(rule)
+    expect(rule.params).toEqual('not selector(:is(a, b))')
+  })
+
+  it("shouldn't throw errors (2)", () => {
+    let rule = { params: ' (selector( :nth-child(1n of a, b) )) or (c: b(1)) ' }
+    supports.process(rule)
+    expect(rule.params).toEqual(
+      ' (selector( :nth-child(1n of a, b) )) or ((c: -moz-b(1)) or (c: b(1))) '
+    )
+  })
 })
Repository: postcss/autoprefixer
Pull request #1420 (2021-08-21 12:29:47)

Fix ::file-selector-button pseudo-element
https://twitter.com/usmanyunusov


Patch:
diff --git a/lib/hacks/file-selector-button.js b/lib/hacks/file-selector-button.js
index d98df51..1f3a9bc 100644
--- a/lib/hacks/file-selector-button.js
+++ b/lib/hacks/file-selector-button.js
@@ -8,7 +8,7 @@ class FileSelectorButton extends Selector {
     if (prefix === '-webkit-') {
       return '::-webkit-file-upload-button'
     }
-    return `::file-selector-button`
+    return `::${prefix}file-selector-button`
   }
 }
 


Test patch:
diff --git a/test/cases/file-selector-button.css b/test/cases/file-selector-button.css
index ebf76b4..b608b36 100644
--- a/test/cases/file-selector-button.css
+++ b/test/cases/file-selector-button.css
@@ -1,3 +1,9 @@
 ::file-selector-button {
   background: black
 }
+input::file-selector-button {
+  color: black
+}
+input:hover::file-selector-button {
+  color: white
+}
diff --git a/test/cases/file-selector-button.out.css b/test/cases/file-selector-button.out.css
index 58e621e..53da7f7 100644
--- a/test/cases/file-selector-button.out.css
+++ b/test/cases/file-selector-button.out.css
@@ -4,3 +4,15 @@
 ::file-selector-button {
   background: black
 }
+input::-webkit-file-upload-button {
+  color: black
+}
+input::file-selector-button {
+  color: black
+}
+input:hover::-webkit-file-upload-button {
+  color: white
+}
+input:hover::file-selector-button {
+  color: white
+}
Repository: postcss/postcss-import
Pull request #513 (2022-12-01 05:29:41)

correctly sort media queries before joining them
fix : #512

This will not help with :

`print and (min-width: 300px)` + `screen and (min-width: 300px)`


Patch:
diff --git a/lib/join-media.js b/lib/join-media.js
index 5780de9..fcaaecd 100644
--- a/lib/join-media.js
+++ b/lib/join-media.js
@@ -1,5 +1,7 @@
 "use strict"
 
+const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i
+
 module.exports = function (parentMedia, childMedia) {
   if (!parentMedia.length && childMedia.length) return childMedia
   if (parentMedia.length && !childMedia.length) return parentMedia
@@ -8,8 +10,17 @@ module.exports = function (parentMedia, childMedia) {
   const media = []
 
   parentMedia.forEach(parentItem => {
+    const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem)
+
     childMedia.forEach(childItem => {
-      if (parentItem !== childItem) media.push(`${parentItem} and ${childItem}`)
+      const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem)
+      if (parentItem !== childItem) {
+        if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) {
+          media.push(`${childItem} and ${parentItem}`)
+        } else {
+          media.push(`${parentItem} and ${childItem}`)
+        }
+      }
     })
   })
 


Test patch:
diff --git a/test/fixtures/filter-ignore.expected.css b/test/fixtures/filter-ignore.expected.css
index 527c13e..a979122 100644
--- a/test/fixtures/filter-ignore.expected.css
+++ b/test/fixtures/filter-ignore.expected.css
@@ -1,5 +1,5 @@
 @import "http://css" (min-width: 25em);
-@import "http://css-screen" (min-width: 25em) and screen;
+@import "http://css-screen" screen and (min-width: 25em);
 @import "http://css";
 @import "https://css";
 @import 'http://css';
diff --git a/test/fixtures/ignore.expected.css b/test/fixtures/ignore.expected.css
index 0f1fcc7..dd97ad6 100644
--- a/test/fixtures/ignore.expected.css
+++ b/test/fixtures/ignore.expected.css
@@ -1,5 +1,5 @@
 @import "http://css" (min-width: 25em);
-@import "http://css-screen" (min-width: 25em) and screen;
+@import "http://css-screen" screen and (min-width: 25em);
 @import "http://css";
 @import "https://css";
 @import 'http://css';
Repository: postcss/postcss-selector-parser
Pull request #250 (2021-12-08 13:16:37)

fix: issue #247


Patch:
diff --git a/.gitignore b/.gitignore
index 1967750..b00cb24 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ coverage
 node_modules
 dist
 .idea
+.vscode
\ No newline at end of file
diff --git a/src/parser.js b/src/parser.js
index 64859c2..26c773f 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -836,7 +836,13 @@ export default class Parser {
             }
             nextToken = this.nextToken;
         }
-        const hasClass = indexesOf(word, '.').filter(i => word[i - 1] !== '\\');
+        const hasClass = indexesOf(word, '.').filter(i => {
+            // Allow escaped dot within class name
+            const escapedDot = word[i - 1] === '\\';
+            // Allow decimal numbers percent in @keyframes
+            const isKeyframesPercent = /^\d+\.\d+%$/.test(word);
+            return !escapedDot && !isKeyframesPercent;
+        });
         let hasId = indexesOf(word, '#').filter(i => word[i - 1] !== '\\');
         // Eliminate Sass interpolations from the list of id indexes
         const interpolations = indexesOf(word, '#{');


Test patch:
diff --git a/src/__tests__/tags.js b/src/__tests__/tags.js
index d405a62..4253c36 100644
--- a/src/__tests__/tags.js
+++ b/src/__tests__/tags.js
@@ -36,3 +36,8 @@ test('tag with attribute', 'label[for="email"]', (t, tree) => {
     t.deepEqual(tree.nodes[0].nodes[1].type, 'attribute');
     t.deepEqual(tree.nodes[0].nodes[1].quoteMark, '"');
 });
+
+test('keyframes animation tag selector', '0.00%', (t, tree) => {
+    t.deepEqual(tree.nodes[0].nodes[0].value, '0.00%');
+    t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');
+});