internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: WordPress/openverse-api

Issue:
Do not unfurl links and media by default in Slack notifications
## Problem
<!-- Describe a problem solved by this feature; or delete the section entirely. -->
Recent provider DAG errors have caused notifications containing images to be sent to Slack. For example, a recent data refresh error notification embedded the image that was being processed when the error was encountered. @sarayourfriend pointed out that while these messages have historically been harmless, it's possible that this could happen with NSFW content.

## Description
<!-- Describe the feature and how it solves the problem. -->
We have a PR to at least help this situation in the Catalog by [preventing links and media from unfurling](https://github.com/WordPress/openverse-catalog/pull/743) in Slack notifications. We should add the same functionality to the Slack utility in the ingestion server.

We should be able to do this the same way as it is done in the catalog, by using the `unfurl_links` and `unfurl_media` options in the payload [here](https://github.com/WordPress/openverse-api/blob/main/ingestion_server/ingestion_server/slack.py#L48). For reference, [this is where it is done in the Catalog](https://github.com/WordPress/openverse-catalog/blob/main/openverse_catalog/dags/common/slack.py#L97). 

## Additional context
<!-- Add any other context about the feature here; or delete the section entirely. -->
In the Catalog we expose `unfurl_links` and `unfurl_media` as arguments in the Slack utility, so it is possible to set them to `True/False` as needed for an individual message. This _might_ be nice to have, but I don't believe it is currently necessary.

## Implementation
<!-- Replace the [ ] with [x] to check the box. -->
- [ ] 🙋 I would be interested in implementing this feature.



Discussion:

Resolving patch:
diff --git a/ingestion_server/ingestion_server/slack.py b/ingestion_server/ingestion_server/slack.py
--- a/ingestion_server/ingestion_server/slack.py
+++ b/ingestion_server/ingestion_server/slack.py
@@ -50,6 +50,8 @@ def _message(text: str, summary: str = None, level: Level = Level.INFO) -> None:
         "text": summary,
         "username": f"Data Refresh Notification | {environment.upper()}",
         "icon_emoji": "arrows_counterclockwise",
+        "unfurl_links": False,
+        "unfurl_media": False,
     }
     try:
         requests.post(webhook, json=data)


Test patch:
Repository: WordPress/openverse-api

Issue:
Switch to `MoreLikeThis` class in the search controller
I noticed that instead of specifying the query type as a string in the earch controller, we can instead import the [`MoreLikeThis` query type](https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html#more-like-this-query) directly for the related image query.

https://github.com/WordPress/openverse-api/blob/a6c959b119f49ce06855293b9f863d776d907a2e/api/catalog/api/controllers/search_controller.py#L424



Discussion:
Hi @zackkrida  ,
This issue seems to be a good initiation of my journey towards contribution to FOSS projects.
Can you please assign this to me?
Sure @Akshat977!
@Akshat977 Are you still working on this?

Resolving patch:
diff --git a/api/catalog/api/controllers/search_controller.py b/api/catalog/api/controllers/search_controller.py
--- a/api/catalog/api/controllers/search_controller.py
+++ b/api/catalog/api/controllers/search_controller.py
@@ -13,7 +13,7 @@
 
 from elasticsearch.exceptions import NotFoundError, RequestError
 from elasticsearch_dsl import Q, Search
-from elasticsearch_dsl.query import EMPTY_QUERY, Query
+from elasticsearch_dsl.query import EMPTY_QUERY, MoreLikeThis, Query
 from elasticsearch_dsl.response import Hit, Response
 
 import catalog.api.models as models
@@ -421,11 +421,12 @@ def related_media(uuid, index, request, filter_dead):
 
     s = search_client
     s = s.query(
-        "more_like_this",
-        fields=["tags.name", "title", "creator"],
-        like={"_index": index, "_id": _id},
-        min_term_freq=1,
-        max_query_terms=50,
+        MoreLikeThis(
+            fields=["tags.name", "title", "creator"],
+            like={"_index": index, "_id": _id},
+            min_term_freq=1,
+            max_query_terms=50,
+        )
     )
     # Never show mature content in recommendations.
     s = s.exclude("term", mature=True)


Test patch:
Repository: WordPress/openverse-api

Issue:
Broken link to image landing page in Django admin
## Description
<!-- Concisely describe the bug. Compare your experience with what you expected to happen. -->
<!-- For example: "I clicked the 'submit' button and instead of seeing a thank you message, I saw a blank page." -->
The functionality for reporting media works fine. But on the API side, there are a lot of parts that are broken and out of date.

- The base URL for reported media items still points to CC.
  https://github.com/WordPress/openverse-api/blob/32189d05db91f8a7587c48017f910bfa9718c6bd/api/catalog/api/models/media.py#L136

- The `ImageReport` model thinks that images are hosted at `/photos`.
  https://github.com/WordPress/openverse-api/blob/32189d05db91f8a7587c48017f910bfa9718c6bd/api/catalog/api/models/image.py#L58

If I find any more before the issue is picked up, I'll add them here.

## Additional context
<!-- Add any other context about the problem here; or delete the section entirely. -->
To the best of my knowledge, submitting reports works. These problems only affect those who are looking into the submitted reports.

## Resolution
<!-- Replace the [ ] with [x] to check the box. -->
- [ ] 🙋 I would be interested in resolving this bug.



Discussion:
@dhruvkb where should the base URL for the reported media point?

Resolving patch:
diff --git a/api/catalog/api/models/image.py b/api/catalog/api/models/image.py
--- a/api/catalog/api/models/image.py
+++ b/api/catalog/api/models/image.py
@@ -84,7 +84,7 @@ class Meta:
 
     @property
     def image_url(self):
-        return super().url("photos")
+        return super().url("images")
 
 
 class ImageList(AbstractMediaList):
diff --git a/api/catalog/api/models/media.py b/api/catalog/api/models/media.py
--- a/api/catalog/api/models/media.py
+++ b/api/catalog/api/models/media.py
@@ -184,7 +184,7 @@ def clean(self):
             )
 
     def url(self, media_type):
-        url = f"{AbstractMediaReport.BASE_URL}{media_type}{self.identifier}"
+        url = f"{AbstractMediaReport.BASE_URL}v1/{media_type}/{self.identifier}"
         return format_html(f"<a href={url}>{url}</a>")
 
     def save(self, *args, **kwargs):


Test patch:
Repository: kovidgoyal/kitty

Issue:
Calculate pixel ratio in cursor_pos_callback
On my Retina MacBook Pro when dragging to make a selection or when trying to click a link, the x and y coordinates were off. This calculates the ratio before calling the callback. Can't test on a non-Retina screen but it should work correctly.


Discussion:
I fixed it slightly differently, to avoid needing to calculate the ratio on every callback
Ah, there's a `ViewPortSize` object :) Perfect. Thanks!
Hey @wezzynl, for me this isn't fixed yet. I'm running kitty on a Macbook Pro (2016). Could you please verify?

Resolving patch:
diff --git a/kitty/boss.py b/kitty/boss.py
--- a/kitty/boss.py
+++ b/kitty/boss.py
@@ -342,12 +342,12 @@ def on_mouse_button(self, window, button, action, mods):
     def on_mouse_move(self, window, xpos, ypos):
         mouse_cursor_pos[:2] = int(xpos * viewport_size.x_ratio), int(ypos * viewport_size.y_ratio)
         self.show_mouse_cursor()
-        w = self.window_for_pos(xpos, ypos)
+        w = self.window_for_pos(*mouse_cursor_pos)
         if w is not None:
             yield w
-            w.on_mouse_move(xpos, ypos)
+            w.on_mouse_move(*mouse_cursor_pos)
         else:
-            self.change_mouse_cursor(self.in_tab_bar(ypos))
+            self.change_mouse_cursor(self.in_tab_bar(int(ypos * viewport_size.y_ratio)))
 
     @callback
     def on_mouse_scroll(self, window, x, y):


Test patch:
Repository: kovidgoyal/kitty

Issue:
Grid layout neighbors not working for < 4 windows
**kitty version**: 0.12.3
**OS**: arch linux 4.14.71-1

When I try to move or focus neighbors on the grid layout and there are less than 4 windows open, nothing happens. The keyboard shortcut I have mapped to that command is ignored.


Discussion:

Resolving patch:
diff --git a/kitty/layout.py b/kitty/layout.py
--- a/kitty/layout.py
+++ b/kitty/layout.py
@@ -721,7 +721,7 @@ def minimal_borders(self, windows, active_window, needs_borders_map):
     def neighbors_for_window(self, window, windows):
         n = len(windows)
         if n < 4:
-            return Tall.neighbors_for_window(window, windows)
+            return Tall.neighbors_for_window(self, window, windows)
         try:
             n, ncols, nrows, special_rows, special_col = windows[0].layout_data
         except Exception:


Test patch:
Repository: kovidgoyal/kitty

Issue:
Feature request: option for hide mouse on keypress event
It would be really nice if the user could enable an option to instantly hide the mouse cursor on any keypress event in the active window. That way you could click inside a window, and as soon as you start typing in your terminal, the mouse cursor disappears. This feature is enabled by default in many other terminal applications like iTerm2. Right now the user has to hack this feature in by setting the mouse_hide_wait param to be very small, which has unintended effects if you're actively using the mouse. 


Discussion:
Not worth the effort to me, but patches are welcome.


Resolving patch:
diff --git a/kitty/config_data.py b/kitty/config_data.py
--- a/kitty/config_data.py
+++ b/kitty/config_data.py
@@ -445,9 +445,10 @@ def copy_on_select(raw):
 The interval between successive clicks to detect double/triple clicks (in seconds).
 Negative numbers will use the system default instead, if available, or fallback to 0.5.'''))
 
-o('mouse_hide_wait', 3.0, option_type=positive_float, long_text=_('''
+o('mouse_hide_wait', 3.0, option_type=float, long_text=_('''
 Hide mouse cursor after the specified number of seconds
-of the mouse not being used. Set to zero to disable mouse cursor hiding.'''))
+of the mouse not being used. Set to zero to disable mouse cursor hiding.
+Set to a negative value to hide the mouse cursor immediately when typing text.'''))
 
 o('focus_follows_mouse', False, long_text=_('''
 Set the active window to the window under the mouse when


Test patch:
Repository: kovidgoyal/kitty

Issue:
Docs - call attention to `mouse_hide_wait`
I love this terminal, and I've really dug into the configuration. Somehow I missed the `mouse_hide_wait` setting though. It was driving me kinda mad, and I tried to "fix" it at the OS level a couple of times. Didn't realize it was a Kitty setting.

Maybe it would make sense to reorder [the docs subheaders](https://sw.kovidgoyal.net/kitty/conf.html?highlight=mouse%20hide#opt-kitty.mouse_hide_wait) so that this setting is up at top of Mouse section. Or... maybe even having it _not_ hide the mouse in default preferences?


Discussion:
I'm afraid the default is not going to change, lots of people, including
me, prefer the mouse hidden while typing. However, I am OK with moving
the option to the top of the mouse section, feel free to send a PR. You
just have to move the option to the top of the mouse section in
config_data.py


Resolving patch:
diff --git a/kitty/config_data.py b/kitty/config_data.py
--- a/kitty/config_data.py
+++ b/kitty/config_data.py
@@ -391,6 +391,11 @@ def scrollback_pager_history_size(x):
 
 g('mouse')  # {{{
 
+o('mouse_hide_wait', 3.0, option_type=float, long_text=_('''
+Hide mouse cursor after the specified number of seconds
+of the mouse not being used. Set to zero to disable mouse cursor hiding.
+Set to a negative value to hide the mouse cursor immediately when typing text.'''))
+
 o('url_color', '#0087bd', option_type=to_color, long_text=_('''
 The color and style for highlighting URLs on mouse-over.
 :code:`url_style` can be one of: none, single, double, curly'''))
@@ -460,11 +465,6 @@ def copy_on_select(raw):
 The interval between successive clicks to detect double/triple clicks (in seconds).
 Negative numbers will use the system default instead, if available, or fallback to 0.5.'''))
 
-o('mouse_hide_wait', 3.0, option_type=float, long_text=_('''
-Hide mouse cursor after the specified number of seconds
-of the mouse not being used. Set to zero to disable mouse cursor hiding.
-Set to a negative value to hide the mouse cursor immediately when typing text.'''))
-
 o('focus_follows_mouse', False, long_text=_('''
 Set the active window to the window under the mouse when
 moving the mouse around'''))


Test patch:
Repository: kovidgoyal/kitty

Issue:
Support drag and drop for text
I select and drag text to and from Terminal windows all the time. kitty doesn’t seem to allow dragging text either direction.

Thanks.


Discussion:
Not something I am interested in. You can simply select the text and paste it, either using a middle click if you are on X11 or your clipboard aste shortcut otherwise. You can use the copy_on_select option in kitty.conf to make this faster.
> Not something I am interested in.

OK, but it’s standard behavior across most apps and it’s a nice way to move text around without destroying what you had in the clipboard.
I imaging drag and drop of text into kitty would be very similar to the code for dragging a file into kitty on macOS.
> Not something I am interested in.

This does not seem like a fair justification for closing the feature request issue.
If you do not feel like implementing the feature is worth your time and effort, someone else may, right?
And they are welcome to, just because an issue is closed does not mean
people are unable to send a PR. I dont keep issues open for things I
dont think are a good idea.


Resolving patch:
diff --git a/kitty/boss.py b/kitty/boss.py
--- a/kitty/boss.py
+++ b/kitty/boss.py
@@ -619,12 +619,12 @@ def update_tab_bar_data(self, os_window_id):
         if tm is not None:
             tm.update_tab_bar_data()
 
-    def on_drop(self, os_window_id, paths):
+    def on_drop(self, os_window_id, strings):
         tm = self.os_window_map.get(os_window_id)
         if tm is not None:
             w = tm.active_window
             if w is not None:
-                w.paste('\n'.join(paths))
+                w.paste('\n'.join(strings))
 
     def on_os_window_closed(self, os_window_id, viewport_width, viewport_height):
         self.cached_values['window-size'] = viewport_width, viewport_height


Test patch:
Repository: kovidgoyal/kitty

Issue:
`inactive_border_color` setting not respected in 0.17.1
Hey !

The `inactive_border_color` no longer works in the latest release. (witnessed on macOS Catalina)

0.17.1:
<img width="887" alt="Screenshot 2020-03-24 at 19 31 10" src="https://user-images.githubusercontent.com/145502/77463657-dbccb180-6dfd-11ea-80bc-db2e1eff9421.png">

0.16.0:
<img width="878" alt="Screenshot 2020-03-24 at 19 35 37" src="https://user-images.githubusercontent.com/145502/77463919-4978dd80-6dfe-11ea-8f0f-0020d137a603.png">

I'll try to bisect later today when I find time to narrow down to the commit which introduced the regression.

Cheers.


Discussion:
Ran `git bisect`, commit [f7eef3f456f7ca38044355b88cd6ffe45cd91061](https://github.com/kovidgoyal/kitty/commit/f7eef3f456f7ca38044355b88cd6ffe45cd91061) introduced the regression.

Resolving patch:
diff --git a/kitty/layout.py b/kitty/layout.py
--- a/kitty/layout.py
+++ b/kitty/layout.py
@@ -549,7 +549,7 @@ def window_independent_borders(self, windows: WindowList, active_window: Optiona
 
     def minimal_borders(self, windows: WindowList, active_window: Optional[WindowType], needs_borders_map: Dict[int, bool]) -> Generator[Borders, None, None]:
         for w in windows:
-            if (w is active_window and draw_active_borders) or w.needs_attention:
+            if w is not active_window or draw_active_borders or w.needs_attention:
                 yield all_borders
             else:
                 yield no_borders


Test patch:
Repository: kovidgoyal/kitty

Issue:
path expanding on hints
**Is your feature request related to a problem? Please describe.**
for hints i would like to expand the path this is my current hint config

`map kitty_mod+p>n kitten hints --type=linenum --linenum-action=tab nvim {path}`
and my term text is 
```
/home/becker on  master [⇡»!?] via C base 
✦ ❯ vi ~/.config/kitty/kitty.conf:5
/home/becker on  master [⇡»!?] via C base took 16h49m54s 
✦ ❯ /home/becker/.config/kitty/kitty.conf:5
```

the full path opens correct
the ~ path opens.. im not sure. when i try and write it vim says "E212: Can't open file for writing: no such file or directory"

If i run just 

`vi ~/.config/kitty/kitty.conf`  the activity shows nvim loading the full path. 


**Describe the solution you'd like**
maybe an {expanded_path} ? 

**Describe alternatives you've considered**
maybe {path} passed to nvim i just receiving the wrong thing?

**Additional context**
the running vim commands from manual vs the hint. 

![image](https://user-images.githubusercontent.com/12170/86269569-cc889d00-bb7e-11ea-9aa5-6bf5c7a8b1e2.png)




Discussion:

Resolving patch:
diff --git a/kittens/hints/main.py b/kittens/hints/main.py
--- a/kittens/hints/main.py
+++ b/kittens/hints/main.py
@@ -559,7 +559,7 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
     for m, g in zip(data['match'], data['groupdicts']):
         if m:
             path, line = g['path'], g['line']
-            path = path.split(':')[-1]
+            path = os.path.expanduser(path.split(':')[-1])
             line = int(line)
             break
     else:


Test patch:
Repository: kovidgoyal/kitty

Issue:
Three sextants are drawn incorrectly (patch provided)
The following sextants are drawn incorrectly:

U+1FB13 BLOCK SEXTANT-35
U+1FB26 BLOCK SEXTANT-46
U+1FB27 BLOCK SEXTANT-146

For reference, please consult https://www.unicode.org/charts/PDF/U1FB00.pdf.

**To Reproduce**
I used the `unicode` program available on Debian and derived distributions. Try:

`unicode U+1fb13 U+1fb26 U+1fb27`

**Expected behavior**
I expect the following three q values (using kitty's `draw_sextant` semantics):

011
022
122

but we are instead getting

111 (1, 5, 1)
122 (1, 10, 2)
222 (2, 10, 2)

The top row's q value is incorrect in all three, adding sections where they do not belong.

**Screenshots**
Good:
![2020-11-14-231237_727x517_scrot](https://user-images.githubusercontent.com/143473/99163062-79009100-26d2-11eb-8324-cfb8b7ce7915.png)

Bad:
![2020-11-14-231206_1004x494_scrot](https://user-images.githubusercontent.com/143473/99163063-79992780-26d2-11eb-8a3c-0c1262357ed8.png)


**Environment details**
OS: Debian Linux unstable

```
[schwarzgerat](0) $ kitty/launcher/kitty  --debug-config
kitty 0.19.2 (ef596f6a8b) created by Kovid Goyal
Linux schwarzgerat 5.9.8nlb #1 SMP Fri Nov 13 16:44:21 EST 2020 x86_64
Debian GNU/Linux bullseye/sid \n \l
Loaded config files: /etc/xdg/kitty/kitty.conf, /home/dank/.config/kitty/kitty.conf
Running under: X11

Config options different from defaults:
background_opacity    0.7
enable_audio_bell     False
font_family           Hack
font_size             10.0https://github.com/dankamongmen/notcurses/issues/1095#issuecomment-720865697
update_check_interval 0.0
[schwarzgerat](0) $ 
```

**Additional context**
I hope the Kitty author now assumes I have "[a minimum level of intelligence](https://github.com/dankamongmen/notcurses/issues/1095#issuecomment-720865697)" =] =] =].


I have submitted a PR to fix this as https://github.com/kovidgoyal/kitty/pull/3105.


Discussion:

Resolving patch:
diff --git a/kitty/fonts/box_drawing.py b/kitty/fonts/box_drawing.py
--- a/kitty/fonts/box_drawing.py
+++ b/kitty/fonts/box_drawing.py
@@ -955,7 +955,7 @@ def braille(buf: BufType, width: int, height: int, which: int = 0) -> None:
 
 c = 0x1fb00
 for i in range(1, 63):
-    if i in (20, 40):
+    if i in (21, 42):
         continue
     box_chars[chr(c)] = [p(sextant, which=i)]
     c += 1


Test patch:
Repository: kovidgoyal/kitty

Issue:
draw powerline tab bar separator (alt symbol) in tab bar background colour
**Is your feature request related to a problem? Please describe.**

The powerline tab bar alt symbol is currently drawn with the foreground colour, but that seems to me to result in something that calls too much attention to itself, rather than just helping separate the tabs:

![image](https://user-images.githubusercontent.com/1543430/120009660-1c145a80-bfd4-11eb-9658-4ce853a0cc54.png)

**Describe the solution you'd like**

I think it would be better, barring it having its own colour setting, to draw it using the bar background colour instead:

![image](https://user-images.githubusercontent.com/1543430/120009788-4108cd80-bfd4-11eb-94d5-baa20ccf6398.png)

**Describe alternatives you've considered**

having its own setting for a colour would also work, but not sure if it's worth it?

**Additional context**

have i mentioned kitty rocks


Discussion:
Whether the foreground or the background works better depends on both the colors used for the tab bar and the users subjective color preferences. For example, with the default color scheme, background is black and foreground is less black so using background would actually have more contrast. 

What I suggest is have the code dynamically pick either the foreground or the background color based on which has less contrast with inactive_tab_background. Avoids using another conf option for something so small. 

Should be a simple patch, PR is welcome, code is in draw_tab_with_powerline()
> What I suggest is have the code dynamically pick either the foreground or the background color based on which has less contrast with inactive_tab_background. Avoids using another conf option for something so small.
> 

+1

Resolving patch:
diff --git a/kitty/rgb.py b/kitty/rgb.py
--- a/kitty/rgb.py
+++ b/kitty/rgb.py
@@ -12,6 +12,16 @@ class Color(NamedTuple):
     green: int
     blue: int
 
+    def luminance(self) -> float:
+        return 0.299 * self.red + 0.587 * self.green + 0.114 * self.blue
+
+    def contrast(self, other: 'Color') -> float:
+        a = self.luminance()
+        b = other.luminance()
+        if a < b:
+            a, b = b, a
+        return (a + 0.05) / (b + 0.05)
+
 
 def alpha_blend_channel(top_color: int, bottom_color: int, alpha: float) -> int:
     return int(alpha * top_color + (1 - alpha) * bottom_color)
diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py
--- a/kitty/tab_bar.py
+++ b/kitty/tab_bar.py
@@ -234,6 +234,15 @@ def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData
             screen.cursor.bg = inactive_bg
         screen.draw(separator_symbol)
     else:
+        if tab_bg == default_bg:
+            pass
+        elif tab_bg == tab_fg:
+            screen.cursor.fg = default_bg
+        else:
+            c1 = draw_data.inactive_bg.contrast(draw_data.default_bg)
+            c2 = draw_data.inactive_bg.contrast(draw_data.inactive_fg)
+            if c1 < c2:
+                screen.cursor.fg = default_bg
         screen.draw(f' {separator_alt_symbol}')
 
     end = screen.cursor.x


Test patch: