From ab8506c904b76a50ac21352907629455bab029d8 Mon Sep 17 00:00:00 2001 From: Alper Yoney Date: Mon, 23 Dec 2024 20:32:36 -0800 Subject: [PATCH] Use pragma single-line Summary: Use `pragma single-line` suppressing all newlines in the current partial. Reviewed By: createdbysk Differential Revision: D67612065 fbshipit-source-id: e9521febea03e68e66700902a5ecc9773e408773 --- .../python/types/exception_base.mustache | 14 +++++++------ .../python/types/exception_metaclass.mustache | 14 +++++++------ .../templates/python/types/mapping.mustache | 20 ++++++++++--------- .../templates/python/types/sequence.mustache | 20 ++++++++++--------- .../templates/python/types/set.mustache | 20 ++++++++++--------- .../python/types/struct_base.mustache | 14 +++++++------ .../python/types/struct_metaclass.mustache | 14 +++++++------ .../types/thrift_container_wrapper.mustache | 16 ++++++++------- .../python/types/union_base.mustache | 14 +++++++------ .../python/types/union_metaclass.mustache | 14 +++++++------ 10 files changed, 90 insertions(+), 70 deletions(-) diff --git a/thrift/compiler/generate/templates/python/types/exception_base.mustache b/thrift/compiler/generate/templates/python/types/exception_base.mustache index 59d6f531422..30082538c43 100644 --- a/thrift/compiler/generate/templates/python/types/exception_base.mustache +++ b/thrift/compiler/generate/templates/python/types/exception_base.mustache @@ -16,9 +16,11 @@ }}{{! This is the base class for Thrift exception -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_exceptions.MutableGeneratedError{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_exceptions.GeneratedError{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_exceptions.MutableGeneratedError +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_exceptions.GeneratedError +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/exception_metaclass.mustache b/thrift/compiler/generate/templates/python/types/exception_metaclass.mustache index efeac98668c..bfce72d9ff0 100644 --- a/thrift/compiler/generate/templates/python/types/exception_metaclass.mustache +++ b/thrift/compiler/generate/templates/python/types/exception_metaclass.mustache @@ -16,9 +16,11 @@ }}{{! This is the metaclass for Thrift exception -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_exceptions.MutableGeneratedErrorMeta{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_exceptions.GeneratedErrorMeta{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_exceptions.MutableGeneratedErrorMeta +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_exceptions.GeneratedErrorMeta +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/mapping.mustache b/thrift/compiler/generate/templates/python/types/mapping.mustache index ea405d6b15c..8e0dd7c3afb 100644 --- a/thrift/compiler/generate/templates/python/types/mapping.mustache +++ b/thrift/compiler/generate/templates/python/types/mapping.mustache @@ -16,12 +16,14 @@ }}{{! This is import module for abstract, mutable, and immutable mappings -}}{{#program:generate_abstract_types}}{{! -}}_typing.Mapping{{! -}}{{/program:generate_abstract_types}}{{! -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_containers.MutableMap{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_typing.Mapping{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_abstract_types}} +_typing.Mapping +{{/program:generate_abstract_types}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_containers.MutableMap +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_typing.Mapping +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/sequence.mustache b/thrift/compiler/generate/templates/python/types/sequence.mustache index 73327bd669c..b3a9147bd59 100644 --- a/thrift/compiler/generate/templates/python/types/sequence.mustache +++ b/thrift/compiler/generate/templates/python/types/sequence.mustache @@ -16,12 +16,14 @@ }}{{! This is import module for abstract, mutable, and immutable sequences -}}{{#program:generate_abstract_types}}{{! -}}_typing.Sequence{{! -}}{{/program:generate_abstract_types}}{{! -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_containers.MutableList{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_typing.Sequence{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_abstract_types}} +_typing.Sequence +{{/program:generate_abstract_types}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_containers.MutableList +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_typing.Sequence +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/set.mustache b/thrift/compiler/generate/templates/python/types/set.mustache index 57db02d1244..97a56e4fd4e 100644 --- a/thrift/compiler/generate/templates/python/types/set.mustache +++ b/thrift/compiler/generate/templates/python/types/set.mustache @@ -16,12 +16,14 @@ }}{{! This is import module for abstract, mutable, and immutable sets -}}{{#program:generate_abstract_types}}{{! -}}_typing.AbstractSet{{! -}}{{/program:generate_abstract_types}}{{! -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_containers.MutableSet{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_typing.AbstractSet{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_abstract_types}} +_typing.AbstractSet +{{/program:generate_abstract_types}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_containers.MutableSet +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_typing.AbstractSet +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/struct_base.mustache b/thrift/compiler/generate/templates/python/types/struct_base.mustache index 18dccb88370..b6f5c147e69 100644 --- a/thrift/compiler/generate/templates/python/types/struct_base.mustache +++ b/thrift/compiler/generate/templates/python/types/struct_base.mustache @@ -16,9 +16,11 @@ }}{{! This is the base class for Thrift struct -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_types.MutableStruct{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_types.Struct{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_types.MutableStruct +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_types.Struct +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/struct_metaclass.mustache b/thrift/compiler/generate/templates/python/types/struct_metaclass.mustache index 183919e5a92..dfe0147f26f 100644 --- a/thrift/compiler/generate/templates/python/types/struct_metaclass.mustache +++ b/thrift/compiler/generate/templates/python/types/struct_metaclass.mustache @@ -16,9 +16,11 @@ }}{{! This is the metaclass for Thrift struct -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_types.MutableStructMeta{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_types.StructMeta{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_types.MutableStructMeta +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_types.StructMeta +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/thrift_container_wrapper.mustache b/thrift/compiler/generate/templates/python/types/thrift_container_wrapper.mustache index a383d8d5e21..f1da431efa7 100644 --- a/thrift/compiler/generate/templates/python/types/thrift_container_wrapper.mustache +++ b/thrift/compiler/generate/templates/python/types/thrift_container_wrapper.mustache @@ -16,10 +16,12 @@ }}{{! to pick the Thrift container wrapper type for mutable types -}}{{^field:has_adapter?}}{{! -}}{{#field:type}}{{! -}}{{#type:list?}} | _fbthrift_python_mutable_types._ThriftListWrapper{{/type:list?}}{{! -}}{{#type:set?}} | _fbthrift_python_mutable_types._ThriftSetWrapper{{/type:set?}}{{! -}}{{#type:map?}} | _fbthrift_python_mutable_types._ThriftMapWrapper{{/type:map?}}{{! -}}{{/field:type}}{{! -}}{{/field:has_adapter?}} +}} +{{#pragma single-line}} +{{^field:has_adapter?}} +{{#field:type}} +{{#type:list?}} | _fbthrift_python_mutable_types._ThriftListWrapper{{/type:list?}} +{{#type:set?}} | _fbthrift_python_mutable_types._ThriftSetWrapper{{/type:set?}} +{{#type:map?}} | _fbthrift_python_mutable_types._ThriftMapWrapper{{/type:map?}} +{{/field:type}} +{{/field:has_adapter?}} diff --git a/thrift/compiler/generate/templates/python/types/union_base.mustache b/thrift/compiler/generate/templates/python/types/union_base.mustache index 8ac7f191502..98250f44bdf 100644 --- a/thrift/compiler/generate/templates/python/types/union_base.mustache +++ b/thrift/compiler/generate/templates/python/types/union_base.mustache @@ -16,9 +16,11 @@ }}{{! This is the base class for Thrift union -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_types.MutableUnion{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_types.Union{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_types.MutableUnion +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_types.Union +{{/program:generate_immutable_types}} diff --git a/thrift/compiler/generate/templates/python/types/union_metaclass.mustache b/thrift/compiler/generate/templates/python/types/union_metaclass.mustache index bf7aede64c8..201e353d0b3 100644 --- a/thrift/compiler/generate/templates/python/types/union_metaclass.mustache +++ b/thrift/compiler/generate/templates/python/types/union_metaclass.mustache @@ -16,9 +16,11 @@ }}{{! This is the metaclass for Thrift union -}}{{#program:generate_mutable_types}}{{! -}}_fbthrift_python_mutable_types.MutableUnionMeta{{! -}}{{/program:generate_mutable_types}}{{! -}}{{#program:generate_immutable_types}}{{! -}}_fbthrift_python_types.UnionMeta{{! -}}{{/program:generate_immutable_types}} +}} +{{#pragma single-line}} +{{#program:generate_mutable_types}} +_fbthrift_python_mutable_types.MutableUnionMeta +{{/program:generate_mutable_types}} +{{#program:generate_immutable_types}} +_fbthrift_python_types.UnionMeta +{{/program:generate_immutable_types}}