internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: fidals/shopelectro

Issue:
Search shows products with no category
It should not, of course

![image](https://user-images.githubusercontent.com/3526796/67692684-9a9cb680-f9b1-11e9-8038-99534e063e03.png)

Search link: https://www.shopelectro.ru/search/?term=MK1215NC
Link to the product: https://www.shopelectro.ru/catalog/products/7608/



Discussion:

Resolving patch:
diff --git a/shopelectro/views/search.py b/shopelectro/views/search.py
--- a/shopelectro/views/search.py
+++ b/shopelectro/views/search.py
@@ -1,9 +1,7 @@
 from django.conf import settings
 
-from search import views as search_views, search as search_engine
-
 from pages.models import Page
-
+from search import views as search_views, search as search_engine
 from shopelectro.models import Category, Product
 
 
@@ -21,14 +19,14 @@ def get_redirect_search_entity(self):
         ),
         search_engine.Search(
             name='product',
-            qs=Product.objects.active(),
+            qs=Product.objects.active().exclude(category__isnull=True),
             fields=['name'],
             redirect_field='vendor_code',
             min_similarity=settings.TRIGRAM_MIN_SIMILARITY,
         ),
         search_engine.Search(
             name='page',  # Ignore CPDBear
-            qs=Page.objects.filter(is_active=True).exclude(type=Page.MODEL_TYPE),
+            qs=Page.objects.active().exclude(type=Page.MODEL_TYPE),
             fields=['name'],
             min_similarity=settings.TRIGRAM_MIN_SIMILARITY,
         )


Test patch:
diff --git a/shopelectro/tests/tests_views.py b/shopelectro/tests/tests_views.py
--- a/shopelectro/tests/tests_views.py
+++ b/shopelectro/tests/tests_views.py
@@ -4,6 +4,7 @@
 Note: there should be tests, subclassed from TestCase.
 They all should be using Django's TestClient.
 """
+import hashlib
 import json
 import re
 import typing
@@ -904,6 +905,18 @@ def test_admin_autocomplete_has_no_model_pages(self):
         )
         self.assertTrue(len(json_to_dict(response)) == 1)
 
+    def test_no_products_with_empty_category(self):
+        """Test search should contain no products with empty category."""
+        product = models.Product.objects.active().first()
+        product.category = None
+        product.name = str(hashlib.md5())  # unique name
+        product.save()
+        response = self.client.get(
+            f'/search/?term={product.name}',
+            follow=True,
+        )
+        self.assertNotContains(response, '<div class="search-result-item">')
+
 
 @tag('fast')
 class Order(TestCase):
Repository: fidals/shopelectro

Issue:
Avoid hardcoded values in RSS template. Take values like...
The puzzle `1004-e3426e23` from #1004 has to be resolved: 

https://github.com/fidals/shopelectro/blob/235fbccbc52e368038419262bc8f4ae895afea0c/templates/prices/price.rss#L7-L8

The puzzle was created by duker33 on 31-Oct-19. 

Estimate: 30 minutes,  role: DEV. 

If you have any technical questions, don't ask me, submit new tickets instead. The task will be \"done\" when the problem is fixed and the text of the puzzle is _removed_ from the source code. Here is more about [PDD](http://www.yegor256.com/2009/03/04/pdd.html) and [about me](http://www.yegor256.com/2017/04/05/pdd-in-action.html). 



Discussion:
@artemiyds2 @duker33 please pay attention to this new issue.
required DB values are living at the index flat Page: `FlatPage.objects.get(slug='')`

Resolving patch:
diff --git a/shopelectro/management/commands/price.py b/shopelectro/management/commands/price.py
--- a/shopelectro/management/commands/price.py
+++ b/shopelectro/management/commands/price.py
@@ -57,6 +57,8 @@ def context(self) -> dict:
         ).products()
 
         return {
+            'title': settings.CUSTOM_PAGES['index']['title'],
+            'description': settings.CUSTOM_PAGES['index']['description'],
             'base_url': settings.BASE_URL,
             'categories': categories,
             'products': products,
diff --git a/shopelectro/settings/base.py b/shopelectro/settings/base.py
--- a/shopelectro/settings/base.py
+++ b/shopelectro/settings/base.py
@@ -333,7 +333,8 @@ def get_robots_content():
         'slug': '',
         'name': 'Интернет-магазин элементов питания "ShopElectro"',
         'menu_title': 'Главная',
-        'title': 'Интернет-магазин Элементов питания с доставкой по России',
+        'title': 'Интернет-магазин элементов питания с доставкой по России',
+        'description': 'Элементы питания в СПб с доставкой по России - интернет-магазин элементов питания ShopElectro',
     },
     'sitemap': {
         'slug': 'sitemap',


Test patch:
diff --git a/shopelectro/tests/tests_commands.py b/shopelectro/tests/tests_commands.py
--- a/shopelectro/tests/tests_commands.py
+++ b/shopelectro/tests/tests_commands.py
@@ -324,6 +324,13 @@ def test_items_in_price_rss(self):
         db_count = len(price.Context('GM').context()['products'])
         self.assertEqual(len(items), db_count)
 
+    def test_title_in_price_rss(self):
+        filename = 'gm.xml'
+        file_path = os.path.join(settings.ASSETS_DIR, filename)
+        root_node = ElementTree.parse(file_path)
+        title = root_node.getroot().find('channel').find('title').text
+        self.assertEqual(settings.CUSTOM_PAGES['index']['title'], title)
+
     def test_categories_in_yandex_price(self):
         categories = self.prices['YM'].categories_node
         self.assertEqual(
Repository: fidals/shopelectro

Issue:
Update prices separately
We update price files only after successful catalog data update. Sometimes we have struggle with data update, but we still need to update price files, otherwise we will get penalties from aggregators.

We should make the price files update independent of the catalog data update.
We can try these approaches:
1) Update files in separate celery cron task
2) Update files in finally block of update_catalog task 


Discussion:

Resolving patch:
diff --git a/shopelectro/celery.py b/shopelectro/celery.py
--- a/shopelectro/celery.py
+++ b/shopelectro/celery.py
@@ -39,6 +39,10 @@
         'task': 'shopelectro.tasks.update_catalog',
         'schedule': timedelta(hours=2).total_seconds(),
     },
+    'update-prices': {
+        'task': 'shopelectro.tasks.update_prices',
+        'schedule': timedelta(hours=1).total_seconds(),
+    },
     'check-purchase': {
         'task': 'shopelectro.tasks.check_purchase',
         'schedule': timedelta(days=1).total_seconds(),
@@ -52,6 +56,11 @@
         'routing_key': 'utils.command',
         'priority': 30,
     },
+    'shopelectro.tasks.update_prices': {
+        'queue': 'command',
+        'routing_key': 'utils.command',
+        'priority': 50,
+    },
     'shopelectro.tasks.check_purchase': {
         'queue': 'command',
         'routing_key': 'utils.command',
diff --git a/shopelectro/tasks.py b/shopelectro/tasks.py
--- a/shopelectro/tasks.py
+++ b/shopelectro/tasks.py
@@ -58,9 +58,16 @@ def update_catalog():
     return [
         update_catalog_command(),
         update_default_templates(),
+        collect_static(),
+    ]
+
+
+@app.task(autoretry_for=(Exception,), max_retries=3, default_retry_delay=60*10)  # Ignore PycodestyleBear (E226)
+def update_prices():
+    return [
         generate_price_files(),
         generate_excel_file(),
-        collect_static()
+        collect_static(),
     ]
 
 


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
Fix documentation table of contents levels
This is the first of what will probably be many issues with our docs... Nick's atomic docks are nice, but they seem to sort of jump up to the top level in the table of contents while ideally we'd like them below the general atomic doc heading. 
Add narrative documentation for plasma parameters
The file `parameters.py` in our `physics` subpackage contains a large number of functions for calculating plasma parameters.  As this file contains some basic functionality that will be useful for nearly all plasma physicists, we will need to add narrative documentation on calculating plasma parameters into our `docs` directory.  We will definitely need this for our v0.1.0 release.

Thanks!
-Nick


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -100,6 +100,7 @@
 # html_theme = 'alabaster'
 # html_theme = 'traditional'
 # html_theme = 'agogo'
+html_theme = "sphinx_rtd_theme"
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
diff --git a/plasmapy/physics/__init__.py b/plasmapy/physics/__init__.py
--- a/plasmapy/physics/__init__.py
+++ b/plasmapy/physics/__init__.py
@@ -1,20 +1,3 @@
-r"""
-Values should be returned as an Astropy Quantity in SI units.
-
-If a quantity has several names, then the function name should be the
-one that provides the most physical insight into what the quantity
-represents.  For example, 'gyrofrequency' indicates gyration, while
-Larmor frequency indicates that this frequency is somehow related to a
-human (or perhaps a cat?) named Larmor.  Similarly, using omega_ce as
-a function name for this quantity will make the code less readable to
-people who are unfamiliar with the notation or use a different symbol.
-
-The docstrings for plasma parameter methods should describe the
-physics associated with these quantities in ways that are
-understandable to students who are taking their first course in plasma
-physics while still being useful to experienced plasma physicists.
-
-"""
 from .parameters import (Alfven_speed,
                          ion_sound_speed,
                          thermal_speed,
diff --git a/plasmapy/physics/quantum.py b/plasmapy/physics/quantum.py
--- a/plasmapy/physics/quantum.py
+++ b/plasmapy/physics/quantum.py
@@ -239,7 +239,8 @@ def Fermi_energy(n_e):
 })
 def Thomas_Fermi_length(n_e):
     r"""
-    Calculate the exponential scale length for charge screening.
+    Calculate the exponential scale length for charge screening
+    for cold and dense plasmas.
 
     Parameters
     ----------
@@ -290,6 +291,7 @@ def Thomas_Fermi_length(n_e):
     See also
     --------
     Fermi_energy
+    plasmapy.physics.Debye_length
 
     Example
     -------


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
Add doc page on authors and credits
It would be really helpful to have a page in our `docs` directory that lists the Coordinating Committee members and a full list of authors of the code, along with other credits.  Some examples are Astropy's [Authors and Credits page](http://docs.astropy.org/en/stable/credits.html), and SunPy's [The Project](http://sunpy.org/team.html).  The list of code contributors can already be accessed from our GitHub repository and the commit log; however, this often does not include full names.  We might be able to find a way to automate this, though that's low priority.  We should do this prior to our 0.1 release.

To help with the organization, we should probably create an `about` subdirectory that will include pages about the PlasmaPy project as a whole, including this one.  The `docs/stability.rst` page could go in this directory too.


Discussion:

Resolving patch:
diff --git a/plasmapy/constants/__init__.py b/plasmapy/constants/__init__.py
--- a/plasmapy/constants/__init__.py
+++ b/plasmapy/constants/__init__.py
@@ -1,4 +1,8 @@
-"""Physical and mathematical constants."""
+"""
+Contains physical and mathematical constants commonly used in plasma
+physics.
+
+"""
 
 from numpy import pi
 
@@ -34,3 +38,26 @@
 )
 
 from astropy.constants import atm
+
+# The following code is modified from astropy.constants to produce a
+# table containing information on the constants contained with PlasmaPy.
+# Mathematical constants can be just entered.
+
+_lines = [
+    'The following constants are available:\n',
+    '========== ================= ================ ============================================',
+    'Name       Value             Units            Description',
+    '========== ================= ================ ============================================',
+    "   pi      3.141592653589793                  Ratio of circumference to diameter of circle",
+]
+
+_constants = [eval(item) for item in dir() if item[0] != '_' and item != 'pi']
+for _const in _constants:
+    _lines.append('{0:^10} {1:^17.12g} {2:^16} {3}'
+                  .format(_const.abbrev, _const.value, _const._unit_string, _const.name))
+
+_lines.append(_lines[1])
+
+__doc__ += '\n'.join(_lines)
+
+del _lines, _const, _constants


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
Use numpy.load and save instead of pickle
As @StanczakDominik put it:

> By the way, apparently pickle is unsafe due to allowing arbitrary code execution, and we're now including those in Langmuir samples. @jasperbeckers do you think we could transition to numpy.save and numpy.load .npz files? We're just storing two arrays in each of those anyway, right?


Discussion:

Resolving patch:
diff --git a/plasmapy/examples/plot_langmuir_analysis.py b/plasmapy/examples/plot_langmuir_analysis.py
--- a/plasmapy/examples/plot_langmuir_analysis.py
+++ b/plasmapy/examples/plot_langmuir_analysis.py
@@ -11,7 +11,6 @@
 from plasmapy.diagnostics.langmuir import Characteristic, swept_probe_analysis
 import astropy.units as u
 import numpy as np
-import pickle
 import os
 
 ######################################################
@@ -22,8 +21,8 @@
 # a Electron Energy Distribution Function (EEDF) as well.
 
 # Load the bias and current values stored in the .p pickle file.
-path = os.path.join("langmuir_samples", "Beckers2017.p")
-bias, current = pickle.load(open(path, 'rb'))
+path = os.path.join("langmuir_samples", "Beckers2017.npy")
+bias, current = np.load(path)
 
 # Create the Characteristic object, taking into account the correct units
 characteristic = Characteristic(np.array(bias) * u.V,
@@ -50,12 +49,12 @@
 # data. This indicates a succesfull analysis.
 
 ######################################################
-# The next sample probe data is provided by David Pace. is also obtained from a low relatively ion
-# temperature and density plasma, in Argon.
+# The next sample probe data is provided by David Pace. It is also obtained
+# from a low relatively ion temperature and density plasma, in Argon.
 
 # Load the data from a file and create the Characteristic object
-path = os.path.join("langmuir_samples", "Pace2015.p")
-bias, current = pickle.load(open(path, 'rb'))
+path = os.path.join("langmuir_samples", "Pace2015.npy")
+bias, current = np.load(path)
 characteristic = Characteristic(np.array(bias) * u.V,
                                 np.array(current) * 1e3 * u.mA)
 
@@ -92,8 +91,8 @@
 # This Helium plasma is fully bi-Maxwellian.
 
 # Import probe data and calculate probe surface area.
-path = os.path.join("langmuir_samples", "Beckers2017b.p")
-bias, current = pickle.load(open(path, 'rb'))
+path = os.path.join("langmuir_samples", "Beckers2017b.npy")
+bias, current = np.load(path)
 characteristic = Characteristic(np.array(bias) * u.V,
                                 np.array(current) * 1e3 * u.mA)
 probe_length = 1.145 * u.mm


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
add axis labels to ITER parameters plot
The ITER parameters plot [here](http://docs.plasmapy.org/en/stable/auto_examples/plot_physics.html#sphx-glr-auto-examples-plot-physics-py) could use some labels and units in said labels.


Discussion:

Resolving patch:
diff --git a/plasmapy/__init__.py b/plasmapy/__init__.py
--- a/plasmapy/__init__.py
+++ b/plasmapy/__init__.py
@@ -33,6 +33,29 @@ class UnsupportedPythonError(Exception):
     from . import physics
     from . import utils
 
+def online_help(query):
+    """
+    Search the online PlasmaPy documentation for the given query from plasmapy.org
+    Opens the results in the default web browser.
+    Requires an active Internet connection.
+    Redirects to Astropy.units in case of query 'unit' or 'units'
+
+    Parameters
+    ----------
+    query : str
+        The search query.
+    """
+    from urllib.parse import urlencode
+    import webbrowser
+
+    url = 'http://docs.plasmapy.org/en/stable/search.html?\
+    {0}&check_keywords=yes&area=default'.format(urlencode({'q': query}))
+
+    if(query.lower() in ('unit', 'units')):
+        url = 'http://docs.astropy.org/en/stable/units/'
+
+    webbrowser.open(url)
+
 __citation__ = """@misc{plasmapy_community_2018_1238132,
   author       = {PlasmaPy Community and
                   Murphy, Nicholas A. and
@@ -51,4 +74,4 @@ class UnsupportedPythonError(Exception):
   year         = 2018,
   doi          = {10.5281/zenodo.1238132},
   url          = {https://doi.org/10.5281/zenodo.1238132}
-}"""
+}"""
\ No newline at end of file
diff --git a/plasmapy/examples/plot_physics.py b/plasmapy/examples/plot_physics.py
--- a/plasmapy/examples/plot_physics.py
+++ b/plasmapy/examples/plot_physics.py
@@ -55,3 +55,6 @@
 plt.scatter(
     electron_concentration,
     physics.plasma_frequency(electron_concentration))
+plt.xlabel("Electron Concentration (m^-3)")
+plt.ylabel("Langmuir Wave Plasma Frequency (rad/s)")
+plt.show()


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
.si in check_relativistic is extra slow
Hi all,

I was making some plots with PlasmaPy today.  So my basic plan was, I have some arrays of densities and temperatures and magnetic fields, and I want to make some contour plots of various plasma parameters.  I didn't think plasmapy would be able to do vectorized operation on the numpy arrays, so I said, screw it, I'll just loop through each array and do each one individually.

Well. I knew it would be slow, but it was even slower than I expected. I ran it through the profiler and I think some of it is from Python itself, some of it is from the astropy units stuff, but then there was a massive amount of time in check_relativistic due to the use of the .si function on the astropy units, somehow.  Apparently that function is really slow?  I'm going to see if we can avoid the use of it.


Discussion:

Resolving patch:
diff --git a/plasmapy/utils/checks.py b/plasmapy/utils/checks.py
--- a/plasmapy/utils/checks.py
+++ b/plasmapy/utils/checks.py
@@ -409,13 +409,15 @@ def _check_relativistic(V, funcname, betafrac=0.05):
     if not isinstance(V, u.Quantity):
         raise TypeError(errmsg)
 
-    if V.si.unit != u.m / u.s:
+    try:
+        V_over_c = (V / c).to_value(u.dimensionless_unscaled)
+    except Exception:
         raise u.UnitConversionError(errmsg)
 
     if np.any(np.isnan(V.value)):
         raise ValueError(f"V includes NaNs in {funcname}")
 
-    beta = np.max(np.abs((V.si / c).value))
+    beta = np.max(np.abs((V_over_c)))
 
     if beta == np.inf:
         raise RelativityError(f"{funcname} is yielding an infinite velocity.")


Test patch:
Repository: PlasmaPy/PlasmaPy

Issue:
Create and update CHANGELOG.rst
List changes for v0.1 and open a new heading for v0.1.1
update README for v0.1 release
Announce it on the README!


Discussion:
In #405 we moved our markdown change log in the top-level directory and turned it into `docs/about/change_log.rst` so that it would show up more readily in the online docs.  We should probably update `docs/about/release_notes.rst` to have a v0.1.1 heading too.




Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -68,9 +68,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '0.1.0'
+version = '0.1'
 # The full version, including alpha/beta/rc tags.
-release = '0.1.0'
+release = '0.1.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/plasmapy/utils/checks.py b/plasmapy/utils/checks.py
--- a/plasmapy/utils/checks.py
+++ b/plasmapy/utils/checks.py
@@ -256,7 +256,7 @@ def _check_quantity(arg, argname, funcname, units, can_be_negative=True,
         else:
             try:
                 arg = arg * units[0]
-            except Exception:
+            except (u.UnitsError, ValueError):
                 raise TypeError(typeerror_message)
             else:
                 warnings.warn(UnitsWarning(unit_casting_warning))


Test patch:
diff --git a/plasmapy/physics/tests/test_parameters_cython.py b/plasmapy/physics/tests/test_parameters_cython.py
--- a/plasmapy/physics/tests/test_parameters_cython.py
+++ b/plasmapy/physics/tests/test_parameters_cython.py
@@ -9,6 +9,7 @@
 from plasmapy.utils.exceptions import PhysicsError
 from plasmapy.constants import c, m_p, m_e, e, mu0
 
+import plasmapy.physics.parameters_cython
 from plasmapy.physics.parameters_cython import (thermal_speed,
                                  )
 def test_thermal_speed():
@@ -21,4 +22,4 @@ def test_thermal_speed():
                           rtol=0.0,
                           atol=1e-16)
     exceptStr = f'Thermal speed value is {methodVal}, should be {trueVal}.'
-    assert testTrue, exceptStr
\ No newline at end of file
+    assert testTrue, exceptStr
Repository: PlasmaPy/PlasmaPy

Issue:
Improve project description on PyPI
[Project description](https://pypi.org/project/plasmapy/#description) is currently bland. We should detail some functionality, problems that the project is trying to address, mention openAstronomy affiliation, etc.



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,7 @@
 
 from astropy_helpers.setup_helpers import (register_commands, get_debug_option,
                                            get_package_info)
+from astropy_helpers.distutils_helpers import is_distutils_display_option
 from astropy_helpers.git_helpers import get_git_devstr
 from astropy_helpers.version_helpers import generate_version_py
 
@@ -124,6 +125,18 @@
                     os.path.relpath(root, PACKAGENAME), filename))
 package_info['package_data'][PACKAGENAME].extend(c_files)
 
+setup_requires = ['numpy']
+
+# Make sure to have the packages needed for building PlasmaPy, but do not require them
+# when installing from an sdist as the c files are included there.
+if not os.path.exists(os.path.join(os.path.dirname(__file__), 'PKG-INFO')):
+    setup_requires.extend(['cython>=0.27.2'])
+
+# Avoid installing setup_requires dependencies if the user just
+# queries for information
+if is_distutils_display_option():
+    setup_requires = []
+
 # Note that requires and provides should not be included in the call to
 # ``setup``, since these are now deprecated. See this link for more details:
 # https://groups.google.com/forum/#!topic/astropy-dev/urYO8ckB2uM
@@ -132,18 +145,33 @@
       version=VERSION,
       description=DESCRIPTION,
       scripts=scripts,
-      setup_requires=metadata.get("setup_requires", None),
+      setup_requires=[s.strip() for s in metadata.get('install_requires', 'astropy').split(',')],
       install_requires=[s.strip() for s in metadata.get('install_requires', 'astropy').split(',')],
       author=AUTHOR,
       author_email=AUTHOR_EMAIL,
       license=LICENSE,
       url=URL,
       long_description=LONG_DESCRIPTION,
+      keywords=['plasma', 'physics', 'transport', 'collisions', 'science',
+                'atomic', 'particle', 'simulation', 'langmuir', 'tokamak',
+                'instability', 'modeling'],
+      classifiers=[
+          'Intended Audience :: Science/Research',
+          'License :: OSI Approved :: BSD-2-Clause-Patent',
+          'Operating System :: OS Independent',
+          'Programming Language :: C',
+          'Programming Language :: Cython',
+          'Programming Language :: Python :: 3',
+          'Programming Language :: Python :: Implementation :: CPython',
+          'Topic :: Scientific/Engineering :: Astronomy',
+          'Topic :: Scientific/Engineering :: Physics'
+      ],
       cmdclass=cmdclassd,
       zip_safe=False,
       use_2to3=False,
       include_package_data=True,
       entry_points=entry_points,
       python_requires='>={}'.format("3.6"),
+      tests_require=["pytest", "pytest-astropy"],
       **package_info
 )


Test patch: