nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: DesignLiquido/delegua
Pull request #491 (2023-09-11 19:30:36)

Atribuição dois pontos igual


Patch:
diff --git a/fontes/lexador/dialetos/lexador-visualg.ts b/fontes/lexador/dialetos/lexador-visualg.ts
index e51d7af8..eefeacde 100644
--- a/fontes/lexador/dialetos/lexador-visualg.ts
+++ b/fontes/lexador/dialetos/lexador-visualg.ts
@@ -92,8 +92,14 @@ export class LexadorVisuAlg extends LexadorBaseLinhaUnica {
                 this.avancar();
                 break;
             case ':':
-                this.adicionarSimbolo(tiposDeSimbolos.DOIS_PONTOS);
+                this.inicioSimbolo = this.atual;
                 this.avancar();
+                if (this.simboloAtual() === '=') {
+                    this.adicionarSimbolo(tiposDeSimbolos.SETA_ATRIBUICAO);
+                    this.avancar();
+                } else {
+                    this.adicionarSimbolo(tiposDeSimbolos.DOIS_PONTOS);
+                }
                 break;
             case '<':
                 this.avancar();


Test patch:
diff --git a/testes/visualg/avaliador-sintatico.test.ts b/testes/visualg/avaliador-sintatico.test.ts
index 363a2326..b09e7953 100644
--- a/testes/visualg/avaliador-sintatico.test.ts
+++ b/testes/visualg/avaliador-sintatico.test.ts
@@ -23,6 +23,27 @@ describe('Avaliador sintático (VisuAlg)', () => {
                 expect(retornoAvaliadorSintatico.declaracoes).toHaveLength(1);
             });
 
+            it('Sucesso - Atribuição', () => {
+                const retornoLexador = lexador.mapear(
+                    [
+                        'algoritmo "Atribuição"',
+                        'var a: inteiro',
+                        'var b: caracter',
+                        'inicio',
+                        'a <- 1',
+                        'b := "b"',
+                        'escreva (a)',
+                        'escreva (b)',
+                        'fimalgoritmo',
+                    ],
+                    -1
+                );
+                const retornoAvaliadorSintatico = avaliadorSintatico.analisar(retornoLexador, -1);
+
+                expect(retornoAvaliadorSintatico).toBeTruthy();
+                expect(retornoAvaliadorSintatico.declaracoes).toHaveLength(6);
+            });
+
             it('Sucesso - Enquanto', () => {
                 const retornoLexador = lexador.mapear(
                     [
Repository: DesignLiquido/delegua
Pull request #538 (2023-10-29 20:35:50)

[delegua] avaliador sintático atribuição de variável


Patch:
diff --git a/fontes/analisador-semantico/analisador-semantico.ts b/fontes/analisador-semantico/analisador-semantico.ts
index a786e0b4..ced15394 100644
--- a/fontes/analisador-semantico/analisador-semantico.ts
+++ b/fontes/analisador-semantico/analisador-semantico.ts
@@ -396,7 +396,7 @@ export class AnalisadorSemantico implements AnalisadorSemanticoInterface {
         this.variaveis[declaracao.simbolo.lexema] = {
             imutavel: false,
             tipo: declaracao.tipo,
-            valor: declaracao.inicializador.valor || declaracao.inicializador
+            valor: declaracao.inicializador?.valor || declaracao.inicializador
         };
 
         return Promise.resolve();


Test patch:
diff --git a/testes/analisador-semantico.test.ts b/testes/analisador-semantico.test.ts
index 135f9600..1f2ed855 100644
--- a/testes/analisador-semantico.test.ts
+++ b/testes/analisador-semantico.test.ts
@@ -60,6 +60,18 @@ describe('Analisador semântico', () => {
                 expect(retornoAnalisadorSemantico.erros).toHaveLength(0);
             });
 
+            it('Atribuindo variável após declaração', () => {
+                const retornoLexador = lexador.mapear([
+                    "var variavel1: texto",
+                    "variavel1 = 'teste'",
+                ], -1);
+                const retornoAvaliadorSintatico = avaliadorSintatico.analisar(retornoLexador, -1);
+                const retornoAnalisadorSemantico = analisadorSemantico.analisar(retornoAvaliadorSintatico.declaracoes);
+
+                expect(retornoAnalisadorSemantico).toBeTruthy();
+                expect(retornoAnalisadorSemantico.erros).toHaveLength(0);
+            });
+
             it('Sucesso - Função com definição de tipos', () => {
                 const retornoLexador = lexador.mapear([
                     // "var a = funcao (valor1: inteiro, valor2: qualquer, valor3: texto): texto {",
Repository: DesignLiquido/delegua
Pull request #590 (2024-01-21 02:11:55)

Ajustes no formatador de Delégua para `se`.


Patch:
diff --git a/fontes/formatadores/formatador-delegua.ts b/fontes/formatadores/formatador-delegua.ts
index 822abbd1..4e987f03 100644
--- a/fontes/formatadores/formatador-delegua.ts
+++ b/fontes/formatadores/formatador-delegua.ts
@@ -266,6 +266,8 @@ export class FormatadorDelegua implements VisitanteComumInterface {
         if (declaracao.caminhoSenao) {
             this.codigoFormatado += `${' '.repeat(this.indentacaoAtual)}} senão `;
             this.formatarDeclaracaoOuConstruto(declaracao.caminhoSenao);
+        } else {
+            this.codigoFormatado += `${' '.repeat(this.indentacaoAtual)}}${this.quebraLinha}`;
         }
     }
 


Test patch:
diff --git a/testes/formatadores/formatador-delegua.test.ts b/testes/formatadores/formatador-delegua.test.ts
index 0f77a8ce..ac18fe03 100644
--- a/testes/formatadores/formatador-delegua.test.ts
+++ b/testes/formatadores/formatador-delegua.test.ts
@@ -101,7 +101,7 @@ describe('Formatadores > Delégua', () => {
         const linhasResultado = resultado.split(sistemaOperacional.EOL);
         
         // console.log(resultado);
-        expect(linhasResultado).toHaveLength(7);
+        expect(linhasResultado).toHaveLength(8);
     });
 
     it('Expressões Regulares', () => {
@@ -141,7 +141,7 @@ describe('Formatadores > Delégua', () => {
         const linhasResultado = resultado.split(sistemaOperacional.EOL);
         
         // console.log(resultado);
-        expect(linhasResultado).toHaveLength(9);
+        expect(linhasResultado).toHaveLength(10);
     });
 
     it('Fazer', () => {
@@ -193,7 +193,7 @@ describe('Formatadores > Delégua', () => {
         const linhasResultado = resultado.split(sistemaOperacional.EOL);
         
         // console.log(resultado);
-        expect(linhasResultado).toHaveLength(9);
+        expect(linhasResultado).toHaveLength(10);
     });
 
     it('Funções com argumentos tipados', () => {
@@ -267,7 +267,7 @@ describe('Formatadores > Delégua', () => {
         const linhasResultado = resultado.split(sistemaOperacional.EOL);
         
         // console.log(resultado);
-        expect(linhasResultado).toHaveLength(6);
+        expect(linhasResultado).toHaveLength(7);
     });
 
     it('Para cada', () => {
Repository: DesignLiquido/delegua
Pull request #603 (2024-01-28 00:18:33)

Resolve bug interpolacao de textos


Patch:
diff --git a/fontes/interpretador/interpretador-base.ts b/fontes/interpretador/interpretador-base.ts
index 3652a197..0a79caa8 100644
--- a/fontes/interpretador/interpretador-base.ts
+++ b/fontes/interpretador/interpretador-base.ts
@@ -282,9 +282,10 @@ export class InterpretadorBase implements InterpretadorInterface {
             if (elemento?.valor?.tipo === tipoDeDadosDelegua.LOGICO) {
                 textoFinal = textoFinal.replace('${' + elemento.variavel + '}', this.paraTexto(elemento?.valor?.valor));
             } else {
+                const valor = elemento?.valor?.hasOwnProperty('valor') ? elemento?.valor.valor : elemento?.valor
                 textoFinal = textoFinal.replace(
                     '${' + elemento.variavel + '}',
-                    elemento?.valor?.valor || elemento?.valor
+                    `${this.paraTexto(valor)}`
                 );
             }
         });


Test patch:
diff --git a/testes/interpretador.test.ts b/testes/interpretador.test.ts
index d47ce43f..3247c846 100644
--- a/testes/interpretador.test.ts
+++ b/testes/interpretador.test.ts
@@ -84,7 +84,8 @@ describe('Interpretador', () => {
                         'somar: 8 = 8',
                         'somar com ponto flutuante: 9 = 9',
                         '2',
-                        'Valor: falso e verdadeiro'
+                        'Valor: falso e verdadeiro',
+                        "0"
                     ]
                     const retornoLexador = lexador.mapear([
                         "var comidaFavorita = 'strogonoff'",
@@ -97,6 +98,8 @@ describe('Interpretador', () => {
                         "escreva('${4 - 2 / 1}');",
                         "var logico1 = falso",
                         "var logico2 = verdadeiro",
+                        "var zero = 0",
+                        "escreva(\"${zero}\")",
                         "escreva('Valor: ${logico1} e ${logico2}')",
                     ], -1);
                     const retornoAvaliadorSintatico = avaliadorSintatico.analisar(retornoLexador, -1);
Repository: DesignLiquido/delegua
Pull request #661 (2024-02-21 19:31:09)

Funcao retorna lista
resolve https://github.com/DesignLiquido/delegua/issues/653


Patch:
diff --git a/fontes/interpretador/interpretador-base.ts b/fontes/interpretador/interpretador-base.ts
index 2be69a49..4d8fa307 100644
--- a/fontes/interpretador/interpretador-base.ts
+++ b/fontes/interpretador/interpretador-base.ts
@@ -1616,8 +1616,11 @@ export class InterpretadorBase implements InterpretadorInterface {
                 retornoVetor += `${this.paraTexto(elemento)},`;
             }
 
-            retornoVetor = retornoVetor.slice(0, -1);
+            if(retornoVetor.length > 1){
+                retornoVetor = retornoVetor.slice(0, -1);
+            }
             retornoVetor += ']';
+
             return retornoVetor;
         }
 


Test patch:
diff --git a/testes/interpretador/interpretador.test.ts b/testes/interpretador/interpretador.test.ts
index 3f4f5455..ccc61d8d 100644
--- a/testes/interpretador/interpretador.test.ts
+++ b/testes/interpretador/interpretador.test.ts
@@ -1410,6 +1410,32 @@ describe('Interpretador', () => {
 
                         expect(retornoInterpretador.erros).toHaveLength(0);
                     });
+
+                    it('função que retorna lista', async () => {
+                        const retornoLexador = lexador.mapear(
+                            [
+                                "funcao retorneLista() {",
+                                    "var lista = []",
+
+                                    "retorna lista",
+                                  "}",
+
+                                  "escreva(retorneLista())"
+                            ],
+                            -1
+                        );
+                        const retornoAvaliadorSintatico = avaliadorSintatico.analisar(retornoLexador, -1);
+
+                        interpretador.funcaoDeRetorno = (saida: string) => {
+                            expect(saida).toEqual('[]');
+                        };
+
+                        const retornoInterpretador = await interpretador.interpretar(
+                            retornoAvaliadorSintatico.declaracoes
+                        );
+
+                        expect(retornoInterpretador.erros).toHaveLength(0);
+                    });
                 });
             });
Repository: hikari-py/hikari
Pull request #702 (2021-07-22 16:57:39)

Actually start rest client in rest bot
### Summary
Actually start rest client in rest bot

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [x] I have run `nox` and all the pipelines have passed.
- [x] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/hikari/impl/rest_bot.py b/hikari/impl/rest_bot.py
index 9fc8b8ce..707ed298 100644
--- a/hikari/impl/rest_bot.py
+++ b/hikari/impl/rest_bot.py
@@ -545,6 +545,7 @@ async def start(
                 name="check for package updates",
             )
 
+        self._rest.start()
         await self._server.start(
             backlog=backlog,
             enable_signal_handlers=enable_signal_handlers,


Test patch:
diff --git a/tests/hikari/impl/test_rest_bot.py b/tests/hikari/impl/test_rest_bot.py
index 0b49e53f..91f67cdb 100644
--- a/tests/hikari/impl/test_rest_bot.py
+++ b/tests/hikari/impl/test_rest_bot.py
@@ -398,7 +398,7 @@ def test_run_ignores_close_executor_when_not_present(self, mock_rest_bot):
         assert mock_rest_bot.executor is None
 
     @pytest.mark.asyncio()
-    async def test_start(self, mock_rest_bot, mock_interaction_server):
+    async def test_start(self, mock_rest_bot, mock_interaction_server, mock_rest_client):
         mock_socket = object()
         mock_ssl_context = object()
         mock_rest_bot._is_closing = True
@@ -432,6 +432,7 @@ async def test_start(self, mock_rest_bot, mock_interaction_server):
             shutdown_timeout=4312312.3132132,
             ssl_context=mock_ssl_context,
         )
+        mock_rest_client.start.assert_called_once_with()
         assert mock_rest_bot._is_closing is False
 
     @pytest.mark.asyncio()
Repository: hikari-py/hikari
Pull request #769 (2021-09-03 02:36:14)

Move away from deprecated "reason" body field on ban member
### Summary
Move away from deprecated "reason" body field on ban member

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [x] I have run `nox` and all the pipelines have passed.
- [x] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/hikari/impl/rest.py b/hikari/impl/rest.py
index d83d00b4..6d4ae5f4 100644
--- a/hikari/impl/rest.py
+++ b/hikari/impl/rest.py
@@ -28,11 +28,7 @@
 
 from __future__ import annotations
 
-__all__: typing.List[str] = [
-    "ClientCredentialsStrategy",
-    "RESTApp",
-    "RESTClientImpl",
-]
+__all__: typing.List[str] = ["ClientCredentialsStrategy", "RESTApp", "RESTClientImpl"]
 
 import asyncio
 import base64
@@ -2777,10 +2773,8 @@ async def ban_user(
     ) -> None:
         body = data_binding.JSONObjectBuilder()
         body.put("delete_message_days", delete_message_days)
-        # This endpoint specifies a reason in the body, specifically.
-        body.put("reason", reason)
         route = routes.PUT_GUILD_BAN.compile(guild=guild, user=user)
-        await self._request(route, json=body)
+        await self._request(route, json=body, reason=reason)
 
     ban_member = ban_user
 


Test patch:
diff --git a/tests/hikari/impl/test_rest.py b/tests/hikari/impl/test_rest.py
index 43f915db..03cd56e1 100644
--- a/tests/hikari/impl/test_rest.py
+++ b/tests/hikari/impl/test_rest.py
@@ -2899,11 +2899,11 @@ async def test_kick_user(self, rest_client):
 
     async def test_ban_user(self, rest_client):
         expected_route = routes.PUT_GUILD_BAN.compile(guild=123, user=456)
-        expected_json = {"delete_message_days": 7, "reason": "because i can"}
+        expected_json = {"delete_message_days": 7}
         rest_client._request = mock.AsyncMock()
 
         await rest_client.ban_user(StubModel(123), StubModel(456), delete_message_days=7, reason="because i can")
-        rest_client._request.assert_awaited_once_with(expected_route, json=expected_json)
+        rest_client._request.assert_awaited_once_with(expected_route, json=expected_json, reason="because i can")
 
     async def test_unban_user(self, rest_client):
         expected_route = routes.DELETE_GUILD_BAN.compile(guild=123, user=456)
Repository: hikari-py/hikari
Pull request #774 (2021-09-06 04:37:21)

Add USE_EXTERNAL_STICKERS perm
### Summary
<!-- Small summary of the merge request -->

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [ ] I have run `nox` and all the pipelines have passed.
- [ ] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/hikari/permissions.py b/hikari/permissions.py
index 9dce0f4e..667113b3 100644
--- a/hikari/permissions.py
+++ b/hikari/permissions.py
@@ -270,6 +270,9 @@ class Permissions(enums.Flag):
     USE_PRIVATE_THREADS = 1 << 36
     """Allows for creating and participating in private threads."""
 
+    USE_EXTERNAL_STICKERS = 1 << 37
+    """Allows the usage of custom stickers from other servers."""
+
     @classmethod
     def all_permissions(cls) -> Permissions:
         """Get an instance of `Permissions` with all the known permissions.


Test patch:
diff --git a/tests/hikari/test_permissions.py b/tests/hikari/test_permissions.py
index 409a1b61..feb2a4ac 100644
--- a/tests/hikari/test_permissions.py
+++ b/tests/hikari/test_permissions.py
@@ -27,4 +27,4 @@ def test_all_permissions(self):
         all_perms = permissions.Permissions.all_permissions()
 
         assert isinstance(all_perms, permissions.Permissions)
-        assert all_perms == 128849018879
+        assert all_perms == 266287972351
Repository: hikari-py/hikari
Pull request #775 (2021-09-06 04:41:18)

Add new message type + rename application command
### Summary
<!-- Small summary of the merge request -->

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [ ] I have run `nox` and all the pipelines have passed.
- [ ] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/hikari/messages.py b/hikari/messages.py
index aea92c6a..68064421 100644
--- a/hikari/messages.py
+++ b/hikari/messages.py
@@ -133,12 +133,15 @@ class MessageType(int, enums.Enum):
     REPLY = 19
     """A message that replies to another message."""
 
-    APPLICATION_COMMAND = 20
-    """A message sent to indicate a application command has been executed."""
+    CHAT_INPUT = 20
+    """A message sent to indicate a chat input application command has been executed."""
 
     GUILD_INVITE_REMINDER = 22
     """A message sent to remind to invite people to the guild."""
 
+    CONTEXT_MENU_COMMAND = 23
+    """A message sent to indicate a context menu has been executed."""
+
 
 @typing.final
 class MessageFlag(enums.Flag):
diff --git a/hikari/permissions.py b/hikari/permissions.py
index 9dce0f4e..667113b3 100644
--- a/hikari/permissions.py
+++ b/hikari/permissions.py
@@ -270,6 +270,9 @@ class Permissions(enums.Flag):
     USE_PRIVATE_THREADS = 1 << 36
     """Allows for creating and participating in private threads."""
 
+    USE_EXTERNAL_STICKERS = 1 << 37
+    """Allows the usage of custom stickers from other servers."""
+
     @classmethod
     def all_permissions(cls) -> Permissions:
         """Get an instance of `Permissions` with all the known permissions.


Test patch:
diff --git a/tests/hikari/test_permissions.py b/tests/hikari/test_permissions.py
index 409a1b61..feb2a4ac 100644
--- a/tests/hikari/test_permissions.py
+++ b/tests/hikari/test_permissions.py
@@ -27,4 +27,4 @@ def test_all_permissions(self):
         all_perms = permissions.Permissions.all_permissions()
 
         assert isinstance(all_perms, permissions.Permissions)
-        assert all_perms == 128849018879
+        assert all_perms == 266287972351
Repository: hikari-py/hikari
Pull request #799 (2021-09-26 07:08:51)

Thread permission changes


Patch:
diff --git a/changes/799.breaking.md b/changes/799.breaking.md
new file mode 100644
index 00000000..21e33851
--- /dev/null
+++ b/changes/799.breaking.md
@@ -0,0 +1,2 @@
+`USE_PUBLIC_THREADS` and `USE_PRIVATE_THREADS` permissions have been removed in favour of new threads permission
+- New permissions are split into `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS` and `SEND_MESSAGES_IN_THREADS`
diff --git a/hikari/permissions.py b/hikari/permissions.py
index 667113b3..92548cd7 100644
--- a/hikari/permissions.py
+++ b/hikari/permissions.py
@@ -264,15 +264,18 @@ class Permissions(enums.Flag):
         (or their owner's account in the case of bot users) and the guild owner.
     """
 
-    USE_PUBLIC_THREADS = 1 << 35
-    """Allows for creating and participating in threads."""
+    CREATE_PUBLIC_THREADS = 1 << 35
+    """Allows for creating threads."""
 
-    USE_PRIVATE_THREADS = 1 << 36
-    """Allows for creating and participating in private threads."""
+    CREATE_PRIVATE_THREADS = 1 << 36
+    """Allows for creating private threads."""
 
     USE_EXTERNAL_STICKERS = 1 << 37
     """Allows the usage of custom stickers from other servers."""
 
+    SEND_MESSAGES_IN_THREADS = 1 << 38
+    """Allows for sending messages in threads."""
+
     @classmethod
     def all_permissions(cls) -> Permissions:
         """Get an instance of `Permissions` with all the known permissions.
diff --git a/pyproject.toml b/pyproject.toml
index aa20025f..c6ddd569 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -36,8 +36,9 @@ directory = "changes"
 filename = "CHANGELOG.md"
 issue_format = "[#{issue}](https://github.com/hikari-py/hikari/issues/{issue})"
 type = [
-    { name = "Deprecations and Removals", directory = "removal",  showcontent = true },
-    { name = "Features",                  directory = "feature",  showcontent = true },
-    { name = "Bugfixes",                  directory = "bugfix",   showcontent = true },
-    { name = "Improved Documentation",    directory = "doc",      showcontent = true },
+    { name = "Breaking Changes",            directory = "breaking",     showcontent = true },
+    { name = "Deprecation",                 directory = "deprecation",  showcontent = true },
+    { name = "Features",                    directory = "feature",      showcontent = true },
+    { name = "Bugfixes",                    directory = "bugfix",       showcontent = true },
+    { name = "Documentation Improvements",  directory = "doc",          showcontent = true },
 ]


Test patch:
diff --git a/tests/hikari/test_permissions.py b/tests/hikari/test_permissions.py
index feb2a4ac..4ff7cbad 100644
--- a/tests/hikari/test_permissions.py
+++ b/tests/hikari/test_permissions.py
@@ -27,4 +27,4 @@ def test_all_permissions(self):
         all_perms = permissions.Permissions.all_permissions()
 
         assert isinstance(all_perms, permissions.Permissions)
-        assert all_perms == 266287972351
+        assert all_perms == 541165879295