internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: lk-geimfari/mimesis

Issue:
Add UUID objects support for uuid()
- [x] Add parameter `as_object` 


Discussion:

Resolving patch:
diff --git a/mimesis/__init__.py b/mimesis/__init__.py
--- a/mimesis/__init__.py
+++ b/mimesis/__init__.py
@@ -72,7 +72,7 @@
     '__license__',
 ]
 
-__version__ = '4.0.0'
+__version__ = '4.1.0'
 __title__ = 'mimesis'
 __description__ = 'Mimesis: fake data generator.'
 __url__ = 'https://github.com/lk-geimfari/mimesis'
diff --git a/mimesis/providers/cryptographic.py b/mimesis/providers/cryptographic.py
--- a/mimesis/providers/cryptographic.py
+++ b/mimesis/providers/cryptographic.py
@@ -4,8 +4,8 @@
 
 import hashlib
 import secrets
-import uuid
-from typing import Optional
+from typing import Optional, Union
+from uuid import UUID
 
 from mimesis.enums import Algorithm
 from mimesis.providers.base import BaseProvider
@@ -30,14 +30,25 @@ class Meta:
 
         name = 'cryptographic'
 
-    def uuid(self, version: int = None) -> str:
+    def uuid(self, version: int = None,
+             as_object: bool = False) -> Union[UUID, str]:
         """Generate random UUID.
 
+        This method returns string by default,
+        but yoy can make it return uuid.UUID object using
+        parameter **as_object**
+
+        :param as_object: Returns uuid.UUID object instead of string.
         :param version: UUID version.
-        :return: UUID
+        :return: UUID.
         """
         bits = self.random.getrandbits(128)
-        return str(uuid.UUID(int=bits, version=version))
+        uuid_obj = UUID(int=bits, version=version)
+
+        if not as_object:
+            return str(uuid_obj)
+
+        return uuid_obj
 
     def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003
         """Generate random hash.


Test patch:
diff --git a/tests/test_providers/test_cryptographic.py b/tests/test_providers/test_cryptographic.py
--- a/tests/test_providers/test_cryptographic.py
+++ b/tests/test_providers/test_cryptographic.py
@@ -1,4 +1,5 @@
 import re
+import uuid
 
 import pytest
 
@@ -18,8 +19,27 @@ def crypto(self):
     def test_str(self, crypto):
         assert re.match(patterns.PROVIDER_STR_REGEX, str(crypto))
 
-    def test_uuid(self, crypto):
-        assert re.match(patterns.UUID_REGEX, crypto.uuid())
+    @pytest.mark.parametrize(
+        'version, as_object', [
+            (0, False),
+            (1, True),
+            (2, False),
+            (3, True),
+            (4, True),
+            (5, False),
+            (6, False),
+        ],
+    )
+    def test_uuid(self, crypto, version, as_object):
+        if 1 <= version <= 5:
+            uuid_result = crypto.uuid(version, as_object=as_object)
+            if as_object:
+                assert isinstance(uuid_result, uuid.UUID)
+            else:
+                assert re.match(patterns.UUID_REGEX, crypto.uuid(version))
+        else:
+            with pytest.raises(ValueError):
+                re.match(patterns.UUID_REGEX, crypto.uuid(version))
 
     @pytest.mark.parametrize(
         'algorithm, length', [
Repository: lk-geimfari/mimesis

Issue:
Add UUID objects support for uuid()
- [x] Add parameter `as_object` 


Discussion:

Resolving patch:
diff --git a/mimesis/providers/cryptographic.py b/mimesis/providers/cryptographic.py
--- a/mimesis/providers/cryptographic.py
+++ b/mimesis/providers/cryptographic.py
@@ -38,6 +38,9 @@ def uuid(as_object: bool = False) -> Union[UUID, str]:
         but you can make it return uuid.UUID object using
         parameter **as_object**
 
+        .. warning:: Seed is not applicable to this method,
+            because of its cryptographic-safe nature.
+
         :param as_object: Returns uuid.UUID.
         :return: UUID.
         """
@@ -54,6 +57,9 @@ def hash(self, algorithm: Algorithm = None) -> str:  # noqa: A003
         To change hashing algorithm, pass parameter ``algorithm``
         with needed value of the enum object :class:`~mimesis.enums.Algorithm`
 
+        .. warning:: Seed is not applicable to this method,
+            because of its cryptographic-safe nature.
+
         :param algorithm: Enum object :class:`~mimesis.enums.Algorithm`.
         :return: Hash.
         :raises NonEnumerableError: When algorithm is unsupported.


Test patch:
Repository: lk-geimfari/mimesis

Issue:
PyCharm indicates wrong type for lambda
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

While using PyCharm,  `lambda` type in `Schema` results in *Expected type 'FunctionType', got '() -> Dict[str, Union[str, Any]]' instead*
![Screenshot 2020-08-28 at 07 59 37](https://user-images.githubusercontent.com/55017335/91531501-ca378a80-e904-11ea-9558-5b44bcff7040.png)

<!-- Describe what is not working. Please, attach a traceback. -->

## How is that should be
Is this warning correct? The code runs perfectly fine but maybe the Type maybe be wrong here. On this [SO post](https://stackoverflow.com/a/33833896/12794150) they mentioned using the `from typing import Callable` for type hinting a lambda.
<!-- Describe how it should work. -->

## System information

<!-- Describe system information -->
```
❯ python3 --version
Python 3.8.5

❯ sw_vers
ProductName:	macOS
ProductVersion:	11.0
BuildVersion:	20A5354i
```
PyCharm 2020.2.1


Discussion:
I've noticed this behavior too. I think this happens since one of the last releases of `mypy`. We can use `Callable`.
If you have free time then you can create a PR, of course.

Resolving patch:
diff --git a/mimesis/schema.py b/mimesis/schema.py
--- a/mimesis/schema.py
+++ b/mimesis/schema.py
@@ -2,7 +2,6 @@
 
 """Implements classes for generating data by schema."""
 
-from types import LambdaType
 from typing import Any, Callable, List, Optional
 
 from mimesis.exceptions import (
@@ -17,7 +16,7 @@
 __all__ = ['Field', 'Schema']
 
 
-class AbstractField(object):
+class AbstractField:
     """
     AbstractField is a class for generating data by the name of the method.
 
@@ -116,15 +115,15 @@ def __str__(self):
             self.__class__.__name__, self.locale)
 
 
-class Schema(object):
+class Schema:
     """Class which return list of filled schemas."""
 
-    def __init__(self, schema: LambdaType) -> None:
+    def __init__(self, schema: Callable) -> None:
         """Initialize schema.
 
         :param schema: A schema.
         """
-        if isinstance(schema, LambdaType):
+        if callable(schema):
             self.schema = schema
         else:
             raise UndefinedSchema()


Test patch:
Repository: GoogleCloudPlatform/professional-services

Issue:
Asset exporter tool - getting ImportError in GAE 
Just tried to set up from scratch in new project. Followed steps from readme
When running the cron job I get this

ImportError: cannot import name 'expr_pb2' from 'google.type' (/env/lib/python3.7/site-packages/google/type/__init__.py)
at <module> (/env/lib/python3.7/site-packages/google/iam/v1/policy_pb2.py:16)
at <module> (/env/lib/python3.7/site-packages/google/iam/v1/iam_policy_pb2.py:17)
at <module> (/env/lib/python3.7/site-packages/google/cloud/asset_v1/proto/assets_pb2.py:19)
at <module> (/env/lib/python3.7/site-packages/google/cloud/asset_v1/proto/asset_service_pb2.py:20)
at <module> (/env/lib/python3.7/site-packages/google/cloud/asset_v1/types.py:23)
at <module> (/env/lib/python3.7/site-packages/google/cloud/asset_v1/__init__.py:20)
at <module> (/srv/lib/asset_inventory/export.py:33)
at <module> (/srv/main.py:45)
at import_app (/env/lib/python3.7/site-packages/gunicorn/util.py:350)
at load_wsgiapp (/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py:41)
at load (/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py:52)
at wsgi (/env/lib/python3.7/site-packages/gunicorn/app/base.py:67)
at load_wsgi (/env/lib/python3.7/site-packages/gunicorn/workers/base.py:138)
at init_process (/env/lib/python3.7/site-packages/gunicorn/workers/base.py:129)
at init_process (/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py:104)
at spawn_worker (/env/lib/python3.7/site-packages/gunicorn/arbiter.py:583)


Discussion:
Sorry for the trouble. Let me try to recreate the issue.


Resolving patch:
diff --git a/tools/asset-inventory/asset_inventory/pipeline_runner.py b/tools/asset-inventory/asset_inventory/pipeline_runner.py
--- a/tools/asset-inventory/asset_inventory/pipeline_runner.py
+++ b/tools/asset-inventory/asset_inventory/pipeline_runner.py
@@ -86,7 +86,8 @@ def run_pipeline_template(dataflow_project, template_region, template_location,
         End state of the pipline and job object.
     """
     credentials = GoogleCredentials.get_application_default()
-    df_service = build('dataflow', 'v1b3', credentials=credentials)
+    df_service = build('dataflow', 'v1b3', credentials=credentials,
+                       cache_discovery=False)
 
     # Set the following variables to your values.
     job_name = get_job_name(load_time)


Test patch:
Repository: mesonbuild/meson

Issue:
won't install rpm macros
```
Installing RPM macros to /home/brain/rpmbuild/BUILDROOT/meson-0.22.0-7.20150321gita5f30e7.fc23.x86_64/usr/lib/rpm/macros.d.
Traceback (most recent call last):
  File "./install_meson.py", line 112, in <module>
    shutil.copyfile('macros.meson', outfilename)
  File "/usr/lib64/python3.4/shutil.py", line 108, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/brain/rpmbuild/BUILDROOT/meson-0.22.0-7.20150321gita5f30e7.fc23.x86_64/usr/lib/rpm/macros.d/macros.meson'
```

We need to do mkdir I think and have install option in `OptionParser` instead of check if path exists



Discussion:
Fixed the directory creation.

I would prefer it if there was a reliable way to detect whether you should install the rpm macros or not so because less configuration options is always better. If there is no reliable way, though, then adding an option is ok.

I think we need to check if `/usr/bin/rpm` is exists.


Resolving patch:
diff --git a/install_meson.py b/install_meson.py
--- a/install_meson.py
+++ b/install_meson.py
@@ -107,7 +107,7 @@
     shutil.rmtree(module_dir)
 shutil.copytree('modules', module_dir)
 
-if os.path.exists(os.path.join('/usr', rpmmacros_dir)):
+if os.path.exists('/usr/bin/rpm'):
     print('Installing RPM macros to %s.' % rpmmacros_dir)
     outfilename = os.path.join(rpmmacros_dir, 'macros.meson')
     os.makedirs(rpmmacros_dir, exist_ok=True)


Test patch:
Repository: mesonbuild/meson

Issue:
modules/gnome: parametrize includes for g-ir-scanner
https://github.com/jpakkane/meson/blob/master/modules/gnome.py#L61

there can be not only `GObject-2.0`. Most of introspected libs contains much more includes.



Discussion:
That is true but that is the minimum that every gir project requires. We should not be adding unnecessary dependencies to users' projects. If there is need to add more arguments to gir-scanner's command line then we need to add a keyword argument for it.


Resolving patch:
diff --git a/modules/gnome.py b/modules/gnome.py
--- a/modules/gnome.py
+++ b/modules/gnome.py
@@ -58,8 +58,16 @@ def generate_gir(self, state, args, kwargs):
         scan_name = girtarget.name + '-gir'
         scan_command = ['g-ir-scanner', '@INPUT@', '--program', girtarget]
         scan_command += pkgargs
-        scan_command += ['--include=GObject-2.0', '--namespace='+ns,
-                         '--nsversion=' + nsversion, '--output', '@OUTPUT@']
+        scan_command += ['--namespace='+ns, '--nsversion=' + nsversion,
+                         '--output', '@OUTPUT@']
+        if 'includes' in kwargs:
+            includes = kwargs.pop('includes')
+            if isinstance(includes, str):
+                scan_command += ['--include=%s' % includes]
+            elif isinstance(includes, list):
+                scan_command += ['--include=%s' % inc for inc in includes]
+            else:
+                raise MesonException('Gir includes must be str or list')
         scankwargs = {'output' : girfile,
                       'input' : libsources,
                       'command' : scan_command}


Test patch:
diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build
--- a/test cases/frameworks/7 gnome/gir/meson.build	
+++ b/test cases/frameworks/7 gnome/gir/meson.build	
@@ -8,6 +8,7 @@ gnome.generate_gir(girexe,
 sources : libsources,
 nsversion : '1.0',
 namespace : 'Meson',
+includes : ['GObject-2.0', 'Gio-2.0'],
 install : true
 )
Repository: mesonbuild/meson

Issue:
modules/gnome: g-ir-scanner should inherit global arguments for C lang and have option to define separate
I'm using `add_global_arguments('-DAS_COMPILATION', language : 'c')` and it should be inherited in `gnome.generate_gir()` to `g-ir-scanner`, otherwise compilation fails.

As additional point we can have `c_args` kwarg there.



Discussion:

Resolving patch:
diff --git a/interpreter.py b/interpreter.py
--- a/interpreter.py
+++ b/interpreter.py
@@ -623,6 +623,7 @@ def method_call(self, method_name, args, kwargs):
         state.headers = self.interpreter.build.get_headers()
         state.man = self.interpreter.build.get_man()
         state.pkgconfig_gens = self.interpreter.build.pkgconfig_gens
+        state.global_args = self.interpreter.build.global_args
         value = fn(state, args, kwargs)
         return self.interpreter.module_method_callback(value)
 
diff --git a/modules/gnome.py b/modules/gnome.py
--- a/modules/gnome.py
+++ b/modules/gnome.py
@@ -68,6 +68,10 @@ def generate_gir(self, state, args, kwargs):
                 scan_command += ['--include=%s' % inc for inc in includes]
             else:
                 raise MesonException('Gir includes must be str or list')
+        if state.global_args.get('c'):
+            scan_command += ['--cflags-begin']
+            scan_command += state.global_args['c']
+            scan_command += ['--cflags-end']
         scankwargs = {'output' : girfile,
                       'input' : libsources,
                       'command' : scan_command}


Test patch:
diff --git a/test cases/frameworks/7 gnome/gir/golib.h b/test cases/frameworks/7 gnome/gir/golib.h
--- a/test cases/frameworks/7 gnome/gir/golib.h	
+++ b/test cases/frameworks/7 gnome/gir/golib.h	
@@ -1,6 +1,10 @@
 #ifndef GOLIB_H
 #define GOLIB_H
 
+#if !defined (MESON_TEST)
+#error "MESON_TEST not defined."
+#endif
+
 #include <glib.h>
 #include <glib-object.h>
 
diff --git a/test cases/frameworks/7 gnome/meson.build b/test cases/frameworks/7 gnome/meson.build
--- a/test cases/frameworks/7 gnome/meson.build	
+++ b/test cases/frameworks/7 gnome/meson.build	
@@ -7,6 +7,7 @@ glib = dependency('glib-2.0')
 gobj = dependency('gobject-2.0')
 gir = dependency('gobject-introspection-1.0')
 gmod = dependency('gmodule-2.0')
+add_global_arguments('-DMESON_TEST', language : 'c')
 
 subdir('resources')
 subdir('gir')
Repository: mesonbuild/meson

Issue:
GNOME: add support for include dirs (gir)
`g-ir-scanner`: `--add-include-path=PATH`
`g-ir-compiler`: `---includedir=DIRECTORY`



Discussion:

Resolving patch:
diff --git a/modules/gnome.py b/modules/gnome.py
--- a/modules/gnome.py
+++ b/modules/gnome.py
@@ -89,6 +89,13 @@ def generate_gir(self, state, args, kwargs):
                 scan_command += ['--pkg-export=%s' % pkg for pkg in pkgs]
             else:
                 raise MesonException('Gir export packages must be str or list')
+        inc_dirs = None
+        if kwargs.get('include_directories'):
+            inc_dirs = kwargs.pop('include_directories')
+            if isinstance(inc_dirs.held_object, build.IncludeDirs):
+                scan_command += ['--add-include-path=%s' % inc for inc in inc_dirs.held_object.get_incdirs()]
+            else:
+                raise MesonException('Gir include dirs should be include_directories()')
         if isinstance(girtarget, build.Executable):
             scan_command += ['--program', girtarget]
         elif isinstance(girtarget, build.SharedLibrary):
@@ -103,6 +110,8 @@ def generate_gir(self, state, args, kwargs):
         
         typelib_output = '%s-%s.typelib' % (ns, nsversion)
         typelib_cmd = ['g-ir-compiler', scan_target, '--output', '@OUTPUT@']
+        if inc_dirs:
+            typelib_cmd += ['--includedir=%s' % inc for inc in inc_dirs.held_object.get_incdirs()]
         kwargs['output'] = typelib_output
         kwargs['command'] = typelib_cmd
         # Note that this can't be libdir, because e.g. on Debian it points to


Test patch:
Repository: mesonbuild/meson

Issue:
if pkgconfig dep not found - printed twice
from `find_external_dependency()` and from cunstructor of `PkgConfigDependency`



Discussion:

Resolving patch:
diff --git a/dependencies.py b/dependencies.py
--- a/dependencies.py
+++ b/dependencies.py
@@ -82,7 +82,6 @@ def __init__(self, name, kwargs):
                                  stderr=subprocess.PIPE)
         out = p.communicate()[0]
         if p.returncode != 0:
-            mlog.log('Dependency', name, 'found:', mlog.red('NO'))
             if required:
                 raise DependencyException('Required dependency %s not found.' % name)
             self.modversion = 'none'


Test patch:
Repository: mesonbuild/meson

Issue:
dependencies: Undefined variable 'required'
``` python
    def get_variable(self, variable_name):
        p = subprocess.Popen([self.pkgbin, '--variable=%s' % variable_name, self.name],
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if required:
                raise DependencyException('%s dependency %s not found.' %
                        (type_string, self.name))
        else:
            variable = out.decode().strip()
        mlog.debug('return of subprocess : %s' % variable)

        return variable
```



Discussion:

Resolving patch:
diff --git a/dependencies.py b/dependencies.py
--- a/dependencies.py
+++ b/dependencies.py
@@ -73,7 +73,7 @@ class PkgConfigDependency(Dependency):
 
     def __init__(self, name, environment, kwargs):
         Dependency.__init__(self)
-        required = kwargs.get('required', True)
+        self.required = kwargs.get('required', True)
         if 'native' in kwargs and environment.is_cross_build():
             want_cross = not kwargs['native']
         else:
@@ -84,7 +84,7 @@ def __init__(self, name, environment, kwargs):
 
         self.is_found = False
         if not PkgConfigDependency.pkgconfig_found:
-            if required:
+            if self.required:
                 raise DependencyException('Pkg-config not found.')
             self.cargs = []
             self.libs = []
@@ -103,7 +103,7 @@ def __init__(self, name, environment, kwargs):
                                  stderr=subprocess.PIPE)
         out = p.communicate()[0]
         if p.returncode != 0:
-            if required:
+            if self.required:
                 raise DependencyException('%s dependency %s not found.' % (type_string, name))
             self.modversion = 'none'
             self.cargs = []
@@ -119,7 +119,7 @@ def __init__(self, name, environment, kwargs):
                 if not isinstance(version_requirement, str):
                     raise DependencyException('Version argument must be string.')
                 self.is_found = mesonlib.version_compare(self.modversion, version_requirement)
-                if not self.is_found and required:
+                if not self.is_found and self.required:
                     raise DependencyException('Invalid version of a dependency, needed %s %s found %s.' % (name, version_requirement, self.modversion))
             if not self.is_found:
                 return
@@ -156,7 +156,7 @@ def get_variable(self, variable_name):
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         out = p.communicate()[0]
         if p.returncode != 0:
-            if required:
+            if self.required:
                 raise DependencyException('%s dependency %s not found.' %
                         (type_string, self.name))
         else:


Test patch:
Repository: mesonbuild/meson

Issue:
dependency: Undefined variable 'type_string'
``` python
    def get_variable(self, variable_name):
        p = subprocess.Popen([self.pkgbin, '--variable=%s' % variable_name, self.name],
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if self.required:
                raise DependencyException('%s dependency %s not found.' %
                                          (type_string, self.name))
        else:
            variable = out.decode().strip()
        mlog.debug('return of subprocess : %s' % variable)

        return variable
```



Discussion:

Resolving patch:
diff --git a/dependencies.py b/dependencies.py
--- a/dependencies.py
+++ b/dependencies.py
@@ -93,10 +93,10 @@ def __init__(self, name, environment, kwargs):
             if "pkgconfig" not in environment.cross_info:
                 raise DependencyException('Pkg-config binary missing from cross file.')
             pkgbin = environment.cross_info['pkgconfig']
-            type_string = 'Cross'
+            self.type_string = 'Cross'
         else:
             pkgbin = 'pkg-config'
-            type_string = 'Native'
+            self.type_string = 'Native'
 
         self.pkgbin = pkgbin
         p = subprocess.Popen([pkgbin, '--modversion', name],
@@ -105,13 +105,13 @@ def __init__(self, name, environment, kwargs):
         out = p.communicate()[0]
         if p.returncode != 0:
             if self.required:
-                raise DependencyException('%s dependency %s not found.' % (type_string, name))
+                raise DependencyException('%s dependency %s not found.' % (self.type_string, name))
             self.modversion = 'none'
             self.cargs = []
             self.libs = []
         else:
             self.modversion = out.decode().strip()
-            mlog.log('%s dependency' % type_string, mlog.bold(name), 'found:',
+            mlog.log('%s dependency' % self.type_string, mlog.bold(name), 'found:',
                      mlog.green('YES'), self.modversion)
             version_requirement = kwargs.get('version', None)
             if version_requirement is None:
@@ -161,7 +161,7 @@ def get_variable(self, variable_name):
         if p.returncode != 0:
             if self.required:
                 raise DependencyException('%s dependency %s not found.' %
-                                          (type_string, self.name))
+                                          (self.type_string, self.name))
         else:
             variable = out.decode().strip()
         mlog.debug('return of subprocess : %s' % variable)


Test patch: