internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: openmc-dev/openmc

Issue:
Incorrect documentation for p1, p2 parameters in Cylinder
The documentation for p1, p2 is incorrect in the `Cylinder` Python class. These parameters should read as two points on the axis of the cylinder, but the documentation seems to have been copied from the `Plane.from_points` function.


Discussion:

Resolving patch:
diff --git a/openmc/surface.py b/openmc/surface.py
--- a/openmc/surface.py
+++ b/openmc/surface.py
@@ -1241,7 +1241,7 @@ def from_points(cls, p1, p2, r=1., **kwargs):
         Parameters
         ----------
         p1, p2 : 3-tuples
-            Points that pass through the plane, p1 will be used as (x0, y0, z0)
+            Points that pass through the cylinder axis.
         r : float, optional
             Radius of the cylinder in [cm]. Defaults to 1.
         kwargs : dict


Test patch:
Repository: openmc-dev/openmc

Issue:
smarter plotting of models with inf bounding boxes in some axis
Paul noticed that PR #2492 is overly cautious when plotting geometry that has ```inf``` values in the bounding box

[link](https://github.com/openmc-dev/openmc/pull/2492/files#r1182454103) to comment

Currently we check if there are **any** ```inf``` values in the bounding box

What we can do is look at the requested axis basis and check if ```inf``` appears in just the relevant areas of the bounding box


Discussion:

Resolving patch:
diff --git a/openmc/universe.py b/openmc/universe.py
--- a/openmc/universe.py
+++ b/openmc/universe.py
@@ -380,17 +380,20 @@ def plot(self, origin=None, width=None, pixels=(200, 200),
             x, y = 0, 2
             xlabel, ylabel = 'x [cm]', 'z [cm]'
 
+        bb = self.bounding_box
         # checks to see if bounding box contains -inf or inf values
-        if True in np.isinf(self.bounding_box):
+        if np.isinf([bb[0][x], bb[1][x], bb[0][y], bb[1][y]]).any():
             if origin is None:
                 origin = (0, 0, 0)
             if width is None:
                 width = (10, 10)
         else:
             if origin is None:
-                origin = self.bounding_box.center
+                # if nan values in the bb.center they get replaced with 0.0
+                # this happens when the bounding_box contains inf values
+                origin = np.nan_to_num(bb.center)
             if width is None:
-                bb_width = self.bounding_box.width
+                bb_width = bb.width
                 x_width = bb_width['xyz'.index(basis[0])]
                 y_width = bb_width['xyz'.index(basis[1])]
                 width = (x_width, y_width)


Test patch:
Repository: openmc-dev/openmc

Issue:
should tally.nuclides docstring request list of strings?

I was just making use of ```tally.nuclides``` and accidentally set it to a list of strings and delighted that it worked.

I notice the doc string asks for a list of ```openmc.Nuclide```

https://github.com/openmc-dev/openmc/blob/d8dbd9bfca5f9e8faf992422149ff0573fb49551/openmc/tallies.py#L59

Should this be change this to list of ```str```?



Discussion:
Yeah I'd say we can update that to `list of openmc.Nuclide or str`.

Resolving patch:
diff --git a/openmc/tallies.py b/openmc/tallies.py
--- a/openmc/tallies.py
+++ b/openmc/tallies.py
@@ -56,7 +56,7 @@ class Tally(IDManagerMixin):
         Name of the tally
     filters : list of openmc.Filter
         List of specified filters for the tally
-    nuclides : list of openmc.Nuclide
+    nuclides : list of str
         List of nuclides to score results for
     scores : list of str
         List of defined scores, e.g. 'flux', 'fission', etc.


Test patch:
Repository: openmc-dev/openmc

Issue:
MicroXS reactions arg in docsstring not available to users
While reading through the MicroXS class I noted we have an argument in the doc string called ```reactions``` but no option for the user to set it as it is not an accepted arg keyword.

https://github.com/openmc-dev/openmc/blob/6c7f857e1e98ce4fd5b39d8be034308596628d7e/openmc/deplete/microxs.py#L58

```reactions``` is however defined few lines later by this function call ```reactions, diluted_materials = cls._add_dilute_nuclides(chain_file,```

perhaps we are missing some logic checks to see if the user sets reactions and if not then if finds them?

If so I think I can make a PR with some if statement to fix that




Discussion:

Resolving patch:
diff --git a/openmc/deplete/microxs.py b/openmc/deplete/microxs.py
--- a/openmc/deplete/microxs.py
+++ b/openmc/deplete/microxs.py
@@ -37,8 +37,9 @@ def from_model(cls,
                    dilute_initial=1.0e3,
                    energy_bounds=(0, 20e6),
                    run_kwargs=None):
-        """Generate a one-group cross-section dataframe using
-        OpenMC. Note that the ``openmc`` executable must be compiled.
+        """Generate a one-group cross-section dataframe using OpenMC.
+
+        Note that the ``openmc`` executable must be compiled.
 
         Parameters
         ----------
@@ -55,8 +56,6 @@ def from_model(cls,
             Initial atom density [atoms/cm^3] to add for nuclides that
             are zero in initial condition to ensure they exist in the cross
             section data. Only done for nuclides with reaction rates.
-        reactions : list of str, optional
-            Reaction names to tally
         energy_bound : 2-tuple of float, optional
             Bounds for the energy group.
         run_kwargs : dict, optional


Test patch:
Repository: openmc-dev/openmc

Issue:
_DECAY_ENERGIES not cleared when changing chain in openmc.config
<!--
If you are a user of OpenMC and are running into trouble with the code or are
seeking general user support, we highly recommend posting on the OpenMC
discourse forum first. GitHub issues should be used specifically for bug reports
and feature requests.

https://openmc.discourse.group/

-->

## Bug Description
This causes incorrect sets of decay energies to be used. The PR which solves this has a more in-depth description of the problem.


## Steps to Reproduce
Run two depletion calcs, each with a different chain. Then, try to postprocess the decay heats from each chain within the same python script by changing `openmc.config['chain_file']`. The decay heats will use energies from the first one we loaded, but not the second. This is because the decay heats are cached in `openmc/data/decay.py` and we're not clearing that dictionary upon changing the chain.



Discussion:

Resolving patch:
diff --git a/openmc/config.py b/openmc/config.py
--- a/openmc/config.py
+++ b/openmc/config.py
@@ -4,7 +4,7 @@
 import warnings
 
 from openmc.data import DataLibrary
-from openmc.data.decay import _DECAY_PHOTON_ENERGY
+from openmc.data.decay import _DECAY_ENERGY, _DECAY_PHOTON_ENERGY
 
 __all__ = ["config"]
 
@@ -41,6 +41,7 @@ def __setitem__(self, key, value):
             os.environ['OPENMC_CHAIN_FILE'] = str(value)
             # Reset photon source data since it relies on chain file
             _DECAY_PHOTON_ENERGY.clear()
+            _DECAY_ENERGY.clear()
         else:
             raise KeyError(f'Unrecognized config key: {key}. Acceptable keys '
                            'are "cross_sections", "mg_cross_sections" and '
@@ -76,7 +77,7 @@ def _default_config():
     if (chain_file is None and
         config.get('cross_sections') is not None and
         config['cross_sections'].exists()
-    ):
+        ):
         # Check for depletion chain in cross_sections.xml
         data = DataLibrary.from_xml(config['cross_sections'])
         for lib in reversed(data.libraries):


Test patch:
Repository: openmc-dev/openmc

Issue:
Wrong directive in docstring
The docs for `Cell.from_xml_element` don't render correctly. `:math:` instead of `:func:` was used. 



Discussion:

Resolving patch:
diff --git a/openmc/cell.py b/openmc/cell.py
--- a/openmc/cell.py
+++ b/openmc/cell.py
@@ -722,7 +722,7 @@ def from_xml_element(cls, elem, surfaces, materials, get_universe):
             Dictionary mapping surface IDs to :class:`openmc.Surface` instances
         materials : dict
             Dictionary mapping material ID strings to :class:`openmc.Material`
-            instances (defined in :math:`openmc.Geometry.from_xml`)
+            instances (defined in :meth:`openmc.Geometry.from_xml`)
         get_universe : function
             Function returning universe (defined in
             :meth:`openmc.Geometry.from_xml`)


Test patch:
Repository: SigmaHQ/sigma

Issue:
endswith Modifier broken
In 2fafff3, a bug was introduced breaking the endswith modifier.
The fix correctly changed the behaviour of the contains modifier but also wrongly applied the fix to endswith instead of startswith.


Discussion:

Resolving patch:
diff --git a/tools/sigma/parser/modifiers/transform.py b/tools/sigma/parser/modifiers/transform.py
--- a/tools/sigma/parser/modifiers/transform.py
+++ b/tools/sigma/parser/modifiers/transform.py
@@ -41,7 +41,10 @@ class SigmaStartswithModifier(ListOrStringModifierMixin, SigmaTransformModifier)
 
     def apply_str(self, val : str):
         if not val.endswith("*"):
-            val += "*"
+            if val.endswith("\\"):
+                val += "\\*"
+            else:
+                val += "*"
         return val
 
 class SigmaEndswithModifier(ListOrStringModifierMixin, SigmaTransformModifier):
@@ -51,10 +54,7 @@ class SigmaEndswithModifier(ListOrStringModifierMixin, SigmaTransformModifier):
 
     def apply_str(self, val : str):
         if not val.startswith("*"):
-            if val.endswith("\\"):
-                val += "\\*"
-            else:
-                val += "*"
+           val = '*' + val
         return val
 
 class SigmaAllValuesModifier(SigmaTransformModifier):


Test patch:
Repository: SigmaHQ/sigma

Issue:
Error while pushing sigma to misp using sigma2misp script
(venv) hydra@Kaushals-MacBook-Air session2/sigma (master %) » tools/sigma2misp @misp.conf --insecure --same-event --info "Test Event" -r rules/windows/sysmon                                           2 ↵
Traceback (most recent call last):
  File "tools/sigma2misp", line 57, in <module>
    eventid = create_new_event()
  File "tools/sigma2misp", line 14, in create_new_event
    event = misp.MISPEvent()
AttributeError: 'PyMISP' object has no attribute 'MISPEvent'


Discussion:

Resolving patch:
diff --git a/tools/sigma/sigma2misp.py b/tools/sigma/sigma2misp.py
--- a/tools/sigma/sigma2misp.py
+++ b/tools/sigma/sigma2misp.py
@@ -5,13 +5,13 @@
 import pathlib
 import urllib3
 urllib3.disable_warnings()
-from pymisp import PyMISP
+from pymisp import PyMISP, MISPEvent
 
 def create_new_event(args, misp):
     if hasattr(misp, "new_event"):
         return misp.new_event(info=args.info)["Event"]["id"]
     
-    event = misp.MISPEvent()
+    event = MISPEvent()
     event.info = args.info
     return misp.add_event(event)["Event"]["id"]
 


Test patch:
Repository: SigmaHQ/sigma

Issue:
Update sigma2attack to the latest navigator version
the data generated for navigator is not up to date.

![Clipboard - 5 novembre 2020 15_38](https://user-images.githubusercontent.com/1626464/98255016-3675e080-1f7d-11eb-8490-321a7a053c04.png)

specs on [att&ck navigator github](https://github.com/mitre-attack/attack-navigator/blob/master/layers/LAYERFORMATv4.md)



Discussion:

Resolving patch:
diff --git a/tools/sigma/sigma2attack.py b/tools/sigma/sigma2attack.py
--- a/tools/sigma/sigma2attack.py
+++ b/tools/sigma/sigma2attack.py
@@ -21,7 +21,7 @@ def main():
     num_rules_used = 0
     for rule_file in rule_files:
         try:
-            rule = yaml.safe_load(open(rule_file).read())
+            rule = yaml.safe_load(open(rule_file, encoding="utf-8").read())
         except yaml.YAMLError:
             sys.stderr.write("Ignoring rule " + rule_file + " (parsing failed)\n")
             continue
@@ -61,7 +61,10 @@ def main():
             "maxValue": curr_max_technique_count,
             "minValue": 0
         },
-        "version": "2.2", 
+        "versions": {
+            "navigator": "4.0",
+            "layer": "4.0"
+        },
         "techniques": scores,
     }
 


Test patch:
Repository: SigmaHQ/sigma

Issue:
sigmac - invalid value in STATE filter
In specification it states that there are three statuses:
* stable
*  test
* experimental 
https://github.com/SigmaHQ/sigma/wiki/Specification#status-optional

Problem arises when  using sigmac with filter option and trying to filter out status **test**, because in filter options it states that status is one of these values: experimental, testing, stable.
Specification says **test**, but filter looks for status **testing**.
```
--filter FILTER, -f FILTER
                        Define comma-separated filters that must match (AND-
                        linked) to rule to be processed. Valid filters:
                        level<=x, level>=x, level=x, status=y, logsource=z,
                        tag=t. x is one of: low, medium, high, critical. y is
                        one of: experimental, testing, stable. z is a word
                        appearing in an arbitrary log source attribute. t is a
                        tag that must appear in the rules tag list, case-
                        insensitive matching. Multiple log source
                        specifications are AND linked.
                        

```

sigma-master\tools\sigma\filter.py
`line 27: STATES = ["experimental", "testing", "stable"] `


Discussion:
Thanks,
Will fix when possible if nobody do it before

Resolving patch:
diff --git a/tools/sigma/filter.py b/tools/sigma/filter.py
--- a/tools/sigma/filter.py
+++ b/tools/sigma/filter.py
@@ -24,7 +24,9 @@ class SigmaRuleFilter:
             "high"     : 2,
             "critical" : 3
             }
-    STATES = ["experimental", "testing", "stable"]
+    STATES = ["experimental",
+              "test",
+              "stable"]
 
     def __init__(self, expr):
         self.minlevel      = None


Test patch:
Repository: SigmaHQ/sigma

Issue:
Invalid AST generated by optimization
Hello, we have come across what I think is a bug in the optimization of the AST. The generated AST seems invalid when one of the selection contains another:

```python
from io import StringIO

from sigma.parser.collection import SigmaCollectionParser
from sigma.parser.condition import dumpNode

rule = StringIO("""
detection:
    selection1:
        field|contains|all:
            - str1
            - str2
    selection2:
        field|contains|all:
            - str1
            - str2
            - str3
            - str4
    condition: 1 of selection*
""")


parsers = [parser.condparsed for parser in SigmaCollectionParser(rule).parsers]
for parser in parsers:
    for condition in parser:
        dumpNode(condition.parsedSearch)
```

Prints the following output:

```
NodeSubexpression<ConditionAND>
  ConditionAND<list>
    tuple=('otherfield', '*str1*')
    tuple=('otherfield', '*str2*')
    tuple=('otherfield', '*str3*')
    tuple=('otherfield', '*str4*')
```

This is equivalent to `selection2` instead of the requested `1 of selection*`


Discussion:

Resolving patch:
diff --git a/tools/sigma/parser/condition.py b/tools/sigma/parser/condition.py
--- a/tools/sigma/parser/condition.py
+++ b/tools/sigma/parser/condition.py
@@ -403,26 +403,6 @@ def _optimizeNode(self, node, changes=False):
                 node.items = newitems
                 return self._optimizeNode(node, changes=True)
 
-            # OR(AND(X, ...), AND(X, ...))  =>  AND(X, OR(AND(...), AND(...)))
-            if type(node) == ConditionOR:
-                othertype = ConditionAND
-            else:
-                othertype = ConditionOR
-            if all(type(child) == othertype for child in node.items):
-                promoted = []
-                for cand in node.items[0]:
-                    if all(cand in child for child in node.items[1:]):
-                        promoted.append(cand)
-                if len(promoted) > 0:
-                    for child in node.items:
-                        for cand in promoted:
-                            if cand in child.items:
-                                child.items.remove(cand)
-                    newnode = othertype()
-                    newnode.items = promoted
-                    newnode.add(node)
-                    return self._optimizeNode(newnode, changes=True)
-
             # fallthrough
 
         elif type(node) == ConditionNOT:


Test patch:
Repository: SigmaHQ/sigma

Issue:
Syntax error in proc_creation_win_enumeration_for_credentials_cli.yml
Two of the \ in one of the strings are escaped, this would create issues with using the string.

`'\Software\\SimonTatham\\PuTTY\SshHostKeys\'`

should instead be

`'\Software\SimonTatham\PuTTY\SshHostKeys\'`


Discussion:

Resolving patch:
diff --git a/tools/sigma/sigmac.py b/tools/sigma/sigmac.py
--- a/tools/sigma/sigmac.py
+++ b/tools/sigma/sigmac.py
@@ -446,8 +446,8 @@ def main():
     if cmdargs.output_fields:
         if cmdargs.output_format == 'json':
             print(json.dumps(output_array, indent=4, ensure_ascii=False), file=out)
-        #elif cmdargs.output_format == 'yaml':
-        #    print(ruamel.yaml.round_trip_dump(output_array), file=out)
+        elif cmdargs.output_format == 'yaml':
+            print(ruamel.yaml.round_trip_dump(output_array), file=out)
 
     out.close()
 


Test patch:
Repository: SigmaHQ/sigma

Issue:
`documentations/tools/sigma-logsource-checker.py` is broken
When you run it on the `rules` directory. It tries to part `README.md` as a yml files and breaks in line 119.

```
Traceback (most recent call last):
  File "/Users/fbreedijk/repos/sigma/documentation/tools/sigma-logsource-checker.py", line 362, in <module>
    windows_service_security_dict, windows_service_powershell_dict, windows_category_process_creation_dict, windows_category_ps_module_dict, windows_category_ps_script_dict = get_logsource_dict(path_to_rules, faulty_rules)
                                                                                                                                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fbreedijk/repos/sigma/documentation/tools/sigma-logsource-checker.py", line 218, in get_logsource_dict
    logsource = get_rule_part(file_path=file_, part_name="logsource")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fbreedijk/repos/sigma/documentation/tools/sigma-logsource-checker.py", line 119, in get_rule_part
    if part_name in yaml_part.keys():
                    ^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'keys'
```



Discussion:

Resolving patch:
diff --git a/documentation/tools/sigma-logsource-checker.py b/documentation/tools/sigma-logsource-checker.py
--- a/documentation/tools/sigma-logsource-checker.py
+++ b/documentation/tools/sigma-logsource-checker.py
@@ -111,7 +111,8 @@
 def yield_next_rule_file_path(path_to_rules: str) -> str:
     for root, _, files in os.walk(path_to_rules):
         for file in files:
-            yield os.path.join(root, file)
+            if file.endswith(".yml"):
+                yield os.path.join(root, file)
 
 def get_rule_part(file_path: str, part_name: str):
     yaml_dicts = get_rule_yaml(file_path)


Test patch:
Repository: buildbot/buildbot

Issue:
Fully general filtering, ordering, selecting, and pagination (on the right base this time)
Well, I've been working on this over the two months since PyCon, but the wait is finally over!

This adds fully general filtering, ordering, selecting, and pagination to the data API. The same options are available via REST or via the Python API. The REST API uses type information from the Data API to properly parse query parameters into Python values. And finally, while result specs are applied automatically by default (eliminating the need for every endpoint to implement everything), there's the option for endpoints to apply some of the result spec directly, presumably by modifying the DB query.

This is big -- sorry about that -- but the commits are nicely segregated if you want to look at one at a time.



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/web/slaves.py b/master/buildbot/status/web/slaves.py
--- a/master/buildbot/status/web/slaves.py
+++ b/master/buildbot/status/web/slaves.py
@@ -136,8 +136,7 @@ def content(self, request, ctx):
             info['connected'] = slave.isConnected()
             info['connectCount'] = slave.getConnectCount()
             
-            if slave.isConnected():
-                info['admin'] = unicode(slave.getAdmin() or '', 'utf-8')
+            info['admin'] = unicode(slave.getAdmin() or '', 'utf-8')
             last = slave.lastMessageReceived()
             if last:
                 info['last_heard_from_age'] = abbreviate_age(time.time() - last)
diff --git a/master/buildbot/steps/source.py b/master/buildbot/steps/source.py
--- a/master/buildbot/steps/source.py
+++ b/master/buildbot/steps/source.py
@@ -227,7 +227,7 @@ def start(self):
         # what source stamp would this build like to use?
         s = self.build.getSourceStamp()
         # if branch is None, then use the Step's "default" branch
-        branch = s.branch or self.branch
+        branch = s.branch or properties.render(self.branch)
         # if revision is None, use the latest sources (-rHEAD)
         revision = s.revision
         if not revision and not self.alwaysUseLatest:


Test patch:
Repository: buildbot/buildbot

Issue:
Update documentation for packages built using python wheels
The tests aren't included on packages build in PyPi. Updating documentation to show that.



Discussion:

Resolving patch:
diff --git a/master/buildbot/master.py b/master/buildbot/master.py
--- a/master/buildbot/master.py
+++ b/master/buildbot/master.py
@@ -204,7 +204,9 @@ def do_load(_):
 
             # execute the config file
 
-            localDict = {'basedir': os.path.expanduser(self.basedir)}
+            localDict = {'basedir': os.path.expanduser(self.basedir),
+                         '__file__': os.path.abspath(self.configFileName)}
+            
             try:
                 exec f in localDict
             except:


Test patch:
Repository: buildbot/buildbot

Issue:
Fix bug: GitPoller is never activated on nine
 a851083 is not a part of this PR. 
I merge upstream/nine in my branch and this commit was added to this PR.

Fix bug: GitPoller is never activated on nine
 a851083 is not a part of this PR. 
I merge upstream/nine in my branch and this commit was added to this PR.



Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/trigger.py b/master/buildbot/steps/trigger.py
--- a/master/buildbot/steps/trigger.py
+++ b/master/buildbot/steps/trigger.py
@@ -77,15 +77,18 @@ def __init__(self, schedulerNames=[], sourceStamp=None, updateSourceStamp=None,
 
         """
         assert schedulerNames, "You must specify a scheduler to trigger"
-        if sourceStamp and updateSourceStamp:
+        if sourceStamp and (updateSourceStamp is not None):
             raise ValueError("You can't specify both sourceStamp and updateSourceStamp")
         if sourceStamp and alwaysUseLatest:
             raise ValueError("You can't specify both sourceStamp and alwaysUseLatest")
-        if alwaysUseLatest and updateSourceStamp:
+        if alwaysUseLatest and (updateSourceStamp is not None):
             raise ValueError("You can't specify both alwaysUseLatest and updateSourceStamp")
         self.schedulerNames = schedulerNames
         self.sourceStamp = sourceStamp
-        self.updateSourceStamp = updateSourceStamp or not (alwaysUseLatest or sourceStamp)
+        if updateSourceStamp is not None:
+            self.updateSourceStamp = updateSourceStamp
+        else:
+            self.updateSourceStamp = not (alwaysUseLatest or sourceStamp)
         self.alwaysUseLatest = alwaysUseLatest
         self.waitForFinish = waitForFinish
         self.set_properties = set_properties


Test patch: