internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: django-extensions/django-extensions

Issue:
add exclude_patterns to werkzeug reloader
Hi,

I couldn't find any way to exclude certain files/dir from triggering server reloading.

We can specify extra files to watch via `RUNSERVER_PLUS_EXTRA_FILES = []`, but what about excluding?

Werkzeug does accept it via:
`werkzeug.serving.run_simple(exclude_patterns="")`
https://werkzeug.palletsprojects.com/en/2.2.x/serving/#werkzeug.serving.run_simple

Would be good to have it, thank you ❤️ 


Discussion:

Resolving patch:
diff --git a/django_extensions/management/commands/runserver_plus.py b/django_extensions/management/commands/runserver_plus.py
--- a/django_extensions/management/commands/runserver_plus.py
+++ b/django_extensions/management/commands/runserver_plus.py
@@ -165,6 +165,8 @@ def add_arguments(self, parser):
                                  'Either --cert-file or --key-file must be provided to use SSL.')
         parser.add_argument('--extra-file', dest='extra_files', action="append", type=str, default=[],
                             help='auto-reload whenever the given file changes too (can be specified multiple times)')
+        parser.add_argument('--exclude-pattern', dest='exclude_patterns', action="append", type=str, default=[],
+                            help='ignore reload on changes to files matching this pattern (can be specified multiple times)')
         parser.add_argument('--reloader-interval', dest='reloader_interval', action="store", type=int, default=DEFAULT_POLLER_RELOADER_INTERVAL,
                             help='After how many seconds auto-reload should scan for updates in poller-mode [default=%s]' % DEFAULT_POLLER_RELOADER_INTERVAL)
         parser.add_argument('--reloader-type', dest='reloader_type', action="store", type=str, default=DEFAULT_POLLER_RELOADER_TYPE,
@@ -333,6 +335,7 @@ def make_environ(self):
         reloader_interval = options['reloader_interval']
         reloader_type = options['reloader_type']
         self.extra_files = set(options['extra_files'])
+        exclude_patterns = set(options['exclude_patterns'])
 
         self.nopin = options['nopin']
 
@@ -392,6 +395,8 @@ def make_environ(self):
         if getattr(settings, 'RUNSERVER_PLUS_EXTRA_FILES', []):
             self.extra_files |= set(settings.RUNSERVER_PLUS_EXTRA_FILES)
 
+        exclude_patterns |= set(getattr(settings, 'RUNSERVER_PLUS_EXCLUDE_PATTERNS', []))
+
         # Werkzeug needs to be clued in its the main instance if running
         # without reloader or else it won't show key.
         # https://git.io/vVIgo
@@ -413,6 +418,7 @@ def make_environ(self):
             use_reloader=use_reloader,
             use_debugger=True,
             extra_files=self.extra_files,
+            exclude_patterns=exclude_patterns,
             reloader_interval=reloader_interval,
             reloader_type=reloader_type,
             threaded=threaded,


Test patch:
Repository: django-extensions/django-extensions

Issue:
runserver_plus with REMOTE_USER ?
Just curious if runserver_plus supports the REMOTE_USER option, if so, I can't seem to find a way to make it work (and thusly could use a little guidance).

When running the default `python manage.py runserver` command I can get it to work with automatically logging in a REMOTE_USER by doing this: `REMOTE_USER="johndoe" python manage.py runserver 8000`

Then I can use the site locally as 'johndoe' already logged in.

However, when I replace `runserver` with `runserver_plus` in that example, it just returns me to the login page - I can't seem to find any configuration that will work with the REMOTE_USER setting and `runserver_plus`; am I missing something or does that feature not work with `runserver_plus` command?

 


Discussion:

Resolving patch:
diff --git a/django_extensions/management/commands/runserver_plus.py b/django_extensions/management/commands/runserver_plus.py
--- a/django_extensions/management/commands/runserver_plus.py
+++ b/django_extensions/management/commands/runserver_plus.py
@@ -326,6 +326,9 @@ def make_environ(self):
                 environ = super().make_environ()
                 if not options['keep_meta_shutdown_func'] and 'werkzeug.server.shutdown' in environ:
                     del environ['werkzeug.server.shutdown']
+                remote_user = os.getenv('REMOTE_USER')
+                if remote_user is not None:
+                    environ['REMOTE_USER'] = remote_user
                 return environ
 
         threaded = options['threaded']


Test patch:
Repository: django-extensions/django-extensions

Issue:
[runserver_plus] autoreload django 
Hello, 
after updating Django to version 4.1.1 I noticed that using runserver_plus on the modification of python files, the autoreload works correctly but on the modification of html files if I do not restart the server,  by reloading the web page the changes are not displayed. If I use the Django runserver command everything works fine.
I think this all depended on this: https://docs.djangoproject.com/en/4.1/releases/4.1/#templates

I wait your feedback.
Thanks!




Discussion:
I'll second that.

```
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'OPTIONS': {
            'loaders': [(
                'django.template.loaders.app_directories.Loader',
                'django.template.loaders.filesystem.Loader',
            )],
           # etc...
    }
]
```
Copying a comment from a conversation on Twitter

> You’re doing reloads somehow though I guess? If you can have your watcher trigger django.templates.autoreload.reset_loaders you’ll be good. 

https://twitter.com/carltongibson/status/1588534399561510914?s=20&t=J-EAyK34GY0uHLP67Nqnxg

Resolving patch:
diff --git a/django_extensions/management/commands/runserver_plus.py b/django_extensions/management/commands/runserver_plus.py
--- a/django_extensions/management/commands/runserver_plus.py
+++ b/django_extensions/management/commands/runserver_plus.py
@@ -7,6 +7,7 @@
 import traceback
 import webbrowser
 import functools
+from pathlib import Path
 from typing import List, Set  # NOQA
 
 import django
@@ -15,7 +16,7 @@
 from django.core.management.color import color_style
 from django.core.servers.basehttp import get_internal_wsgi_application
 from django.dispatch import Signal
-from django.utils.autoreload import get_reloader
+from django.utils.autoreload import file_changed, get_reloader
 from django.views import debug as django_views_debug
 
 try:
@@ -86,12 +87,18 @@ def __init__(self, *args, **kwargs):
 
             @property
             def extra_files(self):
-                return self._extra_files.union(_error_files)
+                return self._extra_files.union(_error_files, {"*.html"})
 
             @extra_files.setter
             def extra_files(self, extra_files):
                 self._extra_files = extra_files
 
+            def trigger_reload(self, filename: str) -> None:
+                path = Path(filename)
+                results = file_changed.send(sender=self, file_path=path)
+                if not any(res[1] for res in results):
+                    super().trigger_reload(filename)
+
         _reloader.reloader_loops[name] = WrappedReloaderLoop
 
 


Test patch:
Repository: django-extensions/django-extensions

Issue:
Add Python 3.11 support
This pull requests adds Python 3.11 to Github actions and classifiers. It mitigates the issue with `importlib_metatdata` as described in #1778. 

Linting fails due to https://github.com/django-extensions/django-extensions/pull/1777


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -127,6 +127,7 @@ def fullsplit(path, result=None):
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Utilities',


Test patch:
Repository: robocorp/rpaframework

Issue:
Correct typos in `RPA.Hubspot` documentation
- Tiny typo in the examples: `${yeaterday_hs_ts}=`
- Probably an extra `api_key` placeholder on this line (several instances)?: `Auth with api key api_key ${secrets}[API_KEY]`

<!-- Edit the body of your new issue then click the ✓ "Create Issue" button in the top right of the editor. The first line will be the issue title. Assignees and Labels follow after a blank line. Leave an empty line before beginning the body of the issue. -->


Discussion:

Resolving patch:
diff --git a/packages/main/src/RPA/Hubspot.py b/packages/main/src/RPA/Hubspot.py
--- a/packages/main/src/RPA/Hubspot.py
+++ b/packages/main/src/RPA/Hubspot.py
@@ -290,9 +290,9 @@ class Hubspot:
         *** Tasks ***
         Search with date
             ${yesterday}=    Get current date    increment=-24h   result_format=epoch
-            ${yeaterday_hs_ts}=    Evaluate    round(${yesterday} * 1000)
+            ${yesterday_hs_ts}=    Evaluate    round(${yesterday} * 1000)
             ${deals}=    Search for objects    DEALS
-            ...    hs_lastmodifieddate    GTE    ${yeaterday_hs_ts}
+            ...    hs_lastmodifieddate    GTE    ${yesterday_hs_ts}
 
     .. code-block:: python
 
@@ -365,7 +365,7 @@ class Hubspot:
         *** Keywords ***
         Authorize Hubspot
             ${secrets}=    Get secret    hubspot
-            Auth with api key    api_key    ${secrets}[API_KEY]
+            Auth with api key    ${secrets}[API_KEY]
 
     .. code-block:: python
 
@@ -924,7 +924,7 @@ def search_for_objects(
             *** Keywords ***
             Authorize Hubspot
                 ${secrets}=    Get secret    hubspot
-                Auth with api key    api_key    ${secrets}[API_KEY]
+                Auth with api key    ${secrets}[API_KEY]
 
         Object Searching
         ================
@@ -1489,7 +1489,7 @@ def get_pipeline_stages(
             *** Keywords ***
             Authorize Hubspot
                 ${secrets}=    Get secret    hubspot
-                Auth with api key    api_key    ${secrets}[API_KEY]
+                Auth with api key    ${secrets}[API_KEY]
 
         This keyword caches results for future use, to refresh results from
         Hupspot, set ``use_cache`` to ``False``.


Test patch:
Repository: robocorp/rpaframework

Issue:
`RPA.JSON` RecursionError: maximum recursion depth exceeded
This error is at the moment breaking our [Certificate level 3](https://robocorp.com/docs/courses/work-data-management/validate-business-data) course with `rpaframework==15.0.0`.

Works correctly with `rpaframework==14.0.0`

```
*** Keywords ***
Validate traffic data
    [Arguments]    ${traffic_data}
    ${country}=    Get Value From Json    ${traffic_data}    $.country
    ${valid}=    Evaluate    len("${country}") == 3
    RETURN    ${valid}
```

example content of `${traffic_data}`
```
  {
      "country": "ISR",
      "year": 2019,
      "rate": 3.90874
  }
```


Discussion:
Duplicate of #537 
The regression was introduced with `rpaframework==14.2.0` given this [line](https://github.com/robocorp/rpaframework/pull/509/files#diff-759fffbba9b8e0532ccd65c2fc0a4a53c585e556177877d5b11af50d9edee7dfR13) since it produces the infinite recursion straight from _libspec_, as can be seen with both rcc and VSCode:
<img width="644" alt="Screenshot 2022-06-17 at 10 46 47" src="https://user-images.githubusercontent.com/709053/174254623-d008a2d1-0258-482d-98e3-3c35b2ac8fa7.png">

Wasn't caught through unit/robot tests since this doesn't replicate in CI/locally:
```bash
python -m robot -L TRACE --outputdir output --logtitle "Task log" --task "Validate traffic data" tasks.robot
```
As it works just fine given this [task](https://github.com/cmin764/robots/blob/main/json-path/tasks.robot#L25-L29). (since it doesn't invoke any _libspec_ parsing I believe)
```python
Validate traffic data
    &{traffic_data} =    Create Dictionary    country=ISR    year=${2019}    rate=${3.9}
    ${country} =    Get Value From Json    ${traffic_data}    $.country
    ${valid} =    Evaluate    len("${country}") == 3
    Log    Valid: ${valid}
```

Resolving patch:
diff --git a/packages/main/src/RPA/JSON.py b/packages/main/src/RPA/JSON.py
--- a/packages/main/src/RPA/JSON.py
+++ b/packages/main/src/RPA/JSON.py
@@ -10,7 +10,7 @@
 
 
 JSONValue = Optional[Union[str, int, float, bool]]
-JSONType = Union[Dict[Hashable, "JSONType"], List["JSONType"], JSONValue]
+JSONType = Union[Dict[Hashable, JSONValue], List[JSONValue], JSONValue]
 
 
 class RPAFilter(Filter):


Test patch:
Repository: robocorp/rpaframework

Issue:
`RPA.Excel.Application` Run macros in filenames with `-` and spaces in name
There is a bug in the way we call a macro with the `Run macro` keyword where if the file name has spaces or hyphens in the name (e.g., `test macro book.xlsm` or `test-macro-book.xlsm`), it will fail to find the macro. In this case, the file name must be surrounded in single quotes. I believe it may be possible to just always include the single quotes around the file name regardless of filename content.



Discussion:

Resolving patch:
diff --git a/packages/main/src/RPA/Excel/Application.py b/packages/main/src/RPA/Excel/Application.py
--- a/packages/main/src/RPA/Excel/Application.py
+++ b/packages/main/src/RPA/Excel/Application.py
@@ -391,7 +391,7 @@ def run_macro(self, macro_name: str, *args: Any):
             raise ValueError("No workbook open")
 
         with catch_com_error():
-            self.app.Application.Run(f"{self.workbook.Name}!{macro_name}", *args)
+            self.app.Application.Run(f"'{self.workbook.Name}'!{macro_name}", *args)
 
     def export_as_pdf(self, pdf_filename: str, excel_filename: str = None):
         """Export Excel as PDF file


Test patch:
diff --git a/packages/main/tests/resources/excels/boldmacro-x.xlsm b/packages/main/tests/resources/excels/boldmacro-x.xlsm
new file mode 100755
Binary files /dev/null and b/packages/main/tests/resources/excels/boldmacro-x.xlsm differ
diff --git a/packages/main/tests/robot/test_excel_application.robot b/packages/main/tests/robot/test_excel_application.robot
new file mode 100644
--- /dev/null
+++ b/packages/main/tests/robot/test_excel_application.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Library         RPA.Excel.Application
+
+Task Setup      Open Application
+Task Teardown   Quit Application
+
+Force tags      windows  skip
+
+
+*** Variables ***
+${RESOURCES}    ${CURDIR}${/}..${/}resources
+${EXCELS}       ${RESOURCES}${/}excels
+
+
+*** Tasks ***
+Run Macro On Strange Name
+    # The `-` in the name created issues.
+    Open Workbook    ${EXCELS}${/}boldmacro-x.xlsm
+    Run Macro    bold_column  # this was failing before (just because of the file name)
diff --git a/packages/main/tests/robot/test_application_word.robot b/packages/main/tests/robot/test_word_application.robot
similarity index 100%
rename from packages/main/tests/robot/test_application_word.robot
rename to packages/main/tests/robot/test_word_application.robot
Repository: robocorp/rpaframework

Issue:
Enhancements for locators database
- [x] Add support to `RPA.Desktop` library to set path to _LocatorsDatabase_ with library init parameter (similar to `RPA.Browser.Selenium`)
- [x] Add possibility to set path to _LocatorsDatabase_ with an environment variable, for example. _RPA_LOCATORS_DATABASE_ 


Discussion:

Resolving patch:
diff --git a/packages/main/src/RPA/Desktop/__init__.py b/packages/main/src/RPA/Desktop/__init__.py
--- a/packages/main/src/RPA/Desktop/__init__.py
+++ b/packages/main/src/RPA/Desktop/__init__.py
@@ -1,7 +1,7 @@
 import logging
 import platform
-import sys
 import warnings
+from typing import Optional
 
 if platform.system() == "Windows":
     # Configure comtypes to not generate DLL bindings into
@@ -19,7 +19,7 @@
 
 # pylint: disable=wrong-import-position
 from robotlibcore import DynamicCore
-from RPA.Desktop.utils import Buffer, is_windows
+from RPA.Desktop.utils import Buffer
 from RPA.Desktop.keywords import (
     ElementNotFound,
     MultipleElementsFound,
@@ -341,7 +341,9 @@ def type_notes(text):
     ROBOT_LIBRARY_SCOPE = "GLOBAL"
     ROBOT_LIBRARY_DOC_FORMAT = "REST"
 
-    def __init__(self):
+    def __init__(self, locators_path: Optional[str] = None):
+        self.locators_path = locators_path
+
         self.logger = logging.getLogger(__name__)
         self.buffer = Buffer(self.logger)
 
diff --git a/packages/main/src/RPA/Desktop/keywords/context.py b/packages/main/src/RPA/Desktop/keywords/context.py
--- a/packages/main/src/RPA/Desktop/keywords/context.py
+++ b/packages/main/src/RPA/Desktop/keywords/context.py
@@ -6,6 +6,8 @@
 except ImportError:
     HAS_RECOGNITION = False
 
+from typing import Optional
+
 
 class ElementNotFound(ValueError):
     """No matching elements were found."""
@@ -32,3 +34,7 @@ def logger(self):
     @property
     def buffer(self):
         return self.ctx.buffer
+
+    @property
+    def locators_path(self) -> Optional[str]:
+        return self.ctx.locators_path
diff --git a/packages/main/src/RPA/Desktop/keywords/finder.py b/packages/main/src/RPA/Desktop/keywords/finder.py
--- a/packages/main/src/RPA/Desktop/keywords/finder.py
+++ b/packages/main/src/RPA/Desktop/keywords/finder.py
@@ -73,7 +73,7 @@ class FinderKeywords(LibraryContext):
 
     def __init__(self, ctx):
         super().__init__(ctx)
-        self._resolver = syntax.Resolver(self._find)
+        self._resolver = syntax.Resolver(self._find, self.locators_path)
 
         self.timeout = 3.0
         if HAS_RECOGNITION:


Test patch:
Repository: robocorp/rpaframework

Issue:
`RPA.Windows.Get Elements` not copying the `robocorp_click_offset` attribute
Should make available this attribute in all siblings found elements, otherwise the `Click` keyword will fail when using offsets:

<img width="841" alt="Screen Shot 2022-08-26 at 4 48 38 PM" src="https://user-images.githubusercontent.com/709053/187146331-32d1ea86-7da7-4afe-b8ec-ea9b5289db70.png">
<img width="1391" alt="Screen Shot 2022-08-26 at 4 48 20 PM" src="https://user-images.githubusercontent.com/709053/187146342-b6ae653f-0ae7-4870-bdc9-edba1ef83533.png">



Discussion:

Resolving patch:
diff --git a/packages/windows/src/RPA/Windows/keywords/locators.py b/packages/windows/src/RPA/Windows/keywords/locators.py
--- a/packages/windows/src/RPA/Windows/keywords/locators.py
+++ b/packages/windows/src/RPA/Windows/keywords/locators.py
@@ -97,6 +97,9 @@ def get_elements(
             if next_control:
                 element = WindowsElement(next_control, locator)
                 if initial_element.is_sibling(element):
+                    element.item.robocorp_click_offset = (
+                        initial_element.item.robocorp_click_offset
+                    )
                     elements.append(element)
             else:
                 break


Test patch:
diff --git a/packages/windows/tests/robot/test_windows.robot b/packages/windows/tests/robot/test_windows.robot
--- a/packages/windows/tests/robot/test_windows.robot
+++ b/packages/windows/tests/robot/test_windows.robot
@@ -395,3 +395,17 @@ Tree printing and controlled anchor cleanup
     #  should get the Desktop element only.
     ${elem} =    Get Element
     Should Be Equal     ${elem.name}     Desktop 1
+
+
+Click Buttons With Offset
+    [Documentation]     Clicks all the numeric buttons in Calculator
+
+    Windows Run   Calc
+    Control Window      subname:Calc
+    @{buttons} =    Get Elements    id:NumberPad > class:Button
+    FOR     ${button}   IN      @{buttons}
+        ${is_numeric} =     Evaluate    "num" in "${button.item.AutomationId}"
+        IF    ${is_numeric}
+            Click   ${button}   wait_time=0.2
+        END
+    END
Repository: robocorp/rpaframework

Issue:
`RPA.core.webdriver` used by Selenium can't download latest Mac arm64 webdriver
💻 System affected: M1/M2 Macs with no working `chromedriver` available in PATH under Chrome browser version **106.0.5249.61** and onwards.

[Fix](https://github.com/SergeyPirogov/webdriver_manager/issues/446#issuecomment-1274558712) is already merged upstream but has not yet been released in PyPI.

### Reproduce

```python
inv code.test-robot -r browser -t "Open Browser With Dict Options"
```

### Solution
The desired fix would be to bump the `webdriver-manager` package `>3.8.3` once such version gets released.

### Workaround
Meanwhile, we can implement the [workaround](https://github.com/SergeyPirogov/webdriver_manager/pull/445/files#diff-38d3c158b7a31027012330b5537df014f3ec50ffa657a2787d449bd3e3c9367bL32-R33) ourselves too as described above (`mac64_m1` -> `mac_arm64`) so we can hit the right web driver download URL.


Discussion:

Resolving patch:
diff --git a/packages/core/src/RPA/core/webdriver.py b/packages/core/src/RPA/core/webdriver.py
--- a/packages/core/src/RPA/core/webdriver.py
+++ b/packages/core/src/RPA/core/webdriver.py
@@ -7,6 +7,7 @@
 from typing import Optional
 
 import requests
+from packaging import version
 from requests import Response
 from selenium import webdriver
 from selenium.webdriver.common.service import Service
@@ -53,7 +54,23 @@ class Downloader(WDMHttpClient):
 
     """Custom downloader which disables download progress reporting."""
 
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.driver = None
+
+    def _fix_mac_arm_url(self, url) -> str:
+        if "m1" not in self.driver.get_os_type():
+            return url
+
+        # FIXME(cmin764): Remove this when the issue below gets closed
+        #  https://github.com/SergeyPirogov/webdriver_manager/issues/446
+        browser_version = self.driver.get_version()
+        if version.parse(browser_version) >= version.parse("106.0.5249.61"):
+            url = url.replace("mac64_m1", "mac_arm64")
+        return url
+
     def get(self, url, **kwargs) -> Response:
+        url = self._fix_mac_arm_url(url)
         resp = requests.get(url=url, verify=self._ssl_verify, stream=True, **kwargs)
         self.validate_response(resp)
         return resp
@@ -91,8 +108,10 @@ def _to_manager(browser: str, root: Path = DRIVER_ROOT) -> DriverManager:
             f"Unsupported browser {browser!r}! (choose from: {list(AVAILABLE_DRIVERS)})"
         )
 
-    download_manager = WDMDownloadManager(Downloader())
+    downloader = Downloader()
+    download_manager = WDMDownloadManager(downloader)
     manager = manager_factory(path=str(root), download_manager=download_manager)
+    downloader.driver = manager.driver
     return manager
 
 


Test patch: