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

Issue:
Celery inspect expected extra argument
I am trying to inspect a task which I can see in my redis broker as `SUCCESS`, however, it was never logged by celery application.

I then tried inspecting it, but I am unable to do so, getting following error

![image](https://user-images.githubusercontent.com/1492350/113293545-8af66f80-9313-11eb-910a-d44eea9745e1.png)

Output of `celery report`

```
software -> celery:5.0.2 (singularity) kombu:5.0.2 py:3.6.9
            billiard:3.6.3.0 redis:3.5.3
platform -> system:Linux arch:64bit, ELF
            kernel version:5.4.0-1038-aws imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:redis results:redis://redis.xyz.service:6379/0
```


Discussion:
Hey @codeasashu :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.

This is indeed a bug.
Thank you!

Resolving patch:
diff --git a/celery/bin/control.py b/celery/bin/control.py
--- a/celery/bin/control.py
+++ b/celery/bin/control.py
@@ -95,7 +95,8 @@ def status(ctx, timeout, destination, json, **kwargs):
             nodecount, text.pluralize(nodecount, 'node')))
 
 
-@click.command(cls=CeleryCommand)
+@click.command(cls=CeleryCommand,
+               context_settings={'allow_extra_args': True})
 @click.argument("action", type=click.Choice([
     name for name, info in Panel.meta.items()
     if info.type == 'inspect' and info.visible
@@ -128,9 +129,12 @@ def inspect(ctx, action, timeout, destination, json, **kwargs):
     """
     callback = None if json else partial(_say_remote_command_reply, ctx,
                                          show_reply=True)
-    replies = ctx.obj.app.control.inspect(timeout=timeout,
+    arguments = _compile_arguments(action, ctx.args)
+    inspect = ctx.obj.app.control.inspect(timeout=timeout,
                                           destination=destination,
-                                          callback=callback)._request(action)
+                                          callback=callback)
+    replies = inspect._request(action,
+                               **arguments)
 
     if not replies:
         raise CeleryCommandException(


Test patch:
Repository: celery/celery

Issue:
Duplicate param 'uid' in CeleryDaemonCommand

# Checklist

- [ x] I have checked the [issues list](https://github.com/celery/celery/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22Category%3A+Documentation%22+)
  for similar or identical bug reports.
- [x ] I have checked the [pull requests list](https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Category%3A+Documentation%22)
  for existing proposed fixes.
- [ x] I have checked the [commit log](https://github.com/celery/celery/commits/master)
  to find out if the bug was already fixed in the master branch.
- [ x] I have included all related issues and possible duplicate issues in this issue
      (If there are none, check this box anyway).

## Related Issues and Possible Duplicates

#### Related Issues

- None

#### Possible Duplicates

- None

# Description

CeleryDaemonCommand have duplicated CeleryOption for --uid which leads to all docs using it to have duplicated line (beat, multi, worker, etc).

# Suggestions

Remove the duplicate in CeleryDaemonCommand in celery/celery/bin/base.py 



Discussion:
Hey @Smixi :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.


Resolving patch:
diff --git a/celery/bin/base.py b/celery/bin/base.py
--- a/celery/bin/base.py
+++ b/celery/bin/base.py
@@ -179,7 +179,6 @@ def __init__(self, *args, **kwargs):
         self.params.append(CeleryOption(('-f', '--logfile'), help_group="Daemonization Options"))
         self.params.append(CeleryOption(('--pidfile',), help_group="Daemonization Options"))
         self.params.append(CeleryOption(('--uid',), help_group="Daemonization Options"))
-        self.params.append(CeleryOption(('--uid',), help_group="Daemonization Options"))
         self.params.append(CeleryOption(('--gid',), help_group="Daemonization Options"))
         self.params.append(CeleryOption(('--umask',), help_group="Daemonization Options"))
         self.params.append(CeleryOption(('--executable',), help_group="Daemonization Options"))


Test patch:
Repository: celery/celery

Issue:
Update the links in PyPI to the new site.
The [PyPI page](https://pypi.org/project/celery/) stills points to the old URLs which confuses users because those domains no longer exist and in some cases the SSL certificate is invalid. 
Update the links in PyPI to the new site.
The [PyPI page](https://pypi.org/project/celery/) stills points to the old URLs which confuses users because those domains no longer exist and in some cases the SSL certificate is invalid. 


Discussion:
Hey @mvaled :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.

Hey @mvaled :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.


Resolving patch:
diff --git a/celery/__init__.py b/celery/__init__.py
--- a/celery/__init__.py
+++ b/celery/__init__.py
@@ -20,7 +20,7 @@
 __version__ = '5.2.3'
 __author__ = 'Ask Solem'
 __contact__ = 'auvipy@gmail.com'
-__homepage__ = 'http://celeryproject.org'
+__homepage__ = 'https://docs.celeryq.dev/'
 __docformat__ = 'restructuredtext'
 __keywords__ = 'task job queue distributed messaging actor'
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -175,8 +175,8 @@ def run_tests(self):
         ]
     },
     project_urls={
-        "Documentation": "https://docs.celeryproject.org/en/latest/index.html",
-        "Changelog": "https://docs.celeryproject.org/en/stable/changelog.html",
+        "Documentation": "https://docs.celeryq.dev/en/stable/",
+        "Changelog": "https://docs.celeryq.dev/en/stable/changelog.html",
         "Code": "https://github.com/celery/celery",
         "Tracker": "https://github.com/celery/celery/issues",
         "Funding": "https://opencollective.com/celery"


Test patch:
Repository: celery/celery

Issue:
Missing `f` prefix on f-strings
Some strings looks like they're meant to be f-strings but are missing the `f` prefix meaning variable interpolation won't happen.

https://github.com/celery/celery/blob/8d35c655d6ac408023da5e30ca81bc834e68bca0/celery/backends/dynamodb.py#L131

I found this issue automatically. I'm a bot. Beep Boop 🦊. See other issues I found in your repo [here](https://codereview.doctor/celery/celery)


Discussion:
Hey @code-review-doctor :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.


Resolving patch:
diff --git a/celery/backends/dynamodb.py b/celery/backends/dynamodb.py
--- a/celery/backends/dynamodb.py
+++ b/celery/backends/dynamodb.py
@@ -128,7 +128,7 @@ def __init__(self, url=None, table_name=None, *args, **kwargs):
                     self.time_to_live_seconds = int(ttl)
                 except ValueError as e:
                     logger.error(
-                        'TTL must be a number; got "{ttl}"',
+                        f'TTL must be a number; got "{ttl}"',
                         exc_info=e
                     )
                     raise e


Test patch:
Repository: celery/celery

Issue:
Use callable in utils.functional.head_from_fun
After the discussion in #3952, we should investigate whether an improvement can be applied using the builtin `callable` instead of `hasattr(fun, '__call__')`.

https://docs.python.org/2/library/functions.html#callable




Discussion:
Hi. I'm a new contributor. May I tackle this issue?
yes please, open a PR and ping me for review

Resolving patch:
diff --git a/celery/utils/functional.py b/celery/utils/functional.py
--- a/celery/utils/functional.py
+++ b/celery/utils/functional.py
@@ -311,7 +311,7 @@ def head_from_fun(fun, bound=False, debug=False):
     # with an empty body, meaning it has the same performance as
     # as just calling a function.
     is_function = inspect.isfunction(fun)
-    is_callable = hasattr(fun, '__call__')
+    is_callable = callable(fun)
     is_cython = fun.__class__.__name__ == 'cython_function_or_method'
     is_method = inspect.ismethod(fun)
 


Test patch:
Repository: celery/celery

Issue:
completed_count reports only successfully completed tasks
Not sure if that's on purpose but it looks like `completed_count` only takes into account the tasks that have completed successfully:

https://github.com/celery/celery/blob/3db7c9dde9a4d5aa9c0eda8c43a219de1baa9f02/celery/result.py#L633

Would it make more sense to report:
```
return sum(int(result.ready()) for result in self.results)
```
the task count in the "ready" state?

Happy to open a PR if that's an acceptable change.


Discussion:
Hey @emilroz :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.

One might say that a task has been completed only if it hasn't failed.
Otherwise, the execution of the task is halted and it is not completed.

I don't think we should change the public API between minor versions but I'm open to amending the documentation. 
Sounds good to me. I'm more than happy to contribute the changes.

Resolving patch:
diff --git a/celery/result.py b/celery/result.py
--- a/celery/result.py
+++ b/celery/result.py
@@ -651,8 +651,11 @@ def ready(self):
     def completed_count(self):
         """Task completion count.
 
+        Note that `complete` means `successful` in this context. In other words, the
+        return value of this method is the number of ``successful`` tasks.
+
         Returns:
-            int: the number of tasks completed.
+            int: the number of complete (i.e. successful) tasks.
         """
         return sum(int(result.successful()) for result in self.results)
 


Test patch:
Repository: celery/celery

Issue:
CLI help output: avoid click text rewrapping
# Checklist

- [x] I have checked the [issues list](https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22)
  for similar or identical enhancement to an existing feature.
- [x] I have checked the [pull requests list](https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22)
  for existing proposed enhancements.
- [x] I have checked the [commit log](https://github.com/celery/celery/commits/main)
  to find out if the if the same enhancement was already implemented in the
  main branch.
- [x] I have included all related issues and possible duplicate issues in this issue
      (If there are none, check this box anyway).

# Brief Summary

The command `celery worker --help` gives 

```bash
Usage: celery worker [OPTIONS]

  Start worker instance.

  Examples
  --------

  $ celery --app=proj worker -l INFO $ celery -A proj worker -l INFO -Q
  hipri,lopri $ celery -A proj worker --concurrency=4 $ celery -A proj worker
  --concurrency=1000 -P eventlet $ celery worker --autoscale=10,0
```

This is caused by the [text rewrapping of `click`](https://click.palletsprojects.com/en/8.1.x/documentation/#preventing-rewrapping). The solution is to add `\b` before every paragraph which results in

```bash
Usage: celery worker [OPTIONS]

  Start worker instance.

  Examples
  --------

  $ celery --app=proj worker -l INFO
  $ celery -A proj worker -l INFO -Q hipri,lopri
  $ celery -A proj worker --concurrency=4
  $ celery -A proj worker --concurrency=1000 -P eventlet
  $ celery worker --autoscale=10,0
```


Discussion:
Hey @woutdenolf :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.


Resolving patch:
diff --git a/celery/bin/worker.py b/celery/bin/worker.py
--- a/celery/bin/worker.py
+++ b/celery/bin/worker.py
@@ -300,8 +300,11 @@ def worker(ctx, hostname=None, pool_cls=None, app=None, uid=None, gid=None,
            **kwargs):
     """Start worker instance.
 
+    \b
     Examples
     --------
+
+    \b
     $ celery --app=proj worker -l INFO
     $ celery -A proj worker -l INFO -Q hipri,lopri
     $ celery -A proj worker --concurrency=4


Test patch:
Repository: celery/celery

Issue:
database backend does not store children
The [`Task`](https://github.com/celery/celery/blob/main/celery/backends/database/models.py#L20-L27) and [`TaskExtended`](https://github.com/celery/celery/blob/main/celery/backends/database/models.py#L57-L62) models for the `database` backend do not include `children`. This means that when using any `database` backend, [`AsyncResult.children`](https://github.com/celery/celery/blob/main/celery/result.py#L424) is always empty, even if a task does have children.


Discussion:
Hey @aaronst :wave:,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our [Open Collective](https://opencollective.com/celery) and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.

I can't recall any reason behind it for not supporting it in database back end. would you mind doing some experiment to add that?
It looks like [`sqlalchemy.types.ARRAY`](https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.ARRAY) is only supported with PostgreSQL, so it would have to be `PickleType` to be fully compatible.

Resolving patch:
diff --git a/celery/backends/database/models.py b/celery/backends/database/models.py
--- a/celery/backends/database/models.py
+++ b/celery/backends/database/models.py
@@ -25,6 +25,7 @@ class Task(ResultModelBase):
     date_done = sa.Column(sa.DateTime, default=datetime.utcnow,
                           onupdate=datetime.utcnow, nullable=True)
     traceback = sa.Column(sa.Text, nullable=True)
+    children = sa.Column(PickleType, nullable=True)
 
     def __init__(self, task_id):
         self.task_id = task_id
@@ -36,6 +37,7 @@ def to_dict(self):
             'result': self.result,
             'traceback': self.traceback,
             'date_done': self.date_done,
+            'children': self.children,
         }
 
     def __repr__(self):


Test patch:
diff --git a/t/unit/backends/test_database.py b/t/unit/backends/test_database.py
--- a/t/unit/backends/test_database.py
+++ b/t/unit/backends/test_database.py
@@ -99,6 +99,7 @@ def test_missing_task_meta_is_dict_with_pending(self):
         assert meta['task_id'] == 'xxx-does-not-exist-at-all'
         assert meta['result'] is None
         assert meta['traceback'] is None
+        assert meta['children'] is None
 
     def test_mark_as_done(self):
         tb = DatabaseBackend(self.uri, app=self.app)
Repository: gradio-app/gradio

Issue:
Add automatic anchor links to the different sections of getting started and guides automatically
Many times when I'm responding to issues, I want to link to a specific section in our getting started page. For example, the section related to "State"

![image](https://user-images.githubusercontent.com/1778297/153347095-593acced-8c5a-402c-9df7-3acdb1042edb.png)

We could manually add anchor links, but I'm sure there is a way to automatically turn any header tag into an anchorable link. Sometimes I've seen a little symbol next to the heading that you can click on to get the anchor link for that section, which would be super convenient.

Applies to the getting started as well as the guides.


Discussion:

Resolving patch:
diff --git a/website/homepage/render_html.py b/website/homepage/render_html.py
--- a/website/homepage/render_html.py
+++ b/website/homepage/render_html.py
@@ -151,14 +151,7 @@ def render_guides():
         guide_output = guide_output.replace("<pre>", "<div class='code-block' style='display: flex'><pre>")
         guide_output = guide_output.replace("</pre>", f"</pre>{copy_button}</div>")
 
-        output_html = markdown2.markdown(guide_output, extras=["target-blank-links"])
-
-        for match in re.findall(r"<h3>([A-Za-z0-9 ]*)<\/h3>", output_html):
-            output_html = output_html.replace(
-                f"<h3>{match}</h3>",
-                f"<h3 id={match.lower().replace(' ', '_')}>{match}</h3>",
-            )
-
+        output_html = markdown2.markdown(guide_output, extras=["target-blank-links", "header-ids"])
         os.makedirs("generated", exist_ok=True)
         os.makedirs(os.path.join("generated", guide["name"]), exist_ok=True)
         with open(


Test patch:
Repository: gradio-app/gradio

Issue:
Update Launch Getting Started Guides
Usage of `iface.launch()` prints out `(<fastapi.applications.FastAPI at 0x7fef0dbbad10>,` in Google Colab and it is not fancy.

Let's update the first deliveries of `launch` in the getting_started guides so that people can adopt those usages.


Discussion:

Resolving patch:
diff --git a/demo/hello_world/run.py b/demo/hello_world/run.py
--- a/demo/hello_world/run.py
+++ b/demo/hello_world/run.py
@@ -7,4 +7,4 @@ def greet(name):
 
 iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 if __name__ == "__main__":
-    iface.launch()
+    iface.launch();
diff --git a/demo/hello_world_2/run.py b/demo/hello_world_2/run.py
--- a/demo/hello_world_2/run.py
+++ b/demo/hello_world_2/run.py
@@ -11,4 +11,5 @@ def greet(name):
     outputs="text",
 )
 if __name__ == "__main__":
-    iface.launch()
+    app, path_to_local_server, share_url = iface.launch()
+
diff --git a/demo/hello_world_3/run.py b/demo/hello_world_3/run.py
--- a/demo/hello_world_3/run.py
+++ b/demo/hello_world_3/run.py
@@ -14,4 +14,5 @@ def greet(name, is_morning, temperature):
     outputs=["text", "number"],
 )
 if __name__ == "__main__":
-    iface.launch()
+    app, path_to_local_server, share_url = iface.launch()
+


Test patch:
Repository: gradio-app/gradio

Issue:
Overwriting input image with output image ?
Hi, how can we show the output image at the place of input image, this means after model inference overwriting the resulted image (OUTPUT) with the input image instead of showing in parallel ?

Thanks


Discussion:
This is a good suggestion and I think it would allow for to some cool demos. @pngwn @FarukOzderim can we design Blocks so that if the same component is provided as the input and output, the result of the model inference would overwrite the input?  E.g.

```python
im = components.Image()
btn.click(fn, im, im)  # the output of fn overwrites the image used for the input
```

I think we could also build a nice higher-level abstraction `UnifiedInterface` which is designed for these use cases.
I think this will be possible when components are merged into one.
Yeah, i think this should just work with the blocks changes but don't quote me on that. Definitely an interesting usecase and something we will want to capture in our tests.
Added it to test workflows!

Resolving patch:
diff --git a/demo/input-output/run.py b/demo/input-output/run.py
new file mode 100644
--- /dev/null
+++ b/demo/input-output/run.py
@@ -0,0 +1,16 @@
+import gradio as gr
+
+
+def image_mod(text):
+    return text[::-1]
+
+block = gr.Blocks()
+
+with block:
+    text = gr.Textbox()
+    btn = gr.Button("Run")
+    btn.click(image_mod, text, text)
+
+print(block.get_config_file())
+if __name__ == "__main__":
+    block.launch()


Test patch:
diff --git a/ui/packages/app/test/input-output.spec.ts b/ui/packages/app/test/input-output.spec.ts
new file mode 100644
--- /dev/null
+++ b/ui/packages/app/test/input-output.spec.ts
@@ -0,0 +1,44 @@
+import { test, expect, Page } from "@playwright/test";
+
+function mock_demo(page: Page, demo: string) {
+	return page.route("http://localhost:7860/config", (route) => {
+		return route.fulfill({
+			headers: {
+				"Access-Control-Allow-Origin": "*"
+			},
+			path: `../../../demo/${demo}/config.json`
+		});
+	});
+}
+
+function mock_api(page: Page, body: Array<unknown>) {
+	return page.route("http://localhost:7860/api/predict/", (route) => {
+		const id = JSON.parse(route.request().postData()!).fn_index;
+		return route.fulfill({
+			headers: {
+				"Access-Control-Allow-Origin": "*"
+			},
+			body: JSON.stringify({
+				data: body[id]
+			})
+		});
+	});
+}
+
+test("a component acts as both input and output", async ({ page }) => {
+	await mock_demo(page, "input-output");
+	await mock_api(page, [["world hello"]]);
+	await page.goto("http://localhost:3000");
+
+	const textbox = await page.locator(".input-text");
+	const button = await page.locator("button");
+
+	await textbox.fill("hello world");
+
+	await Promise.all([
+		button.click(),
+		page.waitForResponse("http://localhost:7860/api/predict/")
+	]);
+
+	await expect(await page.inputValue(".input-text")).toEqual("world hello");
+});
Repository: gradio-app/gradio

Issue:
[`blocks-dev`] Default value of Checkbox does not show up



Discussion:
Is this a checklist to mark when a component is testing for working without an issue?
That's honestly a good idea. Would probably subsume many of the individual issues that I created and easier to manage. Feel free to create it!
Not sure if this fits into this issue or a separate issue, but I noticed that the `default_value` for a `Checkbox` doesn't show up. (It does for `CheckboxGroup`, `Radio`, etc.). Try:

```
bl = gr.Blocks()
with bl:
    gr.Checkbox("vegetarian")
    
    bl.launch()
```
I don't think this issue has been that useful tbh. Renaming to only focus on the last thing that I mentioned.
@pngwn I think there are still some issues with Checkbox:

<img width="729" alt="image" src="https://user-images.githubusercontent.com/1778297/161813673-1ac69bc6-3d98-4ae7-9c53-2c16f0cc78fd.png">

* The `label` gets assigned to both the label and the associated text. The correct behavior is that the `default_value` parameter should be the associated text
* The Checkbox seems to pass in the default_value. I think the correct behavior is that it should pass in a boolean: True or False, depending on it's checked. 

Compare with CheckboxGroup, which is behaving correctly:

<img width="759" alt="image" src="https://user-images.githubusercontent.com/1778297/161813912-3daee717-46b5-4201-9ada-09b883891175.png">


Resolving patch:
diff --git a/demo/blocks_inputs/run.py b/demo/blocks_inputs/run.py
new file mode 100644
--- /dev/null
+++ b/demo/blocks_inputs/run.py
@@ -0,0 +1,20 @@
+import gradio as gr
+
+str = """Hello friends
+hello friends
+
+Hello friends
+
+"""
+
+
+
+with gr.Blocks() as demo:
+    txt = gr.Textbox(label="Input", lines=5)
+    txt_2 = gr.Textbox(label="Output")
+    txt_3 = gr.Textbox(str, label="Output")
+    btn = gr.Button('Submit')
+    btn.click(lambda a : a, inputs=[txt], outputs=[txt_2])
+
+if __name__ == "__main__":
+    demo.launch()


Test patch: