Testing a django view with two forms.
I have a django view which includes both a signup and a login form. I cannot use ```self.client.post(url, data)``` as that cannot differentiate between the two forms. Nothing specific comes up on google.
/r/django
https://redd.it/cdterv
I have a django view which includes both a signup and a login form. I cannot use ```self.client.post(url, data)``` as that cannot differentiate between the two forms. Nothing specific comes up on google.
/r/django
https://redd.it/cdterv
reddit
r/django - Testing a django view with two forms.
0 votes and 1 comment so far on Reddit
Async/Awaiting Production in Python
[https://dev.to/angulardevz/async-awaiting-production-in-python-20d5](https://dev.to/angulardevz/async-awaiting-production-in-python-20d5)
/r/Python
https://redd.it/cdrwir
[https://dev.to/angulardevz/async-awaiting-production-in-python-20d5](https://dev.to/angulardevz/async-awaiting-production-in-python-20d5)
/r/Python
https://redd.it/cdrwir
The DEV Community
Async/Awaiting Production in Python
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/cdxj37
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/cdxj37
reddit
r/Python - What's everyone working on this week?
0 votes and 10 comments so far on Reddit
Mind controlled text writer
# My python implementation of P300 speller
# [Video](https://www.youtube.com/watch?v=1GdjMx5t4ls&feature=youtu.be)
**Idea of P300 speller:**
Highlight rows and cols and record EEG reaction to these events. If row/col with target character is highlighted \~after 300ms peak on EEG diagram will occur and it's possible to train classifier to detect it. To remove noise from EEG data repeat it multiple times and use bandpass filter
​
**Hardware:** [OpenBCI Cyton](https://brainflow.readthedocs.io/en/latest/SupportedBoards.html#openbci-cyton)
**Software:**
* [BrainFlow library](https://github.com/Andrey1994/brainflow) to read and preprocess data from OpenBCI board
* [P300 implementation](https://github.com/Andrey1994/brainapps/tree/master/p300-speller)
/r/Python
https://redd.it/cdwea0
# My python implementation of P300 speller
# [Video](https://www.youtube.com/watch?v=1GdjMx5t4ls&feature=youtu.be)
**Idea of P300 speller:**
Highlight rows and cols and record EEG reaction to these events. If row/col with target character is highlighted \~after 300ms peak on EEG diagram will occur and it's possible to train classifier to detect it. To remove noise from EEG data repeat it multiple times and use bandpass filter
​
**Hardware:** [OpenBCI Cyton](https://brainflow.readthedocs.io/en/latest/SupportedBoards.html#openbci-cyton)
**Software:**
* [BrainFlow library](https://github.com/Andrey1994/brainflow) to read and preprocess data from OpenBCI board
* [P300 implementation](https://github.com/Andrey1994/brainapps/tree/master/p300-speller)
/r/Python
https://redd.it/cdwea0
YouTube
BrainFlow P300 Speller with words suggestion
BrainFlow P300 Speller with simple language model Project page: https://andrey1994.github.io/brainflow/
Train ML Models on Free Cloud GPUs ⚡
https://blog.paperspace.com/free-cloud-gpu?utm_source=reddit&utm_medium=r-JupyterNotebooks&utm_campaign=free-gpu-notebook-waitlist-launch
/r/JupyterNotebooks
https://redd.it/cdyeyi
https://blog.paperspace.com/free-cloud-gpu?utm_source=reddit&utm_medium=r-JupyterNotebooks&utm_campaign=free-gpu-notebook-waitlist-launch
/r/JupyterNotebooks
https://redd.it/cdyeyi
Paperspace Blog
Train ML Models on Free Cloud GPUs ⚡
When we started Paperspace back in 2014, our mission was to make cloud GPU
resources more accessible and less expensive for everyone. Since inception, we
have continued to offer a wide variety of low-cost GPU instances, often at a
fraction of the price of…
resources more accessible and less expensive for everyone. Since inception, we
have continued to offer a wide variety of low-cost GPU instances, often at a
fraction of the price of…
Learning to create Python multi-threaded and multi-process
https://writeabout.tech/programming/learning-to-create-python-multi-threaded-and-multi-process/
/r/Python
https://redd.it/cdy7mf
https://writeabout.tech/programming/learning-to-create-python-multi-threaded-and-multi-process/
/r/Python
https://redd.it/cdy7mf
writeabout.tech
Learning to create Python multi-threaded and multi-process - writeabout.tech
This article is not useful for experienced Python developers. It is rather a superficial overview of Python multi-threaded features for those who recently started learning Python. Unfortunately, you cannot find tons of material about multithreading in Python.…
[P] TensorFlow DICOM Medical Imaging Decoder Operation
Hello, I wanted to share something our team has been working on for a while. I work on an early stage radiology imaging company where we have a blessing and curse of having too much medical imaging data. Something we found internally useful to build was a DICOM Decoder Op for TensorFlow. We are making this available open-source here: [https://github.com/gradienthealth/gradient\_decode\_dicom](https://github.com/gradienthealth/gradient_decode_dicom).
DICOM is an extremely broad standard, so we try to cover the 90% case of image formats (PNG, TIFF, BMP, JPEG, JPEG2000) by relying on the past work folks have done for [DCMTK](https://github.com/DCMTK/dcmtk). DCMTK is also largely considered an industry standard when it comes to parsing DICOMs. We also support multi-frame/multi-frame color images. Try images found here: [https://barre.dev/medical/samples/](https://barre.dev/medical/samples/). In the case an unsupported format is found, an empty Tensor is returned which can be filtered out. Reading the files directly off of bucket storage has allowed us to prevent data duplication of .dcm data (a single CT can be 300MB). You can play with the op in this Colab notebook: [https://colab.research.google.com/drive/1MdjXN3XkYs\_mSyVtdRK7zaCbzkjGub\_B](https://colab.research.google.com/drive/1MdjXN3XkYs_mSyVtdRK7zaCbzkjGub_B)
We firmly believe that having open-source resources in healthcare is what will enable its use in practice, not AI trade secrets. We plan on opening more of our work in the
/r/MachineLearning
https://redd.it/ce0lqk
Hello, I wanted to share something our team has been working on for a while. I work on an early stage radiology imaging company where we have a blessing and curse of having too much medical imaging data. Something we found internally useful to build was a DICOM Decoder Op for TensorFlow. We are making this available open-source here: [https://github.com/gradienthealth/gradient\_decode\_dicom](https://github.com/gradienthealth/gradient_decode_dicom).
DICOM is an extremely broad standard, so we try to cover the 90% case of image formats (PNG, TIFF, BMP, JPEG, JPEG2000) by relying on the past work folks have done for [DCMTK](https://github.com/DCMTK/dcmtk). DCMTK is also largely considered an industry standard when it comes to parsing DICOMs. We also support multi-frame/multi-frame color images. Try images found here: [https://barre.dev/medical/samples/](https://barre.dev/medical/samples/). In the case an unsupported format is found, an empty Tensor is returned which can be filtered out. Reading the files directly off of bucket storage has allowed us to prevent data duplication of .dcm data (a single CT can be 300MB). You can play with the op in this Colab notebook: [https://colab.research.google.com/drive/1MdjXN3XkYs\_mSyVtdRK7zaCbzkjGub\_B](https://colab.research.google.com/drive/1MdjXN3XkYs_mSyVtdRK7zaCbzkjGub_B)
We firmly believe that having open-source resources in healthcare is what will enable its use in practice, not AI trade secrets. We plan on opening more of our work in the
/r/MachineLearning
https://redd.it/ce0lqk
Sources to learn flask
I just finished Corey Schafer’s playlist it’s great but I’m still can’t do anything in my own because I don’t know a lot in back end development so is there is any course , book or advice to be familiar with back end using flask
/r/flask
https://redd.it/cdz9my
I just finished Corey Schafer’s playlist it’s great but I’m still can’t do anything in my own because I don’t know a lot in back end development so is there is any course , book or advice to be familiar with back end using flask
/r/flask
https://redd.it/cdz9my
reddit
r/flask - Sources to learn flask
6 votes and 17 comments so far on Reddit
new with Django: Webhosting option with low entry-barrier?
I have built my first django web site.
I paid for a year of Bluehost webhosting. They came up on a metric butt-load of searches for django webhosting.
The problem is that after several days of hammering about, I finally asked Tech support and they let me know that bluehost can't handle django.
So I am pretty frustrated by this.
I watched a few tutorials on webhosting with django. One suggested "linode" and one suggested "heroku". I have never heard of either of these.
Watching the tutorials, I feel like they deal with a lot of things that I have no knowledge of. I have no way to gauge if these steps are the right way to host a website or not.
For instance: linode requires you to do a lot of firewall and security stuff. Heroku says that you need to save all of your images on yet another webhost like Amazon web-services.
I am reluctant to pay for another webhost. I don't want to work myself into another corner. Does anybody have any experience with a specific webhost and can provide me some specifics on how they like it?
I am looking for the
/r/django
https://redd.it/ce518c
I have built my first django web site.
I paid for a year of Bluehost webhosting. They came up on a metric butt-load of searches for django webhosting.
The problem is that after several days of hammering about, I finally asked Tech support and they let me know that bluehost can't handle django.
So I am pretty frustrated by this.
I watched a few tutorials on webhosting with django. One suggested "linode" and one suggested "heroku". I have never heard of either of these.
Watching the tutorials, I feel like they deal with a lot of things that I have no knowledge of. I have no way to gauge if these steps are the right way to host a website or not.
For instance: linode requires you to do a lot of firewall and security stuff. Heroku says that you need to save all of your images on yet another webhost like Amazon web-services.
I am reluctant to pay for another webhost. I don't want to work myself into another corner. Does anybody have any experience with a specific webhost and can provide me some specifics on how they like it?
I am looking for the
/r/django
https://redd.it/ce518c
reddit
r/django - new with Django: Webhosting option with low entry-barrier?
5 votes and 17 comments so far on Reddit
I just wrote another Python implementation to Graphql, more Pythonic and modern
[https://github.com/ethe/pygraphy](https://github.com/ethe/pygraphy)
Although there is an existing official implementation which names Graphene with graphql-core-next, I developed another library and rewrite the whole system to make it more *Pythonic.* Cause graphql-core-next just directly translated from graphql.js, there are some weird behaviors to Pythonista. If you are also annoyed with some of the features within Graphene, just have a try and tell me your suggestions.
The details of the primary difference between Pygraphy and GraphQL-Core-Next are posted here: [https://github.com/graphql-python/graphql-core-next/issues/37](https://github.com/graphql-python/graphql-core-next/issues/37)
/r/Python
https://redd.it/ce74e1
[https://github.com/ethe/pygraphy](https://github.com/ethe/pygraphy)
Although there is an existing official implementation which names Graphene with graphql-core-next, I developed another library and rewrite the whole system to make it more *Pythonic.* Cause graphql-core-next just directly translated from graphql.js, there are some weird behaviors to Pythonista. If you are also annoyed with some of the features within Graphene, just have a try and tell me your suggestions.
The details of the primary difference between Pygraphy and GraphQL-Core-Next are posted here: [https://github.com/graphql-python/graphql-core-next/issues/37](https://github.com/graphql-python/graphql-core-next/issues/37)
/r/Python
https://redd.it/ce74e1
GitHub
GitHub - ethe/pygraphy: A modern Pythonic GraphQL implementation.
A modern Pythonic GraphQL implementation. Contribute to ethe/pygraphy development by creating an account on GitHub.
I can't get the ORM to annotate with a condition and distinct
I have a Django 1.11 project and I'm having trouble getting the ORM to do what I need it to do. I'll use a blog as an example. Suppose I have these models for my blog:
class Category(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'categories'
ordering = (
'name',
)
class Post(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
publish_date = models.DateTimeField()
/r/django
https://redd.it/ce3xd4
I have a Django 1.11 project and I'm having trouble getting the ORM to do what I need it to do. I'll use a blog as an example. Suppose I have these models for my blog:
class Category(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'categories'
ordering = (
'name',
)
class Post(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
publish_date = models.DateTimeField()
/r/django
https://redd.it/ce3xd4
reddit
r/django - I can't get the ORM to annotate with a condition and distinct
6 votes and 1 comment so far on Reddit
How to go about learning DRF?
I'm an intermediate at Python and have some experience with Django now. I recently worked on a Spring REST API for an internship. I now want to learn DRF since Im far more comfortable with Python than Java. However, Im confused about how to do it. Should I simultaneously build some front-end to consume that API? I have only a little knowledge of JS and so am reluctant to do this(dive into Angular or React).
Does it make sense to build a REST API without having some separate front-end make calls, and get that data? In that case, how should I decide how to design my REST API i.e. what JSON to return etc.
/r/django
https://redd.it/ceaq9q
I'm an intermediate at Python and have some experience with Django now. I recently worked on a Spring REST API for an internship. I now want to learn DRF since Im far more comfortable with Python than Java. However, Im confused about how to do it. Should I simultaneously build some front-end to consume that API? I have only a little knowledge of JS and so am reluctant to do this(dive into Angular or React).
Does it make sense to build a REST API without having some separate front-end make calls, and get that data? In that case, how should I decide how to design my REST API i.e. what JSON to return etc.
/r/django
https://redd.it/ceaq9q
reddit
r/django - How to go about learning DRF?
0 votes and 2 comments so far on Reddit
Django HTML tag autocomplete in VS Code
Can anyone please give me a tip on this: VSCode with Python and Django extensions are installed. However in HTML files with language= Django-HTML, I have to type the closing tags, when I change the language to pure HTML they are closed for me, but I lose the nice Django features. Any tips on how I can get tag autocomplete while using the Django-HTML language?
/r/djangolearning
https://redd.it/ce9w74
Can anyone please give me a tip on this: VSCode with Python and Django extensions are installed. However in HTML files with language= Django-HTML, I have to type the closing tags, when I change the language to pure HTML they are closed for me, but I lose the nice Django features. Any tips on how I can get tag autocomplete while using the Django-HTML language?
/r/djangolearning
https://redd.it/ce9w74
reddit
r/djangolearning - Django HTML tag autocomplete in VS Code
5 votes and 1 comment so far on Reddit
Reverse generic relations and Generic Relations - Database design improvement
In a simple scenario, where I have many measurementstable that describe the measurements that comes from a specific protocol and every measurement is linked to the respective parent device, I was looking for an optimization of my database, putting all the measurements into a table and reference from this table the respective device.
Now, keeping in mind that this table is heavily used in read/write and especially in filtering operations, I was looking for a smarter solution...I've found the Django Generic Relations and Reverse Relations, but this approach it doesn't convince me at all because, as now, with a simple select with a where the problem is solved, but using a generic relation, the ORM will generate a lot of inner joins (if I'm not wrong) and this is an aspect that I would want to avoid.
So, anyone with smarter idea?
My goal is to remove tons of if in my code that at this time are used to decide what table it will be queried based on the protocol type, as shown below:
goal is to remove tons of ifin my code that at this time are used to decide what table it will be queried based on the protocol type, as
/r/django
https://redd.it/ce98xx
In a simple scenario, where I have many measurementstable that describe the measurements that comes from a specific protocol and every measurement is linked to the respective parent device, I was looking for an optimization of my database, putting all the measurements into a table and reference from this table the respective device.
Now, keeping in mind that this table is heavily used in read/write and especially in filtering operations, I was looking for a smarter solution...I've found the Django Generic Relations and Reverse Relations, but this approach it doesn't convince me at all because, as now, with a simple select with a where the problem is solved, but using a generic relation, the ORM will generate a lot of inner joins (if I'm not wrong) and this is an aspect that I would want to avoid.
So, anyone with smarter idea?
My goal is to remove tons of if in my code that at this time are used to decide what table it will be queried based on the protocol type, as shown below:
goal is to remove tons of ifin my code that at this time are used to decide what table it will be queried based on the protocol type, as
/r/django
https://redd.it/ce98xx
reddit
r/django - Reverse generic relations and Generic Relations - Database design improvement
2 votes and 0 comments so far on Reddit
[P] Structure-preserving dimensionality reduction in very large datasets
Hi there, we're a London-based research team working on clinical applications of machine learning. Recently, we've been dealing a lot with clinical datasets that exceed 1M+ observations and 20K+ features. We found that traditional dimensionality reduction and feature extraction methods don't deal well with this data without subsampling and are actually quite poor at preserving both global and local structures of the data. To address these issues, we've been looking into Siamese Networks for non-linear dimensionality reduction and metric learning applications. We are making our work available through an open-source project: [https://github.com/beringresearch/ivis](https://github.com/beringresearch/ivis)
​
So far, we've applied ivis to single cell datasets, images, and free text - we're really keen to see what other applications could be enabled! We've also ran a large number of benchmarks looking at both accuracy of embeddings and processing speed - [https://bering-ivis.readthedocs.io/en/latest/timings\_benchmarks.html](https://bering-ivis.readthedocs.io/en/latest/timings_benchmarks.html) \- and can see that ivis begins to stand out in datasets with 250K+ observations. We're really excited to make this project open source - there's so much for Siamese Networks beyond one-shot learning!
/r/MachineLearning
https://redd.it/ce9q9f
Hi there, we're a London-based research team working on clinical applications of machine learning. Recently, we've been dealing a lot with clinical datasets that exceed 1M+ observations and 20K+ features. We found that traditional dimensionality reduction and feature extraction methods don't deal well with this data without subsampling and are actually quite poor at preserving both global and local structures of the data. To address these issues, we've been looking into Siamese Networks for non-linear dimensionality reduction and metric learning applications. We are making our work available through an open-source project: [https://github.com/beringresearch/ivis](https://github.com/beringresearch/ivis)
​
So far, we've applied ivis to single cell datasets, images, and free text - we're really keen to see what other applications could be enabled! We've also ran a large number of benchmarks looking at both accuracy of embeddings and processing speed - [https://bering-ivis.readthedocs.io/en/latest/timings\_benchmarks.html](https://bering-ivis.readthedocs.io/en/latest/timings_benchmarks.html) \- and can see that ivis begins to stand out in datasets with 250K+ observations. We're really excited to make this project open source - there's so much for Siamese Networks beyond one-shot learning!
/r/MachineLearning
https://redd.it/ce9q9f
GitHub
GitHub - beringresearch/ivis: Dimensionality reduction in very large datasets using Siamese Networks
Dimensionality reduction in very large datasets using Siamese Networks - beringresearch/ivis
Flask user specific form data being passed to a function
Hello - I opened this post on stack overflow and was immediately flagged as a duplicate without answering any of my questions.
​
So if I cant do this how to I use flask.g I have check and searched and have tested but every time I try it keeps failing... Any one have any guidance based off my original request?
​
[https://stackoverflow.com/questions/57067537/flask-data-is-being-shared-between-users-bad](https://stackoverflow.com/questions/57067537/flask-data-is-being-shared-between-users-bad)
/r/flask
https://redd.it/ce7h9i
Hello - I opened this post on stack overflow and was immediately flagged as a duplicate without answering any of my questions.
​
So if I cant do this how to I use flask.g I have check and searched and have tested but every time I try it keeps failing... Any one have any guidance based off my original request?
​
[https://stackoverflow.com/questions/57067537/flask-data-is-being-shared-between-users-bad](https://stackoverflow.com/questions/57067537/flask-data-is-being-shared-between-users-bad)
/r/flask
https://redd.it/ce7h9i
Stack Overflow
Are global variables thread safe in flask? How do I share data between requests?
In my app the state of a common object is changed by making requests, and the response depends on the state.
class SomeObj():
def __init__(self, param):
self.param = param
def quer...
class SomeObj():
def __init__(self, param):
self.param = param
def quer...
Sourcery - new refactoring tool using AI
Hi,
We're developing a new refactoring tool that uses AI to simplify and improve code.
For a video of it in action check out our website: [https://sourcery.ai](https://sourcery.ai).
​
We're starting with a Pycharm plugin (which connects to our web service), and are looking for alpha testers.
Let us know what you think!
/r/Python
https://redd.it/ceb5iz
Hi,
We're developing a new refactoring tool that uses AI to simplify and improve code.
For a video of it in action check out our website: [https://sourcery.ai](https://sourcery.ai).
​
We're starting with a Pycharm plugin (which connects to our web service), and are looking for alpha testers.
Let us know what you think!
/r/Python
https://redd.it/ceb5iz
www.sourcery.ai
AI Code Reviews | Sourcery | Try for Free
AI code reviews in GitHub, GitLab, or your IDE
Simple python script that mutes sound when Spotify app runs an ad
Hey guys, was a bit distracted by the fact that Spotify Free is killing the mood sometimes in a foreign language, so decided to create a script that mutes all the sound whenever there is an ad playing.
This script only works on Windows.
This script get windll libraries and uses them to create a process name list (mostly copied code).
After the list is built, it is checked for Process names "Advertisement" and "Spotify" to see if an ad is playing. These names are specific to the moment when ad is being played in Spotify.
The script is run in an interval, and does not fetch data real-time, so has small delays in runtime. As it is short and easily processed, does not load up CPU and doesn't leak memory.
The code: (Requires ctypes and pycaw libraries)
import ctypes #process find
import time #sleep
from pycaw.pycaw import AudioUtilities #mute
while True:
EnumWindows = ctypes.windll.user32.EnumWindows
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
/r/Python
https://redd.it/cefijn
Hey guys, was a bit distracted by the fact that Spotify Free is killing the mood sometimes in a foreign language, so decided to create a script that mutes all the sound whenever there is an ad playing.
This script only works on Windows.
This script get windll libraries and uses them to create a process name list (mostly copied code).
After the list is built, it is checked for Process names "Advertisement" and "Spotify" to see if an ad is playing. These names are specific to the moment when ad is being played in Spotify.
The script is run in an interval, and does not fetch data real-time, so has small delays in runtime. As it is short and easily processed, does not load up CPU and doesn't leak memory.
The code: (Requires ctypes and pycaw libraries)
import ctypes #process find
import time #sleep
from pycaw.pycaw import AudioUtilities #mute
while True:
EnumWindows = ctypes.windll.user32.EnumWindows
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
/r/Python
https://redd.it/cefijn
reddit
r/Python - Simple python script that mutes sound when Spotify app runs an ad
139 votes and 35 comments so far on Reddit