Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
2 votes
2 answers
450 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
0 answers
80 views

Managing JupyterLab extensions with different Conda environments

I've been trying to install a code formatter into Jupyter lab. I'm unsure how to manage such extensions with multiple conda environments. I have JupyterLab installed on my base conda environment and ...
oweydd's user avatar
  • 111
0 votes
2 answers
80 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
2 answers
2k 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.2k
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,839
0 votes
1 answer
1k 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
883 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,179
-1 votes
1 answer
148 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
127 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
994 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
127 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
  • 10.8k
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
6 votes
1 answer
14k 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
479 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
5 votes
2 answers
6k views

How to make VSCode honor black excluded files in pyproject.toml configuration when using formatOnSave

I have the following pyproject.toml for configuring black: [tool.black] exclude = 'foo.py' If I run black . from the project's root folder that only contains foo.py, I get No Python files are present ...
frankundfrei's user avatar

15 30 50 per page
1
2 3 4 5
7