internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: vaexio/vaex

Issue:
[BUG-REPORT] parsing a pandas.DataFrame with a column named `"col"` causes `RecursionError`
Hey, I just opened up another issue, but since this one came up as well I thought I report it also...

**Description**
It seems that `"col"` is somehow used internally by vaex but `pandas` allows `"col"` as a column-name....

```python
import pandas as pd
import vaex

pandas_df = pd.DataFrame(dict(col=[3, 4, 5]), index=[1,2,3])
vaex.from_pandas(pandas_df)
```

```python
...
...
  File "D:\miniconda\envs\rt1\lib\site-packages\vaex\dataframe.py", line 2098, in col
    expression = getattr(self, name, None)

  File "D:\miniconda\envs\rt1\lib\site-packages\vaex\dataframe.py", line 2098, in col
    expression = getattr(self, name, None)

  File "D:\miniconda\envs\rt1\lib\site-packages\vaex\dataframe.py", line 2094, in col
    class ColumnList(object):

RecursionError: maximum recursion depth exceeded while calling a Python object
```


**Software information**
 - Vaex version (`import vaex; vaex.__version__)`:
 - {'vaex-core': '4.8.0',
 'vaex-viz': '0.5.1',
 'vaex-hdf5': '0.12.0',
 'vaex-server': '0.8.1',
 'vaex-astro': '0.9.0',
 'vaex-jupyter': '0.7.0',
 'vaex-ml': '0.17.0'}
 - Vaex was installed via:  conda-forge
 - OS: Windows



Discussion:
Thanks for the report! I can confirm this is a bug

Resolving patch:
diff --git a/packages/vaex-core/vaex/dataframe.py b/packages/vaex-core/vaex/dataframe.py
--- a/packages/vaex-core/vaex/dataframe.py
+++ b/packages/vaex-core/vaex/dataframe.py
@@ -2184,8 +2184,11 @@ class ColumnList(object):
             pass
         data = ColumnList()
         for name in self.get_column_names():
-            expression = getattr(self, name, None)
-            if not isinstance(expression, Expression):
+            if name != 'col':  # avoid recursion
+                expression = getattr(self, name, None)
+                if not isinstance(expression, Expression):
+                    expression = Expression(self, name)
+            else:
                 expression = Expression(self, name)
             setattr(data, name, expression)
         return data


Test patch:
diff --git a/tests/column_names_test.py b/tests/column_names_test.py
--- a/tests/column_names_test.py
+++ b/tests/column_names_test.py
@@ -94,3 +94,6 @@ def test_special_names():
     # getattr(df, 'data', None) to return None
     df = vaex.from_arrays(data=[1, 2])
     assert df['data'].tolist() == [1, 2]
+
+    df = vaex.from_arrays(col=[1, 2])
+    assert df['col'].tolist() == [1, 2]
Repository: vaexio/vaex

Issue:
agg.list() fails for multiple-column-groupby
On vaex 4.9.1/python 3.9.6/linux:

```
vx = vaex.from_arrays(a=[1,2,3],b=[4,5,6],c=[7,8,9]);
vx.groupby(['a','b'],vaex.agg.count('c'))
```
this code works: 

```
Out[7]: 
  #    a    b    c_count
  0    1    4          1
  1    2    5          1
  2    3    6          1
```

but, this fails:
```
vx=vaex.from_arrays(a=[1,2,3],b=[4,5,6],c=[7,8,9]);
vx.groupby(['a','b'],vaex.agg.list('c'))

```

```
...
~/miniconda3/lib/python3.9/site-packages/vaex/groupby.py in process(args)
    916                 columns = {field.name: ar for field, ar in zip(values.type, values.flatten())}
    917                 for key, value in arrays.items():
--> 918                     assert value.ndim == 1
    919                     columns[key] = value
    920             else:

AttributeError: 'pyarrow.lib.LargeListArray' object has no attribute 'ndim'
```


Discussion:

Resolving patch:
diff --git a/packages/vaex-core/vaex/groupby.py b/packages/vaex-core/vaex/groupby.py
--- a/packages/vaex-core/vaex/groupby.py
+++ b/packages/vaex-core/vaex/groupby.py
@@ -915,7 +915,7 @@ def sort(ar):
                 values = self.by[0].bin_values
                 columns = {field.name: ar for field, ar in zip(values.type, values.flatten())}
                 for key, value in arrays.items():
-                    assert value.ndim == 1
+                    assert vaex.array_types.ndim(value) == 1
                     columns[key] = value
             else:
                 columns = {}


Test patch:
diff --git a/tests/agg_test.py b/tests/agg_test.py
--- a/tests/agg_test.py
+++ b/tests/agg_test.py
@@ -716,3 +716,10 @@ def test_agg_arrow():
     dfg = df.groupby(df.s, agg={'l': vaex.agg.list(df.x)}, sort=True)
     assert dfg.s.tolist() == ['aap', 'kees', 'mies', 'noot', None]
     assert set(dfg.l.tolist()[0]) == {0, 2}
+
+
+    df = vaex.from_arrays(x=x, s=s, y=y)
+    dfg = df.groupby([df.s, df.x], agg={'l': vaex.agg.list(df.y)}, sort=True, assume_sparse=True)
+    assert dfg.s.tolist() == ['aap', 'aap', 'kees', 'mies', 'mies', 'noot', None]
+    assert dfg.x.tolist() == [0, 2, 1, 0, 1, 0, 0]
+    assert set(dfg.l.tolist()[0]) == {1}
Repository: vaexio/vaex

Issue:
[FEATURE-REQUEST]: Expose `vaex.DataFrame` for type hinting
I would like to add type annotations to my code. Currently I can do `from vaex.dataframe import DataFrame`, but it would be nice if  the DataFrame was exposed at the top level so I could just do `import vaex` and then `df: vaex.DataFrame = ...`

I like being able to namespace it like this to differentiate between other DataFrames, eg `import pandas as pd` and then `pdf: pd.DataFrame = ...`

I can submit a PR if you want. Thank you for this awesome library, I'm excited to get started with it! Better string processing is a big requirement of mine and this is 💯 



Discussion:
@JovanVeljanoski any thoughts on this?
Yeah, I like this.

The only thing I have been sloppy with is making sure 'DataFrame' is the only interface people care about. There are quite a few methods in DataFrameLocal that are not in DataFrame, so the type hinting will be always complete.

cheers,

Maarten

I have no strong opinion on this. @maartenbreddels if you have no objections, we can just do this.  Should we proceed?

Resolving patch:
diff --git a/packages/vaex-core/vaex/__init__.py b/packages/vaex-core/vaex/__init__.py
--- a/packages/vaex-core/vaex/__init__.py
+++ b/packages/vaex-core/vaex/__init__.py
@@ -56,6 +56,9 @@
 from . import agg
 import vaex.datasets
 
+# Re-export these so users can type hint with eg vaex.DataFrame
+from vaex.dataframe import DataFrame as DataFrame
+from vaex.expression import Expression as Expression
 
 
 


Test patch:
Repository: django-tastypie/django-tastypie

Issue:
Only way to avoid deprecation warning from Api.override_urls is to define it.
Since `Api.override_urls` raises a deprecation warning, and `Api.urls` calls `override_urls`, there is no way to avoid seeing that warning unless you define `override_urls` on your own `Api` subclass and have it return nothing. Seems backwards to force people to define a deprecated method in order to avoid a deprecation warning about it!

I think the default implementation of `override_urls` should simply return the empty list, rather than raising a warning and calling `prepend_urls`. I don't see the point of the latter; these methods are hooks which are called by `Api.urls` and we know `Api.urls` will call `prepend_urls` anyway, so why do we need to call it again from within `override_urls`? And the warning can be taken care of adequately by the existing warning in `Api.urls` that fires if `override_urls` returns anything non-empty.

Not deeply familiar with tastypie, so I could be missing something.



Discussion:
+1 for this

You can also filter warnings in your django settings.

```
import warnings
warnings.filterwarnings(
    'ignore',
    r"'override_urls' is a deprecated method & will be removed by v1.0.0. Please use ``prepend_urls`` instead.",
    UserWarning, r'tastypie.*')
```

Agreed this is annoying, but based on #516 it looks like it might be intended behaviour...


Resolving patch:
diff --git a/tastypie/api.py b/tastypie/api.py
--- a/tastypie/api.py
+++ b/tastypie/api.py
@@ -79,8 +79,7 @@ def override_urls(self):
         """
         Deprecated. Will be removed by v1.0.0. Please use ``prepend_urls`` instead.
         """
-        warnings.warn("'override_urls' is a deprecated method & will be removed by v1.0.0. Please use ``prepend_urls`` instead.")
-        return self.prepend_urls()
+        return []
 
     def prepend_urls(self):
         """
@@ -104,9 +103,10 @@ def urls(self):
 
         urlpatterns = self.prepend_urls()
 
-        if self.override_urls():
+        overridden_urls = self.override_urls()
+        if overridden_urls:
             warnings.warn("'override_urls' is a deprecated method & will be removed by v1.0.0. Please rename your method to ``prepend_urls``.")
-            urlpatterns += self.override_urls()
+            urlpatterns += overridden_urls
 
         urlpatterns += patterns('',
             *pattern_list
diff --git a/tastypie/resources.py b/tastypie/resources.py
--- a/tastypie/resources.py
+++ b/tastypie/resources.py
@@ -337,9 +337,10 @@ def urls(self):
         """
         urls = self.prepend_urls()
 
-        if self.override_urls():
+        overridden_urls = self.override_urls()
+        if overridden_urls:
             warnings.warn("'override_urls' is a deprecated method & will be removed by v1.0.0. Please rename your method to ``prepend_urls``.")
-            urls += self.override_urls()
+            urls += overridden_urls
 
         urls += self.base_urls()
         urlpatterns = patterns('',


Test patch:
Repository: django-tastypie/django-tastypie

Issue:
Authorization calls create_detail twice
Same issue as ticket [#884](https://github.com/toastdriven/django-tastypie/issues/884) but then for [obj_create](https://github.com/toastdriven/django-tastypie/blob/master/tastypie/resources.py#L2148).

This line is redundant as far as i know.



Discussion:

Resolving patch:
diff --git a/tastypie/resources.py b/tastypie/resources.py
--- a/tastypie/resources.py
+++ b/tastypie/resources.py
@@ -2145,7 +2145,6 @@ def obj_create(self, bundle, **kwargs):
         for key, value in kwargs.items():
             setattr(bundle.obj, key, value)
 
-        self.authorized_create_detail(self.get_object_list(bundle.request), bundle)
         bundle = self.full_hydrate(bundle)
         return self.save(bundle)
 


Test patch:
diff --git a/tests/core/tests/resources.py b/tests/core/tests/resources.py
--- a/tests/core/tests/resources.py
+++ b/tests/core/tests/resources.py
@@ -1242,11 +1242,23 @@ def full_hydrate(self, bundle):
 
 
 class CounterAuthorization(Authorization):
+    def create_detail(self, object_list, bundle, *args, **kwargs):
+        bundle._create_auth_call_count = getattr(bundle, '_create_auth_call_count', 0) + 1
+        return True
+
     def update_detail(self, object_list, bundle, *args, **kwargs):
         bundle._update_auth_call_count = getattr(bundle, '_update_auth_call_count', 0) + 1
         return True
 
 
+class CounterCreateDetailResource(ModelResource):
+    count = fields.IntegerField('count', default=0, null=True)
+
+    class Meta:
+        queryset = Counter.objects.all()
+        authorization = CounterAuthorization()
+
+
 class CounterUpdateDetailResource(ModelResource):
     count = fields.IntegerField('count', default=0, null=True)
 
@@ -3005,6 +3017,18 @@ def test_obj_create(self):
         latest = NoteWithEditor.objects.get(slug='note-with-editor')
         self.assertEqual(latest.editor.username, u'zeus')
 
+    def test_obj_create_full_hydrate_on_create_authorization(self):
+        cr = CounterCreateDetailResource()
+        counter_bundle = cr.build_bundle(data={
+            "name": "About",
+            "slug": "about",
+        }, obj=Counter())
+        cr.obj_create(counter_bundle)
+
+        self.assertEquals(counter_bundle._create_auth_call_count, 1)
+        self.assertEquals(counter_bundle.obj.name, "About")
+        self.assertEquals(counter_bundle.obj.slug, "about")
+
     def test_obj_update(self):
         self.assertEqual(Note.objects.all().count(), 6)
         note = NoteResource()
Repository: django-tastypie/django-tastypie

Issue:
Docs build fails with Sphinx theme warning
Travis CI builds have been failing for a while with the following error (eg https://travis-ci.org/django-tastypie/django-tastypie/jobs/55462479):

Warning, treated as error:

WARNING: 'default' html theme has been renamed to 'classic'. Please change your html_theme setting either to the new 'alabaster' default theme, or to 'classic' to keep using the old default.

ERROR: InvocationError: '/home/travis/build/django-tastypie/django-tastypie/.tox/docs/bin/sphinx-build -W -b html -d /home/travis/build/django-tastypie/django-tastypie/.tox/docs/tmp/doctrees . /home/travis/build/django-tastypie/django-tastypie/.tox/docs/tmp/html'

___________________________________ summary ____________________________________

py26-1.5: commands succeeded

ERROR: docs: commands failed

The command "tox -e py${TRAVIS_PYTHON_VERSION/./}-${DJANGO_VERSION},docs" exited with 1.



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -91,7 +91,7 @@
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'default'
+html_theme = 'classic'
 
 # 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


Test patch:
Repository: django-tastypie/django-tastypie

Issue:
Django 1.9 not fully supported

related: #1395

django-tastypie states in the README that Django 1.9 is supported, but request.REQUEST is used somewhere in current master: https://github.com/django-tastypie/django-tastypie/blob/ea010ffb09f2a30db4acfb734b4315242652da29/tastypie/authentication.py#L528

The removal of WSGIRequest.REQUEST is stated at the Django 1.9 release notes:
https://docs.djangoproject.com/en/1.10/releases/1.9/


Discussion:

Resolving patch:
diff --git a/tastypie/authentication.py b/tastypie/authentication.py
--- a/tastypie/authentication.py
+++ b/tastypie/authentication.py
@@ -525,7 +525,9 @@ def is_valid_request(self, request):
         according to OAuth spec) or fall back to ``GET/POST``.
         """
         auth_params = request.META.get("HTTP_AUTHORIZATION", [])
-        return self.is_in(auth_params) or self.is_in(request.REQUEST)
+        return (self.is_in(auth_params) or
+                self.is_in(request.POST) or
+                self.is_in(request.GET))
 
     def validate_token(self, request, consumer, token):
         oauth_server, oauth_request = oauth_provider.utils.initialize_server_request(request)


Test patch:
Repository: django-tastypie/django-tastypie

Issue:
MultiAuthentication with SessionAuthentication exception when there is no CSRF token
Hello, after updating to:
- Django==4.1.7
- django-tastypie==0.14.5

There is an exception being thrown and not intercepted when trying to use a `MultiAuthentication` with `SessionAuthentication` and another authentication, for example `ApiKeyAuthentication`.

When trying to send a request with no CSRF token in Cookies (because other authentication methods do not require a CSRF token), an `InvalidTokenFormat` exception is raised in `django/middleware/csrf.py` method `_check_token_format`. That exception should be catched in `tastypie/authentication.py` line 315 `csrf_token = check_token_format(csrf_token)` but is not.

As a result, it's impossible to authenticate with another authentication.

The last commit to change that is this one: https://github.com/django-tastypie/django-tastypie/commit/ee87690321dffc6a192227b1b3b2c62e0e18dc51


Discussion:

Resolving patch:
diff --git a/tastypie/authentication.py b/tastypie/authentication.py
--- a/tastypie/authentication.py
+++ b/tastypie/authentication.py
@@ -312,7 +312,10 @@ def is_authenticated(self, request, **kwargs):
             return request.user.is_authenticated
         csrf_token = request.COOKIES.get(settings.CSRF_COOKIE_NAME, '')
 
-        csrf_token = check_token_format(csrf_token)
+        try:
+            csrf_token = check_token_format(csrf_token)
+        except InvalidTokenFormat:
+            return False
 
         if request.is_secure():
             referer = request.META.get('HTTP_REFERER')


Test patch:
diff --git a/tests/core/tests/authentication.py b/tests/core/tests/authentication.py
--- a/tests/core/tests/authentication.py
+++ b/tests/core/tests/authentication.py
@@ -471,6 +471,8 @@ def test_apikey_and_authentication_enforce_user(self):
         self.assertEqual(session_auth.is_authenticated(request1), True)
         # api key auth should fail because of invalid api key
         self.assertEqual(isinstance(api_key_auth.is_authenticated(request2), HttpUnauthorized), True)
+        # multi auth should fail because there is no valid auth
+        self.assertEqual(isinstance(auth.is_authenticated(request2), HttpUnauthorized), True)
 
         # multi auth shouldn't change users if api key auth fails
         # multi auth passes since session auth is valid
Repository: Netflix/lemur

Issue:
When uploading certificates a custom name should be allowed



Discussion:

Resolving patch:
diff --git a/lemur/certificates/service.py b/lemur/certificates/service.py
--- a/lemur/certificates/service.py
+++ b/lemur/certificates/service.py
@@ -168,6 +168,10 @@ def upload(**kwargs):
         kwargs.get('intermediate_cert'),
     )
 
+    # we override the generated name if one is provided
+    if kwargs.get('name'):
+        cert.name = kwargs['name']
+
     cert.description = kwargs.get('description')
 
     cert.owner = kwargs['owner']
diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py
--- a/lemur/certificates/views.py
+++ b/lemur/certificates/views.py
@@ -332,7 +332,8 @@ def post(self):
                  "intermediateCert": "---Begin Public...",
                  "privateKey": "---Begin Private..."
                  "destinations": [],
-                 "notifications": []
+                 "notifications": [],
+                 "name": "cert1"
               }
 
            **Example response**:
@@ -373,6 +374,7 @@ def post(self):
         """
         self.reqparse.add_argument('description', type=str, location='json')
         self.reqparse.add_argument('owner', type=str, required=True, location='json')
+        self.reqparse.add_argument('name', type=str, location='json')
         self.reqparse.add_argument('publicCert', type=pem_str, required=True, dest='public_cert', location='json')
         self.reqparse.add_argument('destinations', type=list, default=[], dest='destinations', location='json')
         self.reqparse.add_argument('notifications', type=list, default=[], dest='notifications', location='json')


Test patch:
Repository: Netflix/lemur

Issue:
Cannot edit owner with no associated role
```
2015-08-26 20:33:36,751 ERROR: 'NoneType' object has no attribute 'name' [in /apps/lemur/lemur/common/utils.py:60]
Traceback (most recent call last):
  File "/apps/lemur/lemur/common/utils.py", line 46, in wrapper
    resp = f(*args, **kwargs)
  File "/apps/lemur/lemur/certificates/views.py", line 575, in put
    permission = UpdateCertificatePermission(certificate_id, role.name)
AttributeError: 'NoneType' object has no attribute 'name'
2015-08-26 20:34:08,236 ERROR: 'NoneType' object has no attribute 'name' [in /apps/lemur/lemur/common/utils.py:60]
Traceback (most recent call last):
  File "/apps/lemur/lemur/common/utils.py", line 46, in wrapper
    resp = f(*args, **kwargs)
  File "/apps/lemur/lemur/certificates/views.py", line 575, in put
    permission = UpdateCertificatePermission(certificate_id, role.name)
AttributeError: 'NoneType' object has no attribute 'name'
2015-08-26 20:37:19,147 ERROR: 'NoneType' object has no attribute 'name' [in /apps/lemur/lemur/common/utils.py:60]
Traceback (most recent call last):
  File "/apps/lemur/lemur/common/utils.py", line 46, in wrapper
    resp = f(*args, **kwargs)
  File "/apps/lemur/lemur/certificates/views.py", line 575, in put
    permission = UpdateCertificatePermission(certificate_id, role.name)
AttributeError: 'NoneType' object has no attribute 'name'
```

If user enters a owner that has no associated role with it, they are unable to edit the owner.



Discussion:

Resolving patch:
diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py
--- a/lemur/certificates/views.py
+++ b/lemur/certificates/views.py
@@ -572,7 +572,8 @@ def put(self, certificate_id):
 
         cert = service.get(certificate_id)
         role = role_service.get_by_name(cert.owner)
-        permission = UpdateCertificatePermission(certificate_id, role.name)
+
+        permission = UpdateCertificatePermission(certificate_id, getattr(role, 'name', None))
 
         if permission.can():
             return service.update(


Test patch:
Repository: Netflix/lemur

Issue:
Common name field needs additional validation on the UI and API
It looks like 64 character limit

http://stackoverflow.com/questions/5136198/what-strings-are-allowed-in-the-common-name-attribute-in-an-x-509-certificate



Discussion:

Resolving patch:
diff --git a/lemur/plugins/lemur_cloudca/plugin.py b/lemur/plugins/lemur_cloudca/plugin.py
--- a/lemur/plugins/lemur_cloudca/plugin.py
+++ b/lemur/plugins/lemur_cloudca/plugin.py
@@ -7,6 +7,7 @@
 .. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
 
 """
+import re
 import ssl
 import base64
 from json import dumps
@@ -245,6 +246,7 @@ def create_authority(self, options):
 
         options['validityStart'] = convert_date_to_utc_time(options['validityStart']).isoformat()
         options['validityEnd'] = convert_date_to_utc_time(options['validityEnd']).isoformat()
+        options['description'] = re.sub(r'[^a-zA-Z0-9]', '', options['caDescription'])
 
         try:
             response = self.session.post(self.url + endpoint, data=dumps(remove_none(options)), timeout=10,
@@ -297,7 +299,7 @@ def create_certificate(self, csr, options):
             'ownerEmail': options['owner'],
             'caName': options['authority'].name,
             'csr': csr,
-            'comment': options['description']
+            'comment': re.sub(r'[^a-zA-Z0-9]', '', options['description'])
         }
 
         response = self.post(endpoint, remove_none(cloudca_options))


Test patch:
Repository: Netflix/lemur

Issue:
Duplicate Plugins Listed
Plugins are duplicated in the authority dropdown.



Discussion:

Resolving patch:
diff --git a/lemur/common/managers.py b/lemur/common/managers.py
--- a/lemur/common/managers.py
+++ b/lemur/common/managers.py
@@ -22,7 +22,8 @@ def get_class_list(self):
 
     def add(self, class_path):
         self.cache = None
-        self.class_list.append(class_path)
+        if class_path not in self.class_list:
+            self.class_list.append(class_path)
 
     def remove(self, class_path):
         self.cache = None
diff --git a/lemur/plugins/views.py b/lemur/plugins/views.py
--- a/lemur/plugins/views.py
+++ b/lemur/plugins/views.py
@@ -86,7 +86,7 @@ def get(self):
         if args['type']:
             return list(plugins.all(plugin_type=args['type']))
 
-        return plugins.all()
+        return list(plugins.all())
 
 
 class Plugins(AuthenticatedResource):


Test patch: