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,733,663 | 2,985,049 | Ray: Parallel read of audio in chunks that preserves ordering | <p>I would like to use Ray to perform large scale inference on audio files. I would like to read each file in, chunk by chunk, perform inference on each chunk, and then write each file out chunk by chunk so that I never have to have an entire file in memory at one time. At the same time, I'd like to parallelize the ope... | <python><ray> | 2023-12-29 19:21:35 | 0 | 7,189 | Luke |
77,733,650 | 3,023,116 | Mypy error is not reproducible in local environment | <p>I have a github action and pre-commit hook for my python code</p>
<p>Below is my yml file for the git action</p>
<pre><code>name: Mypy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: S... | <python><github-actions><mypy><pre-commit><pre-commit.com> | 2023-12-29 19:18:13 | 1 | 6,935 | taras |
77,733,599 | 10,499,034 | How to get Python to recognize installed ost module | <p>This is not the same error shown at <a href="https://stackoverflow.com/questions/14295680/unable-to-import-a-module-that-is-definitely-installed">Unable to import a module that is definitely installed</a> so it is not a duplicate. The resolution of that error involve the module being installed in the wrong director... | <python> | 2023-12-29 19:03:47 | 0 | 792 | Jamie |
77,733,521 | 3,291,993 | How to vectorize operations in pandas data frame? | <pre><code>import pandas as pd
columns = ['S1', 'S2', 'S3', 'S4', 'S5']
df = pd.DataFrame({'Patient':['p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p8', 'p10'],
'S1':[0.7, 0.3, 0.5, 0.8, 0.9, 0.1, 0.9, 0.2, 0.6, 0.3],
'S2':[0.2, 0.3, 0.5, 0.4, 0.9, 0.1, 0.9, 0.7, 0.4, 0.3],
... | <python><pandas><dataframe><vectorization> | 2023-12-29 18:42:23 | 3 | 1,147 | burcak |
77,733,490 | 1,234,434 | Why does my generator function not return a value | <p>I'm learning python.</p>
<p>I'm trying to read in a text file (Linux: <code>/etc/passwd</code>)
I've taken the answer from <a href="https://stackoverflow.com/questions/4842057/easiest-way-to-ignore-blank-lines-when-reading-a-file-in-python">here</a> and tried to implement it with my learning's. I know from all my re... | <python> | 2023-12-29 18:34:24 | 1 | 1,033 | Dan |
77,733,356 | 1,867,246 | Does IntelliJ treat .py files differently from .txt files when they are created | <p>I accidentally created a new .txt file when I wanted a .py file. Of course, Run doesn't work. But, it made me wonder what is happening inside of IntelliJ when I create a .py file, compared to when I create a .txt file.</p>
<p>Here are some possibilities I considered:</p>
<ol>
<li><p>Is there hidden code in the file ... | <python><file><intellij-idea><ide> | 2023-12-29 17:56:53 | 2 | 531 | Nora McDougall-Collins |
77,733,255 | 11,145,820 | How to copy a collection from one instance to another instance with Qdrant? | <p>In the process that i'm running, i need very low latency to be able to process a job, so i use a local instance of qdrant db to be able to insert everything very fast to it.</p>
<p>After finishing the job, i want to copy the whole collection from the local instance to a cloud instance of Qdrant.</p>
<p>I was just wo... | <python><python-embedding><openaiembeddings><qdrant><qdrantclient> | 2023-12-29 17:32:39 | 2 | 1,979 | Guinther Kovalski |
77,733,213 | 908,924 | df.groupby()[].transform('max') returns indices, not the data in the column | <p>I have an excel sheet with two columns of data. The data in the first column is grouped by rows the adjacent column contains some data to be processed. What I would like to do is take the data in column 'B' find it's maximum and print that max next to the data in column 'A'.</p>
<p>The data in both columns looks lik... | <python><pandas> | 2023-12-29 17:19:59 | 0 | 2,355 | Stripers247 |
77,733,036 | 1,684,518 | Python script not releasing memory in Linux | <p>I have a Python script that reads a CSV that contains URLs to PDFs, opens them, does some analytics, and saves that to another CSV. The input CSV is like this:</p>
<pre><code>Bid Number,Items
45455454,['https://example.com/file1.pdf']
230000000237,"['https://example.com/file2.pdf', 'https://example.com/file3.pd... | <python><memory-management><memory-leaks> | 2023-12-29 16:40:23 | 0 | 1,222 | jpbalarini |
77,732,940 | 967,621 | Aggregate dataframe using simpler (vectorized?) operations instead of loops | <p>I have a piece of code that works correctly (gives the expected answer), but is both inefficient and unnecessarily complex. It uses loops that I want to simplify and make more efficient, possibly using vectorized operations. It also converts a dataframe to a series and then back into a dataframe again - another code... | <python><pandas><group-by><aggregate><vectorization> | 2023-12-29 16:18:18 | 4 | 12,712 | Timur Shtatland |
77,732,923 | 17,519,895 | Can't directly paste a string directly in a cell of Jupyter notebook | <p>in the Jupyter notebook version 7 or latest, I can't directly paste a string/text etc directly in the cell but first have to do a work around (paste it in the search bar and then recopy and then paste in the cell ), in contrast to it if I use an older version i.e., <strong>6.5.2</strong>, It works like it is suppose... | <python><jupyter-notebook><jupyter> | 2023-12-29 16:14:42 | 1 | 421 | Aleef |
77,732,836 | 7,243,493 | Posting URL id to a flask blueprint endpoint | <p>Im using flask with Blueprints. I am trying to pass an ID from the url with a post request, but i dont understand the behaviour here:</p>
<p>i am on page localhost/2/updatestrat</p>
<p>This will post to /add_indicator</p>
<pre><code>let indi_data = await postJsonGetData(data, "/add_indicator");
</code></pr... | <javascript><python><flask><post> | 2023-12-29 15:54:25 | 1 | 568 | Soma Juice |
77,732,688 | 2,755,307 | Forcing an 'eq' constraint function to 0 in scipy.optimize.minimize causes a failure | <p>I want to put a "dummy" constraint into my scipy.optimize.minimize call so that I can use it to interrogate variables as they change. I add this simple constraint:</p>
<pre><code># Code that fails.
def tracer(actuals, sReturn): # To allow troubleshooting and insight.
print('You asked to return {}.'.fo... | <python><scipy><scipy-optimize> | 2023-12-29 15:15:24 | 0 | 953 | James Madison |
77,732,534 | 4,799,172 | Check for duplicates in a database and report back whether a new record was created or not | <p>I have a repeated pattern in my code that I feel is an antipattern. I have an <code>sqlalchemy</code> engine set up as this:</p>
<pre><code>engine = create_engine(Config.CONN_STRING)
autoengine = engine.execution_options(isolation_level="AUTOCOMMIT")
</code></pre>
<p>When I want to make a new entry, using ... | <python><sql><sqlalchemy> | 2023-12-29 14:41:23 | 1 | 13,314 | roganjosh |
77,732,498 | 221,342 | How to get for each node the sum of the edge weights for children in a networkx tree | <p>In the example below, how to get the sum of all the children edges from the ROOT.</p>
<pre><code>import networkx as nx
import matplotlib.pyplot as plt
G = nx.DiGraph()
G.add_node("ROOT")
for i in range(5):
G.add_node("Child_%i" % i)
G.add_node("Grandchild_%i" % i)
G.add_nod... | <python><graph><tree><networkx> | 2023-12-29 14:34:50 | 2 | 10,193 | BlueTrin |
77,732,267 | 2,003,686 | Take python input data directly from a Jupyter cell | <p>I would like to create an interactive notebook with Jupiter Lab. My idea is to use this notebook for teaching Python programming in a similar way to some platforms like hackerrank do, using tescases with different input sets. The students should write their code in a jupyter cell and this code would be tested taking... | <python><jupyter-notebook><jupyter><user-input><jupyter-lab> | 2023-12-29 13:35:26 | 1 | 1,940 | rodrunner |
77,732,146 | 4,451,521 | Can not use add with Poetry | <p>I just did poetry init (and did not install anything)</p>
<p>After that if I do</p>
<pre><code>poetry add pandas
'HttpResponse' object has no attribute 'strict'
</code></pre>
<p>What might be the problem and how can I solve it.
(I read a question similar to this but did not understand the reason of the problem. Ple... | <python><python-poetry> | 2023-12-29 13:08:21 | 1 | 10,576 | KansaiRobot |
77,732,090 | 955,273 | polars: multiply 2 LazyFrames together by column | <p>I have 2 polars LazyFrames:</p>
<pre class="lang-py prettyprint-override"><code>import polars as pl
import numpy as np
df1 = pl.LazyFrame(data={
'foo': np.random.uniform(0,127, size= n).astype(np.float64),
'bar': np.random.uniform(1e3,32767, size= n).astype(np.float64),
'baz': np.random.uniform(1e6,2147... | <python><dataframe><python-polars> | 2023-12-29 12:52:35 | 1 | 28,956 | Steve Lorimer |
77,731,909 | 3,291,993 | Running a function on multiple columns of a pandas dataframe in parallel | <p>Assume we have a pandas dataframe and 100 columns from S1 to S100.
There might be other columns in the data frame, but we are interested in these only.
We need to get the number of rows satisfying the condition below.</p>
<pre><code>num_of_rows = len(df[df[S1] >= float(cutoff)])
</code></pre>
<p>Is there a way to... | <python><pandas><dataframe> | 2023-12-29 12:08:30 | 1 | 1,147 | burcak |
77,731,840 | 13,608,794 | Python - os.path.normpath, but leaving the slashes intact | <p>I want to create a Python function that will simultaneously:</p>
<ul>
<li>normalize a path</li>
<li>leave the slashes intact</li>
</ul>
<pre class="lang-py prettyprint-override"><code>def rawnorm(path: str) -> str:
"""
Normalizes path, leaving the slashes intact.
Args:
path: Fi... | <python><operating-system> | 2023-12-29 11:56:04 | 0 | 303 | kubinka0505 |
77,731,430 | 11,211,759 | Specify a list of arguments in the pylintrc file for "unused-argument" | <p>Can I specify a list of arguments in the pylintrc file instead of disabling unused-argument altogether?</p>
<p>I need it to avoid messages like this:</p>
<p>W0613: Unused argument 'evt' (unused-argument)</p>
| <python><pylint> | 2023-12-29 10:32:05 | 1 | 1,318 | 1966bc |
77,731,218 | 13,838,385 | Why do optional arguments appear before positional arguments in the help output from argparse? | <p>Code:</p>
<pre class="lang-py prettyprint-override"><code>import argparse
import sys
from fontbro import Font
def get_font_format(font_path, ignore_flavor):
"""
Gets the font format: otf, ttf, woff, woff2.
:param font_path: Path to the font file.
:param ignore_flavor: If True, the or... | <python><argparse> | 2023-12-29 09:39:15 | 0 | 577 | fmotion1 |
77,731,198 | 955,273 | polars: product of all columns except one in 2 LazyFrames | <p>I am learning polars, having come from pandas.</p>
<p>In pandas land, I frequently operate on 2 dataframes, each with a datetime index, and the same columns.</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override"><code>df1 = pd.DataFrame(data={
'time': pd.date_range('2023-01-01', periods=n, freq='1 min'),... | <python><python-polars> | 2023-12-29 09:35:12 | 1 | 28,956 | Steve Lorimer |
77,730,997 | 1,134,071 | Deactivate manually a virtual environment activated by direnv without leaving the project directory or shell | <p>This is my first approach to direnv. I've been trying to adapt direnv to Poetry and venv.</p>
<p>~/.zshrc:</p>
<pre><code># skip loading direnv if it is already loaded
if test -z $DIRENV_DIR; then
if whereis direnv 2&>1 1> /dev/null ; then
case "$(basename $SHELL)" in
zsh)... | <python><python-venv><python-poetry><direnv> | 2023-12-29 08:43:40 | 0 | 2,884 | Alexey Orlov |
77,730,834 | 8,792,159 | Separate inner logic of function from displaying user information using tqdm | <p>I wonder if it is possible to separate the logic of a function from the user information displayed with <code>tqdm</code>? Currently, my function takes in a <code>verbose</code> argument and includes an if-else statement so that the user information is displayed or not depending on the user's input. But I think it w... | <python><progress-bar><tqdm> | 2023-12-29 07:55:57 | 1 | 1,317 | Johannes Wiesner |
77,730,831 | 8,046,443 | Image dimension mismatch while trying to add Noise to image using Keras Sequential | <p>To Recreate this question's ask on your system, please find the Source code and Dataset <a href="https://www.swisstransfer.com/d/55b0d34b-02a0-4cd6-be26-78cee6e4899c" rel="nofollow noreferrer">here</a></p>
<p><strong>What I am trying?</strong><br />
I am trying to create a simple GAN (Generative Adversarial N/w) whe... | <python><tensorflow><keras><generative-adversarial-network> | 2023-12-29 07:55:21 | 1 | 761 | T3J45 |
77,730,802 | 1,939,432 | How to remove duplicated entries? | <pre><code>Input: new_mainArr[] =
['the', 'at', 2]
['fulton', 'np-tl', 1]
['county', 'nn-tl', 1]
['grand', 'jj-tl', 1]
['jury', 'nn-tl', 1]
['said', 'vbd', 2]
['friday', 'nr', 1]
['an', 'at', 1]
['investigation', 'nn', 1]
['of', 'in', 1]
["atlanta's", 'np$', 1]
['recent', 'jj', 1]
['primary', 'nn', 1]
['ele... | <python><arrays> | 2023-12-29 07:48:17 | 2 | 2,050 | Lyrk |
77,730,744 | 2,604,247 | SQL Alchemy ORM Query Does not Include Inner Join Condition | <p>The problem is as the question says. Using AWS athena server with pyathena engine.</p>
<p>Here is some context. I am basically filtering on a table containing all the bookings, to include only most recent ones based on an <code>earliest_history</code> date (anything earlier than that will be dropped).
I need two col... | <python><mysql><sqlalchemy><orm><pyathena> | 2023-12-29 07:31:46 | 0 | 1,720 | Della |
77,730,123 | 12,569,596 | Generate hooks for selected functions in Python Abstract Base Class | <p>I have Python ABC like,</p>
<pre class="lang-py prettyprint-override"><code>class Foo(ABC):
@abstractmethod
def bar(self):
...
@abstractmethod
def baz(self):
...
</code></pre>
<p>When I initialize it, I want to implement the hooks without defining them in the parent class, and they w... | <python><abstract-class> | 2023-12-29 03:37:21 | 0 | 3,005 | kennysliding |
77,729,925 | 1,689,987 | Errors installing TA-Lib in Debian Linux Dockerfile | <p>When installing TA-Lib in a Dockerfile which inherits from python:3.10.13-slim-bookworm I am using these Dockerfiles as examples however still am getting errors:</p>
<p><a href="https://dev.to/lazypro/build-a-small-ta-lib-container-image-4ca1" rel="nofollow noreferrer">https://dev.to/lazypro/build-a-small-ta-lib-con... | <python><docker><ta-lib> | 2023-12-29 01:59:20 | 1 | 1,666 | user1689987 |
77,729,847 | 5,765,761 | Pandas Dataframe to jsonlines grouping by columns | <pre><code>data = {
'my_index': [1, 2],
'start': ['2023-12-28 00:00:00', '2023-12-29 00:00:00'],
'target': [['value1', 'value2'], ['value3']],
'dynamic_feat': [[['feat1', 'feat2'], ['feat3']], [['feat4']]]
}
df = pd.DataFrame(data)
pd.DataFrame.from_dict(data)
</code></pre>
<p>expected jsonlines format:</p>
<pre><code... | <python><json><pandas><dataframe> | 2023-12-29 01:13:06 | 1 | 1,090 | tmhs |
77,729,786 | 519,422 | Pandas dataframe: how to multiply a specific value by using its row index? | <p>I want to change specific values in a Pandas dataframe. Here is an example dataframe (in reality, there are many more rows):</p>
<pre><code> Value Property
0 CH4 Type
1 -10.90979 Density (g/cm3)
2 5.00000 ... | <python><python-3.x><pandas><dataframe><replace> | 2023-12-29 00:35:53 | 4 | 897 | Ant |
77,729,490 | 10,006,534 | How to do hyper-parameter tuning with panel data in sklearn framework? | <p>Imagine we have multiple time-series observations for multiple entities, and we want to perform hyper-parameter tuning on a single model, splitting the data in a time-series cross-validation fashion.</p>
<p>To my knowledge, there isn't a straightforward solution to performing this hyper-parameter tuning operation wi... | <python><scikit-learn><time-series><hyperparameters><panel-data> | 2023-12-28 22:47:02 | 1 | 581 | Slash |
77,729,310 | 7,128,934 | paramiko issue with host keys - BadHostKeyException | <p>Here is the script that I am using to connect to an SFTP server. <code>sftp.pem</code> and <code>host.pem</code> are private keys in OpenSSH format. I created the user and added the host key to the server myself.</p>
<p>I keep getting an error with this approach (see error message below). I can log in successfully i... | <python><paramiko> | 2023-12-28 21:45:46 | 2 | 32,598 | d.b |
77,729,297 | 6,367,971 | Why does using Requests fail when the URL works fine in browser? | <p>I have this code that used to work but I now get connection timeout errors when I run it. I assumed that something changed on the URL but when I paste the URL into a browser I get a successful response. Yet when curling from Terminal or running it in Pycharm I get the timeout error.</p>
<p>I have tried setting heade... | <python><python-requests> | 2023-12-28 21:42:06 | 2 | 978 | user53526356 |
77,729,182 | 9,135,359 | Unable to encode categorical variables for Deep learning classification model | <p>I tried to train a convolutional neural network to predict the labels (categorical data) given the criteria (text). This should have been a simple classification problem. There are 7 labels, hence my network has 7 output neurons with <code>sigmoid</code> activation functions.</p>
<p>I encoded training data using the... | <python><tensorflow><keras> | 2023-12-28 21:12:12 | 1 | 844 | Code Monkey |
77,729,040 | 10,853,071 | Dask Dataframe Mode on groupy? | <p>I am trying to extract the "mode" of a series under a groupby agregation in a dask dataframe. I could find the <a href="https://docs.dask.org/en/stable/generated/dask.dataframe.DataFrame.mode.html" rel="nofollow noreferrer">documentation of mode</a>, but not how to use it under a group by.</p>
<pre><code>i... | <python><pandas><group-by><dask><dask-dataframe> | 2023-12-28 20:27:51 | 1 | 457 | FábioRB |
77,728,901 | 19,127,570 | Use curve fitting to approximate a group of many straight line segments in python | <p>Suppose you have a group of connected line segments like in the picture below. How can you find a curve to approximate the collection of line segments as shown in the image on the right?</p>
<p><a href="https://i.sstatic.net/LjIeXm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LjIeXm.png" alt="Conne... | <python><numpy><scipy><regression><shapely> | 2023-12-28 19:53:52 | 0 | 773 | trent |
77,728,795 | 1,285,061 | Convert Numpy array into a sine wave signal for Fourier analysis | <p>I have a long tabular data, simple peak amplitude measurement with respect to time, i.e 1D array index of interval 1 minute.</p>
<pre><code>>>> a = np.array([5, 7, -6, 9, 0, 1, 15, -2, 8])
#array is of length of many thousands readings taken on interval of 1 minute.
#The index represents 1-minute interval... | <python><numpy><signal-processing><fft> | 2023-12-28 19:26:50 | 1 | 3,201 | Majoris |
77,728,583 | 21,306,952 | Python Selenium ActionChains not working with canvas | <p>I am trying to test a canvas element with selenium in python: in the canvas there's a custom video editor in which I can drag elements. I'm using Selenium ActionChains, but it doesn't seem to work in the canvas to drag and drop different elements. Here's a code extract:</p>
<pre class="lang-py prettyprint-override">... | <python><selenium-webdriver><testing><canvas> | 2023-12-28 18:37:35 | 1 | 918 | Alexxino |
77,728,423 | 5,822,440 | Drawing the Tangent of 3D Curve Data Points in an Artificial Neural Network From Scratch | <p>I'm working on building an Artificial Neural Network (ANN) from scratch, and I have a set of 3D curve data points representing the output of the network. I'm interested in visualizing the tangents of the curve at various points. How can I draw the tangents of these 3D curve data points within the context of my ANN i... | <python><math><artificial-intelligence> | 2023-12-28 17:52:49 | 0 | 411 | Fatihi Youssef |
77,728,364 | 15,098,472 | Update the settings of a class after construction | <p>I got the following structure:</p>
<p>First, a config class:</p>
<pre><code>class Config:
def __init__(self, config_path='./configs') -> None:
file = open(config_path, 'r')
self.config_path = config_path
self.config = yaml.safe_load(file)
</code></pre>
<p>The purpose of the class is ba... | <python><class><constructor> | 2023-12-28 17:41:01 | 0 | 574 | kklaw |
77,728,334 | 12,343,115 | install lightgbm GPU in a WSL conda env | <p>-------------------- original question ---------------------------------</p>
<p>How to install LightGBM??
I have checked multiple sources but staill failed to install.</p>
<p>I tried pip and conda but both return the error:</p>
<pre><code>[LightGBM] [Warning] Using sparse features with CUDA is currently not supporte... | <python><machine-learning><lightgbm> | 2023-12-28 17:34:48 | 2 | 811 | ZKK |
77,728,246 | 9,788,900 | Files not being written to mapped network drive on windows using python script | <p>I have a python script which accesses a mapped network drive on Windows OS and creates a file in the mapped location to write. Here's the code to write.</p>
<pre><code>output_file = f"{output_dirPath}/{directory_name}{output_suffix}"
with open(output_file, 'w') as file:
file.write("Sample Name\t... | <python><unc> | 2023-12-28 17:12:25 | 0 | 343 | Callie |
77,728,178 | 11,436,917 | generate python models from k8s CRDs | <p>I'm trying to use python to add/delete/get status of CRDs. Since the official SDK provides only generic functions to deal with CRD, i want to implement my own wrapper to manage those particular CRDs ( mainly crossplane ones)</p>
<p>is there a way to generate Python models ideally with validation from a yaml CRD file... | <python><kubernetes><automation><cross-platform><code-generation> | 2023-12-28 17:00:28 | 0 | 634 | ilyesAj |
77,728,058 | 908,924 | Given a column with sets of data print data that corresponds to group in the adjacent row | <p>I have an excel sheet with two columns of data. The data in the first column is grouped by rows the adjacent column contains some data to be processed.</p>
<p>for example</p>
<p><img src="https://i.sstatic.net/e8xCW.png" alt="For example" /></p>
<p>What I would like to do is read in the rows in column "A" ... | <python><pandas> | 2023-12-28 16:32:11 | 2 | 2,355 | Stripers247 |
77,728,032 | 4,343,563 | Split a text by word from list of words and keep the word in Python | <p>I have a list of addresses like:</p>
<pre><code>addresses = [['123 Abc Ave Santa Monica, CA'], ['595 Apts 76 Box Rd Washington, DC'],['Avalon Apts 34 Plain St Dallas, TX']]
</code></pre>
<p>I am trying to split the addresses to get the street address, city, and state separately. Like so:</p>
<pre><code>street_add = ... | <python> | 2023-12-28 16:26:45 | 0 | 700 | mjoy |
77,727,724 | 3,388,491 | What's wrong with my pytest moto context in this test? | <p>As a frequent user of moto, I'm rather confused about the issue I'm facing.
I set up a test class with a pytest fixture providing a DynamoDB table which I want to access in my test.
Business as usual:</p>
<pre><code>class TestDynamodbClient:
@pytest.fixture
def test_table(self):
with mock_dynamodb()... | <python><pytest><moto> | 2023-12-28 15:20:28 | 2 | 2,708 | oschlueter |
77,727,545 | 8,869,570 | How to get around unexpected keyword arguments when callsite uses keyword argument but API uses unnamed arg? | <p>I have a class with a method</p>
<pre><code>def method(self, keyarg1, keyarg2):
# definition
</code></pre>
<p>At the callsite, it uses keyword arguments when passing in the arguments, i.e.,</p>
<pre><code>class_instance.method(keyarg1=..., keyarg2=...)
</code></pre>
<p>I'm trying to write a mockclass with <code>me... | <python> | 2023-12-28 14:46:02 | 1 | 2,328 | 24n8 |
77,727,456 | 1,907,755 | How to read DeltaTable on azure storage account using GraphQL? | <p>I'm looking for different ways to read <code>DeltaTable</code> on Azure Storage account using API's.
One option i find is using <code>delta-rs</code> to read the Delta Table and expose that as <code>Azure Functions</code>.</p>
<p>I was wondering is there anyway, we could use <code>GraphQL</code> to read the Delta ta... | <python><graphql><azure-functions><delta-lake> | 2023-12-28 14:27:48 | 1 | 9,019 | Shankar |
77,727,072 | 525,865 | Scraper with BS4 does not give back any response (data) on the screen | <p>I want to have a overiew on the data of austrian hospitals: how to scrape the data from the site: <a href="https://www.klinikguide.at/oesterreichs-kliniken/" rel="nofollow noreferrer">https://www.klinikguide.at/oesterreichs-kliniken/</a></p>
<p>my approach - with BS4 is these few lines. Note: at the moment i want t... | <python><web-scraping><beautifulsoup> | 2023-12-28 13:09:39 | 2 | 1,223 | zero |
77,727,056 | 12,276,279 | How can I use `df.shift(n)` in pandas dataframe such that I can bring `n` item from bottom to the top instead of `nan` values or vice versa? | <p>I have a pandas dataframe <code>df</code> containing 5 rows and 2 columns.</p>
<pre><code>A B
0 10 0
1 20 5
2 30 10
3 40 15
4 50 20
</code></pre>
<p><code>df.to_dict()</code> returns</p>
<pre><code>{'A': {0: 10, 1: 20, 2: 30, 3: 40, 4: 50},
'B': {0: 0, 1: 5, 2: 10, 3: 15, 4: 20}}
</code></pre>
<p>F... | <python><python-3.x><pandas><dataframe><shift> | 2023-12-28 13:05:37 | 1 | 1,810 | hbstha123 |
77,726,963 | 19,130,803 | extract file name from html file uploader | <p>I am developing a <code>python</code> web app. One of the page has file uploader functionality using html <code><input type="file" id="file"></code>. I want to get the filename of uploaded file by the user. In my backend the function receieve the input box value as <code>str</code> for eg <... | <python> | 2023-12-28 12:43:49 | 2 | 962 | winter |
77,726,479 | 315,168 | Python: Converting SQL list of dicts to dict of lists in fast manner (from row data to columnar) | <p>I am reading and processing row-oriented data from SQL database, and then write it out as columnar data as a Parquet file.</p>
<p>Converting this data in Python is simple. The problem is that the dataset is very large and the raw speed of Python code is a practical bottleneck. My code is spending a lot of time conve... | <python><pandas><psycopg2><parquet> | 2023-12-28 11:02:44 | 2 | 84,872 | Mikko Ohtamaa |
77,726,384 | 9,359,785 | How can a Windows program detect Python installations? | <p>I am trying to determine how a given Windows application locates and loads the Python installation it's going to use.</p>
<p>Some context : I have <strong>Python 3.12</strong> installed on my system (for my own programming). But I also have a Windows application installed, named "DaVinci Resolve", which ne... | <python><davinci-resolve> | 2023-12-28 10:41:55 | 0 | 1,785 | jeancallisti |
77,726,216 | 5,710,451 | How to cover room in light with least number of light sources? | <p>I have an image of a map of room.
and I want to calculate minimum point in this map that I can set a lamp. that all of my map have light.
I read image and edge detect.
but I don't know how can I calculate number of lamp.
have python a function for this?</p>
<p>Fro example:
<a href="https://i.sstatic.net/Hkz6r.png" r... | <python><image-processing><geometry> | 2023-12-28 10:07:32 | 0 | 370 | z.gomar |
77,725,842 | 865,169 | How can I check if a Python variable is an integer, including numpy.int*? | <p>I would like to use an abstract way of checking whether a variable is an integer. I know I can do:</p>
<pre><code>>>> a = 1
>>> isinstance(a, int)
True
</code></pre>
<p>However, this does not work for some special types of integers, e.g.:</p>
<pre><code>>>> import numpy as np
>>>... | <python><integer> | 2023-12-28 08:49:19 | 0 | 1,372 | Thomas Arildsen |
77,725,219 | 3,623,537 | Type comments for list of values | <p>Is there way for typing e.g. a list of ints without <code>typing</code>?</p>
<p>I use python 2.7 and there is no <code>typing</code> yet and the only way to define a type for type hints is type comments.</p>
<p>The goal is that PyLance would see the variables as list of integers.</p>
<pre class="lang-py prettyprint-... | <python><python-2.7><python-typing><pyright> | 2023-12-28 05:51:29 | 1 | 469 | FamousSnake |
77,725,199 | 9,797,207 | Convert datetime string to with timezone in django based on active time zone | <p>I am reading a get request and adding the data to db.</p>
<pre><code>import dateutil.parser as dt
date_string = '2023-12-14 08:00:00'
date_obj = dt.parse(date_string)
</code></pre>
<p>It shows warning</p>
<blockquote>
<p>RuntimeWarning: DateTimeField RequestLab.end_time received a naive datetime (2023-12-14 08:00:0... | <python><django><datetime><django-timezone> | 2023-12-28 05:44:19 | 2 | 467 | saibhaskar |
77,725,122 | 856,804 | Does TextRecognitionModel from opencv support GPU mode? | <p>I've made the <code>TextDetectionModel</code> tutorial at <a href="https://docs.opencv.org/4.x/d4/d43/tutorial_dnn_text_spotting.html" rel="nofollow noreferrer">https://docs.opencv.org/4.x/d4/d43/tutorial_dnn_text_spotting.html</a> work, and I'd like to speed up the detection with GPU by adding a couple of lines, bu... | <python><c++><opencv> | 2023-12-28 05:10:44 | 0 | 9,110 | zyxue |
77,724,574 | 4,281,353 | Langchain huggngface text splitter can cause overflow the max token size | <p>It looks LangChain <a href="https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/split_by_token#hugging-face-tokenizer" rel="nofollow noreferrer">Hugging Face tokenizer Text Splitter</a> is broken and cannot split a text into the token size below the max token length that mo... | <python><huggingface-tokenizers><py-langchain> | 2023-12-28 00:41:56 | 0 | 22,964 | mon |
77,724,454 | 12,974,079 | Patching a property of a used class | <p>I'm trying to patch two properties from a class but the mocking is returning a MagicMock instead the expected return value (String).</p>
<p>Client class:</p>
<pre><code>class ClientApi:
def create_path(self):
return f"client_api_{self.time_now}T{self.date_now}.json"
@property
def date_... | <python><python-3.x><python-unittest><python-unittest.mock> | 2023-12-27 23:41:26 | 1 | 363 | HouKaide |
77,724,269 | 11,932,910 | Why does VSCode debugger ignore raised exception despite the checkmark? | <p>I was debugging Pandas in VSCode (Python). I ran the following code in the debugger:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
index = pd.Index([1,2,3,4]).get_loc('w')
</code></pre>
<p>which resulted in an error (<code>KeyError: 'w'</code>). However, this error was not caught by the deb... | <python><pandas><visual-studio-code><vscode-debugger> | 2023-12-27 22:34:43 | 0 | 381 | paperskilltrees |
77,724,104 | 3,810,748 | Why does pandas.apply return an index on the first iteration instead of the actual element? | <h2>Current Problem:</h2>
<p>I currently have the following pandas dataframe object:</p>
<pre><code>>>> print(my_df)
Date Revenue
0 2023-12-27 00:00:00-05:00 3880359
1 2023-12-26 00:00:00-05:00 3139100
2 2023-12-22 00:00:00-05:00 2849700
3 2023-12-21 00:00:00-05:00 4884800... | <python><pandas><date><datetime> | 2023-12-27 21:35:57 | 1 | 6,155 | AlanSTACK |
77,724,047 | 3,973,175 | how to add comment to SVG file written by matplotlib? | <p>Given an example plot</p>
<pre><code>import matplotlib.pyplot as plt
plt.plot([1,2,3], [2,4,6])
plt.savefig('simple.plot.svg')
</code></pre>
<p>how can I write a comment into that SVG file?</p>
<p>for example, I would like to write that the SVG file was written by <code>simple.plot.py</code></p>
<p>I have seen ther... | <python><matplotlib><svg> | 2023-12-27 21:16:35 | 1 | 6,227 | con |
77,724,025 | 1,390,272 | pyenv installing any python version is resulting in ModuleNotFoundError: No module named '_ssl' | <p>As a new user on my ubuntu WSL system I am installing python versions using pyenv to manage multiple version, I'm using the standard instructions:</p>
<p>I installed homebrew:</p>
<pre><code>/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
</code></pre>
<p>Upd... | <python><linux><openssl><homebrew><pyenv> | 2023-12-27 21:08:45 | 1 | 1,673 | Goku |
77,723,993 | 17,835,120 | Gemini Pro API Blocking Replies | <p>Running Gemini AP added code to avoid blocking but getting blocked. My commands do not get blocked when using ChatGPT?</p>
<p><strong>Code in Python</strong></p>
<pre><code>def get_gemini_response(question, safety_settings=None):
# If safety settings are not provided, set it to 'block_none' for all categories
... | <python><google-gemini> | 2023-12-27 21:01:08 | 1 | 457 | MMsmithH |
77,723,957 | 4,652,030 | Permutation where element can be repeated specific times and do it fast | <p>I have been looking for a function like this, sadly I was not able to found it.</p>
<p>Here a code that do what I write:</p>
<pre class="lang-py prettyprint-override"><code>import itertools
#Repeat every element specific times
data = {
1: 3,
2: 1,
3: 2
}
#Length
n = 0
to_rep = []
for i in data:
to_rep += [... | <python> | 2023-12-27 20:51:53 | 2 | 307 | Latot |
77,723,939 | 4,974,679 | Adding two lists with different length to a Dictionary then to a Dataframe | <p>I have two lists with different length such as below:</p>
<pre><code>list1 = ['col1', 'col2', 'col3', 'col4']
list2 = [[1, 2, 3], [2, 3], [1, 8, 4, 3], [22, 35, 32], [65], [2, 45, 55]]
</code></pre>
<p>and I have a Dataframe as the following with 6 rows:</p>
<pre><code>df = pd.DataFrame([['Alex', 33, 'Male'], [Marly... | <python><dataframe><list> | 2023-12-27 20:46:11 | 1 | 587 | Arwa |
77,723,918 | 17,176,270 | Cyrillic content of attached to email file has wrong encoding when sending it with email in Python | <p>I have a json file with this content, it has cyrillic letters.</p>
<pre><code>{
"Полотенцесушитель EF 600L (белый)": {
"sku": "Полотенцесушитель EF 600L (белый)",
"price": "2 690 грн",
"link": "https://example.org/some_link_bla_bla"
... | <python><json><email><encoding> | 2023-12-27 20:39:43 | 0 | 780 | Vitalii Mytenko |
77,723,914 | 342,331 | How to share a common argument between nested function calls in Python? | <p>I have two Python functions <code>f()</code> and <code>g()</code> which share one argument: <code>a</code>.</p>
<pre class="lang-py prettyprint-override"><code>def f(a, b):
return a + b
def g(a, c):
return a * c
</code></pre>
<p>Sometimes, <code>g()</code> is called standalone, in which case both arguments ... | <python> | 2023-12-27 20:38:51 | 2 | 18,208 | Vincent |
77,723,899 | 19,130,803 | persisting input box value entered by user | <p>I am developing a <code>dash</code> application.I want the data, user has entered to be persisted if page gets refreshed or user switches between different pages.</p>
<p>I am first trying a basic example using an <code>input</code> box to persists the value entered by user and manually clicking on refresh button of ... | <python><plotly><plotly-dash> | 2023-12-27 20:33:48 | 0 | 962 | winter |
77,723,713 | 7,167,564 | RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 18 but got size 17 for tensor number 1 in the list | <p>I am new to Pytorch and using the pre-trained model for my Django App which restores broken images. I took the help from the code given in <a href="https://github.com/safwankdb/Deep-Image-Prior/tree/master" rel="nofollow noreferrer">this repository</a>.</p>
<p>My ML Model Class's code goes like this:</p>
<pre><code>... | <python><machine-learning><deep-learning><pytorch><tensor> | 2023-12-27 19:38:15 | 1 | 311 | Khubaib Khawar |
77,723,648 | 3,615,274 | Databricks ODBC Driver fails if number of rows are exceeding the limit | <p>After installing Databricks ODBC Driver and configuring from <a href="https://www.databricks.com/spark/odbc-drivers-download" rel="nofollow noreferrer">https://www.databricks.com/spark/odbc-drivers-download</a>, it can fetch a maximum of 16,000 records but fails if the record count is 16,000 or more.</p>
<p>Looks li... | <python><odbc><databricks> | 2023-12-27 19:23:44 | 1 | 389 | Vijred |
77,723,585 | 3,142,695 | wfdb in python script returns `IndexError: positional indexers are out-of-bounds` | <p>I am trying to convert WFDB formatted data to csv (using the wfdb package), but I do get an <code>IndexError: positional indexers are out-of-bounds</code> error in the python script, which I do not understand.</p>
<p>I am using the <code>infant10_ecg.*</code> data from here: <a href="https://physionet.org/content/pi... | <python><csv> | 2023-12-27 19:04:04 | 0 | 17,484 | user3142695 |
77,723,202 | 2,573,075 | How to avoid ODOO 15 render error for missing values | <p>In ODOO 15 I have made my own template that runs a method that returns some data to show in a dictionary.</p>
<p>This is a piece of the template:</p>
<pre><code><t t-set="PRI_par_DSP_par_stage" t-value="o.PRI_par_DSP_par_stage(o.date_start, o.date_end, o.source, o.domain)"/>
<table bo... | <python><html><render><qweb><odoo-15> | 2023-12-27 17:17:42 | 1 | 633 | Claudiu |
77,723,163 | 9,335,403 | Can a decorator name classes it creates? | <p>I have a decorator which wraps functions and produces classes (for a better reason than in the following example). It all works, except that I'd like to be able to set the name of the class given by <code>type()</code>.</p>
<p>For example,</p>
<pre><code>>>> class Animal:
... pass
...
>>> def ... | <python> | 2023-12-27 17:09:55 | 1 | 435 | Marnanel Thurman |
77,723,131 | 14,449,816 | How to return YouTube channel information based on a unique channel name or ID | <p>I am trying to do a simply Python script that returns some information about a channel via <code>@username</code> or <code>UCrandomID123</code> search.</p>
<p>I know that you can use the following endpoint to access channel data: <a href="https://www.googleapis.com/youtube/v3/channels" rel="noreferrer">https://www.g... | <python><youtube-data-api> | 2023-12-27 17:03:02 | 1 | 3,582 | Dominik |
77,722,617 | 19,363,912 | Measurement of progress using ObjectiveValue and BestObjectiveValue | <p>How to measure progress of (cp-sat) solver?</p>
<p>I am currently approximating with</p>
<pre><code>o = solver.ObjectiveValue()
b = solver.BestObjectiveBound()
p = 100 * o / b
</code></pre>
<p>This works only when maximizing sum over bools multiplied by positive coefficients, so value cannot be below 0.</p>
<p>Any a... | <python><or-tools><cp-sat> | 2023-12-27 15:03:44 | 1 | 447 | aeiou |
77,722,578 | 374,458 | How to serve concurrent matplotlib figures as images in an HTTP API? | <p>I use <code>FastAPI</code> and <code>Uvicorn</code> to run an HTTP server.</p>
<p>This server serves images generated from <code>Matplotlib</code> figures, using also <code>Image</code> from <code>PIL</code>:</p>
<pre class="lang-py prettyprint-override"><code> import matplotlib.pyplot as plt
from io import B... | <python><matplotlib><concurrency><python-imaging-library><fastapi> | 2023-12-27 14:53:42 | 0 | 1,870 | Nicolas |
77,722,349 | 1,659,599 | Install python 2.7 on cygwin | <p>How to install Python 2.7 on new cygwin versions (as of 2023)?</p>
<p>Packages for python 2 seem not to be available. Only Python 3 is available.</p>
<p>There are several packages <code>python2-###</code> with dependencies to <code>python2</code> but no <code>python2</code> package.</p>
| <python><python-2.7><cygwin> | 2023-12-27 14:07:13 | 0 | 7,359 | wolfrevo |
77,722,325 | 3,079,439 | How do I remove a specific part of a filename in Python? | <p>I have the folder that contains of several images (let's say 10) in .jpg format. The names of the files are the following:</p>
<pre><code>IM001
IM002
IM003
etc.
</code></pre>
<p>Is there a way to remove certain part of the filename (for example <code>IM00</code>) and leave the rest using Python? I only have idea wit... | <python><directory><filenames> | 2023-12-27 14:02:26 | 1 | 3,158 | Keithx |
77,722,308 | 64,023 | Python way to declare test dependencies | <p>There should be one-- and preferably only one --obvious way to do it.</p>
<p>According to the Zen of Python... Python's test dependency management is not preferable.</p>
<p>There are dozens upon dozen of ways to manage test dependencies. For instance: dev-dependencies.txt, setup.py extras_require, tests_require, set... | <python><python-packaging><pyproject.toml> | 2023-12-27 13:58:58 | 1 | 3,648 | Michael |
77,722,234 | 12,016,688 | Why manually writing into stderr suppress other exceptions' error massage in python? | <p>I figured out that after I try to manually write something into the <code>stderr</code> file, no error message will be appear in the shell.</p>
<pre class="lang-py prettyprint-override"><code>>>> f = open(2, 'w')
>>> f.write('hello\n')
hello
6
>>> f.close()
>>> raise Exception
>... | <python><exception><io><stderr> | 2023-12-27 13:43:22 | 0 | 2,470 | Amir reza Riahi |
77,722,219 | 1,234,434 | pandas pivot_table column name should not be present and how to order a text column | <p>I'm learning pandas.</p>
<p>I have created this test dataframe:</p>
<pre><code>dfdict = {'product':['ruler', 'pencil', 'case', 'rubber'],'sold':[4,23,0,14],'Quarter':['Q1/22','Q2/23','Q3/22','Q1/23']}
dftest=pd.DataFrame(dfdict)
dftemp=dftest.pivot_table(index=['product'],columns=['Quarter'],values=['sold'],aggfunc=... | <python><pandas> | 2023-12-27 13:39:50 | 2 | 1,033 | Dan |
77,721,953 | 518,973 | Handling Backslash Escaping Issue in AWS Lambda PyODBC Connection String for SQL Server | <p>In one of my AWS Lambda functions, I need to connect to an on-prem SQL Server instance and my lambda function is as follows :</p>
<pre><code>import os
import json
import pyodbc
def lambda_handler(event, context):
# Establish a connection to the SQL Server database
connection_string = 'DRIVER={ODBC Driver ... | <python><python-3.x><sql-server><pyodbc> | 2023-12-27 12:44:13 | 0 | 4,802 | Happy Coder |
77,721,850 | 2,178,956 | Parallel processing fails with Paddle OCR | <p>I am trying to implement parallel processing using Paddle OCR.
Please refer to the method <code>predictx_parallel</code></p>
<p><code>predictx_parallel(input_images, ocr_params, num_threads=1)</code> - setting num_threads=1 works all the time</p>
<p><code>predictx_parallel(input_images, ocr_params, num_threads=2)</c... | <python><ocr><paddle-paddle><paddleocr> | 2023-12-27 12:24:01 | 1 | 893 | Soumya |
77,721,825 | 424,333 | How can I create HTML email drafts in Gmail using Python? | <p>I can successfully create plaintext email drafts in Gmail using this snippet:</p>
<pre><code>from email.message import Message
import imaplib
import time
message = Message()
# Create message
message["To"] = "john.doe@gmail.com"
message["Subject"] = "Subject line"... | <python><email><gmail><html-email><imaplib> | 2023-12-27 12:17:48 | 1 | 3,656 | Sebastian |
77,721,396 | 3,291,993 | Input output error for the already opened file | <p>I'm directing <code>sys.stderr</code> to a file and opening that file in write mode.
Only at the end, I'm closing <code>sys.stderr</code> and redirecting it to original <code>sys.__stderr__</code></p>
<pre><code>sys.__stderr__ = sys.stderr
sys.stderr = open(error_file, 'w')
# main code in between
sys.stderr.close... | <python> | 2023-12-27 10:38:52 | 2 | 1,147 | burcak |
77,721,135 | 8,584,739 | Get the closest element from a list of dictionaries based on a variable | <p>I need to extract the most close element when counting backwards from a list of dicts based on a variable <code>utime</code>. If <code>utime</code> is less than <code>uid.time</code>, it should not print anything.</p>
<p>I have created below script which does the work but doesn't seem to be efficient or foolproof a... | <python><python-3.x> | 2023-12-27 09:42:30 | 4 | 1,228 | Vijesh |
77,720,977 | 7,798,822 | How to import openai package using jupyter notebook? | <p>I am getting the below error message when importing openai as ai using google jupyter notebook:</p>
<pre><code>ImportError Traceback (most recent call last)
<ipython-input-9-3f86bb4abbfc> in <module>
----> 1 import openai as ai
/opt/anaconda3/lib/python3.8/site-packag... | <python><openai-api><large-language-model> | 2023-12-27 09:09:46 | 1 | 321 | Natália Resende |
77,720,936 | 3,291,993 | Python inner function can not resolve the local variable of the outer function | <p>I have defined <code>df</code> locally in a python function <code>func1</code>.
I want subfunction <code>accumulate_df</code> to see <code>df</code>.
But it gives <code>Unresolved reference 'df'</code> error.</p>
<p>I don't want global variable. Results coming from multiple processors will be accumulated in these va... | <python><pandas><dataframe> | 2023-12-27 09:01:21 | 0 | 1,147 | burcak |
77,720,872 | 424,333 | How do I create a Gmail email draft in Python? | <p>I'm trying to create an email in Python that will appear in my Gmail drafts.</p>
<p>Here's my code:</p>
<pre><code>from email.message import Message
import imaplib
import time
with imaplib.IMAP4_SSL(host="imap.gmail.com", port=imaplib.IMAP4_SSL_PORT) as imap_ssl:
print("Logging into mailbox...&qu... | <python><email><gmail><imap> | 2023-12-27 08:47:07 | 0 | 3,656 | Sebastian |
77,720,387 | 3,297,613 | ChromaDB index update using gunicorn multiple uviworkers on macos throws YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ error | <p>I have created a simple FastAPI app for updating/uploading documents to ChromaDB Vectorstore on Mac OSX in-order to do a simple query search. Here is the below code,</p>
<pre><code>import asyncio
from fastapi import BackgroundTasks, FastAPI
from langchain.document_loaders import DirectoryLoader
from langchain.embed... | <python><macos><fastapi><gunicorn><chromadb> | 2023-12-27 06:30:07 | 1 | 175,204 | Avinash Raj |
77,720,235 | 10,200,497 | Groupby column of sequence of numbers | <p>This is my dataframe:</p>
<pre><code>df = pd.DataFrame(
{
'a': [101, 9, 1, 10, 100, 103, 102, 105, 90, 110],
'b': [1, 0, 1, 0, 0, 1, 1, 1, 0, 1],
}
)
</code></pre>
<p>And this is the way that I want to group them by column <code>b</code>:</p>
<pre><code> a b
# -------------------------
0... | <python><pandas> | 2023-12-27 05:47:24 | 1 | 2,679 | AmirX |
77,720,146 | 7,040,692 | numpy array matrix-like multiplication | <p>I have the following definition:</p>
<pre><code>class Transform:
mat_ = np.ones([2, 2], dtype=float)
def __init__(self, mat):
self.mat_ = mat
# vec should be a column vector
def r_mult(self, vec):
return self.mat_ @ vec.T
</code></pre>
<p>I'm using it to initiate an object, like</p>... | <python><arrays><numpy> | 2023-12-27 05:13:16 | 0 | 630 | dEmigOd |
77,720,049 | 10,853,071 | optimizing multiple try except code for web scraping | <p>I have a web scraping script where, due to many reasons, some codes "break" if not finding the information as expected. I am handling it with multiple "try/except" blocks.</p>
<pre><code> asin = item.get('data-asin')
title = item.find_all('span',{'class' : 'a-size-base-plus a-color... | <python> | 2023-12-27 04:30:11 | 1 | 457 | FábioRB |
77,719,957 | 10,853,071 | Playwright typing annotation | <p>Despite being for informational use, I am trying to setup typing annotations on my script, as it helps me to debug it later.</p>
<p>I am trying to set up Playwright's browser and context as the return of the following code, but I am not being successful:</p>
<pre><code>import asyncio
from playwright.async_api import... | <python><playwright><python-typing> | 2023-12-27 03:48:56 | 1 | 457 | FábioRB |
77,719,741 | 7,563,454 | Change the color of a pixel on a surface from a thread pool | <p>I'm working on a voxel raytracer in Python, just ported from Tkinter to Pygame for window management and pixel drawing. I use a thread pool to do the raytracing for each pixel, in my original code the <code>trace</code> function does various calculations before returning the color as a hex string: The main loop runs... | <python><python-3.x><multithreading><pygame><multiprocessing> | 2023-12-27 01:55:54 | 1 | 1,161 | MirceaKitsune |
77,719,698 | 9,335,403 | Should <instance>.<property> += v call the property's setter? | <p>Given</p>
<pre><code>class TameWombat:
def __init__(self):
self.stomach = []
def __iadd__(self, v):
self.stomach += v
return self
class Fred:
def __init__(self):
self._pet = TameWombat()
@property
def wombat(self):
return self._pet
@wombat.setter
d... | <python> | 2023-12-27 01:30:38 | 1 | 435 | Marnanel Thurman |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.