From 12a4a2b423f32de8124d4f1d15c6f680b4887db3 Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Sat, 28 Jan 2017 15:14:00 +0100 Subject: [PATCH] shorter warning moved that to comments --- .../compilation/compile_definitions.py | 38 +++++++++---------- coolamqp/framing/definitions.py | 38 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/coolamqp/framing/compilation/compile_definitions.py b/coolamqp/framing/compilation/compile_definitions.py index 2b9b166..964953a 100644 --- a/coolamqp/framing/compilation/compile_definitions.py +++ b/coolamqp/framing/compilation/compile_definitions.py @@ -215,25 +215,25 @@ Field = collections.namedtuple('Field', ('name', 'type', 'basic_type', 'reserved line(u' ])\n zpf = six.binary_type(zpf)\n') line(u''' if zpf in %s.PARTICULAR_CLASSES: - warnings.warn(u"""You could go faster. - - If you know in advance what properties you will be using, use typized constructors like - - # runs once - my_type = BasicContentPropertyList.typize('content_type', 'content_encoding') - # runs many times - props = my_type('text/plain', 'utf8') - - instead of - - # runs many times - props = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8') - - This way you will be faster. - - If you do not know in advance what properties you will be using, it is correct to use - this constructor. - """) + warnings.warn(u"You could go faster. Go see the comments here") + +# If you know in advance what properties you will be using, use typized constructors like +# +# runs once +# my_type = BasicContentPropertyList.typize('content_type', 'content_encoding') +# +# runs many times +# props = my_type('text/plain', 'utf8') +# +# instead of +# +# # runs many times +# props = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8') +# +# This way you will be faster. +# +# If you do not know in advance what properties you will be using, it is correct to use +# this constructor. return %s.PARTICULAR_CLASSES[zpf](**kwargs) else: diff --git a/coolamqp/framing/definitions.py b/coolamqp/framing/definitions.py index 6532dea..2479e2d 100644 --- a/coolamqp/framing/definitions.py +++ b/coolamqp/framing/definitions.py @@ -2378,25 +2378,25 @@ class BasicContentPropertyList(AMQPContentPropertyList): zpf = six.binary_type(zpf) if zpf in BasicContentPropertyList.PARTICULAR_CLASSES: - warnings.warn(u"""You could go faster. - - If you know in advance what properties you will be using, use typized constructors like - - # runs once - my_type = BasicContentPropertyList.typize('content_type', 'content_encoding') - # runs many times - props = my_type('text/plain', 'utf8') - - instead of - - # runs many times - props = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8') - - This way you will be faster. - - If you do not know in advance what properties you will be using, it is correct to use - this constructor. - """) + warnings.warn(u"You could go faster. Go see the comments here") + +# If you know in advance what properties you will be using, use typized constructors like +# +# runs once +# my_type = BasicContentPropertyList.typize('content_type', 'content_encoding') +# +# runs many times +# props = my_type('text/plain', 'utf8') +# +# instead of +# +# # runs many times +# props = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8') +# +# This way you will be faster. +# +# If you do not know in advance what properties you will be using, it is correct to use +# this constructor. return BasicContentPropertyList.PARTICULAR_CLASSES[zpf](**kwargs) else: -- GitLab