QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
77,757,271 | 7,615,872 | Running an async coroutine in the background from a sync function using create_task and asyncio.run does not finish | <p>I want to run an async code as a background task from a sync function. My use case is that I have a huge application written in sync Python but I want to run some background tasks from it. An illustration from what I am doing is:</p>
<pre><code>import asyncio
from time import sleep
import sys
async def task():
... | <python><python-asyncio> | 2024-01-04 09:53:13 | 2 | 1,085 | Mehdi Ben Hamida |
77,757,166 | 5,997,555 | duckdb SQL select result to JSON | <p>Is there a way to convert the result of a <code>SELECT</code> query on a table directly to JSON without writing it to a file? Perhaps with the JSON extension of <code>duckdb</code>?</p>
<p>I could also use the python client, where I'd convert the result to a pandas dataframe and then to JSON, but I figured there sho... | <python><sql><json><duckdb> | 2024-01-04 09:34:37 | 2 | 7,083 | Val |
77,757,164 | 3,747,486 | Looking for easy way to setup a callback url for a console program requesting an API | <p>I am building a python program that send POST request to a 3rd party API. I am the only user and not building an App for others. I built the program on my Win11 desktop try to query (read only) data from 3rd party.</p>
<p>The problem is the API required 3-Legged OAuth. Based on my understanding, I need to setup a we... | <python><callback><azure-web-app-service> | 2024-01-04 09:34:28 | 1 | 326 | Mark |
77,756,723 | 7,622,324 | Type hints for class decorator | <p>I have a class decorator which removes one method and adds another to a class.</p>
<p>How could I provide type hints for that? I've obviously tried to research this myself, to no avail.</p>
<p>Most people claim this requires an intersection type. Is there any recommended solution? Something I'm missing?</p>
<p>Examp... | <python><mypy> | 2024-01-04 08:11:00 | 1 | 669 | Omer Lubin |
77,756,493 | 15,106,139 | OpenCV Document Scanner - better quadrilateral detection | <p>I'm having troubles detecting the edges of the documents real-time from the camera as the backgrounds could vary and the color of the document could be very close to the background color.
Any help regardless of the programming language will be appreciated.</p>
<p>I've tried to do so by:</p>
<pre><code>const val CLOS... | <python><android><opencv><image-processing> | 2024-01-04 07:19:57 | 0 | 745 | Stoyan Milev |
77,756,344 | 5,761,601 | PyCharm uses wrong interpreter with managed Jupyter server | <p>PyCharm uses the wrong python interpreter even when you select a different one using a managed Jupyter server.
<a href="https://i.sstatic.net/HSFzJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HSFzJ.png" alt="pycharm settings" /></a>
I noticed this first because I was getting wrong results from a d... | <python><jupyter-notebook><pycharm><jupyter> | 2024-01-04 06:48:07 | 1 | 557 | warreee |
77,756,136 | 11,156,161 | Properly scheduling nested functions with asyncio | <p>I'm having trouble scheduling work with asyncio. I have a code like this:</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
async def stream():
char_string = "Hi. Hello. Hello."
for char in char_string:
await asyncio.sleep(0.1) # something time consuming happening here
... | <python><asynchronous><python-asyncio> | 2024-01-04 05:47:55 | 2 | 727 | MKaras |
77,755,849 | 4,276,963 | Is there any way to specify the type of event loop for the asyncio REPL in Python? | <p>I'm working on some networking code in Python that uses the asyncio module and I like to use the Python REPL from -m asyncio a lot for testing examples. What I've noticed though is the default event loop type for the asyncio REPL changes depending on the OS. For example, on Linux it uses the Selector Event Loop whil... | <python><python-asyncio><read-eval-print-loop> | 2024-01-04 04:10:39 | 2 | 767 | Matthew Roberts |
77,755,795 | 4,451,521 | Poetry. Does add install or create a virtual environment? | <p>I am getting very confused trying to understand Poetry usage.</p>
<p>I thought you needed <code>poetry install</code> to actually install packages (after adding them)
But I have not run that, and only did</p>
<pre><code>poetry add pytest --dev
Creating virtualenv rp-poetry-L1ArV34E-py3.9 in /home/myself/.cache/pypoe... | <python><python-poetry> | 2024-01-04 03:51:31 | 1 | 10,576 | KansaiRobot |
77,755,646 | 1,492,229 | Bag of Words with Negative Words in Python | <p>I have this document</p>
<p>It is not normal text</p>
<p>It is a text of Scientific terminologies</p>
<p>The text of these documents are like this</p>
<pre><code>RepID,Txt
1,K9G3P9 4H477 -Q207KL41 98464 ... Q207KL41
2,D84T8X4 -D9W4S2 -D9W4S2 8E8E65 ... D9W4S2
3,-05L8NJ38 K2DD949 0W28DZ48 207441 ... K2D28K84
</code... | <python><machine-learning><scikit-learn><nlp> | 2024-01-04 02:56:20 | 1 | 8,150 | asmgx |
77,755,615 | 13,115,571 | How to modify tree attribute inside form view in odoo16? | <p>I want to modify tree attributes inside form view for each record. I tried to use get_view() but it is not working as expected and active_id is not the one I opened and got another record. Which function is working everytime we open the record form view and how can I do it? This is my sample code for adding limit at... | <python><xml><odoo><odoo-16> | 2024-01-04 02:45:33 | 1 | 430 | Neural |
77,755,505 | 14,122 | Use Pydantic with strict=False to coerce UUIDs in a structure to strings? | <p>In a Python 3.12 codebase using Pydantic 2.5.3, I'm trying to coerce a dictionary into a form where it contains only JSON-serializeable values (without actually converting it all the way to JSON at this time).</p>
<pre class="lang-py prettyprint-override"><code>import uuid, pydantic
</code></pre>
<p>I have a type de... | <python><pydantic> | 2024-01-04 02:05:43 | 0 | 299,045 | Charles Duffy |
77,755,443 | 10,576,557 | Python Pass Execution to External Process | <p>I would like to do some computation in Python and then pass or transfer to an interactive process, such as <code>ssh</code>. I want to dive into the new process. This would (preferably) be something where Python hands the interaction over and quits, but alternatively could be something the user interacts with and th... | <python><python-3.x> | 2024-01-04 01:37:02 | 0 | 569 | shepster |
77,755,439 | 404,604 | How to set up a Poetry project to install module as a runnable Python binary? | <p>I have a Python project that I intend to run as a command line utility and I'm managing its build using Poetry. Through <code>poetry install</code>, I'm able to install a snapshot of the module and import it within the virtualised environment or run it through <code>python -m</code>. However, I want to be able to ad... | <python><python-poetry> | 2024-01-04 01:35:10 | 1 | 6,942 | Psycho Punch |
77,755,277 | 15,781,591 | Unable to increase pandas dataframe decimal precision | <p>I make the following dataframe in python:</p>
<pre><code>import pandas as pd
data = [['Blue', 34], ['Green', 61], ['Red', 22]]
df = pd.DataFrame(data, columns=['Color', 'Value'])
df
</code></pre>
<p>and see:</p>
<pre><code> Color Value
------------------
0 Blue 34
1 Green 61
2 Red 22
<... | <python><pandas><dataframe> | 2024-01-04 00:20:21 | 0 | 641 | LostinSpatialAnalysis |
77,754,884 | 2,152,371 | applying read_csv to a Series of filenames only loads the first dataframe | <p>When I run this block of code:</p>
<pre><code>import pandas as pd
import os
working_dir = os.getcwd()+'/'
files = pd.Series(os.listdir(working_dir))
input_files = files[files.str.contains('.csv')]
input_files = working_dir+input_files
dataframes = input_files.apply(pd.read_csv)
</code></pre>
<p>It returns a serie... | <python><pandas><dataframe><read-csv> | 2024-01-03 22:12:49 | 1 | 470 | Miko |
77,754,838 | 6,840,119 | How to avoid circular dependencies when using pydantic v2? | <p>I have a <code>Snapshot</code> class in one file with instance method <code>view</code> which returns a <code>View</code> class defined in another file. But also instance of <code>View</code> needs to be constructed with <code>Snapshot</code> instance.</p>
<p>Requirements:</p>
<ul>
<li>have these 2 classes in separa... | <python><python-3.x><pydantic><pydantic-v2> | 2024-01-03 21:57:01 | 0 | 321 | Danny |
77,754,661 | 6,357,916 | process.kill() does not kill the process | <p>I want to start a process from python and wait till exits. Also, if it throws error, I check if the string "error" is printed by it on terminal and if yes, I just want to kill it and proceed. I also want to write all terminal output to file. My current code looks like this:</p>
<pre><code>def monitor_proce... | <python><multithreading> | 2024-01-03 21:08:53 | 0 | 3,029 | MsA |
77,754,655 | 8,963,300 | How to statically enforce frozen data classes in Python? | <p>I'm trying to write an example where I'd like to use a frozen dataclass instance during type checking and swap it out with a normal dataclass to avoid paying the instantiation cost of frozen dataclasses.</p>
<p>The goal is to ensure that the instance is immutable with the type checker and use a regular dataclass dur... | <python><mypy><python-typing><python-dataclasses> | 2024-01-03 21:06:42 | 1 | 1,716 | rednafi |
77,754,630 | 1,208,923 | MyPy gives false alarm on `mutagen.id3.PictureType` | <p>I am writing some Python code (to manipulate audio metadata) using <a href="https://github.com/quodlibet/mutagen/tree/main" rel="nofollow noreferrer">mutagen</a> library. The library does not have type hints, however I have added type hints to my routines. In particular, I have a function with the following signat... | <python><mypy><python-typing><mutagen> | 2024-01-03 21:01:19 | 0 | 2,529 | MikeL |
77,754,521 | 10,798,917 | add title to a dataframe, save it then read it in and display result not what I expected | <p>I have a simple dataframe that I read in and display. Then I add a title to the dataframe. I save the titled dataframe, then read it in and display it but the result is NOT what I expected. I repeats the title in each column. Code is shown below.</p>
<pre><code># read in a simple dataframe
csvpath=r'C:\Users\tfuser\... | <python><pandas><dataframe> | 2024-01-03 20:33:40 | 3 | 8,192 | Gerry P |
77,754,272 | 5,867,094 | Is there any example to customize current Streamlit component | <p>In the streamlit doc of component, it says:</p>
<blockquote>
<p>Custom versions of existing Streamlit elements and widgets, such as
st.slider or st.file_uploader.</p>
</blockquote>
<p>But there's no such example of doing it except creating a brand new component from scratch. Is there any tutorial that can help me to... | <python><streamlit> | 2024-01-03 19:35:34 | 0 | 891 | Tiancheng Liu |
77,754,266 | 9,092,669 | in a delta table, how can i find the number of files per partition? | <p>in a delta table, how can i find the number of files per partition? also looking to find the size of each file as well. i've tried this code, but I run into an error TypeError: 'JavaPackage' object is not callable:</p>
<pre><code>from delta.tables import *
JDeltaLog = spark._jvm.org.apache.spark.sql.delta.DeltaLog
d... | <python><pandas> | 2024-01-03 19:34:53 | 0 | 395 | buttermilk |
77,754,245 | 15,804,190 | Dealing with PyArrow decimal128 precision | <p>[some example data at the end]
I've just started working with PyArrow, so forgive me if I'm missing something obvious here.</p>
<p>I have a project that I'm updating to (hopefully) better handle calculations on money. Mostly, these calculations are multiplying a normal money amount by a percentage, like <code>9.94 *... | <python><pandas><dataframe><decimal><pyarrow> | 2024-01-03 19:30:47 | 1 | 3,163 | scotscotmcc |
77,754,161 | 1,744,491 | Polars getting ColumnNotFound when use the when() method | <p>I'm trying to use a combination of <code>contains</code> method together <code>when</code> in polars. However, I'm getting the following annoying error:</p>
<pre><code>Exception has occurred: ColumnNotFoundError
Foo message.
</code></pre>
<p>I read the documentation, but the examples are quite simple and don't cover... | <python><dataframe><python-polars> | 2024-01-03 19:14:31 | 1 | 670 | Guilherme Noronha |
77,754,139 | 2,183,336 | Python reset or reuse custom range class | <p>Example custom range class is not reset or "reusable" like builtin range. How to make it so?</p>
<pre><code>def exampleCustomRange(stopExclusive):
for i in range(stopExclusive):
yield i
>> builtinRange = range(3)
>> [x for x in builtinRange]
[0, 1, 2]
>> [x for x in builtinRange]
[... | <python><range><generator> | 2024-01-03 19:09:12 | 2 | 665 | user2183336 |
77,754,131 | 2,261,950 | MacOs Tkinter - App terminating 'Invalid parameter not satisfying: aString != nil' | <p>When im launching my app via CLI, it works without issue</p>
<blockquote>
<p>./org_chart.app/Contents/MacOS/org_chart</p>
</blockquote>
<p>however when I launch via double click I met with the error</p>
<pre><code>*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid para... | <python><macos><tkinter><py2app> | 2024-01-03 19:07:12 | 3 | 2,163 | AlexW |
77,754,053 | 2,069,064 | The type Type[Array] is not generic and not indexable | <p>This program:</p>
<pre class="lang-py prettyprint-override"><code>class Array:
def __init__(self, underlying):
self.underlying = underlying
def __class_getitem__(cls, key):
return Array(key)
def __getitem__(self, key):
pass
def __str__(self):
return f"Array({se... | <python><python-3.x><mypy> | 2024-01-03 18:49:42 | 2 | 311,202 | Barry |
77,753,860 | 1,686,628 | Python subprocess not printing real time | <p>test.py</p>
<pre><code>import time
for x in range(0, 10, 1):
print(x)
time.sleep(1)
</code></pre>
<p><code>python test.py</code> prints real time i.e a number every second</p>
<pre><code>0
1
2
3
4
5
6
7
8
9
</code></pre>
<p>Now, I wanted to run <code>test.py</code> in another script called <code>run.py</co... | <python><python-3.x> | 2024-01-03 18:07:21 | 1 | 12,532 | ealeon |
77,753,855 | 4,199,253 | return a subset of dataframe based on a condition resulting from groupby python | <p>I have a data frame like below:</p>
<pre><code>date|point|agent
2023-10-02|A|agent1
2023-10-02|A|agent2
2023-10-05|B|agent3
2023-10-05|B|agent2
2023-10-02|C|agent1
2023-10-02|C|agent2
2023-10-02|C|agent3
</code></pre>
<p>On each day at a specific point, there should be only two agents. There are cases that th... | <python><pandas><dataframe><group-by> | 2024-01-03 18:05:53 | 2 | 1,034 | GeoBeez |
77,753,839 | 5,036,928 | NumPy row operations that depend on other rows/columns | <h2>Problem</h2>
<p>I am trying to avoid a for loop in NumPy (which is quite messy and obviously performance prohibiting). My challenge is that operations on each row depend on other rows. That is:</p>
<p>I have a (very large) array with 8 columns. In each row I need to find the indices of the 2 (or some arbitrary numb... | <python><numpy><vectorization><array-broadcasting><elementwise-operations> | 2024-01-03 18:03:13 | 2 | 1,195 | Sterling Butters |
77,753,801 | 1,786,165 | Query Python's iGraph as if it would be a Neo4j DB | <p>I'm trying to query an <code>igraph</code> graph in python as I would do in Neo4j to find all the sets of nodes that match a given pattern. I have read through the documentation, searched for answers here, and interrogated Google with no luck.</p>
<p>Assuming that I have the following:</p>
<pre><code>import pandas a... | <python><neo4j><cypher><igraph> | 2024-01-03 17:56:11 | 0 | 644 | Stefano Bragaglia |
77,753,726 | 1,939,576 | Why does the output of Pandas DataFrame.sort_values differ from Series.sort_values? | <p>While teaching, one of my students pointed out that Pandas <code>DataFrame.sort_values</code> returns a different ordering (different tie breaks) to that from the equivalent <code>Series.sort_values</code>. Consider this</p>
<pre><code>>>> import pandas as pd
>>> df = pd.read_csv('https://gist.git... | <python><pandas><dataframe><series> | 2024-01-03 17:45:12 | 1 | 925 | Matthew Brett |
77,753,682 | 1,469,954 | Beautifulsoup selector in Python returns blank result set for valid selector | <p>We want to scrape some content from <a href="https://bankcodesfinder.com/world-postal-codes/india" rel="nofollow noreferrer">this</a> webpage. The HTML of the element we are interested in is this (<code>div.white-bg-border-radius-kousik.shadow-kousik-effect.mb-2</code>).</p>
<p><a href="https://i.sstatic.net/RsV7V.p... | <python><beautifulsoup><urllib> | 2024-01-03 17:36:26 | 1 | 5,353 | NedStarkOfWinterfell |
77,753,669 | 12,461,032 | Python cannot add package leidenalg | <p>I want to install leidenalg package, but it failed both through pip and through Pycharm's package manager.</p>
<p>This is the error I get when installing with Pycharm package manager:</p>
<pre><code> Using cached leidenalg-0.8.10.tar.gz (3.8 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.p... | <python><python-3.x><linux><pip><leiden> | 2024-01-03 17:32:44 | 0 | 472 | m0ss |
77,753,662 | 13,525,512 | Fix column width in RecycleView when changing density | <p>I'm working with multiple columns in <code>RecycleView</code>. For the sake of simplification, the following example contains only a <code>ref</code> column which I expect to be displayed on one line and a <code>message</code> column that should take the rest of the screen, the text being wrapped in order to be full... | <python><kivy><kivymd> | 2024-01-03 17:30:39 | 2 | 12,821 | Tranbi |
77,753,658 | 404,264 | LangChain + local LLAMA compatible model | <p>I'm trying to setup a local chatbot demo for testing purpose. I wanted to use LangChain as the framework and LLAMA as the model. Tutorials I found all involve some registration, API key, HuggingFace, etc, which seems unnecessary for my purpose.</p>
<p>Is there a way to use a local LLAMA comaptible model file just fo... | <python><langchain><large-language-model><llama> | 2024-01-03 17:30:14 | 1 | 26,824 | Dagang Wei |
77,753,534 | 16,236,118 | How can I auto-insert a linebreak with quotation marks into a string in vscode? | <p>I have seen the following in a Python tutorial.
Instead of Visual Studio Code they use PyCharm (see pictures).</p>
<p>From this:</p>
<p><a href="https://i.sstatic.net/UtaJi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UtaJi.png" alt="Before newline" /></a></p>
<p>After pressing enter at <em><strong... | <python><visual-studio-code> | 2024-01-03 17:10:02 | 1 | 1,636 | JAdel |
77,753,482 | 839,238 | How to render to an animated SVG on the page using pyodide and the Basthon turtle package? | <p>I am trying to use the Python turtle module with pyodide. This isn't <a href="https://pyodide.org/en/stable/usage/wasm-constraints.html#removed-modules" rel="nofollow noreferrer">officially supported</a> but I found another <a href="https://stackoverflow.com/questions/72096299/how-to-add-turtle-module-to-pyodide">St... | <javascript><python><turtle-graphics><webassembly><pyodide> | 2024-01-03 17:02:33 | 1 | 1,690 | Chris |
77,753,450 | 19,130,803 | accept multiple values from user | <p>I am developing <code>dash</code> application. I want to provide functionality that accepts <code>multiple</code> values (preferably comma separated) from the user.</p>
<p>Currently trying, by having an <code>input</code> box with <code>type=text</code> and user enters values by manually typing <code>comma</code> li... | <python><plotly><plotly-dash> | 2024-01-03 16:58:27 | 1 | 962 | winter |
77,753,412 | 11,277,108 | Get the standard deviation of a row ignoring the min and max values | <p>Given the following data frame:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>sd</th>
</tr>
</thead>
<tbody>
<tr>
<td>-100</td>
<td>2</td>
<td>3</td>
<td>60</td>
<td>4</td>
<td>1</td>
</tr>
<tr>
<td>7</td>
<td>5</td>
<td>-50</td>
<... | <python><pandas> | 2024-01-03 16:50:03 | 4 | 1,121 | Jossy |
77,753,131 | 519,422 | Python: for a long string where a certain word is repeated, how to identify the first occurrence of the word after a unique word? | <p>I have a large file that is made up of many blocks of data. For example, two blocks of data would look like:</p>
<pre><code>name1 1234567 comment
property1 = 1234567.98765 property2 = 1234567.98765
property3 = 1234567.98765
final
name2 1234568 comment ... | <python><python-3.x><replace><extract><slice> | 2024-01-03 16:02:25 | 1 | 897 | Ant |
77,753,107 | 1,265,067 | Flask ajax callback fails to update graph | <p>I'm trying to update a plotly graph on click using ajax. I don't understand why it works only the first time. The action here color the point clicked, later I would like to perform other actions on click.</p>
<p>Here is the app:</p>
<pre><code>from flask import Flask, config, render_template, request
import numpy as... | <python><ajax><flask><plotly> | 2024-01-03 15:58:05 | 1 | 897 | user1265067 |
77,752,955 | 1,017,986 | Dynamically discounted cumulative sum in Numpy | <p>I have a frequently occurring problem where I have two arrays of the same length: one with values and one with dynamic decay factors; and wish to calculate a vector of the decayed cumulative sum at each position. Using a Python loop to express the desired recurrence we have the following:</p>
<pre><code>c = np.empty... | <python><numpy><cython><numba> | 2024-01-03 15:32:23 | 2 | 899 | masaers |
77,752,416 | 4,451,521 | Poetry new does not create a python test | <p>I have googled this question but it is more basic than any of the results.
I am reading a <a href="https://realpython.com/dependency-management-python-poetry/" rel="nofollow noreferrer">tutorial</a> on Poetry and it says that when I do</p>
<pre><code>poetry new rp-poetry
</code></pre>
<p>I should get a <code>test_rp... | <python><python-poetry> | 2024-01-03 14:03:37 | 1 | 10,576 | KansaiRobot |
77,752,407 | 9,462,829 | FastAPI how to add Authorization header to next requests | <p>Been working on an API's authentication and I'm stuck in something kind of simple (I hope). I have a <code>login</code> endpoint:</p>
<pre><code>@router.get("/login")
def login(request: Request):
return templates.TemplateResponse("auth/login.html", {"request": request})
@router.po... | <python><authentication><oauth-2.0><fastapi> | 2024-01-03 14:02:00 | 2 | 6,148 | Juan C |
77,752,307 | 15,098,472 | Fill boxes in a 3D grid | <p>I got an array of <code>n</code> boxes, where each box has 8 4D coordinates, i.e. a <code>(x, y, z, l)</code>, where <code>(x,y,z)</code> are the coordinates and <code>l</code> is some label, like 'car'</p>
<pre><code>boxes.shape = (4, 8, 3, 1)
</code></pre>
<p>The positions are for example given in meters, and the ... | <python> | 2024-01-03 13:45:18 | 2 | 574 | kklaw |
77,752,028 | 1,515,333 | jaydebeapi only exceptions from the first statement in Cursor.execute | <p>I'm connecting to a SQL Server from Python using <code>jaydebeapi</code>. When executing multiple <code>;</code>-separated SQL-Statements in a <strong>single</strong> <code>Cursor.execute</code>-call only errors from the <em>first</em> statement are thrown. Meaning that: when running</p>
<pre class="lang-py prettypr... | <python><sql-server><jaydebeapi> | 2024-01-03 12:53:58 | 0 | 543 | MeinAccount |
77,751,795 | 2,447,233 | How to get around "Instance attribute defined outside __init__" warning from PyCharm | <p>I have written this class with a load of variables in it that I need to be able to reset to defaults at any point. Initially I "declared" and initialised (as much as you seem to be able to declare in Python) these in <code>__init__</code> but that gave the problem that when I wanted an external force to se... | <python><pycharm> | 2024-01-03 12:14:24 | 0 | 876 | DiBosco |
77,751,790 | 1,444,097 | BeautifulSoup(response.content, 'html.parser') return wrong html structure | <p>why</p>
<pre><code>soup = BeautifulSoup(response.content, 'html.parser')
</code></pre>
<p>return</p>
<pre><code><ul><li><li><li></li></li></li></ul>
</code></pre>
<p>instead of</p>
<pre><code><ul><li></li><li></li><li></li>&l... | <python><web-scraping><beautifulsoup> | 2024-01-03 12:14:07 | 1 | 2,075 | Dmitrij Holkin |
77,751,766 | 19,155,645 | Extracting Zip File from public google drive using colab notebook | <p>I would like to download a dataset from a public google drive folder (saved as a zip).</p>
<p><code> url = https://drive.google.com/drive/folders/1TzwfNA5JRFTPO-kHMU___kILmOEodoBo</code></p>
<p>Since I want it to be reproducible by other people, I do not want to copy it to my drive (and preferably also not to mount ... | <python><jupyter-notebook><google-drive-api><dataset><google-colaboratory> | 2024-01-03 12:10:09 | 1 | 512 | ArieAI |
77,751,752 | 13,225,321 | ValueError: Attempt to convert a value (class) with an unsupported type (class) to a Tensor | <p>these codes were running flawlessly on tensorflow==2.15, for the purpose of GPU acceleration, I switched to tensorflow-gpu == 2.10.1 with keras 2.10, respectively. and this ValueError raised up on my screen when I try to use decay class for learning rates. These are my model build below:</p>
<pre><code>#import packa... | <python><tensorflow><tensor><python-class><decay> | 2024-01-03 12:07:31 | 0 | 329 | pepCoder |
77,751,706 | 6,049,429 | different results with icontains in django ORM | <p>I'm filtering results from django database (mysql) with the following:</p>
<pre><code>queryset = MyModel.objects.filter(value_name__icontains=search).order_by("pk")
class MyModel(models.Model):
...
value_name = models.CharField(unique=True, max_length=255)
...
class Meta:
managed... | <python><django><django-models><django-orm> | 2024-01-03 11:59:11 | 1 | 984 | Cool Breeze |
77,751,594 | 1,285,061 | NumPy change float precision for the array | <p>How do I change the float precision for an entire array without having to do <code>np.set_printoptions</code>? It is not about printing; I want the values to be compressed to do equality checks with other arrays.</p>
<pre><code>e = np.array([0.8292222222222225, 0.1310000000000003])
</code></pre>
<p>to</p>
<pre><co... | <python><numpy><floating-point> | 2024-01-03 11:36:08 | 1 | 3,201 | Majoris |
77,751,307 | 12,633,371 | Divide every nth element of a Polars list with a number | <p>I have the following DataFrame</p>
<pre><code>import polars as pl
pl.Config(fmt_table_cell_list_len=8, fmt_str_lengths=100)
data = {
'col': [[11, 21, 31, 41, 51], [12, 22, 32, 42, 52], [13, 23, 33, 43, 53]]
}
df = pl.DataFrame(data)
</code></pre>
<pre><code>shape: (3, 1)
┌──────────────────────┐
│ col ... | <python><dataframe><list><python-polars> | 2024-01-03 10:41:09 | 2 | 603 | exch_cmmnt_memb |
77,751,015 | 14,650,673 | Creating a Tkinter Application for Farsi/Persian Language Support with Correct RTL Display | <p>I am working on a Tkinter application where I need to support the Farsi/Persian language. The title displays correctly, but the rest of the widgets don't show Persian text as expected. I want the text to be right-to-left (RTL), and the Persian letters should stick to each other.</p>
<p>Here's a simplified version of... | <python><tkinter><farsi> | 2024-01-03 09:53:24 | 1 | 441 | kzlca |
77,750,570 | 936,269 | Cannot start windows services | <p>I have a python program which have to run as a windows service.
However, when I try to run the service I get the error:</p>
<pre><code>Error starting service: The service did not respond to the start or control request in a timely fashion.
</code></pre>
<p>As in this question <a href="https://stackoverflow.com/q/640... | <python><pywin32> | 2024-01-03 08:29:45 | 0 | 2,208 | Lars Kakavandi-Nielsen |
77,750,442 | 11,054,829 | python uses 100% of single CPU (Google Compute Engine) - RealESRGAN | <p>I have the following setup:</p>
<ul>
<li>Google Compute Engine VM with Nvidia Tesla T4 , 4CPU 16GB RAM</li>
<li>Conda environment where I am running the <code>inference_realesrgan.py</code> cloned from <a href="https://github.com/xinntao/Real-ESRGAN" rel="nofollow noreferrer">https://github.com/xinntao/Real-ESRGAN</... | <python><google-cloud-vm> | 2024-01-03 08:04:07 | 1 | 446 | FeHora |
77,750,328 | 2,170,269 | Implementing operators using data model objects and checking with pyright | <p>I am working on a class where I have to implement arithmetic operators (<code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>), where each operator has multiple overloads, but the overloads are all the same. Instead of copying the overloads to each operator, I thought I would implement it as a data model ob... | <python><pyright> | 2024-01-03 07:37:50 | 1 | 1,844 | Thomas Mailund |
77,750,241 | 2,497,309 | How do we properly mock async_engine and async_sessionmaker in python? | <p>I'm using SQLAlchemy and a Postgres DB in a project and wanted to write unit tests for a function which writes to the database. I'd like to use mocks instead of actually writing to a test database and I'm using the following code to create the clients in the actual code.</p>
<pre><code>async_engine = create_async_en... | <python><sqlalchemy><pytest><python-asyncio><pytest-mock> | 2024-01-03 07:15:51 | 0 | 947 | asm |
77,750,066 | 6,108,107 | Group axis labels for seaborn box plots | <p>I want a grouped axis label for box-plots for example a bit like this bar chart where the x axis is hierarchical:
<a href="https://i.sstatic.net/RiomQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RiomQ.png" alt="enter image description here" /></a></p>
<p>I am struggling to work with groupby object... | <python><pandas><matplotlib><seaborn> | 2024-01-03 06:26:16 | 1 | 578 | flashliquid |
77,749,714 | 15,542,245 | Regex to count words after an underscored word | <p>I want to count an unknown number of words in a string that appear after an underscored word.</p>
<pre><code>testString='21 High Street _Earth Mighty Motor Mechanic'
</code></pre>
<p>I can match these words using a non-capture group <code>(?:\s[a-zA-Z]+)</code> But cannot build the regex up to eliminate what comes b... | <python><regex> | 2024-01-03 04:20:33 | 2 | 903 | Dave |
77,749,705 | 10,200,497 | Creating a new column by resetting cummin() of another column and a condition | <p>This is my DataFrame:</p>
<pre><code>import pandas as pd
df = pd.DataFrame(
{
'a': [98, 97, 100, 135, 103, 100, 105, 109, 130],
'b': [100, 103, 101, 105, 110, 120, 101, 150, 160]
}
)
</code></pre>
<p>And this is the desired output. I want to create column <code>c</code>:</p>
<pre><code> ... | <python><pandas><dataframe> | 2024-01-03 04:16:41 | 3 | 2,679 | AmirX |
77,749,362 | 508,330 | Install linux dependency during the python WebApp zip deployment (Azure, Oryx) | <p>I would like to install linux package during the python Azure Web App (app services) deployment.</p>
<p>Type of the app is "code" and at the moment I cannot use docker container deployment due to non-technical restrictions.</p>
<p>however application requires linux library to be installed.
I am searching f... | <python><azure><deployment><web-applications><oryx> | 2024-01-03 01:52:27 | 1 | 4,473 | Ievgen |
77,749,311 | 2,924,334 | Replace multiple matching groups with modified captured gropus | <p>I am reading text from a file that contains flags <code>start</code> and <code>end</code>. I want to replace everything between <code>start</code> and <code>end</code> with the same text except I want to remove any newlines in the matching group.</p>
<p>I tried to do it as follows:</p>
<pre><code>import re
start = '... | <python><python-re> | 2024-01-03 01:29:21 | 1 | 587 | tikka |
77,749,113 | 15,587,184 | KerasTuner: Custom Metrics (e.g., F1 Score, AUC) in Objective with RandomSearch Error | <p>I'm using KerasTuner for hyperparameter tuning of a Keras neural network. I would like to use common metrics such as F1 score, AUC, and ROC as part of the tuning objective. However, when I specify these metrics in the kt.Objective during RandomSearch, I encounter issues with KerasTuner not finding these metrics in t... | <python><tensorflow><keras> | 2024-01-03 00:00:02 | 1 | 809 | R_Student |
77,749,076 | 1,172,265 | Efficient Text Search for Large Term List: Python vs PostgreSQL vs Elasticsearch | <p>I have a list containing terms that vary in length from 1 to 10 words, with approximately 500,000 entries. My goal is to search for these terms in a long text (converted from a PDF, typically 1.5 to 2 pages long). I need to perform the searches not only as exact matches but also using fuzzy (e.g., the term 'Lionel M... | <python><postgresql><elasticsearch><full-text-search><fuzzy-search> | 2024-01-02 23:46:46 | 3 | 1,885 | Batuhan B |
77,748,942 | 4,688,190 | Python multihreading: Return result of fastest thread | <p>What is the easiest way to start both threads and return the output of the thread that completes first? I want to ignore the long-running thread and continue executing the rest of the script. In this example, the total time taken should be 1 second and the output should be 1.</p>
<pre><code>import threading, time
d... | <python><multithreading> | 2024-01-02 22:51:38 | 2 | 678 | Ned Hulton |
77,748,873 | 1,848,345 | Scipy signal correlate direct method - calculate results for a subset of all possible lags | <p>I'm trying to use scipy signal correlate with the <code>method="direct"</code> option and I'm wondering if it is possible to restrict the calculation to just a subset of all possible lags. The size of my input arrays is on the order of 240,000,000 entries, but I'd be interested in the about a 500k lag on ... | <python><scipy><correlation> | 2024-01-02 22:29:55 | 1 | 461 | dllahr |
77,748,811 | 7,454,177 | n8n in GitHub pipeline fails to expose port | <p>We have a docker compose which we need for testing of our code. When we run it locally (macOS, different hosts) it works fine, however as soon as we run it on a GitHub action runner, it fails with</p>
<pre><code>requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5678): Max retries exceede... | <python><docker><docker-compose><github-actions><fastapi> | 2024-01-02 22:13:12 | 1 | 2,126 | creyD |
77,748,799 | 2,591,138 | Use online webdriver for BeautifulSoup / Selenium Python code (vs. local reference) | <p>I wrote local Python code in Spyder that does webscraping using BeautifulSoup and Selenium. I now want to transfer that code to run online and on a schedule (using pythonanywhere). That works fine for the pure BeautifulSoup elements. The parts that use Selenium, currently have some configuration on my local setup, i... | <python><selenium-webdriver><beautifulsoup> | 2024-01-02 22:10:40 | 1 | 1,083 | Berbatov |
77,748,747 | 3,726,933 | Streamlit text_input or chat_input set dynamically | <p>Is there a way to set dynamic text on a text input or a chat input? Context is I am allowing users to say something on their microphones, transcribing audio to text and I want to place the transcribed text on the chat input or text input so they can interact with the app. Is this possible with text_input or chat_inp... | <python><streamlit> | 2024-01-02 21:57:43 | 1 | 369 | user3726933 |
77,748,731 | 5,421,539 | How can I install packages in Jupyterlab online? | <p>I am using Jupyterlab online (<a href="https://jupyter.org/try-jupyter/lab" rel="nofollow noreferrer">https://jupyter.org/try-jupyter/lab</a>) and can't install a package. I did a lot search and people says it can be done by <code>!pip install PACKAGE</code>. However, I got this error when run <code>!pip install req... | <python><jupyter-notebook><jupyter-lab> | 2024-01-02 21:54:36 | 0 | 43,242 | Joey Yi Zhao |
77,748,700 | 3,358,599 | How to find element based on string that may span multiple child tags? | <p>I am trying to identify specific elements within a document based on a known text string. Normally, you could easily do this with</p>
<pre><code>soup.find(string=re.compile(".*some text string.*"))
</code></pre>
<p>However the known string may have (multiple) child elements within it. For example, if this ... | <python><web-scraping><beautifulsoup> | 2024-01-02 21:44:23 | 3 | 6,596 | T.C. Proctor |
77,748,696 | 1,848,345 | Scipy use sparse array with signal.correlate | <p>I'm trying to calculate a serial correlation in Scipy using a sparse matrix, and I'm getting an error that my arrays do not have the same dimensionality, but they appear to be identical. Example code:</p>
<pre class="lang-py prettyprint-override"><code>import numpy
import scipy.signal as signal
import scipy.sparse ... | <python><numpy><scipy> | 2024-01-02 21:43:52 | 1 | 461 | dllahr |
77,748,613 | 5,651,960 | ValueError: The truth value of a Series is ambiguous. Using function and pandas df | <p>Looking to run a function using dataframe elements to create a new column (IV) but the function is stuck on the line below.</p>
<p><strong>Error:</strong>
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
<p><strong>Line</strong>:if (abs(diff) < PRECISI... | <python><pandas><dataframe><quantitative-finance> | 2024-01-02 21:21:17 | 1 | 949 | RageAgainstheMachine |
77,748,578 | 21,115 | How does pathlib.Path implement '/' when the left operand is a string? | <p>I understand how <code>__truediv__</code> works, per <a href="https://stackoverflow.com/a/53085465/21115">this answer</a>.</p>
<p>But in this case:</p>
<pre><code>>>> from pathlib import Path
>>> 'foo' / Path('bar')
PosixPath('foo/bar')
</code></pre>
<p>Surely <code>__truediv__</code> is called on ... | <python><pathlib> | 2024-01-02 21:11:10 | 1 | 18,140 | davetapley |
77,748,465 | 6,703,783 | How to create variable of type VectorSearchAlgorithmConfiguration | <p>Following this tutorial, <a href="https://learn.microsoft.com/en-us/azure/search/search-get-started-vector" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/search/search-get-started-vector</a> , instead of using the <code>json</code> <code>put</code> method, I am trying to use <code>python</code> A... | <python> | 2024-01-02 20:40:45 | 0 | 16,891 | Manu Chadha |
77,748,401 | 4,064,166 | Can I install conda packages with pip? | <p>I want to install a package on macOS, which can be done by</p>
<p><code>conda env create -f environment.yaml</code><br/>
<code>conda activate <package></code></p>
<p>but I don't want to install <code>conda</code> and am looking for an alternative to install it with <code>pip</code> or <code>source</code> comma... | <python><pip><conda><python-packaging><python-install> | 2024-01-02 20:23:18 | 1 | 577 | Devharsh Trivedi |
77,748,266 | 424,333 | How can I check when any blog was last updated in Python? | <p>I'd like to write a script that takes the URL of any blog and returns the date of its most recent post.</p>
<p>So far I have tried two ways.</p>
<p>The first is <code>htmldate</code>, which has a high error rate for this use case:</p>
<pre><code>import requests
from htmldate import find_date
url = 'xxx'
# Check UR... | <python><web-scraping> | 2024-01-02 19:53:55 | 0 | 3,656 | Sebastian |
77,748,222 | 617,122 | Determine Process in multiprocessing.Pool still active? | <h1>Background</h1>
<p>I have some code that looks like this:</p>
<pre class="lang-py prettyprint-override"><code>import datetime
import multiprocessing
def my_function(a, b, c):
c.append(a)
# A cool function that takes a long time and returns a lot of data
c.remove(a)
return (random_tuple, very_large_... | <python><python-3.x><python-multiprocessing> | 2024-01-02 19:43:34 | 1 | 379 | distortedsignal |
77,748,127 | 16,503,741 | Using regex (from the re python library) inside of a pydantic model | <p>I am using <code>re</code> to parse a string into its composite parts. The problem is that pydantic 2 does <em>NOT</em> like this.</p>
<p>Example:</p>
<pre><code>MyClass(RootModel[str])
root: str
_FREQUENCY_PATTERN = re.compile(r"^(\d+)\s*/\s*(\d+)([YMWD])$")
@classmethod
def _parse(cls, ... | <python><pydantic> | 2024-01-02 19:18:51 | 1 | 339 | Jelkimantis |
77,748,050 | 10,908,375 | Attempting to get the rolling mean per group, getting wrong values and "TypeError: incompatible index of inserted column with frame index" | <p>I seem to misunderstand and misuse <code>pd.Series.rolling.mean()</code>. I have a toy <code>df</code> here:</p>
<pre><code>import pandas as pd
import numpy as np
df = pd.DataFrame({
'a': np.random.choice(['x', 'y'], 8),
'b': np.random.choice(['r', 's'], 8),
'c': np.arange(1, 8 + 1)
})
</code></pre>
<pr... | <python><pandas><dataframe><numpy> | 2024-01-02 19:00:51 | 1 | 36,924 | Nicolas Gervais |
77,747,852 | 2,583,346 | python plotly - left-align subplots shared category labels | <pre><code>import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=1, cols=2,
shared_yaxes=True)
fig.add_box(x=[1,3,5,7], row=1, col=1, name='short')
fig.add_box(x=[3,5,7,9], row=1, col=1, name='longer')
fig.add_box(x=[1,4,6,8], row=1, col=1, name='even... | <python><plotly> | 2024-01-02 18:16:14 | 1 | 1,278 | soungalo |
77,747,717 | 2,817,602 | Exposing the right port to airflow services in docker | <p>I'm trying to build a minimal datapipeline using docker, postgres, and airflow. <a href="https://gist.github.com/Dpananos/f818a3253e0d01b8eed5673575796500" rel="nofollow noreferrer">My <code>docker-compose.yaml</code> file can be found here</a> and is exteneded from airflow's documentation <a href="https://airflow.... | <python><docker><airflow> | 2024-01-02 17:40:21 | 2 | 7,544 | Demetri Pananos |
77,747,683 | 893,254 | How to prevent matplotlib from plotting the "day number" on an axis | <p>I am seeing a slightly annoying issue when plotting some data with matplotlib.</p>
<p>As shown in the example output below, the x-axis has a slightly unexpected format.</p>
<p>The labels are (for example) <code>04 12:30</code>. The <code>04</code> being the day of the month.</p>
<p>The code and data are provided to ... | <python><pandas><matplotlib> | 2024-01-02 17:32:31 | 1 | 18,579 | user2138149 |
77,747,671 | 108,390 | Python application packaged for Windows 11 using pyside6-deploy complains about numpy installation | <p>I have spent the day working on a Qt POC application based on the <a href="https://doc.qt.io/qtforpython-6/examples/example_external_pandas.html" rel="nofollow noreferrer">Pandas simple example</a> and trying to package it using <a href="https://doc.qt.io/qtforpython-6/deployment/deployment-pyside6-deploy.html" rel=... | <python><pyqt><pyside6><python-3.10><nuitka> | 2024-01-02 17:29:53 | 1 | 1,393 | Fontanka16 |
77,747,594 | 157,704 | pyspark sql combine two columns with same value but different names | <p>I have two tables with below structure</p>
<p>Table1</p>
<pre class="lang-none prettyprint-override"><code>lang created_date
java 11-01-23
python 11-11-23
</code></pre>
<p>Table2</p>
<pre class="lang-none prettyprint-override"><code>lang ingested_date
scala 11-21-23
</code></pre>
<p>I want to create combined table w... | <python><sql><pyspark> | 2024-01-02 17:12:03 | 2 | 2,834 | Amol Aggarwal |
77,747,279 | 5,036,928 | Avoiding for-loop in NumPy 1D nearest neighbors | <p>I have the following code in which I get the N nearest neighbors in 1D:</p>
<pre><code>import numpy as np
def find_nnearest(arr, val, N):
idxs = []
for v in val:
idx = np.abs(arr - v).argsort()[:N]
idxs.append(idx)
return np.array(idxs)
A = np.arange(10, 20)
test = find_nnearest(A, A, ... | <python><numpy><for-loop><vectorization><nearest-neighbor> | 2024-01-02 16:15:00 | 1 | 1,195 | Sterling Butters |
77,747,229 | 967,621 | Log a dataframe using logging and pandas | <p>I am using <code>pandas</code> to operate on dataframes and <a href="https://docs.python.org/3/library/logging.html" rel="nofollow noreferrer"><code>logging</code></a> to log intermediate results, as well as warnings and errors, into a separate log file. I need to also print into the same log file a few intermediate... | <python><pandas><dataframe><logging><pretty-print> | 2024-01-02 16:07:07 | 2 | 12,712 | Timur Shtatland |
77,747,221 | 1,907,755 | Delta Table read performance when using delta-rs Python API? | <p>I'm trying to read <code>Delta Table</code> using delta-rs library (Python).</p>
<p>The table has millions of records and we wanted to read it frequently using <code>Rest API</code> call(only specific records, based on request).</p>
<p>So, i was checking the <code>delta-rs</code> library. Since it has millions of re... | <python><delta-lake><delta-rs> | 2024-01-02 16:05:40 | 0 | 9,019 | Shankar |
77,746,775 | 16,626,443 | Google Sheets API giving 400 response INVALID_ARGUMENT when attempting to add rows, can't figure out why | <p>I am trying to add rows to a Google Spreadsheet using the Python API and I am getting a 400 response code and the response body says that all the values I am trying to add are invalid.</p>
<p>I simplified my code to try and add 1 string value and I get the same result. I was going to start adding values back 1 by 1 ... | <python><google-sheets-api> | 2024-01-02 14:45:20 | 1 | 760 | Mo0rBy |
77,746,656 | 19,130,803 | apply different function on each row | <p>I have a dataframe with 2 columns <code>field</code> and <code>value</code>(number of rows maximum 10). I need to perform some checks depending on the field(ie need to apply different function on each row) and store its result in <code>status</code> column. Below is sample:</p>
<pre><code>data = {
'field': ['a',... | <python><pandas><dataframe> | 2024-01-02 14:24:22 | 2 | 962 | winter |
77,746,653 | 2,386,113 | Allocate unified memory on GPU | <p>I am using Python and cuPy to access a GPU cluster (NVIDIA V100, Four GPUs, 32 GB each). I need to allocate large arrays which cannot fit on a single GPU. Therefore, I would like to use Unified Memory using <strong><a href="https://docs.cupy.dev/en/stable/reference/generated/cupy.cuda.ManagedMemory.html" rel="nofoll... | <python><gpu><cupy> | 2024-01-02 14:23:07 | 1 | 5,777 | skm |
77,746,627 | 9,669,142 | Convolution integral with limits | <p>I'm trying to implement a convolution integral in Python with limits, but I cannot get it to work.</p>
<p>I have this convolution integral:</p>
<p><a href="https://i.sstatic.net/lGGbx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lGGbx.png" alt="enter image description here" /></a></p>
<p>Where t0 i... | <python><convolution> | 2024-01-02 14:17:56 | 0 | 567 | Fish1996 |
77,746,509 | 13,225,321 | code run on tensorflow cpu version, won't run on tensorflow gpu version, trying cnn bilstm model | <p>I am currently working on my CQF final on deep learning right now.</p>
<p>I built a cnn-bilstm-attention model earlier as the course progress. When I throw in more and more features into the model, the training process was getting slower and slower. 4 features will drag me down to 10s per epoch. So I re-did my windo... | <python><tensorflow><keras><deep-learning> | 2024-01-02 13:53:27 | 1 | 329 | pepCoder |
77,746,452 | 7,281,675 | DRF inserting relative urls to models.URLField | <p>I am posting a <code>relative url</code> to a model DRF which includes a <code>models.URLField</code>. The problem is that it returns for the field <code>insert a valid internet address</code>. I know that the problem is with <code>is_valid</code> method. Also, I know that I can edit the <code>relative url</code> at... | <python><django><django-rest-framework> | 2024-01-02 13:43:28 | 0 | 4,603 | keramat |
77,746,344 | 2,080,368 | How to hyperlink nodes in d3js NetworkX diGraph | <p>I would like to create a NetworkX graph and visualize it using d3js similarly to
the javascript <a href="https://networkx.org/documentation/stable/auto_examples/external/javascript_force.html#sphx-glr-auto-examples-external-javascript-force-py" rel="nofollow noreferrer">example</a> in the NetworkX docs. This graph i... | <python><d3.js><networkx> | 2024-01-02 13:20:53 | 3 | 406 | Björn Johansson |
77,746,126 | 20,770,190 | How to use dependency injection in FastAPI properly? | <p>I am new to FastAPI, and I'm trying to use a simple dependency injection via <code>Depends</code> with the FastAPI.</p>
<p>Can somebody tell me what is differences between these two code snippets for using <code>Depends</code> to have <strong>Shared Logic</strong>?</p>
<h2>1:</h2>
<pre class="lang-py prettyprint-ove... | <python><dependency-injection><fastapi><python-typing> | 2024-01-02 12:40:36 | 0 | 301 | Benjamin Geoffrey |
77,746,021 | 8,648,222 | Using multiple **kwarg in Python with syntax def func(a,b, *, kwarg1, kwarg2) | <p>I forgot where I saw a post before talking about how we can use this syntax <code>*</code> to give as many kwargs after it:</p>
<pre><code>def func(arg1, arg2, *, kwarg1, kwarg2):
print(arg1, arg2)
for k, v in kwarg1.items():
print(k, v)
for k, v in kwarg2.items():
print(k, v)
return ... | <python> | 2024-01-02 12:17:01 | 0 | 825 | v_head |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.