internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: wevote/WeVoteServer

Issue:
Search Google Photos: Add "Choose and Update" button
Add to the results page a "Choose and Update" button under the photo on Edit Candidate page:
http://localhost:8001/c/wv01cand5748/edit/
<img width="646" alt="screen shot 2017-10-25 at 6 53 53 pm" src="https://user-images.githubusercontent.com/7756031/32031500-62a151c4-b9b6-11e7-9868-2e9281882a88.png">

When this button is clicked, we should cache the photo to We Vote's AWS photo store, and then add the photo to the candidate record.


Discussion:
Hi @jainanisha90, I tried the "Choose and Update" button on "Anthony Beckford" (New York), as well as a couple of other candidates, on the Google Search result from Twitter. It showed the green check mark, but did not save the Twitter handle. It did not seem to save the photo either. Save Twitter Link didn't work either.
I clicked "Choose and Update" for the Facebook search results for "Alan H. Reed":
https://api.wevoteusa.org/c/27715/edit/?show_all_google_search_users=1

...but it didn't store the photo.

Resolving patch:
diff --git a/candidate/views_admin.py b/candidate/views_admin.py
--- a/candidate/views_admin.py
+++ b/candidate/views_admin.py
@@ -470,6 +470,7 @@ def candidate_edit_process_view(request):
 
     look_for_politician = request.POST.get('look_for_politician', False)  # If this comes in with value, don't save
     remove_duplicate_process = request.POST.get('remove_duplicate_process', False)
+    refresh_from_twitter = request.POST.get('refresh_from_twitter', False)
 
     candidate_id = convert_to_int(request.POST['candidate_id'])
     redirect_to_candidate_list = convert_to_int(request.POST['redirect_to_candidate_list'])
@@ -732,7 +733,8 @@ def candidate_edit_process_view(request):
         messages.add_message(request, messages.ERROR, 'Could not save candidate.')
         return HttpResponseRedirect(reverse('candidate:candidate_edit', args=(candidate_id,)))
 
-    results = refresh_twitter_candidate_details(candidate_on_stage)
+    if positive_value_exists(refresh_from_twitter) or positive_value_exists(candidate_twitter_handle):
+        results = refresh_twitter_candidate_details(candidate_on_stage)
 
     if redirect_to_candidate_list:
         return HttpResponseRedirect(reverse('candidate:candidate_list', args=()) +


Test patch:
Repository: wevote/WeVoteServer

Issue:
Create voter email export tool from WeVote.US based on "opt in"
On the voter Account Settings page in WeVote.US we have an option to receive the We Vote newsletter:
![screen shot 2018-01-30 at 2 16 51 pm](https://user-images.githubusercontent.com/7756031/35594574-90241c90-05c8-11e8-8b53-e28b44030dde.png)

We would like to create an view/controller that exports those emails into the import_export_batches system, so we can then download a CSV file with the emails.

This feature should be implemented after the completion of this issue:
https://github.com/wevote/WeVoteServer/issues/666

We will need a retrieve_voter_list function added to VoterManager in this file where Voter.has_valid_email and Voter.notification_settings_flags &&
 NOTIFICATION_NEWSLETTER_OPT_IN
See WeVoteServer/voter/models.py

Please export:
- first_name
- middle_name
- last_name
- email
- we_vote_id
- twitter_screen_name

Full links to the code you need to add are here:
https://docs.google.com/document/d/19MWnCSXg5XXSLSliOTHLGb6q3Ueg0V2cljNR0iUlvKI/edit#heading=h.2r5vp3v9x728


Discussion:

Resolving patch:
diff --git a/image/controllers.py b/image/controllers.py
--- a/image/controllers.py
+++ b/image/controllers.py
@@ -803,7 +803,7 @@ def retrieve_facebook_image_url(facebook_user_id):
     }
     facebook_manager = FacebookManager()
 
-    get_url = "https://graph.facebook.com/v2.7/{facebook_user_id}/picture?width=200&height=200"\
+    get_url = "https://graph.facebook.com/v2.8/{facebook_user_id}/picture?width=200&height=200"\
         .format(facebook_user_id=facebook_user_id)
     response = requests.get(get_url)
     if response.status_code == HTTP_OK:
diff --git a/voter/models.py b/voter/models.py
--- a/voter/models.py
+++ b/voter/models.py
@@ -851,15 +851,11 @@ def retrieve_voter_list(self):
         result = dict()
         status = 'NO_VOTER_LIST'
         # get query set of voters with verified emails
-        voter_queryset = Voter.objects.filter(email_ownership_is_verified=True)
+        voter_queryset = Voter.objects.extra(where=["notification_settings_flags & %s = 1",
+                                                    "email_ownership_is_verified = True"], params=[NOTIFICATION_NEWSLETTER_OPT_IN])
         if voter_queryset.exists():
             voter_list.extend(voter_queryset)
 
-        # remove voters not registered for newsletter
-        for voter in voter_list:
-            if voter.notification_settings_flags & NOTIFICATION_NEWSLETTER_OPT_IN != 1:
-                voter_list.remove(voter)
-
         result = {
             'status':   status,
             'voter_list':   voter_list,


Test patch:
Repository: wevote/WeVoteServer

Issue:
Merge pull request #1 from wevote/master
Additional changes to add to master branch



Discussion:

Resolving patch:
diff --git a/retrieve_tables/controllers_local.py b/retrieve_tables/controllers_local.py
--- a/retrieve_tables/controllers_local.py
+++ b/retrieve_tables/controllers_local.py
@@ -118,6 +118,7 @@ def retrieve_sql_files_from_master_server(request):
                         if retry < 10:
                             continue
 
+            bytes_transferred = len(response.text)
             structured_json = json.loads(response.text)
             if structured_json['success'] is False:
                 print("FAILED:  Did not receive '" + table_name + " from server")
@@ -131,8 +132,8 @@ def retrieve_sql_files_from_master_server(request):
                       ' table (as JSON) in ' + str(int(dt)) + ' seconds)')
                 break
             final_lines_count += len(lines)
-            print('... Intermediate line count from this request of ' + '{:,}'.format(gulp_size) + 'k, returned ' +
-                  '{:,}'.format(len(lines)) + ' rows, cumulative is ' + '{:,}'.format(final_lines_count))
+            print(f'... Intermediate line count from this request of {gulp_size:,} rows, returned {len(lines):,} '
+                  f'rows ({bytes_transferred:,} bytes), cumulative lines is {final_lines_count:,}')
             update_fast_load_db(host, voter_api_device_id, table_name, len(lines))
 
             if len(lines) > 0:


Test patch:
Repository: wevote/WeVoteServer

Issue:
Add icon assets
We need to have a starter sprite of the icons that will be used for the app. They don't have to be the ones that will be used when we go into production but we will need some to start with.



Discussion:
Icons have been added for what we have at this point


Resolving patch:
diff --git a/config/base.py b/config/base.py
--- a/config/base.py
+++ b/config/base.py
@@ -260,18 +260,21 @@ def get_environment_variable_default(var_name, default_value):
 # Described here: https://docs.djangoproject.com/en/1.8/topics/auth/customizing/#a-full-example
 AUTH_USER_MODEL = 'voter.Voter'
 
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.11/howto/static-files/ calls loading static files from the project
-# "grossly inefficient and probably insecure, so it is unsuitable for production", but we only use it (August 2017) to
-# serve apis_v1.css for the admin console.
-# If we ever care, there is a better way: https://docs.djangoproject.com/en/1.11/howto/static-files/deployment/
-STATIC_URL = '/static/'
-# STATIC_ROOT = os.path.join(PROJECT_PATH, "static", "static") if DEBUG else \
-#     os.path.join(PROJECT_PATH, "apis_v1", "static")  # Django Cookbook
-STATIC_ROOT = os.path.join(PROJECT_PATH, "static")
-STATICFILES_DIRS = [
-    os.path.join(BASE_DIR, 'apis_v1', 'static'),
-]
+# Static files (CSS, JavaScript, Images) Django 5+
+STATIC_URL = 'static/'
+
+# # Static files (CSS, JavaScript, Images)  Django 1.11 - 3.nn
+# # https://docs.djangoproject.com/en/1.11/howto/static-files/ calls loading static files from the project
+# # "grossly inefficient and probably insecure, so it is unsuitable for production", but we only use it (August 2017) to
+# # serve apis_v1.css for the admin console.
+# # If we ever care, there is a better way: https://docs.djangoproject.com/en/1.11/howto/static-files/deployment/
+# STATIC_URL = '/static/'
+# # STATIC_ROOT = os.path.join(PROJECT_PATH, "static", "static") if DEBUG else \
+# #     os.path.join(PROJECT_PATH, "apis_v1", "static")  # Django Cookbook
+# STATIC_ROOT = os.path.join(PROJECT_PATH, "static")
+# STATICFILES_DIRS = [
+#     os.path.join(BASE_DIR, 'apis_v1', 'static'),
+# ]
 MEDIA_URL = '/media/'  # Django Cookbook
 MEDIA_ROOT = os.path.join(PROJECT_PATH, "static", "media")  # Django Cookbook
 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'        # Added for Django 3.2, June 2021


Test patch:
Repository: wevote/WeVoteServer

Issue:
People Photos
Will need a collection of photos for the cards that will be available for each voter being represented in the proof of concept. This will eventually come from the services but for now we will need static ones. When they are collected, put them into `WebAppPublic/assets/photos/`. This directory has not been created yet.



Discussion:
Added the one placeholder for Pelosi since I did not have all of the other photo assets


Resolving patch:
diff --git a/config/base.py b/config/base.py
--- a/config/base.py
+++ b/config/base.py
@@ -261,7 +261,10 @@ def get_environment_variable_default(var_name, default_value):
 AUTH_USER_MODEL = 'voter.Voter'
 
 # Static files (CSS, JavaScript, Images) Django 5+
-STATIC_URL = 'static/'
+STATIC_URL = 'static/'      # April 2024, don't think this is correct, but can't run without it
+ALT_STATIC_URL = BASE_DIR + "/apis_v1/static"
+STATICFILES_DIRS = [ALT_STATIC_URL]
+
 
 # # Static files (CSS, JavaScript, Images)  Django 1.11 - 3.nn
 # # https://docs.djangoproject.com/en/1.11/howto/static-files/ calls loading static files from the project


Test patch:
Repository: rootpy/rootpy

Issue:
pip installing git rootpy on python 2.6 tries to install python-3?!
I just updated pip and distribute to make sure it wasn't something weird with those..

It's SLC 6.3, python 2.6, pip 1.2.1 and distribute 0.6.30.

This is a curious one.

```
$ pip install -U git+git://github.com/rootpy/rootpy.git#egg=rootpy
Downloading/unpacking rootpy from git+git://github.com/rootpy/rootpy.git#egg=rootpy
  Cloning git://github.com/rootpy/rootpy.git to ./env-slc6/build/rootpy
Cloning into docs/_themes/sphinx-bootstrap...
remote: Counting objects: 104, done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 104 (delta 37), reused 87 (delta 20)
Receiving objects: 100% (104/104), 143.03 KiB, done.
Resolving deltas: 100% (37/37), done.
  Running setup.py egg_info for package rootpy

                     _
     _ __ ___   ___ | |_ _ __  _   _
    | '__/ _ \ / _ \| __| '_ \| | | |
    | | | (_) | (_) | |_| |_) | |_| |
    |_|  \___/ \___/ \__| .__/ \__, |
                        |_|    |___/
          dev

    warning: no files found matching '*' under directory 'doc'
    warning: no files found matching '*.c' under directory 'rootpy'
Downloading/unpacking python>=2.6 from http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2 (from rootpy)
  Downloading Python-3.3.0.tar.bz2 (13.8MB): 13.8MB downloaded
  Running setup.py egg_info for package python
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/user1/pwaller/env-slc6/build/python/setup.py", line 1804
        exec(f.read(), globals(), fficonfig)
    SyntaxError: unqualified exec is not allowed in function 'configure_ctypes' it contains a nested function with free variables
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/user1/pwaller/env-slc6/build/python/setup.py", line 1804

    exec(f.read(), globals(), fficonfig)

SyntaxError: unqualified exec is not allowed in function 'configure_ctypes' it contains a nested function with free variables
```



Discussion:
I just tried with a totally fresh virtualenv with the latest version of virtualenv and I still have the same problem.

.. curiously, I then tried `pip install rootpy` expecting to get whatever was registered in pypi, but instead this successfully installted the git version, somehow.

Wow...  strange indeed. python>=2.6 is in the setup.py install_requires...


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,9 @@
 from os.path import join
 import sys
 
+if sys.version_info < (2, 6):
+    raise RuntimeError("rootpy only supports python 2.6 and above")
+
 local_path = os.path.dirname(os.path.abspath(__file__))
 # setup.py can be called from outside the rootpy directory
 os.chdir(local_path)
@@ -127,7 +130,6 @@
     download_url=__download_url__,
     packages=find_packages(),
     install_requires=[
-        'python>=2.6',
         'argparse>=1.2.1',
         ],
     extras_require={


Test patch:
Repository: rootpy/rootpy

Issue:
merge rootcint.py into stl.py



Discussion:

Resolving patch:
diff --git a/rootpy/stl.py b/rootpy/stl.py
--- a/rootpy/stl.py
+++ b/rootpy/stl.py
@@ -127,22 +127,19 @@ def shell(cmd):
 # Initialized in initialize()
 LOOKUP_TABLE = {}
 LOADED_DICTS = {}
-DICTS_PATH = None
 
+DICTS_PATH = os.path.join(userdata.BINARY_PATH, 'modules')
+if not os.path.exists(DICTS_PATH):
+    os.makedirs(DICTS_PATH)
 
 @extra_initialization
 def initialize():
     global LOOKUP_TABLE, DICTS_PATH
 
-    DICTS_PATH = os.path.join(userdata.BINARY_PATH, 'dicts')
-
     # Used insetad of AddDynamicPath for ordering
     path = ":".join([DICTS_PATH, ROOT.gSystem.GetDynamicPath()])
     ROOT.gSystem.SetDynamicPath(path)
 
-    if not os.path.exists(DICTS_PATH):
-        os.makedirs(DICTS_PATH)
-
     if os.path.exists(os.path.join(DICTS_PATH, LOOKUP_TABLE_NAME)):
         LOOKUP_FILE = open(os.path.join(DICTS_PATH, LOOKUP_TABLE_NAME), 'r')
         LOOKUP_TABLE = dict([reversed(line.strip().split('\t'))
@@ -435,7 +432,7 @@ class STLWrapper(object):
 
     CPPType = CPPType
 
-    generate = generate
+    generate = staticmethod(generate)
 
 @atexit.register
 def cleanup():


Test patch:
Repository: rootpy/rootpy

Issue:
rootpy.Graph not working with rootpy.plotting.root2matplotlib.errorbar
As the title says, it is currently not possible to plot rootpy.Graph (but works with ROOT.TGraphAsymmErrors) with errorbar.
An example + trace is given in
https://github.com/kreczko/DailyPythonScripts/blob/master/examples/rootpy_graph_bug_example.py

Is there a reason why it should behave this way or is it a bug?



Discussion:

Resolving patch:
diff --git a/rootpy/plotting/graph.py b/rootpy/plotting/graph.py
--- a/rootpy/plotting/graph.py
+++ b/rootpy/plotting/graph.py
@@ -21,17 +21,19 @@ class Graph(Plottable, NamelessConstructorObject, QROOT.TGraphAsymmErrors):
     def __init__(self, npoints=0,
                  hist=None,
                  filename=None,
+                 name=None,
+                 title=None,
                  **kwargs):
 
         if hist is not None:
-            super(Graph, self).__init__(hist, **kwargs)
+            super(Graph, self).__init__(hist, name=name, title=title)
         elif npoints > 0:
-            super(Graph, self).__init__(npoints, **kwargs)
+            super(Graph, self).__init__(npoints, name=name, title=title)
         elif filename is not None:
             gfile = open(filename, 'r')
             lines = gfile.readlines()
             gfile.close()
-            super(Graph, self).__init__(len(lines) + 2, **kwargs)
+            super(Graph, self).__init__(len(lines) + 2, name=name, title=title)
             pointIndex = 0
             for line in lines:
                 self.SetPoint(pointIndex,
@@ -42,6 +44,8 @@ def __init__(self, npoints=0,
             raise ValueError(
                 'unable to construct a graph with the supplied arguments')
 
+        self._post_init(**kwargs)
+
     def __len__(self):
 
         return self.GetN()
@@ -551,14 +555,15 @@ def __init__(self, npoints=0,
                  **kwargs):
 
         if hist is not None:
-            super(Graph2D, self).__init__(hist, **kwargs)
+            super(Graph2D, self).__init__(hist, name=name, title=title)
         elif npoints > 0:
-            super(Graph2D, self).__init__(npoints, **kwargs)
+            super(Graph2D, self).__init__(npoints, name=name, title=title)
             # ROOT bug in TGraph2D
             self.Set(npoints)
         else:
             raise ValueError(
                 'unable to construct a graph with the supplied arguments')
+        self._post_init(**kwargs)
 
     def __len__(self):
 


Test patch:
Repository: rootpy/rootpy

Issue:
path module overriden by path variable
On

https://github.com/rootpy/rootpy/blob/master/rootpy/io/file.py#L43

the module path is overriden by the variable path.

Locally, pyflakes also  warns me about it:

```
rootpy/rootpy/io $ pyflakes file.py
file.py:255: redefinition of unused 'path' from line 13
file.py:306: redefinition of unused 'path' from line 13
```

Is this something we like to have fixed?



Discussion:
Yes. That sort of thing can be problematic.

My preferred fix in this case is to just import the used symbol (`expand`), maybe as `expand_path`.


Resolving patch:
diff --git a/rootpy/io/file.py b/rootpy/io/file.py
--- a/rootpy/io/file.py
+++ b/rootpy/io/file.py
@@ -10,7 +10,7 @@
 from ..context import preserve_current_directory
 from .. import asrootpy, QROOT
 from . import utils, DoesNotExist
-from ..util import path
+from ..util.path import expand as expand_path
 
 import tempfile
 import os
@@ -248,7 +248,7 @@ def __exit__(self, type, value, traceback):
 
 def root_open(filename, mode=""):
 
-    filename = path.expand(filename)
+    filename = expand_path(filename)
     root_file = ROOT.TFile.Open(filename, mode)
     # fix evil segfault after attempt to open bad file in 5.30
     # this fix is not needed in 5.32


Test patch:
Repository: rootpy/rootpy

Issue:
'TCanvas' object has no attribute 'name'
Hi,

I am seeing weird issues with the interactive module. It looks like the TCanvas is not 'decorated' when loading rootpy.interactive.

```
>>> from ROOT import *
>>> t = TCanvas()
>>> from rootpy.interactive import wait
/usr/local/lib/python2.7/site-packages/IPython/frontend.py:30: UserWarning: The top-level `frontend` package has been deprecated. All its subpackages have been moved to the top `IPython` level.
  warn("The top-level `frontend` package has been deprecated. "
w>>> wait()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rootpy-dev-py2.7.egg/rootpy/interactive/rootwait.py", line 206, in wait_for_zero_canvases
    log.debug("waiting for canvas {0} to close".format(canvas.name))
AttributeError: 'TCanvas' object has no attribute 'name'
```

Albert



Discussion:

Resolving patch:
diff --git a/rootpy/interactive/rootwait.py b/rootpy/interactive/rootwait.py
--- a/rootpy/interactive/rootwait.py
+++ b/rootpy/interactive/rootwait.py
@@ -203,7 +203,7 @@ def exit_application_loop():
     visible_canvases = get_visible_canvases()
 
     for canvas in visible_canvases:
-        log.debug("waiting for canvas {0} to close".format(canvas.name))
+        log.debug("waiting for canvas {0} to close".format(canvas.GetName()))
         canvas.Update()
 
         if middle_mouse_close:


Test patch:
Repository: rootpy/rootpy

Issue:
root2hdf5 does not respect inheritance
Hey guys,

first of all : great work =)

I'm currently testing the root(tree)2hdf5 functionality to convert a root file that contains a TNtuple.
[rootpy walks through the file with `class_pattern="TTree"`](https://github.com/rootpy/rootpy/blob/master/rootpy/root2hdf5.py#L247), which skips all instances of TNtuple. This is not the behavior I would expect since a TNtuple _is_ a TTree. IMHO, `class_pattern` is the problem here. I would either use something like `class_regexp` or pass a class reference to compare with `isinstance` in [rootpy.io.file._DirectoryBase.walk](https://github.com/rootpy/rootpy/blob/master/rootpy/io/file.py#L505).

I'll try to create a PR soon.

Edit:
I just created PR #673.



Discussion:

Resolving patch:
diff --git a/rootpy/io/file.py b/rootpy/io/file.py
--- a/rootpy/io/file.py
+++ b/rootpy/io/file.py
@@ -507,6 +507,7 @@ def walk(self,
              path=None,
              depth=0,
              maxdepth=-1,
+             class_ref=None,
              class_pattern=None,
              return_classname=False,
              treat_dirs_as_objs=False):
@@ -536,6 +537,10 @@ def walk(self,
             The maximum depth in the directory hierarchy to traverse. There is
             no limit applied by default.
 
+        class_ref : class, optional (default=None)
+            If not None then only include objects that are instances of
+            ``class_ref``.
+
         class_pattern : string, optional (default=None)
             If not None then only include objects in ``filenames`` with class
             names that match ``class_pattern``. ``class_pattern`` should be a
@@ -575,6 +580,9 @@ def walk(self,
             if is_directory:
                 dirnames.append(name)
             if not is_directory or treat_dirs_as_objs:
+                if class_ref is not None:
+                    if not isinstance(tdirectory.Get(name), class_ref):
+                        continue
                 if class_pattern is not None:
                     if not fnmatch(classname, class_pattern):
                         continue
@@ -592,6 +600,7 @@ def walk(self,
         for dirname in dirnames:
             rdir = tdirectory.GetDirectory(dirname)
             for x in rdir.walk(
+                    class_ref=class_ref,
                     class_pattern=class_pattern,
                     depth=depth + 1,
                     maxdepth=maxdepth,
diff --git a/rootpy/root2hdf5.py b/rootpy/root2hdf5.py
--- a/rootpy/root2hdf5.py
+++ b/rootpy/root2hdf5.py
@@ -27,6 +27,8 @@
 from .extern.six import string_types
 from .logger.utils import check_tty
 
+from . import QROOT
+
 __all__ = [
     'tree2hdf5',
     'root2hdf5',
@@ -244,7 +246,7 @@ def root2hdf5(rfile, hfile, rpath='',
         own_h5file = True
 
     for dirpath, dirnames, treenames in rfile.walk(
-            rpath, class_pattern='TTree'):
+            rpath, class_ref=QROOT.TTree):
 
         # skip directories w/o trees
         if not treenames:


Test patch: