anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: geopython/pywps
Issue: fix safe file handling in unit tests

# Description

Unit tests in a Python 3 environment yield `ResourceWarning` warnings like:

```
/home/travis/build/geopython/pywps/tests/test_inout.py:64: ResourceWarning: unclosed file <_io.FileIO name='/tmp/tmpwbpvbq0c' mode='rb'>
```
# Environment
- operating system: Ubuntu
- Python version: 3.4
- PyWPS version: master
- source/distribution
  - [x] git clone
  - [ ] Debian
  - [ ] PyPI
  - [ ] zip/tar.gz
  - [ ] other (please specify): 
- web server
  - [ ] Apache/mod_wsgi
  - [ ] CGI
  - [x] other (please specify): unit test runner
# Steps to Reproduce

``` bash
# in a Python 3 virtualenv
python -m unittest tests
```
# Additional Information

Initial discussion in #106.

Example can be found in current travis builds: https://travis-ci.org/geopython/pywps/jobs/111190874#L360


Changed files:
pywps/inout/basic.py

diff --git a/pywps/inout/basic.py b/pywps/inout/basic.py
index ef88557..bf2b979 100644
--- a/pywps/inout/basic.py
+++ b/pywps/inout/basic.py
@@ -74,6 +74,7 @@ class IOHandler(object):
         self.source = None
         self._tempfile = None
         self.workdir = workdir
+        self._stream = None
 
         self.valid_mode = mode
 
@@ -160,8 +161,11 @@ class IOHandler(object):
     def get_stream(self):
         """Get source as stream object"""
         if self.source_type == SOURCE_TYPE.FILE:
+            if self._stream and not self._stream.closed:
+                self._stream.close()
             from io import FileIO
-            return FileIO(self.source, mode='r', closefd=True)
+            self._stream = FileIO(self.source, mode='r', closefd=True)
+            return self._stream
         elif self.source_type == SOURCE_TYPE.STREAM:
             return self.source
         elif self.source_type == SOURCE_TYPE.DATA:
Repository: geopython/pywps
Issue: Internal Server Error using Postgres database

# Description
Using a Postgres logging database the application fails with an Internal Server Error. SQLAlchemy is trying to create table fields with types that do not exist in Postgres.

# Environment

- operating system: Ubuntu 16.04
- Python version: Python 2.7
- PyWPS version: 4.0.0
- source/distribution
 - [x] git clone
 - [ ] Debian
 - [ ] PyPI
 - [ ] zip/tar.gz
 - [ ] other (please specify): 
- web server
 - [ ] Apache/mod_wsgi
 - [ ] CGI
 - [x] other (please specify): Flask

# Steps to Reproduce
Happens with any request. Db connection string:
database=postgresql://pywps:toto123@localhost:5432/pywps-demo

# Additional Information


Changed files:
pywps/dblog.py

diff --git a/pywps/dblog.py b/pywps/dblog.py
index 175ec14..cb5a32e 100644
--- a/pywps/dblog.py
+++ b/pywps/dblog.py
@@ -21,7 +21,7 @@ import os
 
 import sqlalchemy
 from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy import Column, Integer, String, VARCHAR, Float, DateTime, BLOB
+from sqlalchemy import Column, Integer, String, VARCHAR, Float, DateTime, LargeBinary
 from sqlalchemy.orm import sessionmaker
 
 LOGGER = logging.getLogger('PYWPS')
@@ -54,7 +54,7 @@ class RequestInstance(Base):
     __tablename__ = '{}stored_requests'.format(_tableprefix)
 
     uuid = Column(VARCHAR(255), primary_key=True, nullable=False)
-    request = Column(BLOB, nullable=False)
+    request = Column(LargeBinary, nullable=False)
 
 
 def log_request(uuid, request):
Repository: geopython/pywps
Issue: LiteralInput min_occurs, max_occurs attributes always set to 1

# Description
There is a bug in basic.py LiteralInput class, when it initialises its parent BasicIO, it sets the min_occurs, max_occurs to 1 instead of using the passed in parameter.  The same goes for the metadata parameter. 
This results in all process LiteralInputs being mandatory and only accepting 1 value when more than 1 are passed into the process.  So for example, a process defined with an input parameter with max_occurs=9 which should allow for 9 possible values will only make use of 1. That is because in service.py (create_literal_inputs), line 216 a deque is created using the LiteralInput's max_occurs parameter to limit the size for that parameter.  This also means that the describeProcess  output for any process is incorrect, max_occurs and min_occurs are always set to 1.
# Environment

- operating system: Ubuntu 18.04.1 LTS
- Python version: 3.6
- PyWPS version: 4
- source/distribution
 - [x] git clone
 - [ ] Debian
 - [x ] PyPI
 - [ ] zip/tar.gz
 - [ ] other (please specify): 
- web server
 - [ x] Apache/mod_wsgi
 - [ ] CGI
 - [ ] other (please specify): 

# Steps to Reproduce
Create a process, set min_occurs or max occurs > 1
# Additional Information


Changed files:
pywps/inout/basic.py

diff --git a/pywps/inout/basic.py b/pywps/inout/basic.py
index 4c309af..a7db9b4 100644
--- a/pywps/inout/basic.py
+++ b/pywps/inout/basic.py
@@ -677,7 +677,7 @@ class LiteralInput(BasicIO, BasicLiteral, SimpleHandler):
                  min_occurs=1, max_occurs=1, metadata=[],
                  default=None, default_type=SOURCE_TYPE.DATA):
         BasicIO.__init__(self, identifier, title, abstract, keywords,
-                         min_occurs=1, max_occurs=1, metadata=[])
+                         min_occurs, max_occurs, metadata)
         BasicLiteral.__init__(self, data_type, uoms)
         SimpleHandler.__init__(self, workdir, data_type, mode=mode)
Repository: geopython/pywps
Issue: upload to pypi fails due to Readme rendering issues

# Description

Upload with twine to pypi of 4.2.4 fails:
```
twine check dist/pywps-4.2.4.tar.gz 
Checking dist/pywps-4.2.4.tar.gz: FAILED
  `long_description` has syntax errors in markup and would not be rendered on PyPI.
    line 54: Warning: Inline literal start-string without end-string.
  warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
```

Maybe we should add this check to travis CI.

# Environment

- operating system:
- Python version:
- PyWPS version: 4.2.4
- source/distribution
 - [ ] git clone
 - [ ] Debian
 - [ ] PyPI
 - [ ] zip/tar.gz
 - [ ] other (please specify): 
- web server
 - [ ] Apache/mod_wsgi
 - [ ] CGI
 - [ ] other (please specify): 

# Steps to Reproduce

# Additional Information



Changed files:
setup.py

diff --git a/setup.py b/setup.py
index 66a2432..ab87755 100644
--- a/setup.py
+++ b/setup.py
@@ -32,6 +32,7 @@ CONFIG = {
     'version': VERSION,
     'description': DESCRIPTION,
     'long_description': LONG_DESCRIPTION,
+    'long_description_content_type': 'text/markdown',
     'keywords': KEYWORDS,
     'license': 'MIT',
     'platforms': 'all',
Repository: geopython/pywps
Issue: StatusLocation document is not being updated

The status location document is not being updated. This is true at least when the process finishes. Must test if it is being updated during a long execution.


Changed files:
pywps/app/Process.py, pywps/app/WPSResponse.py

diff --git a/pywps/app/Process.py b/pywps/app/Process.py
index d322f51..f0c3761 100644
--- a/pywps/app/Process.py
+++ b/pywps/app/Process.py
@@ -239,6 +239,7 @@ class Process(object):
     def _run_process(self, wps_request, wps_response):
         try:
             self._set_grass()
+            wps_response.update_status('PyWPS Process started', 0)
             wps_response = self.handler(wps_request, wps_response)
 
             if (not wps_response.status_percentage) or (wps_response.status_percentage != 100):
diff --git a/pywps/app/WPSResponse.py b/pywps/app/WPSResponse.py
index f720bf9..5755a53 100644
--- a/pywps/app/WPSResponse.py
+++ b/pywps/app/WPSResponse.py
@@ -160,7 +160,7 @@ class WPSResponse(object):
                 self.message = 'PyWPS Process %s accepted' % self.process.identifier
                 status_doc = self._process_accepted()
                 doc.append(status_doc)
-                self.write_response_doc(doc)
+                #self.write_response_doc(doc)
                 return doc
             elif 0 < self.status_percentage < 100:
                 status_doc = self._process_started()
Repository: architecture-building-systems/cityenergyanalyst
Issue: Zone helper cannot process `min_heights` of type `str`

**Describe the bug**
When running the zone helper after the merging of the polygon intersection PR (#3208), a `site.shp` file that was previously functional can no longer be used to create a zone shapefile. The reason is that the `min_height` parameter for at least one building has a string value, and hence the zone helper cannot process it.

Changed files:
cea/datamanagement/zone_helper.py

diff --git a/cea/datamanagement/zone_helper.py b/cea/datamanagement/zone_helper.py
index 4f05f912f..103f1b985 100644
--- a/cea/datamanagement/zone_helper.py
+++ b/cea/datamanagement/zone_helper.py
@@ -155,10 +155,12 @@ def fix_overlapping_geoms(buildings, zone):
 
     # Correct levels below ground if a minimum floor level or height is indicated
     if 'building:min_level' in list_of_attributes:
+        buildings["building:min_level"] = buildings["building:min_level"].astype(float)
         has_min_floor = buildings["building:min_level"] == buildings["building:min_level"]
         buildings[has_min_floor].floors_bg = [- int(x) for x in buildings[has_min_floor]["building:min_level"]]
         buildings[has_min_floor].height_bg = buildings[has_min_floor].floors_bg * constants.H_F
     if 'min_height' in list_of_attributes:
+        buildings["min_height"] = buildings["min_height"].astype(float)
         has_min_height = buildings["min_height"] == buildings["min_height"]
         buildings[has_min_height].height_bg = [- int(x) for x in buildings[has_min_height]["min_height"]]
Repository: architecture-building-systems/cityenergyanalyst
Issue: Radiation script fails if building name has space in it

Running radiation with a scenario that has building names with spaces in them would throw this error.

```python
Running command `ds_illum "/var/folders/3_/62hm8hld4hl4mjtq27_8gkbr0000gn/T/cea_radiation/projects/chunk_0/chunk_0.hea"`
Traceback (most recent call last):
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/main.py", line 190, in <module>
    main(cea.config.Configuration())
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/main.py", line 180, in main
    run_daysim_simulation(cea_daysim, zone_building_names, locator, config.radiation, geometry_staging_location,
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/main.py", line 91, in run_daysim_simulation
    daysim.isolation_daysim(
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/daysim.py", line 287, in isolation_daysim
    daysim_project.execute_ds_illum()
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/radiance.py", line 336, in execute_ds_illum
    CEADaySim.run_cmd(command1, self.daysim_bin_directory, self.daysim_lib_directory)
  File "/Users/reynoldmok/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation/radiance.py", line 103, in run_cmd
    raise subprocess.CalledProcessError(process.returncode, cmd)
subprocess.CalledProcessError: Command 'ds_illum "/var/folders/3_/62hm8hld4hl4mjtq27_8gkbr0000gn/T/cea_radiation/projects/chunk_0/chunk_0.hea"' returned non-zero exit status 1.
```

Changed files:
cea/resources/radiation/radiance.py

diff --git a/cea/resources/radiation/radiance.py b/cea/resources/radiation/radiance.py
index 2defd328d..76aee1168 100644
--- a/cea/resources/radiation/radiance.py
+++ b/cea/resources/radiation/radiance.py
@@ -365,7 +365,8 @@ class RadSurface(object):
     __slots__ = ['name', 'points', 'material']
 
     def __init__(self, name, occ_face, material):
-        self.name = name
+        # Make sure there are no spaces in the name, which could affect Daysim parsing the radiance geometry file
+        self.name = name.replace(" ", "_")
         self.points = points_frm_occface(occ_face)
         self.material = material
Repository: architecture-building-systems/cityenergyanalyst
Issue: Bug in EV schedule

Under the Input Editor/schedules/electromobility the input accepts only binary values and can not be modified for integer values.
Path to reproduce error:
Input Editor -> Schedules->Electromobility-> Select building-> input EV number -> ERROR


![image](https://github.com/architecture-building-systems/CityEnergyAnalyst/assets/114220019/216f79ad-85f2-4f57-ae14-4c7ababbb770)


Changed files:
cea/interfaces/dashboard/frontend/__init__.py

diff --git a/cea/interfaces/dashboard/frontend/__init__.py b/cea/interfaces/dashboard/frontend/__init__.py
index 3c8dc92c6..787d61702 100644
--- a/cea/interfaces/dashboard/frontend/__init__.py
+++ b/cea/interfaces/dashboard/frontend/__init__.py
@@ -14,11 +14,8 @@ def frontend():
 
 
 def get_build():
-    url = "https://github.com/architecture-building-systems/CityEnergyAnalyst-GUI/releases/download/v3.32.0-browser/build.zip"
-    output = os.path.dirname(os.path.abspath(__file__))
-
-    if os.path.exists(os.path.join(output, "build", "index.html")):
-        return
+    url = "https://github.com/architecture-building-systems/CityEnergyAnalyst-GUI/releases/download/v3.32.1-browser/build.zip"
+    output = os.path.join(os.path.dirname(os.path.abspath(__file__)), "build")
 
     print("Fetching GUI build...")
     with urlopen(url) as r:
Repository: meerk40t/meerk40t
Issue: Home after "step repeat"

Hi,

when I'm doing "step repeat" after optimizing, right before spool, I have to manualy add "home". Is there way to automaticly add "home" after "step repeat"?  I ask that because MK is losing position after "step repeat", and if I forgot to manually "home" I got motors going out of working area.

Changed files:
meerk40t/core/planner.py

diff --git a/meerk40t/core/planner.py b/meerk40t/core/planner.py
index 81626b35d..84abe98b4 100644
--- a/meerk40t/core/planner.py
+++ b/meerk40t/core/planner.py
@@ -836,6 +836,7 @@ class Planner(Modifier):
                 y_pos += y_distance
             if x_pos != 0 or y_pos != 0:
                 data.plan.append(offset(-x_pos, -y_pos))
+            data.plan.append(home)
             self.context.signal("plan", self._default_plan, None)
             return data_type, data
Repository: meerk40t/meerk40t
Issue: Stroke-width is not accounted for in make-raster size of images

https://www.facebook.com/groups/716000085655097/permalink/952890345299402/

Seems to arise in the wild where people would like to raster their shapes correctly.

Changed files:
meerk40t/core/elements.py, meerk40t/core/planner.py

diff --git a/meerk40t/core/elements.py b/meerk40t/core/elements.py
index a06e382b4..c41fa8cfd 100644
--- a/meerk40t/core/elements.py
+++ b/meerk40t/core/elements.py
@@ -3064,12 +3064,15 @@ class Elemental(Modifier):
             context = self.context
             if data is None:
                 data = list(self.elems(emphasized=True))
+            reverse = context.classify_reverse
+            if reverse:
+                data = list(reversed(data))
             elements = context.elements
             make_raster = self.context.registered.get("render-op/make_raster")
             if not make_raster:
                 channel(_("No renderer is registered to perform render."))
                 return
-            bounds = Group.union_bbox(data)
+            bounds = Group.union_bbox(data, with_stroke=True)
             if bounds is None:
                 return
             if step <= 0:
@@ -5085,8 +5088,11 @@ class Elemental(Modifier):
             context = self.context
             elements = context.elements
             subitems = list(node.flat(types=("elem", "opnode")))
+            reverse = self.context.classify_reverse
+            if reverse:
+                subitems = list(reversed(subitems))
             make_raster = self.context.registered.get("render-op/make_raster")
-            bounds = Group.union_bbox([s.object for s in subitems])
+            bounds = Group.union_bbox([s.object for s in subitems], with_stroke=True)
             if bounds is None:
                 return
             step = float(node.settings.raster_step)
diff --git a/meerk40t/core/planner.py b/meerk40t/core/planner.py
index dd3857211..010abb1be 100644
--- a/meerk40t/core/planner.py
+++ b/meerk40t/core/planner.py
@@ -505,7 +505,7 @@ class CutPlan:
             subitems = list(reversed(subitems))
         make_raster = self.context.registered.get("render-op/make_raster")
         objs = [s.object for s in subitems]
-        bounds = Group.union_bbox(objs)
+        bounds = Group.union_bbox(objs, with_stroke=True)
         if bounds is None:
             return None
         xmin, ymin, xmax, ymax = bounds
Repository: meerk40t/meerk40t
Issue: On load the image zooms to bed.

The image zooms to bed is to cover up an issue that only Jpirnay actually experiences where on loading multiple files his view jumps weirdly. I cannot, duplicate this functionality, so we can't remove the problematic and generally unneeded zoom to bed.

Replacing a bug for one with a defect for all.

Changed files:
meerk40t/gui/wxmmain.py

diff --git a/meerk40t/gui/wxmmain.py b/meerk40t/gui/wxmmain.py
index 0e1707878..324dcb892 100644
--- a/meerk40t/gui/wxmmain.py
+++ b/meerk40t/gui/wxmmain.py
@@ -321,7 +321,6 @@ class MeerK40t(MWindow):
     def register_options_and_choices(self, context):
         _ = context._
         context.setting(bool, "disable_tool_tips", False)
-        context.setting(bool, "maintain_zoom_resize", True)
         context.setting(bool, "enable_sel_move", True)
         context.setting(bool, "enable_sel_size", True)
         context.setting(bool, "enable_sel_rotate", True)
@@ -443,11 +442,11 @@ class MeerK40t(MWindow):
         context.kernel.register_choices("preferences", choices)
         choices = [
             {
-                "attr": "maintain_zoom_resize",
+                "attr": "autofocus_resize",
                 "object": self.context.root,
-                "default": True,
+                "default": False,
                 "type": bool,
-                "label": _("Maintain zoom on resize"),
+                "label": _("Autofocus bed on resize"),
                 "tip": _("Autofocus bed when resizing the main window"),
                 "page": "Gui",
                 "section": "Zoom",
@@ -3609,7 +3608,7 @@ class MeerK40t(MWindow):
         if self.context is None:
             return
         self.Layout()
-        if self.context.maintain_zoom_resize:
+        if self.context.autofocus_resize:
             zl = self.context.zoom_margin
             self.context(f"scene focus -{zl}% -{zl}% {100 + zl}% {100 + zl}%\\n")
Repository: meerk40t/meerk40t
Issue: [0.8.3 Beta 3] Various burn issues

Since trying this beta I have had various examples of burns going wrong.

1. Y-axis mis-positioning at slow 2mm/s vector speed
2. Image x-axis mis-positioning (at 300mm/s - I can normally;y achieve 550mm/s without losing position).

I have no idea whether this is due to changes in code or a hardware glitch, but I thought I would report it in case it is significant.

Changed files:
meerk40t/gui/laserrender.py

diff --git a/meerk40t/gui/laserrender.py b/meerk40t/gui/laserrender.py
index abd23eaa4..5d9dbbc11 100644
--- a/meerk40t/gui/laserrender.py
+++ b/meerk40t/gui/laserrender.py
@@ -950,11 +950,11 @@ class LaserRender:
 
         for item in _nodes:
 
-            bb = item.bounds
-            # bb = item.paint_bounds
-            # if bb is None:
-            #     # Fall back to bounds
-            #     bb = item.bounds
+            # bb = item.bounds
+            bb = item.paint_bounds
+            if bb is None:
+                # Fall back to bounds
+                bb = item.bounds
             if bb is None:
                 continue
             if bb[0] < x_min: