2015-02-16 21:57 GMT+02:00 Dave Andreoli <[email protected]>:
> davemds pushed a commit to branch master.
>
> http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=b4fcee3de22092d206747ba03275833917e9bbdb
>
> commit b4fcee3de22092d206747ba03275833917e9bbdb
> Author: Dave Andreoli <[email protected]>
> Date: Mon Feb 16 20:38:25 2015 +0100
>
> Use consistent indentation style with the rest of the code
> ---
> CODING | 14 ++++++++++++++
> efl/elementary/image.pyx | 25 ++++++++++++-------------
> examples/elementary/test_image.py | 23 +++++++++--------------
> 3 files changed, 35 insertions(+), 27 deletions(-)
>
> diff --git a/CODING b/CODING
> index a5c4600..1e4f965 100644
> --- a/CODING
> +++ b/CODING
> @@ -8,6 +8,20 @@ Style
> * When comparing C pointers with NULL, use == and != instead of the python
> operator "is". This makes a visual distinction between python and C code.
>
> +* For long lines that do not fit in the 80 cols please use only the first
> + raccomandation from PEP-8 (Aligned with opening delimiter). Example:
> + Yes:
> + foo = long_function_name(var_one, var_two,
> + var_three, var_four)
> + No:
> + foo = long_function_name(
> + var_one, var_two,
> + var_three, var_four)
> +
> + This to keep new code consistent with the rest of the bindings and to
> + try to match the style of the C efl code style as much as possible.
> + ...also because I found it more readable and I like it more :P -davemds-
> +
WTF man? How about first at least having a discussion before enforcing
your personal code formatting style everywhere. The "hanging indent"
style, which is the other "approved" style in pep-8 you quoted, has
been used in many places including the file you just re-formatted
entirely.
Yes: Communication and co-operation
No: Mussolini
>
> Design patterns
> ===============
> diff --git a/efl/elementary/image.pyx b/efl/elementary/image.pyx
> index 79cb7e3..e39ea59 100644
> --- a/efl/elementary/image.pyx
> +++ b/efl/elementary/image.pyx
> @@ -195,19 +195,18 @@ cdef class Image(Object):
> self._set_properties_from_keyword_args(kwargs)
>
> def memfile_set(self, img, size, format=None, key=None):
> - """
> - Set a location in memory to be used as an image object's source
> + """Set a location in memory to be used as an image object's source
> bitmap.
>
> This function is handy when the contents of an image file are
> mapped in memory, for example.
>
> The ``format`` string should be something like ``"png"``, ``"jpg"``,
> - ``"tga"``, ``"tiff"``, ``"bmp"`` etc, when provided. This improves
> the loader performance as it tries the
> - "correct" loader first, before trying a range of other possible
> - loaders until one succeeds.
> + ``"tga"``, ``"tiff"``, ``"bmp"`` etc, when provided. This improves
> + the loader performance as it tries the "correct" loader first,
> + before trying a range of other possible loaders until one succeeds.
>
> - :return: (``True`` = success, ``False`` = error)
> + :return: ``True`` = success, ``False`` = error
>
> .. versionadded:: 1.14
>
> @@ -216,6 +215,7 @@ cdef class Image(Object):
> :param format: (Optional) expected format of ``img`` bytes
> :param key: Optional indexing key of ``img`` to be passed to the
> image loader (eg. if ``img`` is a memory-mapped EET file)
> +
> """
> cdef Py_buffer view
>
> @@ -227,13 +227,12 @@ cdef class Image(Object):
>
> PyObject_GetBuffer(img, &view, PyBUF_SIMPLE)
>
> - ret = bool(elm_image_memfile_set(
> - self.obj,
> - <void *>view.buf,
> - size,
> - <const char *>format if format else NULL,
> - <const char *>key if key else NULL
> - ))
> + ret = bool(elm_image_memfile_set(self.obj,
> + <void *>view.buf,
> + size,
> + <const char *>format if format else
> NULL,
> + <const char *>key if key else NULL
> + ))
>
> PyBuffer_Release(&view)
>
> diff --git a/examples/elementary/test_image.py
> b/examples/elementary/test_image.py
> index e095cf2..4203c40 100644
> --- a/examples/elementary/test_image.py
> +++ b/examples/elementary/test_image.py
> @@ -61,9 +61,8 @@ def image_clicked(obj, it=None):
> win.resize_object_add(vbox)
> vbox.show()
>
> - im = Image(
> - win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
> - file=os.path.join(img_path, "logo.png"))
> + im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
> + file=os.path.join(img_path, "logo.png"))
> vbox.pack_end(im)
> im.show()
>
> @@ -71,9 +70,8 @@ def image_clicked(obj, it=None):
> vbox.pack_end(sep)
> sep.show()
>
> - hbox = Box(
> - win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
> - size_hint_align=FILL_BOTH)
> + hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
> + size_hint_align=FILL_BOTH)
> vbox.pack_end(hbox)
> hbox.show()
>
> @@ -96,9 +94,8 @@ def image_clicked(obj, it=None):
> b.callback_clicked_add(lambda b: im.file_set(remote_url))
> b.show()
>
> - pb = Progressbar(
> - win, size_hint_weight=EXPAND_BOTH,
> - size_hint_align=FILL_BOTH)
> + pb = Progressbar(win, size_hint_weight=EXPAND_BOTH,
> + size_hint_align=FILL_BOTH)
> hbox.pack_end(pb)
> pb.show()
>
> @@ -118,8 +115,7 @@ def image2_clicked(obj, it=None):
> vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
> win.resize_object_add(vbox)
>
> - im = Image(
> - win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
> + im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
>
> with open(os.path.join(img_path, "logo.png"), "rb") as fp:
> image_data = fp.read()
> @@ -133,9 +129,8 @@ def image2_clicked(obj, it=None):
>
> if __name__ == "__main__":
> elementary.init()
> - win = StandardWindow(
> - "test", "python-elementary test application",
> - size=(320, 520))
> + win = StandardWindow("test", "python-elementary test application",
> + size=(320, 520))
> win.callback_delete_request_add(lambda o: elementary.exit())
>
> box0 = Box(win, size_hint_weight=EXPAND_BOTH)
>
> --
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel