From bc928d824ba6963e06e749c76a5f1fdc5779a6d9 Mon Sep 17 00:00:00 2001 From: shemogumbe Date: Fri, 9 Aug 2024 17:10:52 +0300 Subject: [PATCH 1/4] remove falsy check for nulls in method definitions --- src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 0b5025485..17f082d35 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -43,7 +43,7 @@ public class CodeMethodWriter : BaseElementWriter !x.Optional).OrderBy(static x => x.Name)) { var parameterName = parameter.Name; - writer.StartBlock($"if not {parameterName}:"); + writer.StartBlock($"if {parameterName} is None:"); writer.WriteLine($"raise TypeError(\"{parameterName} cannot be null.\")"); writer.DecreaseIndent(); } From 30bcf0db2aadce943a66124cf669c361a9bcad6a Mon Sep 17 00:00:00 2001 From: shemogumbe Date: Fri, 9 Aug 2024 18:23:12 +0300 Subject: [PATCH 2/4] Update unit tests --- .../Writers/Python/CodeMethodWriterTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 4bb016605..2d3516a27 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2086,7 +2086,7 @@ public sealed class CodeMethodWriterTests : IDisposable }); writer.Write(method); var result = tw.ToString(); - Assert.Contains("if not original_name:", result); + Assert.Contains("if original_name is None:", result); Assert.Contains("if original_name == \"select\":", result); Assert.Contains("return \"%24select\"", result); Assert.Contains("if original_name == \"expand\":", result); @@ -2124,7 +2124,7 @@ public sealed class CodeMethodWriterTests : IDisposable }); writer.Write(method); var result = tw.ToString(); - Assert.Contains("if not original_name:", result); + Assert.Contains("if original_name is None:", result); Assert.Contains("if original_name == \"start_date_time\":", result); Assert.Contains("return \"startDateTime\"", result); Assert.Contains("return original_name", result); From ba5e39c84d7f5d1f78da3fef0246e95fc4ff4d9c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Aug 2024 12:15:59 -0400 Subject: [PATCH 3/4] chore: adds python fix changelog entry Signed-off-by: Vincent Biret --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 447d71f76..521b32331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Adds generation of default 'color.png`and`outline.png` files when generating plugins. [#4993](https://github.com/microsoft/kiota/issues/4993) +- Adds generation of default `color.png` and `outline.png` files when generating plugins. [#4993](https://github.com/microsoft/kiota/issues/4993) ### Changed @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Exclude the `x-openai-isConsequential` extension from cleanup. [#4962](https://github.com/microsoft/kiota/issues/4962) - Fixed file name and namespace sanitization when generating plugins. [#5019](https://github.com/microsoft/kiota/issues/5019) - Added TypeScript typecheck suppression to generated method prototype, where anused arguments can cause build fail in projects which use `noUnusedLocals: true` compiler option. [#5095](https://github.com/microsoft/kiota/issues/5095) +- Fixed a bug where defensive programming would consider some default values as invalid in Python. ## [1.16.0] - 2024-07-05 From c6c41ade1735788de92300b422ee5e775621fdda Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Aug 2024 12:29:08 -0400 Subject: [PATCH 4/4] chore: release version bump Signed-off-by: Vincent Biret --- CHANGELOG.md | 7 +++++++ src/Kiota.Builder/Kiota.Builder.csproj | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 521b32331..1a95bf545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Changed + +## [1.17.0] - 2024-08-09 + +### Added + - Adds generation of default `color.png` and `outline.png` files when generating plugins. [#4993](https://github.com/microsoft/kiota/issues/4993) ### Changed @@ -1406,3 +1412,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial GitHub release + diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 4cedd1211..805a6f5b5 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -61,7 +61,7 @@ - - + +