[libcamera-devel] [PATCH 13/24] utils: raspberrypi: ctt: Fix pycodestyle W605
David Plowman
david.plowman at raspberrypi.com
Thu May 14 11:47:35 CEST 2020
Hi
Thanks everyone for fixing up all this stuff. (If I'd known there was an
official "pycodestyle" I'd have done it myself ages ago!).
I actually applied all 24 of these patches including this one, yesterday,
and re-ran the tool to check that it still works. And it did, so I gave it
the nod!
Regards
David
On Thu, 14 May 2020 at 10:08, Kieran Bingham <
kieran.bingham at ideasonboard.com> wrote:
> Hi Laurent
>
> On 12/05/2020 17:38, Laurent Pinchart wrote:
> > Hi Kieran,
> >
> > On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
> >> On 12/05/2020 01:03, Laurent Pinchart wrote:
> >>> W605 invalid escape sequence '\.'
> >>>
> >>
> >> Would these be better interpreted as a 'raw' string?:
> >>
> >>> - col =
> re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> + col =
> re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>
> >> That is how I have been handling regexes in python:
> >>
> >> https://docs.python.org/3/howto/regex.html#the-backslash-plague
> >
> > It's a good point. I'll submit a new version.
> >
> > Would you do the same for the strings in ctt_awb.py, or just for the
> > regexp ?
>
> the 'r' prefix is 'raw' not 'regexp', so I believe it applies to the
> ct_awb.py edits too.
>
> Might be worth testing the change somehow though to make sure it still
> works with the matplot component.
>
> I don't see a reason for it not to work ... but still.
>
> --
> Regards
>
> Kieran
>
>
> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> >>> ---
> >>> utils/raspberrypi/ctt/ctt.py | 4 ++--
> >>> utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
> >>> 2 files changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/utils/raspberrypi/ctt/ctt.py
> b/utils/raspberrypi/ctt/ctt.py
> >>> index ff264176f040..4d8d6addf415 100755
> >>> --- a/utils/raspberrypi/ctt/ctt.py
> >>> +++ b/utils/raspberrypi/ctt/ctt.py
> >>> @@ -41,8 +41,8 @@ def get_col_lux(string):
> >>> """
> >>> Extract colour and lux values from filename
> >>> """
> >>> - col =
> re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> - lux =
> re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> + col =
> re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> + lux =
> re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> try:
> >>> col = col.group(1)
> >>> except AttributeError:
> >>> diff --git a/utils/raspberrypi/ctt/ctt_awb.py
> b/utils/raspberrypi/ctt/ctt_awb.py
> >>> index 58ef8432fb86..e97d833d0e49 100644
> >>> --- a/utils/raspberrypi/ctt/ctt_awb.py
> >>> +++ b/utils/raspberrypi/ctt/ctt_awb.py
> >>> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
> >>> plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
> >>> for i, ct in enumerate(rbs_hat[2]):
> >>> plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
> >>> - plt.xlabel('$\hat{r}$')
> >>> - plt.ylabel('$\hat{b}$')
> >>> + plt.xlabel('$\\hat{r}$')
> >>> + plt.ylabel('$\\hat{b}$')
> >>> """
> >>> optional set axes equal to shortest distance so line really
> does
> >>> looks perpendicular and everybody is happy
> >
>
> --
> Regards
> --
> Kieran
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200514/89f215f8/attachment.htm>
More information about the libcamera-devel
mailing list