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,781,957 | 7,875,799 | How to prevent premature deletion of built-in functions by garbage collector on application exit | <p>Here is a short script with a class that dumps some data to disk upon destruction:</p>
<pre><code>import pickle
class MyClass(object):
def __init__(self):
self._some_data = "lorem ipsum dolor sit"
def __del__(self):
with open("/some/file/to/dump/data.pickle", 'wb') as o... | <python><garbage-collection> | 2024-01-08 16:39:47 | 1 | 2,462 | Leander Moesinger |
77,781,920 | 1,911,091 | protobuf serializetostring in python ends with \x00, reparsing in C++ fails | <p>I have the following proto file :</p>
<pre><code>// [START declaration]
syntax = "proto3";
...
// message from cloud to device
message Downstream
{
// types
message GetValues{}
// fields
uint32 TargetDeviceAddress=1;
oneof sub_message{
Axis target_axis=2; // new axis values ... | <python><c++><protocol-buffers> | 2024-01-08 16:33:26 | 0 | 1,442 | user1911091 |
77,781,909 | 4,025,749 | Priority is not integer in clickup api | <p>I am using <a href="https://github.com/Imzachjohnson/clickupython" rel="nofollow noreferrer">clickuppython</a> to call clickup API. When I set Priority in Clickup dashboard (e.g. High), I get this error</p>
<pre class="lang-py prettyprint-override"><code> # Example request | Creating a task in a list
... | <python><clickup-api> | 2024-01-08 16:30:10 | 1 | 616 | Omid Erfanmanesh |
77,781,835 | 8,280,171 | Passing Secret Value to DocumentDB | <p>I'm creating a secret and passing it as a user password to AWS DocumentDB with Python CDK but i keep getting Could not parse SecretString JSON error.</p>
<pre><code> excluded_characters = "!@#$%^&*()`~,}{[]_=+'?\/|<>:;-" + '"'
generated_database_password = secretsmanager.Secr... | <python><amazon-web-services><aws-cdk><aws-secrets-manager> | 2024-01-08 16:12:34 | 1 | 705 | Jack Rogers |
77,781,781 | 6,630,397 | instantiate a django form in readonly mode in a view function | <p>I have a django 4 form having some widgets for the user to select some values:</p>
<pre class="lang-py prettyprint-override"><code>from django import forms
from .app.model import MyModel
from bootstrap_datepicker_plus.widgets import DatePickerInput
class FooForm(forms.ModelForm):
# stuff
class Meta:
... | <python><django><django-forms><readonly><django-widget> | 2024-01-08 16:01:31 | 2 | 8,371 | swiss_knight |
77,781,712 | 15,912,168 | DataFrame to XML Conversion: Price Value Multiplication Issue in Pandas | <p>I'm encountering an issue while working with pandas in Python. I have a script that receives a DataFrame containing product details, prices, and other information. My goal is to convert this DataFrame into an XML format to subsequently send it to a database. There are additional processes involved in this workflow.<... | <python><pandas><dataframe> | 2024-01-08 15:49:57 | 1 | 305 | WesleyAlmont |
77,781,708 | 23,196,983 | seaborn jointplot axes don't match after adding a colorbar | <p>I am using seaborn to create a jointplot with kind='hist'. When I add the colorbar for the histogram to the plot the grid for the jointplot and the single histogram no longer match. I am pretty sure this is because I add the colorbar to the axis, but I have no idea how to do it differently and wasn't able to find an... | <python><matplotlib><seaborn> | 2024-01-08 15:48:35 | 1 | 310 | Frede |
77,781,377 | 1,396,516 | How to run a one-off Python unzipping script (19Gb .7z archive) on GC? | <p>I need to extract files from the archive on a one-off basis. The Python code that can handle the task is very simple:</p>
<pre><code>from py7zr import unpack_7zarchive
import shutil
shutil.register_unpack_format('7zip', ['.7z'], unpack_7zarchive)
path = 'gs://my_bucket/my_archive.7z'
shutil.unpack_archive(path, '')... | <python><google-cloud-storage><7zip> | 2024-01-08 14:58:00 | 1 | 3,567 | Yulia V |
77,781,150 | 730,858 | Descriptor not being invoked and not getting the desired output | <pre><code>class MaxLength:
def __init__(self, max_length):
self.max_length = max_length
def __get__(self, instance, owner):
print("get called")
return self.max_length
def __set__(self, instance, value):
if not isinstance(value, str):
raise ValueError(... | <python> | 2024-01-08 14:22:26 | 0 | 4,694 | munish |
77,781,132 | 2,971,574 | Transform pyspark dataframe to code / syntax | <p>Let's assume I've got the following pyspark dataframe in Databricks:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>some_other_column</th>
<th>price_history</th>
</tr>
</thead>
<tbody>
<tr>
<td>test1</td>
<td>[{"date":"2021-03-21T01:20:33Z","price_tag":&quo... | <python><pyspark> | 2024-01-08 14:19:48 | 2 | 555 | the_economist |
77,781,015 | 1,803,648 | global python library installation where pipx is not an option | <p>I understand as of <a href="https://peps.python.org/pep-0668/" rel="nofollow noreferrer">PEP-0668</a> we're supposed to be installing python executables via <code>pipx</code>. What about packages such as a <a href="https://mopidy.com/" rel="nofollow noreferrer">mopidy</a> plugin <a href="https://mopidy.com/ext/spoti... | <python><linux><pip><debian><pipx> | 2024-01-08 14:08:07 | 0 | 598 | laur |
77,780,873 | 1,413,513 | Removing certain end-standing values from list in Python | <p>Is there an elegant Pythonic way to perform something like <code>rstrip()</code> on a list?</p>
<p>Imagine, I have different lists:</p>
<pre><code>l1 = ['A', 'D', 'D']
l2 = ['A', 'D']
l3 = ['D', 'A', 'D', 'D']
l4 = ['A', 'D', 'B', 'D']
</code></pre>
<p>I need a function that will remove <em>all end-standing</em> <co... | <python><list> | 2024-01-08 13:54:46 | 5 | 5,461 | CodingCat |
77,780,829 | 22,466,650 | How to avoid redundant logins when instantiating inter-dependent objects? | <p>I have two classes: <code>LogSess</code> (for login) and <code>DataReq</code> (for fetching a json).</p>
<p>The problem I face is that the instantiation of <code>DataReq</code> depends on the one of <code>LogSss</code>. So whenever I create <code>DataReq</code> objects, I keep logged in again and again. The desired ... | <python><class><python-requests> | 2024-01-08 13:51:28 | 1 | 1,085 | VERBOSE |
77,780,714 | 8,921,867 | SQLAlchemy why have model classes inherit from class Base(DeclarativeBase) instead of DeclarativeBase directly? | <p>The ORM quickstart guide for SQLAlchemy 2.0 defines a practice where you should define a simple child class of <code>DeclarativeBase</code> and let all your model classes inherit from that.</p>
<p>Example straight from the <a href="https://docs.sqlalchemy.org/en/20/orm/quickstart.html#learn-the-above-concepts-in-dep... | <python><sqlalchemy> | 2024-01-08 13:41:54 | 0 | 2,172 | emilaz |
77,780,485 | 11,462,274 | A template to bring the CMD window to the foreground while executing any Python code | <p>When I want to bring VSCode to the foreground by running any Python in the terminal, I do it this way:</p>
<pre class="lang-python prettyprint-override"><code>import subprocess
import os
VS_CODE_PATH = r'C:\Users\Computador\AppData\Local\Programs\Microsoft VS Code\Code.exe'
def attention() -> None:
subproce... | <python><cmd> | 2024-01-08 13:14:53 | 1 | 2,222 | Digital Farmer |
77,780,347 | 1,391,441 | Evaluating Laplacian using sympy does not match Wolfram-Alpha | <p>I have a function whose Laplacian needs to be solved and evaluated. Using <a href="https://www.sympy.org/" rel="nofollow noreferrer"><code>sympy</code></a> and <a href="https://www.wolframalpha.com/input?i=laplacian%20A%2Fsqrt%28x%5E2%2B%28B%2Bsqrt%28y%5E2%2BC%29%29%5E2%29&lang=es" rel="nofollow noreferrer">Wolf... | <python><sympy><laplacian> | 2024-01-08 12:58:59 | 0 | 42,941 | Gabriel |
77,780,228 | 469,294 | pandas Series replace with backfill alternative | <p>The documentation of <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.replace.html" rel="nofollow noreferrer">pandas.Series.replace</a> includes an example:</p>
<pre><code>>> import pandas as pd
>> s = pd.Series([1, 2, 3, 4, 5])
>> s.replace([1, 2], method='bfill')
0 3
1 3
... | <python><pandas> | 2024-01-08 12:45:35 | 1 | 5,177 | yucer |
77,780,165 | 143,336 | ROS2 colcon build fails with ModuleNotFoundError for Python dependency in virtual environment | <p>When trying to build my ROS2 project, I get a <code>ModuleNotFoundError</code> when compiling one of the C modules, due to a missing dependency called <code>em</code>:</p>
<pre><code>% colcon build --cmake-clean-cache
Starting >>> r1_messages
--- stderr: r1_messages ... | <python><cmake><virtualenv><ros2><colcon> | 2024-01-08 12:40:10 | 1 | 10,735 | Matt Ryall |
77,779,927 | 10,896,698 | Change file custom properties/columns in SharePoint with Python API | <p>I'm trying update custom created column for files in a SharePoint using Python API.</p>
| <python><sharepoint><sharepoint-api> | 2024-01-08 12:15:04 | 1 | 467 | nklsla |
77,779,818 | 12,243,638 | Create a dataframe from permutation of two columns from two different dataframes | <p>There are two dataframes which look like the below:</p>
<p>df_1:</p>
<pre><code> A1
0 2023-12-30
1 2023-12-31
</code></pre>
<p>df_2:</p>
<pre><code> B1 B2 B3
501 Sam 159cm 300gm
502 Tam 175cm 400gm
</code></pre>
<p>I want to make another dataframe with the combination of these two. ... | <python><pandas> | 2024-01-08 12:04:41 | 2 | 500 | EMT |
77,779,721 | 11,426,624 | np.select join all true values together | <p>I have a dataframe and would like to check for each row which of my conditions are true. If multiple are true I would like to return all of those choices with np.select. How can I do this?</p>
<pre><code>df = pd.DataFrame({'cond1':[True, True, False, True],
'cond2':[False, False, True, True],
... | <python><pandas><dataframe><numpy> | 2024-01-08 11:51:24 | 2 | 734 | corianne1234 |
77,779,183 | 5,479,129 | Emacs lsp update pylsp server | <p>I'm trying to update the lsp server in python-mode based on the current project in order to use the correct virtualenv.</p>
<p>I'm doing something like this</p>
<pre><code>(use-package python-mode
:ensure t
:preface
(defun projectile-set-lsp-venv ()
"Set pyenv version matching project name."
(le... | <python><emacs> | 2024-01-08 11:03:30 | 0 | 1,398 | Isky |
77,779,141 | 1,043,882 | Data cardinality is ambiguous in shape of input to LSTM layer | <p>Suppose I have these 7 time-series samples:</p>
<pre><code>1,2,3,4,5,6,7
</code></pre>
<p>I know there is a relation between each sample and its two earlier ones. It means when you know two earlier samples are <code>1,2</code> then you can predict the next one must be <code>3</code> and for <code>2,3</code> the next... | <python><tensorflow><keras><neural-network><lstm> | 2024-01-08 10:59:28 | 1 | 14,064 | hasanghaforian |
77,778,901 | 5,457,202 | Bugged Park transform on three-phase signal | <p>I'm supposed to apply Clarke-Park transformation to an electrical signal so other people at my office can study the "quality" (?) of said signal.</p>
<p>I was given a Jupyter Notebook replicating the tutorial from <a href="https://pypi.org/project/ClarkePark/" rel="nofollow noreferrer">here</a>, which is p... | <python><signal-processing> | 2024-01-08 10:33:14 | 0 | 436 | J. Maria |
77,778,798 | 15,098,472 | Import parameters from config, but create the config first if it does not exist | <p>I have some global constants, that are saved in a .py file and that are needed at many different places in the codebase:</p>
<pre class="lang-py prettyprint-override"><code>from important_parameters import ROOT_DIR, ANOTHER_DIR
</code></pre>
<p>This import is needed in many files, and is more convenient than passing... | <python><import> | 2024-01-08 10:17:16 | 2 | 574 | kklaw |
77,778,689 | 4,405,942 | pytest fake filesystem and unittest mock interfere | <p>I have a large pytest suite for a django project which uses plenty of mockers (<a href="https://docs.python.org/3/library/unittest.mock.html" rel="nofollow noreferrer">unittest.mock</a>, <a href="https://pypi.org/project/requests-mock/" rel="nofollow noreferrer">requests-mock</a> and <a href="https://github.com/pnuc... | <python><pytest><pytest-django><pyfakefs> | 2024-01-08 10:01:32 | 0 | 2,180 | Gerry |
77,778,336 | 11,801,298 | Expand distance between values in pandas dataframe | <p>How to expand distance between values in pandas dataframe?</p>
<pre><code> A
1 3
2 5
3 6
5 5
6 9
</code></pre>
<p>I want to increase the distance between adjacent elements by x times, for example by two times.</p>
<p>Expected output:</p>
<pre><code> A B
1 3 3
2 5 7 # (3 + 2 * 2)
3 6 9 # (7 + 1 * 2)
5 5 7 # (9 -... | <python><pandas> | 2024-01-08 09:23:24 | 2 | 877 | Igor K. |
77,777,699 | 11,630,148 | Weird bug when creating a user in django | <p>I have a weird bug in django where I have 2 different profile models for each user type and one profile model creates two profile models when I create a User.</p>
<p>Here's my code for the user model:</p>
<pre class="lang-py prettyprint-override"><code>class User(TimeStampedModel, AbstractUser):
class Types(mode... | <python><django> | 2024-01-08 07:51:27 | 2 | 664 | Vicente Antonio G. Reyes |
77,777,436 | 700,023 | Why doesn't Spark change the physical plan after caching? | <p>I'm trying to understand how caching of some dataframes alters the physical plan.
Its my understanding that if a dataframe is cached then subsequent computation that uses that dataframe should not re-evaluate the operations needed by the dataframe.</p>
<p>Unfortunately there does not seem to be a difference between ... | <python><dataframe><apache-spark><pyspark><caching> | 2024-01-08 07:11:28 | 1 | 5,069 | fstab |
77,777,407 | 5,157,081 | How can I pass data from API endpoint (request) to middleware in FastAPI? | <p>I would like to implement a logic, where every API endpoint will have its API Credits (of <code>int</code> type), which I am going to use in an HTTP middleware to deduct credits from the user's balance.</p>
<p>I have searched a lot, but have been unable to find a solution. Could anyone help me to achieve this? I am ... | <python><fastapi><middleware><starlette><fastapi-middleware> | 2024-01-08 07:05:42 | 1 | 341 | Moiz Travadi |
77,776,619 | 11,053,801 | Global variable get undefined on re-run of Flask app | <p>global variables get undefined on re-run of flask app,
I have 3 files,</p>
<p>api.py</p>
<pre><code>import trainer
app = Flask(__name__)
@app.route('/start', methods=['POST'])
def apifunc(id):
result = trainer.consume(id)
return jsonify(result)
if __name__ == '__main__':
app.run(debug=True, port=LISTEN_P... | <python><flask> | 2024-01-08 05:06:14 | 1 | 1,616 | hanzgs |
77,775,828 | 15,455,922 | Database config for Django and SQL Server - escaping the host | <p>I have setup my Django app to use Microsoft SQL Server database. This is my database config.</p>
<pre><code> DATABASES = {
'default': {
'ENGINE': 'mssql',
'NAME': "reporting",
'HOST': '192.168.192.225\SQL2022;',
'PORT': 1433,
'USER': "sa",
'PASS... | <python><sql-server><django><escaping> | 2024-01-08 02:03:30 | 1 | 746 | Mess |
77,775,597 | 8,893,835 | How to convert these functions to act on the entire dataframe and speed up my python code | <p>In an attempt to backtest the much-discussed trading approach known as the Smart Money Concept, I made a Python class with a few functions.</p>
<p>Now, the mistake I made was to make each function operate on the last candle/row and return results only for that row/candle. This has turned out to be a mistake because ... | <python><algorithmic-trading><pyalgotrade> | 2024-01-08 00:50:06 | 2 | 468 | chawila |
77,775,538 | 11,210,476 | Python: How to statically refer to the return type of a function | <p>If I imported a function from a module, can I make the linter & type checker to refer to its return type?</p>
<ul>
<li>I don't want to call the function</li>
<li>I don't want runtime solution, like <code>inpsect</code> module.</li>
<li>For some reason, I can't import the type itself, e.g. its not meant to be imp... | <python><python-typing> | 2024-01-08 00:32:02 | 1 | 636 | Alex |
77,775,267 | 2,144,868 | Combine argparse.MetavarTypeHelpFormatter, argparse.ArgumentDefaultsHelpFormatter and argparse.HelpFormatter | <p>I want to display default values, argument type, and big spacing for <code>--help</code>.</p>
<p>But if I do</p>
<pre class="lang-py prettyprint-override"><code>import argparse
class F(argparse.MetavarTypeHelpFormatter, argparse.ArgumentDefaultsHelpFormatter, lambda prog: argparse.HelpFormatter(prog, max_help_positi... | <python><argparse> | 2024-01-07 23:01:34 | 2 | 305 | llodds |
77,775,036 | 825,924 | How to disable load_ssh_configs in fabric (used as library) from user code? | <p>I'm using <code>fabric</code> as a library and want to avoid loading my local <code>~/.ssh/config</code> file (etc).</p>
<p><a href="https://docs.fabfile.org/en/latest/concepts/configuration.html#disabling-ssh-config" rel="nofollow noreferrer">Fabrics configuration docs</a> declare: "To do so, simply set the to... | <python><paramiko><fabric> | 2024-01-07 21:42:44 | 1 | 35,122 | Robert Siemer |
77,774,853 | 4,547,189 | Superset guest token returns login page | <p>I am trying to embed the dashboard into an iframe on another site. Both the sites are on HTTP only. Here are the configs in the superset file</p>
<pre><code>PUBLIC_ROLE_LIKE_GAMMA: True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_SAMESITE = 'LAX'
SESSION_COOKIE_HTTPONLY = True
PUBLIC_ROLE_LIKE: 'Gamma'
HTTP_HEADERS... | <python><embed><apache-superset> | 2024-01-07 21:00:06 | 1 | 648 | tkansara |
77,774,595 | 14,120,387 | Reformat CloudWatch logs sent to S3 using Kinesis Firehose for JSON | <p>I have a working setup that sends CloudWatch logs to a S3 bucket using Kinesis Firehose. Unfortunately the files in S3 do not contain properly formatted JSON. A properly formatted array of JSON objects will look like this: [{}, {}, {}]. However, the S3 files created by Firehose look like this: {}{}{}. I am attem... | <python><amazon-web-services><amazon-s3><aws-lambda><amazon-cloudwatch> | 2024-01-07 19:45:11 | 1 | 418 | Brian G |
77,774,517 | 7,961,594 | How to create a Python GTK3 TreeView column which contains BOTH text and images | <p>I have a GTK3 Python program with a TreeView, and I would like to have a column that mostly contains text, but can also contain an image. I've been asking ChatGPT, but this is as close as I can get:</p>
<pre><code>import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf
class TreeViewExam... | <python><treeview><gtk3> | 2024-01-07 19:25:43 | 1 | 1,095 | Jeff H |
77,774,515 | 18,321,042 | PdfWriter Python how to update field with multiline text | <p>I've been trying for hours to insert a multiline text into a PDF with Python but none of the potential solutions worked. I've looked at multiple libraries and other solutions but none of them were using PdfWriter or helped solve my problem
Here are a few of my tries:</p>
<ul>
<li>\n</li>
<li>\r</li>
<li>\t</li>
<li>... | <python><newline><pdf-writer> | 2024-01-07 19:24:47 | 1 | 575 | Liam |
77,774,435 | 5,332,914 | Reading And Filtering a CSV files Column | <p>I am reading a dataframe and finding the len using a condition like this:</p>
<pre><code>import pandas as pd
gf = pd.read_csv(raw_github_csv_file_url)
print(len(gf[gf["gender"]=="M"]))
</code></pre>
<p>My CSV has these columns:</p>
<p>id | profile | author | gender | flag
<a href="https://i.ssta... | <python><pandas><google-colaboratory> | 2024-01-07 19:00:34 | 1 | 2,046 | user404 |
77,774,225 | 1,123,733 | How to batch two select queries in sqlalchemy to avoid multiple requests? | <p>Is it possible to batch independent database requests in SQLAlchemy? Say I have a setup like this:</p>
<pre class="lang-py prettyprint-override"><code>from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session
Base = declarative_base()
... | <python><sqlalchemy> | 2024-01-07 18:04:27 | 0 | 1,883 | nullUser |
77,774,217 | 16,383,578 | How to extract several rotated shapes from an image? | <p>I had taken an online visual IQ test, in it a lot of questions are like the following:</p>
<p><img src="https://www.idrlabs.com/static/i/eysenck-iq/en/3.png" alt="" /></p>
<p><img src="https://www.idrlabs.com/static/i/eysenck-iq/en/5.png" alt="" /></p>
<p><img src="https://www.idrlabs.com/static/i/eysenck-iq/en/7.pn... | <python><opencv><image-processing><computer-vision> | 2024-01-07 18:01:50 | 1 | 3,930 | Ξένη Γήινος |
77,774,216 | 2,567,544 | How do Python enums enforce read access only? | <p>I understand that in Python constants are implied, but not enforced, by an uppercase variable name. I also understand that by subclassing from Enum, a class can implement an enumerated type which prevents the individual enumerated values from being overwritten.</p>
<p>These two idioms seem to me to be somewhat at od... | <python><enums> | 2024-01-07 18:00:43 | 1 | 607 | user2567544 |
77,774,153 | 9,931,606 | Error building MySQLclient wheel on Python 3.12.0: clang error - invalid active developer path | <p>I'm encountering an issue while trying to install the <code>mysqlclient</code> package on Python <code>3.12.0</code>. The build process fails with a clang error. I've included the relevant error output below.</p>
<p>Note: I have turned to use <code>PySQL</code> and it rightly worked. But I still want to dig into and... | <python><macos><pip><libmysqlclient> | 2024-01-07 17:43:14 | 1 | 323 | littleAnt |
77,774,062 | 1,005,334 | quart-cors no longer working after update | <p>I've been using Quart with quart-schema and quart-cors for some time, and since the latest version of quart-schema provides some updates I can use, I upgraded the Quart packages with pip.</p>
<p>It all works fine, except the front-end now throws CORS errors at me:</p>
<blockquote>
<p>Access to fetch at 'http://abc.a... | <python><cors><quart><hypercorn> | 2024-01-07 17:17:31 | 1 | 1,544 | kasimir |
77,773,884 | 8,754,958 | Python Scrapy Splash Extremely Slow with Single Page | <p>I'm new to Scrapy with Splash and would appreciate some advice. I'm trying to scrape the website <a href="https://www.canada.ca/en/revenue-agency/services/forms-publications/forms.html" rel="nofollow noreferrer">https://www.canada.ca/en/revenue-agency/services/forms-publications/forms.html</a>, which contains a list... | <python><scrapy><splash-screen> | 2024-01-07 16:28:13 | 0 | 805 | Geoff L |
77,773,861 | 2,251,142 | How to run python source file and display source code and output | <p>[Added] <strong>Background</strong>: I am trying to make a script to preprocess markdown files containing examples in various languages (R, Stata, and python for now). For each markdown file, my script extracts the code blocks and save the code blocks to files, say "temp.R", "temp.do", and "... | <python> | 2024-01-07 16:20:27 | 1 | 663 | chan1142 |
77,773,655 | 2,244,093 | Prisoner's dilemma strange results | <p>I tried to implement a prisoner's dilemma in Python, but my results, instead of showing that tit for tat is a better solution, it is showing that defecting is giving better results.</p>
<p>Can someone look at my code, and tell me what I have done wrong here?</p>
<pre><code>import random
from colorama import Fore, St... | <python><game-theory> | 2024-01-07 15:21:00 | 1 | 1,010 | danielassayag |
77,773,403 | 6,637,269 | Find a concave hull of an array of integer points on a grid | <p>I have arrays of thousands of points on an integer grid. I'm looking for a fast way of finding a concave hull for the points. Points are adjacent if they are 1 unit away in any cardinal direction. I am ambivalent about whether the boundary should move diagonally (i.e. cutting corners as shown below from <code>[391,4... | <python><matplotlib><polygon><shapely><boundary> | 2024-01-07 14:16:24 | 1 | 870 | Josh Kidd |
77,773,293 | 12,178,630 | Python dictionary sorting weird behaviour | <p>I would like to sort a python dictionary by multiple criteria depending on a condition on its values, like:</p>
<pre><code>d = {'27': 'good morning', '14': 'morning', '23': 'good afternoon', '25': 'amazing'}
priority_1 = 'good'
priority_2 = 'morning'
priority_3 = 'afternoon'
new_d = sorted(d.items(), key=lambda c: ... | <python><sorting> | 2024-01-07 13:48:06 | 1 | 314 | Josh |
77,773,218 | 1,169,091 | InvalidArgumentError: cannot compute MatMul as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:MatMul] name: | <p>The data type of input_data is an array of numpy.float64 but the code still fails inside a tensorflow library because it's not a 'double'. Not sure how to remedy this.</p>
<pre><code>import tensorflow as tf
import numpy as np
input_data = np.random.uniform(low=0.0, high=1.0, size=100)
print("type(input_data):&... | <python><numpy><tensorflow><types> | 2024-01-07 13:23:27 | 1 | 4,741 | nicomp |
77,772,928 | 4,451,315 | Julian date of timezone-aware timestamp? | <p>Should the Julian date change depending on the original timestamp's time zone?</p>
<p>For example, do <code>2020-01-01 +00:00</code> and <code>2020-01-01 +05:45</code> have the same Julian Date?</p>
<p>pandas suggests they do:</p>
<pre class="lang-py prettyprint-override"><code>In [1]: import pandas as pd
In [2]: p... | <python><pandas><julian-date> | 2024-01-07 11:50:22 | 1 | 11,062 | ignoring_gravity |
77,772,670 | 8,110,961 | How to parse JSON response that includes multiple JSON objects | <p><a href="https://stackoverflow.com/questions/55575374/how-to-parse-json-response-that-includes-multiple-objects">How to parse JSON response that includes multiple objects</a>
with reference to above link, I am getting multiple JSON objects in response but unlike response in above link (which receives single array of... | <python><json><rest> | 2024-01-07 10:18:33 | 3 | 385 | Jack |
77,772,628 | 719,276 | Indexing a batch of images using PyTorch tensor from an index image | <p>Suppose I have a batch of images <code>M</code> in the form of a torch tensor <code>(B, W, H)</code>, and an image <code>I</code> of size <code>(W, H)</code> whose pixels are indices.</p>
<p>I want to get an image <code>(W, H)</code> where each pixel come from the corresponding image in the image batch (following th... | <python><numpy><indexing><torch> | 2024-01-07 10:05:25 | 1 | 11,833 | arthur.sw |
77,772,560 | 20,851,944 | Merge value lists of two dict in python | <p>I have several dictionary with equal keys. The values of the key are list. Now I would merge the values lists like.</p>
<p>Input, e.g.:</p>
<pre><code>dict_1 ={"a":["1"], "b":["3"]}
dict_2 = {"a":["2"], "b":["3"]}
</code></pre>
<p>Requir... | <python><python-3.x><list><dictionary> | 2024-01-07 09:42:13 | 2 | 316 | Paul-ET |
77,772,472 | 16,383,578 | Visual Studio Code doesn't recognize cv2 members | <p>I don't know if this is on topic but I have seen some similar questions on this site.</p>
<p>The problem is simple, recently I have found out that Visual Studio Code cannot access any members of <code>cv2</code> at all. The attribute names are all white, hovering over them show "(function) {name}: Any", it... | <python><visual-studio-code> | 2024-01-07 09:08:43 | 2 | 3,930 | Ξένη Γήινος |
77,772,327 | 10,618,857 | TypeError when trying to display transformed images PyTorch | <p>I have some trouble defining the transforms for images using PyTorch.
Here you are the transforms I need:</p>
<pre><code>mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
train_transform = transforms.Compose([
transforms.RandomHorizontalFlip(p=0.5),
transforms.Resize((256, 256), interpolation=torchvi... | <python><pytorch><pre-trained-model> | 2024-01-07 07:59:31 | 1 | 945 | Eminent Emperor Penguin |
77,772,223 | 6,562,828 | django allauth adding uuid field | <p>I'm trying to add a field for user uuid for sigup but after adding <code>AUTH_USER_MODEL = "aihuser.UidUser" </code></p>
<p>I'm getting errors even without makemigrations and with makemigrations too. I deleted all migrations and drop the database and I created new database :</p>
<p>If I comment this line :... | <python><django><wagtail> | 2024-01-07 07:17:38 | 1 | 705 | Bynd |
77,772,133 | 9,092,563 | Can't get one pod to talk to another pod (ScrapyRT communication in Kubernetes not working) | <p>I'm managing a Kubernetes cluster and want <strong>Pod1</strong> to make API calls to <strong>Pod2</strong> and <strong>Pod3</strong> (but <strong>Pod1</strong> - <strong>Pod3</strong> fails!):</p>
<ol>
<li><strong>Pod1</strong>: A Jupyter Notebook environment to test connections.</li>
<li><strong>Pod2</strong>: An... | <python><node.js><docker><kubernetes><scrapy> | 2024-01-07 06:31:59 | 0 | 692 | rom |
77,772,039 | 5,811,638 | How can I setup my container Django app in Azure so it doesn't crash? | <p>Sometimes, my container Django app in Azure crashes.</p>
<p>The error I get is this:</p>
<blockquote>
<p>upstream connect error or disconnect/reset before headers. retried,
and the latest reset reason: remote connection failure, transport
failure reason: delayed connect error: 111</p>
</blockquote>
<p>I haven't been... | <python><django><azure> | 2024-01-07 05:48:41 | 1 | 430 | Jean Paul Ruiz |
77,772,014 | 485,330 | Syncing Redis with MariaDB | <p>In my spare time, I'm developing an API where successful queries result in a reduction of the user's available query credits. Currently, I'm utilizing Redis 6 for a temporary cache of the balance data (with a 60-second time-to-live) and MariaDB 10.5 for storing the data persistently.</p>
<p>My concern is about the p... | <python><database><caching><redis><mariadb> | 2024-01-07 05:36:19 | 0 | 704 | Andre |
77,771,938 | 1,492,229 | How to fix this MemoryError: Unable to allocate in Python | <p>Here is the code I have</p>
<pre><code>out = out.T.groupby(level=0, sort=False).sum().T
</code></pre>
<p>and it gives this error</p>
<pre><code>MemoryError: Unable to allocate 13.1 GiB for an array with shape (37281, 47002) and data type int64
</code></pre>
<p>I tried this</p>
<pre><code>out = out.T.groupby(level=0,... | <python><dataframe><memory> | 2024-01-07 04:48:20 | 2 | 8,150 | asmgx |
77,771,936 | 4,246,716 | aligning multiple labels below xaxis using matplotlib at equi-distances | <p>I am trying to add a few labels below the x-axis using matplotlib. I have 5-6 labels which I want to plot below the xaxis. The text of these labels will vary hence, having a single setting to render the labels is not possible. I have a minimal example given below.</p>
<pre><code>import matplotlib.pyplot as plt
im... | <python><matplotlib> | 2024-01-07 04:46:27 | 1 | 3,045 | Apricot |
77,771,824 | 1,492,229 | Why Python ignores the sign in the column name? | <p>I have a dataframe of text that looks like this</p>
<pre><code>RepID, Txt
1, +83 -193 -380 +55 +901
2, -94 +44 +2892 -60
3, +7010 -3840 +3993
</code></pre>
<p>Although the Txt field have +282 and -829 but these are string values not numeric</p>
<p>The problem is that when I use Bag of words function</p>
<pre><code>d... | <python><dataframe><nlp> | 2024-01-07 03:34:18 | 3 | 8,150 | asmgx |
77,771,673 | 1,492,229 | Merging DataFrame Columns in Python | <p>I have a special dataframe called df</p>
<p>here is how it looks like</p>
<pre><code>RepID +Col01 +Col02 +Col03 -Col01 +Col04 +Col05 -Col03 -Col04 +Col06 -Col07
1 5 7 9 8 3 8 1 9 4 6
2 1 3 3 3 1 2 2 3 ... | <python><pandas><dataframe> | 2024-01-07 02:06:30 | 4 | 8,150 | asmgx |
77,771,642 | 3,782,963 | Labelling a step plot in Matplotlib | <p>Below is a code in which it plots a sine wave and adds a step wave on top of it:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.pyplot as plt
# sine wave parameters
A = 5 # Increased Amplitude
f = 1 # Frequency in Hz
T = 1/f # Period
t = np.linspace(0, 2*T, 1000) # Time... | <python><matplotlib> | 2024-01-07 01:46:22 | 1 | 2,835 | Akshay |
77,771,561 | 2,591,138 | Use selenium to navigate in joint selection/list elements | <p>I'm using beautifulSoup / selenium to do some webscraping and am hitting a wall with a certain dropdown select menu. The rough HTML is as follows:</p>
<pre><code><div class="selection-box" alt="selection" title="selection" role="select" tabindex="0">
<select... | <python><html><selenium-webdriver> | 2024-01-07 00:48:47 | 1 | 1,083 | Berbatov |
77,771,523 | 5,521,564 | RateLimitingError when communicating with OpenAI API | <p>I am trying to get ChatGPT OpenAI API up and running with this little python script:</p>
<pre><code>from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a... | <python><chatgpt-api> | 2024-01-07 00:27:58 | 1 | 1,963 | Matthias |
77,771,494 | 1,144,251 | Python Plotly: How to avoid truncated chart | <p>I have a chart with an annotation that is 10 lines long that is truncated. I tried increasing the height of the layout and it only increased the height of the chart but the truncation issue persists.
I've included an image of what I mean below:</p>
<p><a href="https://i.sstatic.net/h4KFl.png" rel="nofollow noreferre... | <python><plotly><annotations> | 2024-01-07 00:14:36 | 1 | 357 | user1144251 |
77,771,119 | 2,664,376 | Gurobi: unsupported operand type(s) for -: 'int' and 'tupledict' | <p>I have this constraint with big-M parameter and an auxiliary binary variable w:</p>
<pre><code>for i in customers:
for j in customers:
if i != j:
mdl.addConstr(y[j] + z[j] <= y[i] + z[i] - df.demand[j]*(x1[i,j] + x2[i,j])
+ 100000 * (1 - w), name= 'C8')
</code></... | <python><gurobi> | 2024-01-06 21:38:06 | 1 | 1,335 | MAYA |
77,770,346 | 12,432,147 | Flask hot reload not working in Python 3.10: "operation was attempted on something that is not a socket" | <p>I am using Python 3.10.11, Flask 3.0.0 and Werkzeug 3.0.1.
I've worked on a project for couple of months, took a break and now, couple of months later for some reason the hot reload doesn't work. Instead, it throws this error. Moreover, Sometimes the app doesn't update even when I restart it (close and start new ter... | <python><sockets><flask><werkzeug><hot-reload> | 2024-01-06 17:27:52 | 1 | 319 | Ilan Yashuk |
77,770,290 | 1,467,552 | How to drop certain elements from a list typed column in Polars? | <p>Suppose I have polars Dataframe with a list column type of strings:</p>
<pre><code>┌─────────────────────────────────────────────────┐
│ words │
│ --- │
│ list[str] │
╞═════════════════════════... | <python><dataframe><python-polars> | 2024-01-06 17:12:18 | 2 | 1,170 | barak1412 |
77,770,248 | 9,582,542 | Scrapy loop to find each element and export to Json | <p>Code below locates all the elements I am looking for but I am struggling to put this is a loop where data gets put into a dataframe and exported out to a Json file. All the commands work from the command line to bring in the data I need. How can I get his to export a json?</p>
<pre><code>import scrapy
from scrapy.it... | <python><scrapy> | 2024-01-06 17:00:21 | 1 | 690 | Leo Torres |
77,770,219 | 11,946,045 | Is there a way to define response models based on a schema in FastAPI websockets? | <h1>Question</h1>
<p>Assume you have the following pydantic schema</p>
<pre><code>class Item(BaseModel):
id: int
name: str
</code></pre>
<p>and a fastapi server running websockets</p>
<pre><code>class ConnectionManager:
def __init__(self, db: Session = Depends(get_db)):
self.active_connections: list... | <python><websocket><sqlalchemy><fastapi><jsonschema> | 2024-01-06 16:51:14 | 1 | 814 | Weed Cookie |
77,770,191 | 12,178,630 | YOLOv8 inference with OpenCV Python | <p>I have trined YOLOv8 model for segmentation on a custom dataset, the model can do inference successfully when loaded by ultralytics, however I would like to run it on edge device for which ultralytics would be a bit heavy to install. Therefore I am using opencv.
I have exported my model to onnx format using the comm... | <python><opencv><deep-learning><yolo><yolov8> | 2024-01-06 16:42:21 | 0 | 314 | Josh |
77,770,173 | 8,512,262 | Get length of line on tkinter.canvas in inches (Mac OS) | <p>I'm currently running Mac OS Sonoma 14.2.1 and I'm trying to set up a tkinter canvas which is scaled to "actual" real-life size. I.e., if I draw a line between any two points on the canvas, I'd like to calculate its length in inches.</p>
<p>I've tried getting the DPI in tkinter like so:</p>
<pre><code>root... | <python><macos><tkinter><tk-toolkit> | 2024-01-06 16:37:06 | 0 | 7,190 | JRiggles |
77,770,168 | 6,423,456 | How do I create a class with async code in the constructor? | <p>I have a fastAPI project that talks to a Cosmos database.
All of my fastAPI routes are async (<code>async def ...</code>).
I need an async class that will perform CRUD operations of the Cosmos DB.
The problem I'm having is figuring out a constructor for the class.</p>
<p>I want the constructor to:</p>
<ul>
<li>Take ... | <python><asynchronous><fastapi> | 2024-01-06 16:34:56 | 2 | 2,774 | John |
77,769,925 | 19,130,803 | dropdown multi with same value but different datatype | <p>I am developing a <code>dash</code> app. I have a <code>dropdown</code> with <code>multi</code> that contains different datatype value. In this set of values, I have value as 1 which is <code>str</code> type and 1 which is <code>int</code> type. I am able to select both, but <strong>problem</strong> is when I remove... | <python><plotly><plotly-dash> | 2024-01-06 15:14:00 | 0 | 962 | winter |
77,769,753 | 236,872 | how do I find out the "package names" in requirements.txt when writing a Google Cloud Function? | <p>I am writing a Google Cloud Function in Python. It imports the following packages:</p>
<pre><code>from google.api_core.client_options import ClientOptions
from google.cloud import documentai # type: ignore
from google.cloud import storage
</code></pre>
<p>I need to put these requirements into requirements.txt. By r... | <python><google-cloud-platform><google-cloud-functions> | 2024-01-06 14:20:42 | 1 | 1,146 | Thorsten Staerk |
77,769,693 | 3,591,044 | Encode audio data to string (Flask) and decode it (Javascript) | <p>I have a Python Flask app with the method shown below. In the method I'm synthesizing voice from text using Azure text to speech.</p>
<pre><code>@app.route("/retrieve_speech", methods=['POST'])
def retrieve_speech():
text= request.form.get('text')
start = time.time()
speech_key = "my key&q... | <javascript><python><flask><base64><azure-cognitive-services> | 2024-01-06 13:59:53 | 1 | 891 | BlackHawk |
77,769,652 | 2,219,819 | Reading sorted parquet files and merge them with Polars | <p>In order to save memory, I have written 49 sorted files to disk:</p>
<pre class="lang-py prettyprint-override"><code>tissue_pq_paths = []
for tissue in tissues:
[...]
aggregated_tissue_df = [...].sort(groupby).collect()
aggregated_tissue_df.write_parquet(tissue_pq_path, compression="snappy", s... | <python><dataframe><memory><python-polars> | 2024-01-06 13:46:10 | 0 | 716 | Hoeze |
77,769,608 | 1,757,321 | Add Agent with llm-math to a LangChain Expressive Language implementation | <p>I have this LCEL solution:</p>
<pre><code>
from langchain.document_loaders.pdf import PyMuPDFLoader
import os
from typing import List, Tuple
from dotenv import load_dotenv
from langchain.prompts.prompt import PromptTemplate
from langchain.schema import AIMessage, HumanMessage
from langchain_core.output_parsers impo... | <python><langchain> | 2024-01-06 13:34:20 | 0 | 9,577 | KhoPhi |
77,769,496 | 2,320,983 | Selenium unable to send keys to a combobox element | <p>I have been trying to create an automated way of adding stocks to google finance, using selenium. I am able to login and get to the adding of the new investment, but that's where I get stuck.</p>
<p>Steps to reproduce:</p>
<p>Create a new portfolio in google finance. Populate the portfolio with at least 1 item. Next... | <python><selenium-webdriver><google-finance> | 2024-01-06 13:00:33 | 1 | 326 | Akshayanti |
77,769,473 | 8,465,299 | Adjusting Output Size of Auxiliary Matrix in Python | <p>After hidden layer activation, I want to create an auxiliary matrix to better capture the temporal aspect of the data in the below code snippet. The current shape of the return variable is <code>[out_channels, out_channels]</code> but I want the returned shape to be <code>[input_channels, out_channels]</code>. Which... | <python><pytorch><matrix-multiplication> | 2024-01-06 12:55:49 | 1 | 733 | Asif |
77,769,458 | 12,806,025 | monitoring memory usage and time with Python of the subprocess in Unix | <p>I want to track the time elapsed and memory usage of the <code>process</code> (bioinformatic tool) I execute from a Python script. I run the process on the Unix cluster, and save the monitoring parameters in a <code>report_file.txt</code>. To measure the elapsed time, I use the <code>resources</code> library, and to... | <python><unix><subprocess><resources><psutil> | 2024-01-06 12:50:56 | 1 | 369 | amk |
77,769,366 | 14,839,602 | Exclude page number from text when extracting from a PDF | <p>I want to exclude the page number of a PDF from the actual text using <code>pypdf</code> package</p>
<pre><code>from pypdf import PdfReader
reader = PdfReader("pdf-examples/kurdish-sample-2.pdf")
full_text = ""
for page in reader.pages:
full_text += page.extract_text() + "\n"
print... | <python><pdf><pypdf><text-extraction> | 2024-01-06 12:26:10 | 1 | 434 | Hama Sabah |
77,769,292 | 584,239 | when using pyserial connection to /dev/ttyS0 second time throws error termios.error: (22, 'Invalid argument') | <p>Below is my sample Python script. I am using <code>socat</code> to simulate <code>/dev/ttyS0</code> serial connection. When I run my Python script first time I do not get any errors. But when the Python script stops executing and I run it for second time I get the below error. I have set <code>parity=serial.PARITY_N... | <python><pyserial> | 2024-01-06 12:02:21 | 0 | 9,691 | kumar |
77,769,243 | 893,254 | How do I take one column of a Pandas dataframe and make it become part of the index? | <p>I have a Pandas dataframe which looks something like this:</p>
<pre><code> data day_of_month days_in_month
timestamp
2022-01-03 09:00:00 12 3 31
</code></pre>
<p>There is currently an index, which has the type of "pandas timestamp".</p>
<p>I want to be abl... | <python><pandas><dataframe> | 2024-01-06 11:42:21 | 2 | 18,579 | user2138149 |
77,769,088 | 1,234,434 | Why isn't the python function updating arguments on recursive call | <p>I am learning Python.</p>
<p>I have a task to find the numbers in a list that sum up to the target number.</p>
<p>My attempt is this:</p>
<pre><code>def two_sum(numbers, target):
# subtraction
numbers.sort(reverse=True)
if (len(numbers)>=2):
for k,v in enumerate(numbers):
count=dif... | <python><for-loop><recursion> | 2024-01-06 10:50:51 | 1 | 1,033 | Dan |
77,769,043 | 1,841,839 | Gemini returns error: 400 Multiturn chat is not enabled for models/gemini-pro-vision | <p>I am trying to send a request to gemini-pro-vision model and it keeps returning this error</p>
<blockquote>
<p>400 Multiturn chat is not enabled for models/gemini-pro-vision</p>
</blockquote>
<p>My code.</p>
<pre><code># Create a client
client = generativelanguage_v1beta.GenerativeServiceAsyncClient()
content1 = bui... | <python><google-gemini> | 2024-01-06 10:37:33 | 2 | 118,263 | Linda Lawton - DaImTo |
77,769,033 | 21,896,093 | RandomizedSearchCV independently on models in an ensemble | <p>Suppose I construct an ensemble of two estimators, where each estimator runs its own parameter search:</p>
<p>Imports and regression dataset:</p>
<pre><code>from sklearn.ensemble import VotingRegressor, StackingRegressor, RandomForestRegressor
from sklearn.tree import DecisionTreeRegressor
from sklearn.datasets impo... | <python><machine-learning><scikit-learn> | 2024-01-06 10:35:42 | 1 | 5,252 | MuhammedYunus |
77,768,813 | 1,172,907 | How can I unit test the log file? | <p>I must run the script below by hand <code>$ python -m mylog</code> in order to test logging.</p>
<p>Why does <code>$ pytest -s</code> fail creating the logfile?</p>
<pre class="lang-py prettyprint-override"><code>#mylog.py
import logging
def foobar(logfile):
logging.basicConfig(filename=logfile, level=logging.DE... | <python><logging><pytest> | 2024-01-06 09:06:01 | 1 | 605 | jjk |
77,768,803 | 485,330 | AWS Lambda using Python does not recognize the Redis library | <p>Using Python 3.12 and AWS Lambda, I'm trying to run Redis, but it gives an error for an unrecognized library.</p>
<p>It's hard to believe that Redis is not a native Lambda library. Do I need to upload the Redis library manually, or is it under another name?</p>
<pre><code>import json
import redis
def lambda_handler... | <python><amazon-web-services><aws-lambda><redis> | 2024-01-06 08:59:05 | 1 | 704 | Andre |
77,768,631 | 5,790,653 | python how to find duplicated values of yaml file for specific key | <p>I have a yaml file like this:</p>
<pre class="lang-yaml prettyprint-override"><code>-
ip: 1.1.1.1
status: Active
type: 'typeA'
-
ip: 1.1.1.1
status: Disabled
type: 'typeA'
-
ip: 2.2.2.2
status: Active
type: 'typeC'
-
ip: 3.3.3.3
status: Active
type: 'typeB'
-
ip: 3... | <python><yaml> | 2024-01-06 07:41:12 | 2 | 4,175 | Saeed |
77,768,473 | 2,989,330 | Python: Protocol requiring class property | <p>My method requires an object with the attribute <code>pattern</code> and the function <code>handle</code>. To this end, I wrote a <code>Protocol</code> instance with these two members. Consider the following code:</p>
<pre><code>class Handler(typing.Protocol):
"""Handler protocol"""... | <python><python-3.x><python-typing> | 2024-01-06 06:36:07 | 0 | 3,203 | Green 绿色 |
77,768,127 | 2,530,674 | Accessing nested element using beautifulsoup | <p>I want to find all the <code>li</code> elements nested within <code><ol class="messageList" id="messageList"></code>. I have tried the following solutions and they all return 0 messages:</p>
<pre class="lang-py prettyprint-override"><code>messages = soup.find_all("ol")
messages = ... | <python><html><beautifulsoup> | 2024-01-06 03:12:49 | 2 | 10,037 | sachinruk |
77,768,011 | 10,200,497 | Change first row of a column if it meets a condition | <p>This is a very basic problem. I have searched SO, but I didn't find the answer.</p>
<p>My DataFrame:</p>
<pre><code>df = pd.DataFrame(
{
'a': [10, 50, 3],
'b': [5, 4, 5],
}
)
</code></pre>
<p>Now I want to change <code>df.b.iloc[0]</code> to 1 if <code>df.a.iloc[0]</code> is greater than 5.</p>... | <python><pandas><dataframe> | 2024-01-06 01:55:43 | 1 | 2,679 | AmirX |
77,767,855 | 1,084,875 | Use Sphinx doctest with docstrings that contain Matplotlib examples | <p>The function shown below displays a line plot using Matplotlib. The docstring of the function contains an example of using the function with a list of numbers. I'm using the Sphinx <code>make html</code> command to create documentation for this function. I also use Sphinx to test the docstring using <code>make docte... | <python><matplotlib> | 2024-01-06 00:37:36 | 1 | 9,246 | wigging |
77,767,715 | 401,226 | Celery chain, how to wait for dynamically created subtasks (seems to rule out chord) | <p>I have a series of tasks which should be executed sequentially for data integrity purposes. I don't need any kind of celery orchestration for this as such; I could just have one task do the top level steps sequentially.</p>
<p>This is in django, python 3.11 and latest celery. Redis is the broker and result store.</p... | <python><celery> | 2024-01-05 23:42:16 | 1 | 7,351 | Tim Richardson |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.