Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-19 Thread Amr Ibrahim

Am 19.04.23 um 21:46 schrieb Julian Gilbey:

forwarded 1034085 https://github.com/spyder-ide/spyder/issues/20852
thanks

On Wed, Apr 19, 2023 at 08:12:24PM +0100, Julian Gilbey wrote:

On Tue, Apr 18, 2023 at 07:11:39PM +0200, Amr Ibrahim wrote:

Am 18.04.23 um 17:30 schrieb Julian Gilbey:

Would you be able to share the file you were editing when you did this 
screenshot? I'd like to see if I can reproduce it on my machine.


Attached is the file.

Super, thanks - I can reproduce it on my machine (and I don't believe
I'm running Wayland).  I'll report it to upstream.

I did a bit more digging, and I've found the source of the problem: it
is the option Editor > Display > Wrap lines which doesn't play nicely
with autoformatting.  I'm not sure exactly why, but I've reported
this.

Best wishes,

Julian


Thanks a lot, Julian. Let's see what upstream has to say.

Best,
Amr



Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-19 Thread Julian Gilbey
forwarded 1034085 https://github.com/spyder-ide/spyder/issues/20852
thanks

On Wed, Apr 19, 2023 at 08:12:24PM +0100, Julian Gilbey wrote:
> On Tue, Apr 18, 2023 at 07:11:39PM +0200, Amr Ibrahim wrote:
> > Am 18.04.23 um 17:30 schrieb Julian Gilbey:
> > > > Would you be able to share the file you were editing when you did this 
> > > > screenshot? I'd like to see if I can reproduce it on my machine.
> > > > 
> > 
> > Attached is the file.
> 
> Super, thanks - I can reproduce it on my machine (and I don't believe
> I'm running Wayland).  I'll report it to upstream.

I did a bit more digging, and I've found the source of the problem: it
is the option Editor > Display > Wrap lines which doesn't play nicely
with autoformatting.  I'm not sure exactly why, but I've reported
this.

Best wishes,

   Julian



Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-19 Thread Julian Gilbey
On Tue, Apr 18, 2023 at 07:11:39PM +0200, Amr Ibrahim wrote:
> Am 18.04.23 um 17:30 schrieb Julian Gilbey:
> > > Would you be able to share the file you were editing when you did this 
> > > screenshot? I'd like to see if I can reproduce it on my machine.
> > > 
> 
> Attached is the file.

Super, thanks - I can reproduce it on my machine (and I don't believe
I'm running Wayland).  I'll report it to upstream.

Best wishes,

   Julian



Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-18 Thread Amr Ibrahim

Am 18.04.23 um 17:30 schrieb Julian Gilbey:

Would you be able to share the file you were editing when you did this 
screenshot? I'd like to see if I can reproduce it on my machine.



Attached is the file.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 18 18:41:38 2023

@author: amr
"""


def solution(A):
# Implement your solution here
for a in range(1, 11, 1):
if a not in A:
if a > 0:
return a
else:
return 1


def puzzle1(a):
return a.count(19) == 2 and a.count(5) >= 3


# print(puzzle1([19, 19, 15, 5, 3, 5, 5, 2]))
# print(puzzle1([19, 15, 15, 5, 3, 3, 5, 2]))
# print(puzzle1([19, 19, 5, 5, 5, 5, 5]))


def puzzle2(a):
return len(a) == 8 and a.count(a[4]) == 3


# print(puzzle2([19, 19, 15, 5, 5, 5, 1, 2]))
# print(puzzle2([19, 15, 5, 7, 5, 5, 2]))
# print(puzzle2([11, 12, 14, 13, 14, 13, 15, 14]))
# print(puzzle2([19, 15, 11, 7, 5, 6, 2]))


def puzzle3(a):
return a > 4**4 and a % 34 == 4


# print(puzzle3(922))


def piles(num_of_piles):
list_of_piles = [num_of_piles]
for i in range(num_of_piles - 1):
list_of_piles.append(num_of_piles + 2)
num_of_piles += 2
return list_of_piles


def piles2(num_of_piles):
return [num_of_piles + 2 * i for i in range(num_of_piles)]


# print(piles2(2))
# print(piles2(10))
# print(piles2(3))
# print(piles2(17))


def strings(list_of_strings):
return (
list_of_strings[len(list_of_strings) - 2]
in list_of_strings[len(list_of_strings) - 1]
and list_of_strings[len(list_of_strings) - 2]
!= list_of_strings[len(list_of_strings) - 1]
)


# print(strings(["a", "abb", "sfs", "oo", "de", "sfde"]))
# print(strings(["a", "abb", "sfs", "oo", "ee", "sfde"]))
# print(
# strings(
# ["a", "abb", "sad", "ooaaesdfe", "sfsdfde", "sfsd", "sfsdf", "qwrew"]
# )
# )
# print(
# strings(
# [
# "a",
# "abb",
# "sad",
# "ooaaesdfe",
# "sfsdfde",
# "sfsd",
# "sfsdf",
# "qwsfsdfrew",
# ]
# )
# )


def list_of_ints(a):
if len(a) == 100:
for x in a:
if x in range(0, 1000, 10):
return True
else:
return False
else:
return False


# print(list_of_ints([0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490,
# 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800, 810, 820, 830, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 960, 970, 980, 990]))
# print(list_of_ints([0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460,
#   480, 500, 520, 540, 560, 580, 600, 620, 640, 660, 680, 700, 720, 740, 760, 780, 800, 820, 840, 860, 880, 900, 920, 940, 960, 980]))


def sum_of_ints(a, i):
return print(sum(a[:i]) == i)


# sum_of_ints([0, 1, 2, 3, 4, 5], 4)
# sum_of_ints([1, 1, 1, 1, 1, 1], 4)
# sum_of_ints([2, 2, 2, 2, 2], 4)


def split_strings(s):
import re

words = re.split(r"([ ,]+)", s)
print(words)


# split_strings("The dance, held in the school gym, ended at midnight.")


def list_of_distinct_ints(nums):
# return all([nums[i] != nums[i + 1] for i in range(len(nums)-1)]) and len(set(nums)) == 4

if len(set(nums)) == 4:
for i in range(len(nums) - 1):
if nums[i] != nums[i + 1]:
return True
else:
return False
else:
return False


# print(list_of_distinct_ints([1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]))
# print(list_of_distinct_ints([1, 2, 3, 3, 1, 2, 3, 3, 1, 2, 3, 3, 1, 2, 3, 3]))
# print(list_of_distinct_ints([1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]))


def test(combined):
li = []
st = ""
for s in combined.replace(" ", ""):
st += s
if st.count("(") == st.count(")"):
li.append(st)
st = ""
return li


# test('( ()) ((()()())) (()) ()')


def indices(list_of_nums, thres):
return [i for i, x in enumerate(list_of_nums) if x < thres]
# list_of_indices = []
# for i, x in enumerate(list_of_nums):
# if x < thres:
# list_of_indices.append(i)
# return list_of_indices


# print(indices([0, 12, 45, 3, 4923, 322, 105, 29, 15, 39, 55], 100))
# print(indices([0, 12, 4, 3, 49, 9, 1, 5, 3], 10))


def check_palindrome(list_of_strings):
return [x == x[::-1] for x in list_of_strings]
# list_of_bool = []
# for x in list_of_strings:
# list_of_bool.append(x == x[::-1])
# return list_of_bool


# print(check_palindrome(['palindrome', 'madamimadam'

Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-18 Thread Julian Gilbey
On Sun, Apr 09, 2023 at 03:13:26PM +0200, Amr Ibrahim wrote:
> 
> Am 09.04.23 um 12:15 schrieb Julian Gilbey:
> > If you can take a screencast showing the behaviour you describe,
> > please do send it to this bug report and I will be able to investigate
> > further.
> 
> Hallo Julian,
> 
> I run Spyder on Wayland if that matters. A screencast is attached, and the
> file (~/.config/spyder-py3/config/spyder.ini) in case it helps.

Hello Amr,

Thanks for this and sorry for the slow reply.  I doubt Wayland makes
much of a difference, but this is strange behaviour which I thought
was fixed already.  Would you be able to share the file you were
editing when you did this screenshot?  I'd like to see if I can
reproduce it on my machine.

Best wishes,

   Julian



Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-09 Thread Julian Gilbey
tags 1034085 + unreproducible
thanks

On Sat, Apr 08, 2023 at 01:00:04PM +0200, Amr Ibrahim wrote:
> Package: spyder
> Version: 5.4.2+ds-5
> Severity: normal
> 
> Hello,
> 
> Steps to reproduce the bug:
> 0. Enable a formatter: Black or Autopep8
> 1. Make sure that there is something to be formatted in the code
> 2. Right-click somewhere in the editor and select Format with Black or 
> Autopep8
> 
> What happens:
> After formatting the file, the cursor jumps somewhere else in the editor,
> usually up, changing the editor view.
> 
> What should happen:
> The cursor stays where it is after formatting is done.

Dear Amr,

I have followed your instructions, but I cannot reproduce the
behaviour you describe.  What I *do* observe is that the editor view
changes, but even so, the cursor remains in the same place in the
file.  The bug you describe was fixed upstream a few months ago, see
https://github.com/spyder-ide/spyder/issues/19958

If you can take a screencast showing the behaviour you describe,
please do send it to this bug report and I will be able to investigate
further.

Best wishes,

   Julia
n



Bug#1034085: spyder: Cursor jumps somewhere else after right-clicking → selecting Format with Black or Autopep8

2023-04-08 Thread Amr Ibrahim
Package: spyder
Version: 5.4.2+ds-5
Severity: normal

Hello,

Steps to reproduce the bug:
0. Enable a formatter: Black or Autopep8
1. Make sure that there is something to be formatted in the code
2. Right-click somewhere in the editor and select Format with Black or Autopep8

What happens:
After formatting the file, the cursor jumps somewhere else in the editor,
usually up, changing the editor view.

What should happen:
The cursor stays where it is after formatting is done.


Best,
Amr


-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (100, 'unstable'), 
(50, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-7-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages spyder depends on:
ii  python3 3.11.2-1
ii  python3-spyder  5.4.2+ds-5

spyder recommends no packages.

Versions of packages spyder suggests:
pn  python3-spyder-unittest  

Versions of packages python3-spyder depends on:
ii  ipython3   8.5.0-4
ii  libjs-jquery   3.6.1+dfsg+~3.5.14-1
ii  libjs-mathjax  2.7.9+dfsg-1
ii  pyflakes3  2.5.0-1
ii  pylint 2.16.2-2
ii  python33.11.2-1
ii  python3-atomicwrites   1.4.1-1
ii  python3-autopep8   2.0.1-1
ii  python3-chardet5.1.0+dfsg-2
ii  python3-cloudpickle2.2.0-1
ii  python3-cookiecutter   1.7.3-3
ii  python3-diff-match-patch   20200713-2
ii  python3-docutils   0.19+dfsg-6
ii  python3-flake8 5.0.4-4
ii  python3-intervaltree   3.0.2-1.1
ii  python3-ipython8.5.0-4
ii  python3-jedi   0.18.2-1
ii  python3-jellyfish  0.8.9-1+b4
ii  python3-jsonschema 4.10.3-1
ii  python3-keyring23.9.3-2
ii  python3-mccabe 0.7.0-1
ii  python3-nbconvert  6.5.3-3
ii  python3-numpydoc   1.5.0-1
ii  python3-parso  0.8.3-1
ii  python3-pexpect4.8.0-4
ii  python3-pickleshare0.7.5-5
ii  python3-pkg-resources  66.1.1-1
ii  python3-psutil 5.9.4-1+b1
ii  python3-pycodestyle2.10.0-1
ii  python3-pydocstyle 6.2.3-3
ii  python3-pygments   2.14.0+dfsg-1
ii  python3-pylint-venv2.3.0-2
ii  python3-pyls-spyder0.4.0-2
ii  python3-pylsp  1.7.1-1
ii  python3-pylsp-black1.2.1-2
ii  python3-pyqt5  5.15.9+dfsg-1
ii  python3-pyqt5.qtwebengine  5.15.6-1
ii  python3-qdarkstyle 3.1+ds1-1
ii  python3-qstylizer  0.2.2-1
ii  python3-qtawesome  1.2.2+dfsg-1
ii  python3-qtconsole  5.4.0-1
ii  python3-qtpy   2.3.0-1
ii  python3-rope   1.7.0-1
ii  python3-rtree  1.0.1-1
ii  python3-setuptools 66.1.1-1
ii  python3-sphinx 5.3.0-4
ii  python3-spyder-kernels 2.4.2-1
ii  python3-textdistance   4.5.0-1
ii  python3-three-merge0.1.1-4
ii  python3-watchdog   2.2.1-1
ii  python3-xdg0.28-2
ii  python3-zmq24.0.1-4+b1
ii  spyder-common  5.4.2+ds-5
ii  yapf3  0.32.0-1

python3-spyder recommends no packages.

Versions of packages python3-spyder suggests:
pn  cython3 
ii  python3-matplotlib  3.6.3-1+b1
ii  python3-numpy   1:1.24.2-1
pn  python3-pandas  
ii  python3-pil 9.4.0-1.1+b1
pn  python3-scipy   
ii  python3-sympy   1.11.1-1

Versions of packages python3-pyqt5 depends on:
ii  libc6 2.36-8
ii  libgcc-s1 12.2.0-14
ii  libpython3.11 3.11.2-6
ii  libqt5core5a [qtbase-abi-5-15-8]  5.15.8+dfsg-3
ii  libqt5dbus5   5.15.8+dfsg-3
ii  libqt5designer5   5.15.8-2
ii  libqt5gui55.15.8+dfsg-3
ii  libqt5help5   5.15.8-2
ii  libqt5network55.15.8+dfsg-3
ii  libqt5printsupport5   5.15.8+dfsg-3
ii  libqt5test5   5.15.8+dfsg-3
ii  libqt5widgets55.15.8+dfsg-3
ii  libqt5xml55.15.8+dfsg-3
ii  libstdc++612.2.0-14
ii  python3   3.11.2-1
ii  python3-pyqt5.sip 12.11.1-1

-- no debconf information