{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":688995911,"defaultBranch":"main","name":"black","ownerLogin":"konstin","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2023-09-08T14:49:34.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/6826232?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1694240947.0","currentOid":""},"activityList":{"items":[{"before":"870f12c027d113f0a708379f910956c8efc98af4","after":null,"ref":"refs/heads/blank_line_after_body_in_stub_file","pushedAt":"2023-09-09T06:29:07.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"konstin","name":"konsti","path":"/konstin","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/6826232?s=80&v=4"}},{"before":"9e1cc30e08cc8f4e1d990a7529c2a93d43e62854","after":"870f12c027d113f0a708379f910956c8efc98af4","ref":"refs/heads/blank_line_after_body_in_stub_file","pushedAt":"2023-09-08T15:17:23.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"JelleZijlstra","name":"Jelle Zijlstra","path":"/JelleZijlstra","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/906600?s=80&v=4"},"commit":{"message":"Update src/black/lines.py","shortMessageHtmlLink":"Update src/black/lines.py"}},{"before":null,"after":"9e1cc30e08cc8f4e1d990a7529c2a93d43e62854","ref":"refs/heads/blank_line_after_body_in_stub_file","pushedAt":"2023-09-08T14:50:21.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"konstin","name":"konsti","path":"/konstin","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/6826232?s=80&v=4"},"commit":{"message":"Blank line between nested and function def in stub files.\n\nThe idea behind this change is that we stop looking into previous body to determine if there should be a blank before a function or class definition.\n\nInput:\n\n```python\nimport sys\n\nif sys.version_info > (3, 7):\n class Nested1:\n assignment = 1\n def function_definition(self): ...\n def f1(self) -> str: ...\n class Nested2:\n def function_definition(self): ...\n assignment = 1\n def f2(self) -> str: ...\n\nif sys.version_info > (3, 7):\n def nested1():\n assignment = 1\n def function_definition(self): ...\n def f1(self) -> str: ...\n def nested2():\n def function_definition(self): ...\n assignment = 1\n def f2(self) -> str: ...\n```\n\nStable style\n```python\nimport sys\n\nif sys.version_info > (3, 7):\n class Nested1:\n assignment = 1\n def function_definition(self): ...\n\n def f1(self) -> str: ...\n\n class Nested2:\n def function_definition(self): ...\n assignment = 1\n def f2(self) -> str: ...\n\nif sys.version_info > (3, 7):\n def nested1():\n assignment = 1\n def function_definition(self): ...\n\n def f1(self) -> str: ...\n def nested2():\n def function_definition(self): ...\n assignment = 1\n def f2(self) -> str: ...\n```\n\nIn the stable formatting, we have a blank line sometimes, not depending on the previous statement on the same level, but on the last (potentially nested) statement in the previous body.\n\n#2783/#3564 fixes this for classes in preview style:\n\n```python\nimport sys\n\nif sys.version_info > (3, 7):\n class Nested1:\n assignment = 1\n def function_definition(self): ...\n\n def f1(self) -> str: ...\n\n class Nested2:\n def function_definition(self): ...\n assignment = 1\n\n def f2(self) -> str: ...\n\nif sys.version_info > (3, 7):\n def nested1():\n assignment = 1\n def function_definition(self): ...\n\n def f1(self) -> str: ...\n def nested2():\n def function_definition(self): ...\n assignment = 1\n def f2(self) -> str: ...\n```\n\nThis PR additionally fixes this for function definitions:\n\n```python\nif sys.version_info > (3, 7):\n if sys.platform == \"win32\":\n assignment = 1\n def function_definition(self): ...\n\n def f1(self) -> str: ...\n if sys.platform != \"win32\":\n def function_definition(self): ...\n assignment = 1\n\n def f2(self) -> str: ...\n\nif sys.version_info > (3, 8):\n if sys.platform == \"win32\":\n assignment = 1\n def function_definition(self): ...\n\n class F1: ...\n if sys.platform != \"win32\":\n def function_definition(self): ...\n assignment = 1\n\n class F2: ...\n```\n\nYou can see the effect of this change on typeshed in https://github.com/konstin/typeshed/pull/1/files. As baseline, the preview mode changes without this PR are at https://github.com/konstin/typeshed/pull/2.","shortMessageHtmlLink":"Blank line between nested and function def in stub files."}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAADfMQVegA","startCursor":null,"endCursor":null}},"title":"Activity ยท konstin/black"}