Skip to main content

All Questions

Tagged with
0 votes
2 answers
218 views

VSCode adds unwanted extra spaces on enter

I am using VSCode since a couple years and have recently changed computers. After installing VSCode, I came upon this issue: lets say I have a list like this: int_list = [ 1, 2, 3, 4, ] and now I ...
Nicolas Bechstedt's user avatar
0 votes
0 answers
45 views

auto formatting using yapf to put parameters on multiple lines in condensed format

Related to this. But instead of putting all arguments on single line, I want to put them onto multiple lines in condensed form. Basically I want to transform: def f(arg1: typ1, arg2: typ2, ..., ...) -&...
Sourav Kannantha B's user avatar
5 votes
2 answers
2k views

How to automating Code Formatting in VSCode for Jupyter Notebooks with Black Formatter?

I've been enjoying the convenience of the Black Formatter extension in Visual Studio Code, especially its "Format on Save" feature for Python files. Being able to automatically format my ...
Ellie Su's user avatar
0 votes
2 answers
188 views

How to put item from room into inventory

I am having issues with not being able to get any item and move it into my inventory on this text-based game, I have tried a couple of things but none of it has helped and I am genuinely stuck. I am ...
TEsco's user avatar
  • 3
4 votes
3 answers
4k views

How to prevent VSCode from reordering python imports across statements?

This is the correct way to import Gtk3 into python: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, GObject When I save such code in VSCode with "editor....
lvella's user avatar
  • 13.5k
0 votes
1 answer
2k views

Black make function arguments formatting without new lines around barackets

I'd like to format function argumetns in a way similar to the PyCharm default formatting - see image. Meaning no new line after '(' and before ) so it does NOT look like in the second image. It looks ...
mCs's user avatar
  • 2,931
0 votes
1 answer
2k views

Module not found when trying to run `black` in a Jupyter notebook

I've created a Jupyter notebook inside of a virtual environment. These packages are installed: black==22.12.0 jupyter~= 1.0.0 jupyter-black==0.3.3 jupyter-contrib-nbextensions~=0.5.1 In my notebook, ...
canary_in_the_data_mine's user avatar
1 vote
1 answer
1k views

Are line breaks possible in Python match case patterns?

I want a match pattern with a rather long OR-pattern something like: match item: case Really.Long.Qualified.Name.ONE | Really.Long.Qualified.Name.TWO | Really.Long.Qualified.Name.THREE | Some.Other....
BadZen's user avatar
  • 4,284
-1 votes
1 answer
277 views

Getting a dictionary from web-scrapping data sets

table = soup.find('table') list_of_states = table.find_all('tr') for state in list_of_states: state_name = state.find('td') if state_name is None: continue hours = state.find_all(...
Flow's user avatar
  • 1
-3 votes
1 answer
137 views

BeautifulSoup - Please help explain my code [closed]

I've just written a little scraper using BeautifulSoup and Jupyter notebook. I wanted to get certain links from a web page, loop through those links and extract articles, and save those articles as ....
Mortus Pect's user avatar
0 votes
1 answer
1k views

Visual Studio Code creates new lines on its own while coding in python

Visual Studio Code creates new lines on its own while using Python, I have no idea how to get rid of it, and it drives me mad. Example: ap.add_argument("-p", "--path", help="...
user avatar
0 votes
1 answer
128 views

How to satisfy output line length, code line length and Black code formatting at the same time? I.e. textwrap.wrap drop whitespace before wrapping?

This might be an XY-problem regarding the question about textwrap.wrap. I don't need to use textwrap.wrap if there's an easier way. I want to satisfy the following three criteria: Printed output text ...
finefoot's user avatar
  • 11.4k
4 votes
1 answer
3k views

How to run *BOTH* black and autopep8 *AUTOMATICALLY* upon saving a Python file in Visual Studio Code?

Under the settings.json file in VS Code, I've got black set as the Python formatter: "python.formatting.provider": "black", "python.linting.enabled": true, "python....
JohnnyUtah's user avatar
9 votes
1 answer
21k views

Python Black Code Formatter - Is there any way to apply automatic black formatting before commiting project to Github

Recently I started to use Black code formatter for my projects and sometimes it can be hard to track did I formatted all my changed files or not. Let's assume that my project contains 20 different ...
user avatar
0 votes
0 answers
493 views

Formatter Black is not working on save (VSC)

{ "workbench.colorTheme": "Default Dark+", "python.linting.flake8Enabled": true, "python.linting.enabled": true, "python.formatting.provider": ...
insub kim's user avatar

15 30 50 per page
1
2 3 4 5
7