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,920,093 | 11,355,926 | Python 3.12: Correct typing for list[list[int,str,list[list[str]]]]? | <p>I have a list of users, that I would like to type correctly, but I'm not able to find an answer explaining how to do this.</p>
<p>The list looks like this:</p>
<pre><code>listofusers = [[167, 'john', 'John Fresno', [[538, 'Privileged'], [529, 'User']]]]
</code></pre>
<p>I tried doing like this:</p>
<pre><code>def te... | <python><python-3.x><python-typing> | 2024-02-01 12:13:02 | 2 | 3,060 | Cow |
77,919,954 | 9,247,345 | FastAPI overwrite pydantic model during startup | <p>In my FastAPI application, I want to create a dynamic pydantic model which is used as an input argument. If a condition (that can only be checked during startup) is True, I want to overwrite the model.</p>
<p>In the minimum working example, the model <code>Model</code> is initialized with the default value <code>lim... | <python><fastapi><pydantic> | 2024-02-01 11:50:21 | 0 | 317 | brnk |
77,919,918 | 839,963 | Missing center point in scatter plot on matplotlib PolarAxes | <p>I try to draw markers on a matplotlib <code>PolarAxes</code> using <code>plot</code> or <code>scatter</code> (tried both).</p>
<p>Here is my code (not showing the part that creates the plot and colorbar):</p>
<pre class="lang-py prettyprint-override"><code>figure = plt.figure(figsize=(6, 5))
axes: plt.Axes = figure... | <python><matplotlib> | 2024-02-01 11:44:45 | 1 | 745 | Glemi |
77,919,397 | 1,711,271 | Polars: create an integer column from another one by computing the difference with the largest smaller value from a list | <p>I have a <code>polars</code> dataframe like this one:</p>
<pre><code>shape: (10, 2)
┌────────┬───────┐
│ foo ┆ bar │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞════════╪═══════╡
│ 86 ┆ 11592 │
│ 109 ┆ 2765 │
│ 109 ┆ 4228 │
│ 153 ┆ 4214 │
│ 153 ┆ 7217 │
│ 153 ┆ 11095 │
│ 160 ┆ 1134 │
│ 222... | <python><list><python-polars> | 2024-02-01 10:28:09 | 1 | 5,726 | DeltaIV |
77,919,370 | 4,105,440 | Unexpected behaviour when applying rolling operation on a dataframe with no data | <p>Consider the following code</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
data = pd.DataFrame({'time': pd.date_range('2024-01-01 00:00',
'2024-01-02 00:00',
freq='1H'),
'data' : np.rand... | <python><pandas><dataframe><rolling-computation> | 2024-02-01 10:23:53 | 0 | 673 | Droid |
77,918,877 | 5,938,276 | Adding watch to Python project in Debug mode | <p>I am working in VSCode on Windows and have a created a debug configuration. I want to add a watch to inspect the contents of a data class as it is populated. My data class is setup like so:</p>
<pre><code>class BSM:
def __init__(self)
self.ct = CTimer()
def process(self, BP:float) -> None|CTimer... | <python><visual-studio-code> | 2024-02-01 09:12:38 | 1 | 2,456 | Al Grant |
77,918,750 | 3,727,079 | How can I optimize a search over two sets of files to merge them? | <p>I've got a bunch of .txt files with alphabetically-sorted file names:</p>
<pre><code>aaa.txt
aab.txt
aac.txt
.
.
.
zzz.txt
</code></pre>
<p>And another set of .txt files stored in a different location:</p>
<pre><code>ant.txt
bat.txt
cat.txt
lion.txt
...
</code></pre>
<p>I want to take the text of .txt files in the l... | <python><algorithm><optimization> | 2024-02-01 08:47:48 | 2 | 399 | Allure |
77,918,600 | 7,295,599 | Irreproducible crash/behaviour of pyinstaller executable on different PCs | <p>I'm writing a little Python (3.11.3) program using PyQt5 and a few more modules.
Then I was packing this with pyInstaller (5.10.1) into an single file executable for Windows10.</p>
<p>On my laptop, I did not experience any problems, neither with the Python script nor with the executable.
However, when I copied the .... | <python><windows><pyqt5><crash><pyinstaller> | 2024-02-01 08:19:28 | 0 | 27,030 | theozh |
77,918,540 | 10,232,932 | Map the upper group to the column in pandas | <p>I have the following (ordered) dataframe <code>df</code>:</p>
<pre><code>Level ID
5 A
8 DD
8 DA
8 AC
5 B
8 BA
8 BB
8 BC
8 BD
</code></pre>
<p>The logic is that the Level 5 , which stands above the level 8 has to get mapped to it, that means:</p>
<pre>... | <python><pandas> | 2024-02-01 08:06:52 | 1 | 6,338 | PV8 |
77,918,537 | 1,936,853 | Play Developer Api, edits.tracks.update not work | <p>I have an Android app released on PlayStore.</p>
<p>In general, when I release a new version to the PlayStore, I set the 'user fraction' to 30%.</p>
<p>Then, I will monitor it for a few days and if there are no major problems, I will gradually increase it and deploy it to 100%.</p>
<p>I do this on the PlayConsole We... | <python><android><google-play-developer-api> | 2024-02-01 08:06:22 | 1 | 2,861 | dev.farmer |
77,918,532 | 9,072,753 | How to overload class member type depending on argument? | <p>I recently learned I can overload return type using <code>Literal[True]</code> and <code>Literal[False]</code> argument. I am implementing my own <code>subprocess.Popen</code>-ish interface and I am not able to overload <code>self.stdin</code> return type to be <code>IO[bytes]</code> or <code>IO[str]</code> dependin... | <python><python-typing><pyright> | 2024-02-01 08:05:25 | 2 | 145,478 | KamilCuk |
77,918,290 | 3,099,733 | How to test if an object is Annotated in Python? | <p>Consider the following code:</p>
<pre class="lang-py prettyprint-override"><code>from dataclasses import dataclass, fields
from typing import Annotated
@dataclass
class Foo:
x: Annotated[int, 'x']
print(fields(Foo)[0].type)
# typing.Annotated[int, 'x']
print(isinstance(fields(Foo)[0].type, Annotated))
# False
... | <python><python-typing> | 2024-02-01 07:17:22 | 1 | 1,959 | link89 |
77,917,969 | 9,542,989 | Persist Package Installations in Python-based Docker Container | <p>I have a Python app running in a Docker container. I want to have the flexibility of installing new packages while the container is running. Eventually, I want to do this via the GUI, but right now I am doing it using the following commands,</p>
<pre><code>docker exec -it container-name sh
pip install <package-na... | <python><docker> | 2024-02-01 05:57:02 | 1 | 2,115 | Minura Punchihewa |
77,917,904 | 4,066,329 | Pycharm debugger console not autocompleting variables created in the debugger console | <p>I have just upgraded to PyCharm 2023.3.3 community edition and am experiencing a weird issue that hasn't occurred before. System is Windows 10 64 bit, and this has worked fine on this machine before.</p>
<p>When I debug a script and hit a breakpoint and the program is suspended and the debugger window is opened, aut... | <python><debugging><pycharm><console><code-completion> | 2024-02-01 05:37:18 | 1 | 684 | Sighonide |
77,917,840 | 2,827,181 | How to translate PySpark res = notesCollege.select(*[f.mean(c).alias(c) for c in notesCollege.columns]) into Java Spark? | <p>I would like to apply a PySpark statement suggested in
<a href="https://stackoverflow.com/questions/53855300/pyspark-calculate-mean-of-all-columns-in-one-line">pyspark calculate mean of all columns in one line</a> question, into my Java program but I don't know how.</p>
<p>In the next codes, <code>notesCollege</code... | <python><java><apache-spark><pyspark><apache-spark-sql> | 2024-02-01 05:13:33 | 1 | 3,561 | Marc Le Bihan |
77,917,829 | 8,516,987 | Stripe Proration Webhook Interception on Downgrades | <p>I'm looking for a way to ensure on a plan downgrade, the user gets charged the plans price on the next payment period.</p>
<p>If susan is going from $20/month to a $10/month plan, she continues to get the benefits of the $20/month until end of her subscription plan. However, on stripe UI it says she pays $0 for next... | <python><stripe-payments> | 2024-02-01 05:08:02 | 1 | 642 | itsPav |
77,917,717 | 1,601,580 | How does one create a HF tokenizer with only a fraction of the vocabulary but without changing the model? | <p>I tried to create a smaller tokenizer:</p>
<pre><code>def get_tokenizer_with_subset_of_vocab(tokenizer: GPT2Tokenizer, percentage_to_keep: float) -> GPT2Tokenizer:
"""
Create a tokenizer with a fraction of the vocabulary.
"""
from copy import deepcopy
tok = ... | <python><huggingface-transformers> | 2024-02-01 04:24:00 | 1 | 6,126 | Charlie Parker |
77,917,599 | 11,053,343 | Zope 5 Log To Error Log From Python Script | <p>Normally when an exception occurs, Zope automatically logs it to the error_log via the Products.SiteErrorLog package, however I have a python script with a try/except block because I need to return json whether or not the script succeeds. Unfortunately, the exception block overrides Zope's default logging to the err... | <python><logging><zope> | 2024-02-01 03:41:08 | 2 | 1,515 | kittonian |
77,917,567 | 11,277,108 | Attribute Error for compare_metadata with multiple schemas | <p>I'm trying to use the <code>compare_metadata</code> function with the following setup:</p>
<p><strong>base.py</strong></p>
<pre><code>from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass
</code></pre>
<p><strong>workspace.py</strong></p>
<pre><code>from sqlalchemy import Column, Integer... | <python><sqlalchemy><alembic> | 2024-02-01 03:29:16 | 1 | 1,121 | Jossy |
77,917,429 | 7,662,164 | Indexing multiple elements in a muldimensional numpy array | <p>I would like to extract elements of a given multidimensional numpy array, using another array of indices. However it doesn't behave in the way I expected. Below is a simple example:</p>
<pre><code>import numpy as np
a = np.random.random((3, 3, 3))
idx = np.asarray([[0, 0, 0], [0, 1, 2]])
b = a[idx]
print(b.shape) ... | <python><arrays><numpy><indexing><numpy-ndarray> | 2024-02-01 02:34:12 | 1 | 335 | Jingyang Wang |
77,917,402 | 5,896,591 | When does Python require parentheses around "not x"? | <p>I get the following result in both Python 2.7 and Python 3.5. Why do the parentheses make a difference?</p>
<pre><code>>>> True == (not False)
True
>>> True == not False
File "<stdin>", line 1
True == not False
^
SyntaxError: invalid syntax
>>>
</code><... | <python> | 2024-02-01 02:23:17 | 1 | 4,630 | personal_cloud |
77,917,342 | 2,175,052 | How do I protect my FastAPI REST-ful services by making sure request are coming from only a certain domain (front-end application)? | <p>I have an application stack as follows.</p>
<ul>
<li>Backend: FastAPI, REST-ful service; eg r.domain.com</li>
<li>Frontend: Angular 17 application; eg w.domain.com</li>
</ul>
<p>On the backend, I want to ensure that a response is generated only for requests coming from the frontend application (eg w.domain.com). My ... | <python><angular><rest><cors><fastapi> | 2024-02-01 01:56:27 | 0 | 8,955 | Jane Wayne |
77,917,266 | 1,944,636 | pyspark splitting words into rows | <p>I'm trying out pyspark and looking at this example:
<a href="https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html</a></p>
<p>I got the code working easy enough, so the guide is pret... | <python><pyspark> | 2024-02-01 01:28:08 | 0 | 1,077 | MikeKulls |
77,917,257 | 1,497,385 | Python SQLite database is locked in a single-thread interactive process despite closing all SQLAlchemy sessions/engines/connections | <p>There are many SO questions with same issues. However, all other answers focus on user errors that are not valid for me.
In most other SO question, the situation involves 2+ process conflicting over the DB file. In my case, there is only a single process conflicting with itself. If you think about it, there is no re... | <python><sqlite><sqlalchemy> | 2024-02-01 01:24:27 | 0 | 6,866 | Ark-kun |
77,917,202 | 7,662,164 | Tensor power of 1D numpy array | <p>I would like to implement a function that takes what I call the "tensor power" of an one-dimensional numpy array:</p>
<pre><code>def tensor_pow(x: np.ndarray, n: int) -> np.ndarray:
# code goes here
return y
</code></pre>
<p>For any numpy array <code>x</code> of shape <code>(Nx)</code>, th... | <python><arrays><numpy><tensor><broadcast> | 2024-02-01 01:00:31 | 1 | 335 | Jingyang Wang |
77,917,146 | 9,670,371 | Failure in converting the SparkDF to Pandas DF | <p>I have a Spark code running on a Dataproc cluster that reads a table from BigQuery into a Spark dataframe. In this code, there is a step where I need to perform some data processing using pandas dataframe logic. However, when I try to convert the Spark dataframe to a pandas dataframe, I encounter an error that I am ... | <python><pandas><dataframe><apache-spark><google-cloud-dataproc> | 2024-02-01 00:36:12 | 1 | 415 | trougc |
77,917,091 | 5,942,100 | unique melt and pivot crosstab format with a groupby using pandas | <p>I have a dataset where I would like for some values to become column headers, as well as a crosstab format.</p>
<p>data</p>
<pre><code>year qtr ID type growth re nondd_re se_re or
2024 2024Q1 NY aa 3.18 1.14 0 0 0
2024 2024Q2 NY aa 2.1 1.14 0 0 ... | <python><pandas><numpy> | 2024-02-01 00:15:42 | 2 | 4,428 | Lynn |
77,916,993 | 3,433,802 | Why won't a custom font work with ezdxf on Ubuntu? | <p>I am running this test program.</p>
<pre><code>import ezdxf
doc = ezdxf.new("AC1032")
doc.styles.add("IAmOnlineWithU", font="IAmOnlineWithU-o96q.ttf")
msp = doc.modelspace()
t = msp.add_text("TEST TEXT", height=1, dxfattribs = {"style": "IAmOnlineWithU"})
... | <python><ezdxf> | 2024-01-31 23:43:48 | 0 | 1,982 | mmachenry |
77,916,633 | 4,590,499 | Understanding Gunicorn Worker and Thread Configuration for Flask-SocketIO with Eventlet | <p>I'm developing a Flask web application that uses SocketIO and am facing issues with configuring Gunicorn, particularly with the number of workers and threads. My server runs on Ubuntu with 32GB DDR4 memory and an i7 7700k CPU. I've tried several configurations, but I'm puzzled by the performance results and SocketIO... | <python><flask><socket.io><gunicorn><eventlet> | 2024-01-31 21:56:24 | 1 | 964 | Daqs |
77,916,345 | 23,260,297 | Write multiple dataframes to multiple sheets in excel file | <p>I have 4 different programs that read 4 different types of csv files to get the data in the same format. My goal is to export dataframes from each program into a single excel workbook onto 4 seperate sheets. Each time I write a dataframe to excel it overwrites the data that was just exported there.</p>
<p>this is th... | <python><pandas><excel> | 2024-01-31 20:51:55 | 1 | 2,185 | iBeMeltin |
77,916,261 | 5,728,714 | How to create a grid containing all possible parameters for a function? | <p>I have the following parameters:</p>
<pre class="lang-py prettyprint-override"><code>trend_types = ['add', 'mul']
seasonal_types = ['add', 'mul']
boxcox_options = [True, False, 'log']
</code></pre>
<p>To be used in the following function:</p>
<pre class="lang-py prettyprint-override"><code>model = sm.tsa.Exponential... | <python> | 2024-01-31 20:34:06 | 1 | 1,877 | Mathias Hillmann |
77,916,213 | 1,214,800 | Python 3.11 + Mypy generic type hinting that can accept both types and type definitions | <p>I'm trying to write an arg getter with generics that casts the result to the correct type based on a generic type input:</p>
<pre><code>T = TypeVar("T")
R = TypeVar("R")
P = ParamSpec("P")
GenericCallable = Callable[P, R]
def get_arg(
name_or_pos: str | int, # 0-based index
ty... | <python><mypy><python-typing><python-3.11> | 2024-01-31 20:22:23 | 2 | 73,674 | brandonscript |
77,916,199 | 535,782 | Python logger does not print debug messages, even if logger.getEffectiveLevel() is DEBUG | <p>The following code changes the log level from INFO to DEBUG, and even though
logger.getEffectiveLevel() returns DEBUG, the debug message doesn't get logged,
as the output shows.</p>
<p>version of python: 3.10.12</p>
<p>---out.log---</p>
<pre><code>log level 1: INFO
log level 2: DEBUG
</code></pre>
<p>Code</p>
<pre><... | <python><python-logging> | 2024-01-31 20:20:39 | 1 | 10,224 | Boutran |
77,916,018 | 1,294,072 | How efficiently share complex and expensive objects between python files | <p>In my case, I initialize and use these (complex and expensive) object in file1, import them in file2 and use. It doesn't waste time create multiple obj in multiple functions accross two files, and works for me.</p>
<pre><code># utils.py
from fancy_module import Fancy_class
expensive_obj = Fancy_class()
def func1():
... | <python><performance><object><initialization><python-lru-cache> | 2024-01-31 19:41:45 | 1 | 746 | xyliu00 |
77,915,989 | 4,500,083 | how make a class with async aiohttp tread safe? | <p>I have this Python class and want your opinion on whether this <code>cls._instance._cache = {}</code> is thread safe for <code>tornado</code>? if not how can I handle this cache to be thread safe?</p>
<pre><code>import logging
import aiohttp
import time
# Constants
DEFAULT_TIMEOUT = 20
MAX_ERRORS = 3
HTTP_READ_TIME... | <python><tornado><aiohttp> | 2024-01-31 19:32:51 | 1 | 1,170 | Mini |
77,915,929 | 608,294 | How do I define the constraints of a multiple assignment problem with Pulp? | <p>I am trying to solve an assignment problem:
A supervisor can be assigned to multiple consultants according to the number of languages a supervisor and a consultant speak (the more languages they have in common the better).
The constraints are:</p>
<ul>
<li>each supervisor has a fixed number of hours that it can use ... | <python><optimization><constraints><linear-programming><pulp> | 2024-01-31 19:20:41 | 1 | 1,741 | Andrea |
77,915,868 | 12,092,252 | "module 'os' has no attribute 'add_dll_directory'" in aws lambda function | <p>I'm facing an issue that <code>os</code> does not have an <code>add_dll_directory</code> attribute in the AWS lambda function on the trigger.</p>
<p>I have written code for creating a thumbnail of a video and I have tried it locally that's working fine but when I upload this function with the required libraries then... | <python><amazon-web-services><amazon-s3><aws-lambda><video-thumbnails> | 2024-01-31 19:09:33 | 2 | 1,053 | Muhammad AbuBaker |
77,915,826 | 5,838,180 | Defining a variable as a copy of another one with a condition | <p>I have a variable <code>a</code>, that's an array, and I want to define another variable <code>b</code>, which is the copy of <code>a</code>, except for a condition (let's say, every non-zero element should be set to 1). I can write this in the following way:</p>
<pre><code>>>> import numpy as np
>>&g... | <python><numpy><variables> | 2024-01-31 19:01:36 | 2 | 2,072 | NeStack |
77,915,759 | 312,444 | Creating a pydatinc Enum from a string | <pre><code>from pydantic import BaseModel
from uuid import UUID
from enum import Enum
from datetime import datetime
class NoteTemplate(str, Enum):
general_practitioner = "general_practitioner"
cardiologist = "cardiologist"
soap = "soap"
consultation_report = "consult... | <python><pydantic> | 2024-01-31 18:45:59 | 0 | 8,446 | p.magalhaes |
77,915,725 | 1,401,560 | Pass/fail result for Paramiko SFTPClient get() and put() functions? | <p>I'm writing an Ansible module using Paramiko's <a href="https://docs.paramiko.org/en/3.4/api/sftp.html" rel="nofollow noreferrer"><code>SFTPClient</code> class</a>. I have the following code snippets</p>
<pre class="lang-py prettyprint-override"><code>import paramiko
from ansible.module_utils.basic import *
def get... | <python><ansible><sftp><paramiko> | 2024-01-31 18:38:48 | 1 | 17,176 | Chris F |
77,915,597 | 4,531,757 | Need help in turn off docker in 'Autogen AutoBuilder" | <p>I am new and struggling to turn off Docker. I like to either set 'use_docker': false or set up environment variable. Either option will work. Thanks for your help. The screenshot has been enclosed.
<a href="https://i.sstatic.net/5Vhqt.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5Vhqt.gif" alt="ent... | <python><docker><artificial-intelligence><ms-autogen> | 2024-01-31 18:14:23 | 1 | 601 | Murali |
77,915,540 | 639,676 | How to implement the next function (the use of Dynamic Shapes) in JAX? | <p>I have a simple function that takes an jax Array as input, searches for the first occurrence of 1, and replaces it with another jax Array (specified as a second input):</p>
<pre><code>rules_int = [
jnp.array([0,0]),
jnp.array([1,1,1]),
]
# Even with the same size of inputs, the sizes of outputs can be differ... | <python><jax> | 2024-01-31 18:03:04 | 1 | 4,143 | Oleg Dats |
77,915,195 | 2,610,522 | Why dask shows smaller size than the actual size of the data (numpy array)? | <p><code>Dask</code> shows slightly smaller size than the actual size of a numpy array. Here is an example of a <code>numpy</code> array that is exactly 32 Mb:</p>
<pre><code>import dask as da
import dask.array
import numpy as np
shape = (1000,4000)
ones_np = np.ones(shape)
print(f"Size:{ones_np.nbytes / 1e6} Mb&... | <python><numpy><dask><dask-distributed> | 2024-01-31 17:10:55 | 1 | 810 | Ress |
77,915,134 | 10,719,369 | opencv-python installation issue using pip | <p>I am trying to install <code>opencv-python</code> inside a python venv using pip in one server env (ubuntu 22.04, python version 3.10.6). When i try to import like <code>import cv2</code> I am facing the below error</p>
<pre><code>ImportError: libGL.so.1: cannot open shared object file: No such file or directory
</c... | <python><opencv><ocr><importerror><python-venv> | 2024-01-31 17:01:20 | 0 | 708 | Mari |
77,915,106 | 6,010,142 | How to insert into oracle database with custom object type using sqlalchemy | <p>Given the following code:</p>
<p>Custom oracle object type:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TYPE address_type AS OBJECT (
street VARCHAR2(30),
city VARCHAR2(20),
state CHAR(2),
postal_code VARCHAR2(6) )
</code></pre>
<pre class="lang-py prett... | <python><oracle-database><sqlalchemy> | 2024-01-31 16:57:36 | 0 | 831 | Ali |
77,914,954 | 3,112,672 | Best practice for isolating dependencies during unit tests | <p>I have a Python module which contains utility methods for use in Databricks. The module essentially looks like this (<code>utils.py</code>):</p>
<pre><code>from databricks.sdk.runtime import spark, dbutil
def someUsefulFunction():
pass
</code></pre>
<p>etc.</p>
<p>I have a unit test module built in Python unittes... | <python><apache-spark><python-unittest> | 2024-01-31 16:34:00 | 0 | 1,174 | absmiths |
77,914,854 | 6,705,902 | Threading is replaceable in Python? | <p>I have done some reading on the topic and <a href="https://stackoverflow.com/questions/27435284/multiprocessing-vs-multithreading-vs-asyncio">found that</a> we can use <code>threading</code> if some problem is <strong>io-bounded</strong> but <strong>io is not very slow</strong>. But I couldn't understand why we stil... | <python><multithreading><python-asyncio><python-multithreading><gil> | 2024-01-31 16:18:06 | 1 | 1,120 | Wenuka |
77,914,786 | 1,028,270 | Can sphinx.ext.viewcode allow me to include the _content_ of the source code in my doc in addition to linking to it? | <p>I'm trying to avoid having to do literal includes with specific line numbers to embed snippets of my code in my docs.</p>
<p>I'm asking almost this same question: <a href="https://stackoverflow.com/questions/58277247/sphinx-how-to-include-a-python-function-as-source-code">sphinx - How to include a Python function as... | <python><python-sphinx><restructuredtext> | 2024-01-31 16:08:09 | 0 | 32,280 | red888 |
77,914,732 | 5,269,749 | How to get the layer details in tensorflow? | <p>I have a layer which is defined as following</p>
<pre><code>import tensorflow.keras.layers as layers
avg_pool = layers.AveragePooling1D(pool_size=2)
</code></pre>
<p>Is there a way to print the details of this layer? (in this case it would be printing the <code>pool_size</code>)?
I cannot use summary on this layer a... | <python><tensorflow><keras><tf.keras> | 2024-01-31 15:59:47 | 2 | 1,264 | Alex |
77,914,684 | 302,102 | How do you write a statically typed Python function that converts a string to a parameterized type? | <p>I would like to write a statically typed Python function that accepts a general type and a string and that returns a value of the given type, derived from the given string. For example:</p>
<pre class="lang-py prettyprint-override"><code>>>> parse(int | None, "5")
5
>>> parse(int | None,... | <python><pyright><python-3.12> | 2024-01-31 15:52:17 | 2 | 1,935 | aparkerlue |
77,914,585 | 9,869,260 | Pandas / Openpyxl : Write Dataframe with left corner on a specific cell | <p>I would like to write a table in an excel sheet using openpyxl.</p>
<p>My Pandas Dataframe looklikes this :</p>
<pre><code>df = pd.DataFrame({
"A": [1, 3, 5],
"B": [2, 4, 6],
})
</code></pre>
<p>I want to create a xlsx file that looklike this (Right corner of my dataframe in cell D9):</p>
<... | <python><pandas> | 2024-01-31 15:37:53 | 2 | 437 | Chjul |
77,914,578 | 10,145,953 | Detect if a checkbox is checked OpenCV | <p>I am using OpenCV to process an image of a form which contains main checkboxes. I have used the pixel coordinates to crop around the checkbox so all I am left with is just the single checkbox. From there, I need to detect if there is anything inside of that checkbox (x, checkmark, slash, etc.) or not.</p>
<p>I used ... | <python><opencv><checkbox><computer-vision><omr> | 2024-01-31 15:37:29 | 2 | 883 | carousallie |
77,914,497 | 10,232,932 | Keep all rows before first occurrence of a value | <p>I have a pandas dataframe and the opposite question to <a href="https://stackoverflow.com/questions/38707165/drop-all-rows-before-first-occurrence-of-a-value">Drop all rows before first occurrence of a value</a></p>
<p>Instead of drop all rows before the first occurence of a value, I want to keep the rows before the... | <python><pandas> | 2024-01-31 15:25:55 | 2 | 6,338 | PV8 |
77,914,370 | 10,415,970 | Pydantic/SQLAlchemy: How to Avoid cyclic reference error on bidirectional models? | <p>I can't run <code>model_validate</code> on my SQLAlchemy ORM because it contains a foreignkey relationship (error at bottom):</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override"><code># models.py
from __future__ import annotations
from pydantic import BaseModel
BaseModel.model_config = {'from_attributes'... | <python><sqlalchemy><pydantic> | 2024-01-31 15:06:47 | 0 | 4,320 | Zack Plauché |
77,914,336 | 4,696,802 | Where to find the pyconfig.h when building Python for Windows? | <p>To use the C API of the Python interpreter you include the Python.h header. And you can <a href="https://github.com/python/cpython" rel="nofollow noreferrer">see</a> that the Python.h header includes a file called pyconfig.h. There is no pyconfig.h in that include folder. Which is why when I include Python.h I get a... | <python><windows> | 2024-01-31 15:02:11 | 1 | 16,228 | Zebrafish |
77,914,222 | 880,874 | read_sql_query() using stored procedure and parameters | <p>How can I pass a parameter to a SQL Stored Procedure?</p>
<p>I've tried so many ways, but they all fail.</p>
<p>Here is my latest attempt.</p>
<p>The parameter is <code>BookId</code>.</p>
<p>Here is my code:</p>
<pre><code>bookId = 653
connection_string = "DRIVER={ODBC Driver 17 for SQL Server};SERVER=dev;DATA... | <python><sql-server><pandas><sqlalchemy> | 2024-01-31 14:45:34 | 1 | 7,206 | SkyeBoniwell |
77,914,135 | 19,125,840 | Weird Behavior of __new__ | <p>I have encountered a peculiar behavior with the <code>__new__</code> method in Python and would like some clarification on its functionality in different scenarios. Let me illustrate with two unrelated classes, <code>A</code> and <code>B</code>, and provide the initial code:</p>
<pre class="lang-py prettyprint-overr... | <python><python-3.x><magic-methods> | 2024-01-31 14:30:09 | 1 | 460 | demetere._ |
77,913,802 | 10,721,627 | How to mock a database connection in FastAPI using polars? | <p>I want to mock <code>pyodbc.Connection</code> in a FastAPI application that uses the <code>polars</code> package to read the database. This is the initial <code>main.py</code> file:</p>
<pre><code>from fastapi import Depends, FastAPI
import polars as pl
import pyodbc
import os
app = FastAPI()
def init_db() -> ... | <python><pytest><fastapi><python-polars> | 2024-01-31 13:41:13 | 1 | 2,482 | Péter Szilvási |
77,913,773 | 8,703,313 | pandas: select value from column name given as a value of another column | <p>I have following dfs:</p>
<pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({'a': [94, 170, 5],
'b': [31, 115, 8]}, index=[11, 12, 13])
df1 = pd.DataFrame({'idx': ["a", "b", "a"]}, index=[11, 12, 13])
</code></pre>
<p><strong>I need to select value fr... | <python><pandas><select> | 2024-01-31 13:37:25 | 1 | 310 | Honza S. |
77,913,743 | 6,281,366 | fastapi - how to use middleware to change the request body? | <p>I know i can create a middleware function using the <code>@app.middleware("http")</code> annotation.</p>
<p>I would like to create such function, that before every POST request, will modify the request body in a way.</p>
<p>I know the generic structure is of this form:</p>
<pre><code>@app.middleware("... | <python><fastapi><starlette> | 2024-01-31 13:33:39 | 1 | 827 | tamirg |
77,913,720 | 16,383,578 | How to parse MFT File Record bytes using ctypes and struct? | <p>Don't know if this is a duplicate, anyway my Google-fu is weak and Google almost never finds anything relevant if I type more than five words.</p>
<p>I am trying to parse Master File Table as located by <code>"//?/X:/$MFT"</code>, I know trying to open it directly will raise <code>PermissionDenied</code>. ... | <python><struct><ctypes><ntfs-mft> | 2024-01-31 13:31:06 | 1 | 3,930 | Ξένη Γήινος |
77,913,561 | 1,445,531 | v2 python programming model and Azure Functions: dynamic amount of blob_output bindings | <p>I'm creating an Azure Function that will receive an array of images URLs and should download them all on Blob storage. I'm using the new v2 programming model with decorators. Here is the dummy code to illustrate:</p>
<pre><code>import azure.functions as func
import datetime
import json
import logging
from pathlib im... | <python><azure-functions> | 2024-01-31 13:06:25 | 1 | 678 | jerorx |
77,913,473 | 15,461,255 | Why pandas value_counts() generates tuples as index? | <p>I have the following pandas dataframe:</p>
<pre><code>import pandas as pd
df = pd.DataFrame({'a': ["Q1", "Q2", "Q1", "P1"]})
</code></pre>
<p>That is:</p>
<pre><code> a
0 Q1
1 Q2
2 Q1
3 P1
</code></pre>
<p>When I count the values with <code>counts = df.value_counts... | <python><pandas> | 2024-01-31 12:53:27 | 1 | 350 | Palinuro |
77,913,463 | 9,208,758 | How to resolve the stride assert error produced by the PyTorch compile? | <p>I am currently trying to run the code from the section 3.2 of the "A QuickPyTorch 2.0 Tutorial" (<a href="https://www.learnpytorch.io/pytorch_2_intro/#27-create-training-and-testing-loops" rel="nofollow noreferrer">https://www.learnpytorch.io/pytorch_2_intro/#27-create-training-and-testing-loops</a>). When... | <python><machine-learning><deep-learning><pytorch><resnet> | 2024-01-31 12:52:11 | 0 | 589 | Isaac A |
77,913,408 | 7,123,933 | How to keep original indentations in YML file after section deletion | <p>I am using Python script to remove specific sections in YML file, which is schema of source tables for DBT in format like:</p>
<pre class="lang-yaml prettyprint-override"><code>models:
- name: model1
columns:
- name: ID
description: user_id
data_type: INT64
- name: ATTR
desc... | <python><yaml> | 2024-01-31 12:42:05 | 1 | 359 | Lukasz |
77,913,385 | 9,138,097 | Find duplicates in environment variables defined in YAML file | <p>I have a kubernetes deployment YAML file, with defined environment variables including duplicated environment variables.
My goal is detect them and print them, as I have hundreds of files which needs to parsed.</p>
<p>Example YAML:</p>
<pre><code>kind: ReplicationController
apiVersion: v1
spec:
template:
... | <python><python-3.x><parsing><yaml><pyyaml> | 2024-01-31 12:37:28 | 0 | 811 | Aziz Zoaib |
77,913,227 | 9,758,017 | Remove the boxes but keep the labels for a YOLOv8 prediction | <p>I am working on a project where I have trained a model using YOLO (from the Ultralytics library - version: 8.0.132) to detect specific objects in images. My classification categories are <strong>[A, B, C, D]</strong>.</p>
<p>In my Jupyter Notebook, I have the following code:</p>
<pre><code>from ultralytics import YO... | <python><yolo><yolov8><ultralytics> | 2024-01-31 12:14:37 | 1 | 1,778 | 41 72 6c |
77,913,154 | 7,662,164 | Vectorizing power of `jax.grad` | <p>I'm trying to vectorize the following "power-of-grad" function so that it accepts multiple <code>order</code>s: (<a href="https://github.com/google/jax/discussions/18834" rel="nofollow noreferrer">see here</a>)</p>
<pre><code>def grad_pow(f, order, argnum):
for i in jnp.arange(order):
f = grad... | <python><loops><vectorization><jax> | 2024-01-31 12:01:31 | 1 | 335 | Jingyang Wang |
77,913,003 | 275,088 | How does autocommit work with multiple queries? | <p>I have a psycopg connection with autocommit turned on. Say, I run a query that is a combination of multiple queries, e.g.:</p>
<pre><code>query = ";".join([create_table, insert_data, analyze_table])
conn.execute(query)
</code></pre>
<p>Is this batch executed in a single transaction or multiple transactions... | <python><psycopg2> | 2024-01-31 11:34:03 | 1 | 16,548 | planetp |
77,912,987 | 6,231,251 | Error with setup.py egg_info while pip-installing my own package | <p>I am building a python package via <code>pip</code>and <code>setuptools</code>. I am testing it on <code>test.pypi</code> and I am building it following <a href="https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/" rel="nofollow noreferrer">this guide</a>.</p>
<p>Prior to build... | <python><pip><setuptools><pypi><python-packaging> | 2024-01-31 11:31:48 | 0 | 882 | sato |
77,912,835 | 4,965,381 | groupby on pandas dataframe created with pandas.read_csv | <p>How do you create a dataframe from a csv file and be able to execute the same <code>groupby</code> command that simply works when creating the dataframe by hand?</p>
<p>Step-by-step i tried to do:</p>
<p>I create a pandas dataframe with multiindexed columns:</p>
<pre><code>df = pd.DataFrame({
('A', 'x'): [1, 2, ... | <python><pandas><group-by> | 2024-01-31 11:08:34 | 2 | 1,067 | voiDnyx |
77,912,770 | 2,233,500 | How to extract data from a wikilinks? | <p>I want to extract data from the wikilinks returned by the <a href="https://github.com/earwig/mwparserfromhell" rel="nofollow noreferrer">mwparserfromhell</a> lib.
I want for instance to parse the following string:</p>
<pre><code>[[File:Warszawa, ul. Freta 16 20170516 002.jpg|thumb|upright=1.18|[[Maria Skłodowska-Cur... | <python><wikipedia> | 2024-01-31 10:57:24 | 1 | 867 | Vincent Garcia |
77,912,637 | 5,769,814 | What is `\*` in Python function definition? | <p>I know what a single asterisk (<code>*</code>) means in a function definition. See, for example, <a href="https://stackoverflow.com/questions/14301967/what-does-a-bare-asterisk-do-in-a-parameter-list-what-are-keyword-only-parame">this question</a>.</p>
<p>However, the <a href="https://docs.python.org/3/library/warni... | <python><python-3.x> | 2024-01-31 10:39:53 | 1 | 1,324 | Mate de Vita |
77,912,612 | 13,392,257 | MySQLdb/_mysql.c:521:9: error: call to undeclared function 'mysql_ssl_set' | <p>My system -- Python version -- 3.8.18 and OS version -- macOS ventura 13.6.4</p>
<p>I have an error when I want to install mysqlclient</p>
<pre><code> pip install mysqlclient==2.2.0
</code></pre>
<p>Error: (full log below)</p>
<pre><code>MySQLdb/_mysql.c:521:9: error: call to undeclared function 'mysql_ssl_set'
</c... | <python><mysql><pip><feast> | 2024-01-31 10:36:32 | 0 | 1,708 | mascai |
77,912,467 | 7,347,925 | How to clip tile imagery by patch? | <p>I'm trying to clip the satellite background image by circle:</p>
<pre><code>import io
from PIL import Image
import cartopy.crs as ccrs
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import cartopy.io.img_tiles as cimgt
from urllib.request import urlopen, Request
def image_spoof(self, tile):
... | <python><matplotlib><patch><cartopy><clip> | 2024-01-31 10:13:25 | 1 | 1,039 | zxdawn |
77,912,307 | 11,963,167 | Managing pd.Series and pd.DatetimeIndex in a function simultaneously | <p>I have a function meant to examine time-series data, usually obtained from a pandas dataframe. However, there are usually two ways to store this kind of data: the time-series can be stored in a column (in that case, it is a <code>pd.Series</code>, kind of), or serves as the dataframe's index. In that latter case, it... | <python><pandas><dataframe><time-series> | 2024-01-31 09:50:53 | 0 | 496 | Clej |
77,912,302 | 4,609,258 | PyCloudinary "Invalid value for parameter kind" while trying to upload to Cloudinary | <p>I'm trying to use <a href="https://cloudinary.com/documentation/python_quickstart" rel="nofollow noreferrer">the quickstart guide</a> with our test system.</p>
<pre><code> cloudinary.uploader.upload("https://cloudinary-devs.github.io/cld-docs-assets/assets/images/butterfly.jpeg", public_id="quickstart... | <python><cloudinary> | 2024-01-31 09:50:14 | 1 | 866 | Florian Straub |
77,912,077 | 10,721,627 | How to connect to Azure SQL Database in Python using pyodbc? | <p>I would like to connect to an Azure SQL database via <code>pyodbc</code> Python package. I obtained the connection string by navigating to the Azure SQL database resource and going to the <strong>Connection strings</strong> menu under the <strong>Settings</strong> group. After, I selected the <strong>ODBC</strong> t... | <python><sql-server><azure><pyodbc> | 2024-01-31 09:15:36 | 1 | 2,482 | Péter Szilvási |
77,912,040 | 2,688,929 | Using local library in Ansible filter_plugin | <p>I am creating a bunch of filter plugins for Ansible (2.9/2.13) and I would like to have a tools library that can be used by these filter plugins.</p>
<p>I have the directory <code>filter_plugins</code> under my playbook directory and in there, I have a bunch of python scripts that provide Ansible with various filter... | <python><ansible> | 2024-01-31 09:07:45 | 2 | 427 | Johan G |
77,912,012 | 265,521 | "Collection if" in Python | <p>Dart has a neat feature called <a href="https://dart.dev/language/collections#control-flow-operators" rel="nofollow noreferrer">collection if</a>. It lets you conditionally include an element in a list literal. For example:</p>
<pre><code>var nav = ['Home', 'Furniture', 'Plants', if (promoActive) 'Outlet'];
</code><... | <python> | 2024-01-31 09:02:25 | 2 | 98,971 | Timmmm |
77,911,884 | 987,074 | Python Azure Function works in local emulator but no HTTP triggers found when deploying | <p>I have 5 Azure Functions I'm developing, and 4 of them deploy and work fine, just having this trouble with one of them.</p>
<p>I have the Azure Functions Core Tools installed and Azurite running as a VSCode plugin, and am able to run my function with no errors by calling <code>func start --python --verbose</code> fr... | <python><azure-functions> | 2024-01-31 08:40:46 | 1 | 3,544 | bdx |
77,911,883 | 1,860,805 | How get local IANA zone name in python 3 | <p>In python 3 how to get local zone name (e.g Australia/Sydney)</p>
<p>I tried like this</p>
<pre><code>import datetime
local_tzname = datetime.datetime.now().astimezone().tzinfo
print(local_tzname)
</code></pre>
<p>this outputs like this</p>
<blockquote>
<p>AEDT</p>
</blockquote>
<p>But I want to output like this wh... | <python><python-3.x><linux><timezone> | 2024-01-31 08:40:43 | 1 | 523 | Ramanan T |
77,911,745 | 2,784,032 | Install Python on Self Hosted Windows runner for Github Action | <p>I am using Windows Server 2019 as a self hosted runner for my Github Actions. I need to install Python.
Shall install this python as one time activity or through github action workflow every time that workflow is executed?</p>
<p>I came across <a href="https://github.com/actions/setup-python/blob/main/docs/advanced-... | <python><github-actions-self-hosted-runners> | 2024-01-31 08:13:58 | 1 | 856 | Maxx |
77,911,732 | 3,099,733 | Final is not working with type alias in Python | <p>Given the following code</p>
<pre class="lang-py prettyprint-override"><code>from typing import Final
ImmutableStr = Final[str]
class Test:
s1: ImmutableStr = 'abc'
s2: Final[str] = 'abc'
t = Test()
t.s1 = 'def' # pass type check
t.s2 = 'def' # error detected
</code></pre>
<p>In VsCode only report erro... | <python><python-typing><pyright> | 2024-01-31 08:12:11 | 0 | 1,959 | link89 |
77,911,535 | 10,053,485 | SQLAlchemy running on Kubernetes Pod, broken behaviour compared to localhost: Async issue / Missing Greenlet | <p>When running an API (using FastAPI) I'm building on my Localhost it works as intended, when deploying it to a kubernetes pod it does not. It is unclear to me as to why, though the error appears to suggest an async issue. This seems unusual to me, as I would also expect this to then also be an issue on the localhost.... | <python><kubernetes><sqlalchemy> | 2024-01-31 07:36:30 | 0 | 408 | Floriancitt |
77,911,530 | 1,153,768 | Identifying what triggers a join timeout multiprocessing | <p>I am trying to work out why my multiprocessing hangs, it is not regular, sometimes it will hang after 10 minutes sometimes after hours</p>
<p>This is a reduced version of the code. I start the job and then join the jobs</p>
<pre><code>jobs = []
for item in items_to_do:
p = multiprocessing.Process(target=index_a... | <python><multiprocessing><timeout> | 2024-01-31 07:35:37 | 1 | 929 | mozman2 |
77,911,424 | 17,580,381 | Interesting behaviour of contextlib.redirect_stdout | <p>Let's start with a contrived piece of code. Explanation will follow:</p>
<pre><code>from timeit import timeit
from os import devnull
from contextlib import redirect_stdout
def process():
for i in range(1_000):
print(f"Message {i}")
N = 10_000
if __name__ == "__main__":
with red... | <python> | 2024-01-31 07:13:15 | 1 | 28,997 | Ramrab |
77,911,210 | 12,789,602 | In odoo 16, ValueError: message_post does not support subtype parameter anymore. Please give a valid subtype_id or subtype_xmlid value instead | <p>I have call <code>message_post</code> function from a wizard TransientModel. and use subtype of <code>hr_recruitment.mt_job_applicant_hired</code> and also add depended module in manifest.json but its showing error</p>
<pre><code>ValueError: message_post does not support subtype parameter anymore. Please give a vali... | <python><odoo><odoo-16> | 2024-01-31 06:30:02 | 1 | 552 | Bappi Saha |
77,911,173 | 4,238,408 | Discrepancy between OpenCV Python and C++ implementations of `imreconstruct` | <p>I'm implementing MATLAB's <code>imreconstruct</code> in both Python and C++. However, for my test case, the Python implementation matches the MATLAB's output, the C++ one doesn't.</p>
<p>This is the Python implementation:</p>
<pre class="lang-py prettyprint-override"><code>def imReconstruct(marker: np.array, mask: n... | <python><c++><opencv> | 2024-01-31 06:20:07 | 1 | 151,120 | Quang Hoang |
77,911,172 | 18,730,707 | If you specify a background color in pandas in python, number formatting is disabled | <p>After sorting the data in pandas, I am saving it in Excel. At this time, we are trying to improve readability by changing the format. I specified the number format and background color at the same time, but there is an error where only one of the two is specified. I'm pretty sure this isn't an error, it's just 'I'm ... | <python><pandas><xlsxwriter> | 2024-01-31 06:20:00 | 2 | 878 | na_sacc |
77,911,091 | 5,751,473 | Not more than one special symbol in a range from a long text | <p>Simplify the problem:</p>
<p>There is an article (long text)</p>
<p>Extract the content between <code>start</code> (included) and <code>end</code> (included)</p>
<p>Requirement: There cannot be more than one <code>\n</code> between <code>start</code> and <code>end</code></p>
<p>Find all matches</p>
<p>Use <code>pyth... | <python><regex><python-re> | 2024-01-31 06:01:20 | 1 | 430 | Se ven |
77,910,877 | 3,795,219 | Why is VSCode Ctrl+Space suggesting all words, vice methods/attributes? | <p>Using <code>Ctrl+Space</code> while editing a python file triggers a suggestions popup. However, rather than linting the object and suggesting its methods/attributes, my popup shows me all words in the file (sorted alphabetically).</p>
<p>For instance, <code>10_000</code> and <code>10k</code> are just words listed i... | <python><visual-studio-code><intellisense><lint> | 2024-01-31 04:51:52 | 0 | 8,645 | Austin |
77,910,876 | 3,123,290 | "relation x does not exist" in Sqlalchemy 2.0 Async when it very clearly does | <p>I have tried to boil this down to the most basic of test cases. This is part of our test mocking; the db_session is mapped to a test-specific schema, I confirm that the setup works and the test-specific schema has the the required table, and then add a record to that table.</p>
<pre class="lang-py prettyprint-overri... | <python><sqlalchemy><python-asyncio> | 2024-01-31 04:51:32 | 1 | 778 | EthanK |
77,910,795 | 11,753,262 | How the __name__ of a Python module be defined with different import method? | <p>I'm struggling to understand how <code>__name__</code> of a module be defined, especially in different import methods. Suppose a directory tree:</p>
<pre><code>├ main.py
└ test/
├── __init__.py
├── a
│ ├── a1.py
│ ├── base.py <- a1.py and b1.py will import it
│ └── __init__.py
└── b
├──... | <python><python-3.x><python-import> | 2024-01-31 04:20:55 | 1 | 385 | Chun-Ye Lu |
77,910,640 | 1,070,833 | python OCIO colour space conversions - colour issue | <p>I have a test 16bit tiff file that is using ACEScc colour space:
<a href="https://i.sstatic.net/7NzcT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7NzcT.png" alt="acess_cc" /></a></p>
<p>I want to process it using OCIO to, for instance, linear sRGB.
OCIO provides examples of how to do it:
<a href="... | <python><image-processing><colors><openimageio> | 2024-01-31 03:24:41 | 2 | 1,109 | pawel |
77,910,394 | 2,805,482 | How to get text in white color from image in grey background and paste it on another image | <p>Hi I am using opencv to extract text in white from one image and paste it on another. I am using below approach for black image background and it works fine. Check the below code</p>
<pre><code>import cv2
import numpy as np
image_msg = (30, 209, 187, 31)
base_path="/Users/images/"
mask_image1 = "{}sh... | <python><numpy><opencv><image-processing> | 2024-01-31 01:51:50 | 2 | 1,677 | Explorer |
77,910,368 | 1,412,564 | Django - is there a way to shuffle and run only a subset of tests? | <p>We are using Django with tests. We have in total about 6,000 tests which take about 40 minutes to run. Is there a way to shuffle the tests and run only 200 (randomly chosen) tests? This should be done with a command line parameter with the number 200 (which may change), since usually we run all the tests.</p>
<p>Thi... | <python><django><django-tests><django-unittest><manage.py> | 2024-01-31 01:40:35 | 2 | 3,361 | Uri |
77,910,348 | 13,379,052 | D5RF - Display something in HTML format before processing API requests | <p><strong>Django 5 - Rest Framework</strong></p>
<p>I am building a Django REST API project. I am currently dealing with a request that takes so long to process. I want to know if I could display something like an HTML Response before the request is processed, or just like a text saying: <code>Loading... Please wait.<... | <python><django><django-rest-framework> | 2024-01-31 01:33:27 | 1 | 442 | Coderio |
77,910,224 | 8,540,947 | How to check if a node in Maya is read only using Python | <p>I was trying to find a Maya command or flag to use to check if a node is read only in Maya using Python. There does not seem to be a direct way to query this, but it must be needed fairly often?</p>
| <python><maya> | 2024-01-31 00:49:24 | 2 | 519 | winteralfs |
77,910,172 | 22,212,435 | Why do Entries have different text using the same Variable? | <p>Basically, I was just experimenting with tkinter and decided to write this useless code:</p>
<pre><code>import tkinter as tk
root = tk.Tk()
var = tk.IntVar(value=1)
class SmallClass(tk.Frame):
def __init__(self, special_var: tk.IntVar, *args, **kwargs):
super().__init__(*args, **kwargs)
self.la... | <python><tkinter> | 2024-01-31 00:29:02 | 0 | 610 | Danya K |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.