Easily use code directly from Stack Overflow
Project description
Do you ever feel like all you’re doing is copy/pasting from Stack Overflow?
Let’s take it one step further.
from stackoverflow import quick_sort will go through the search
results
of [python] quick sort looking for the largest code block that
doesn’t
syntax error in the highest voted answer from the highest voted
question
and return it as a module. If that answer doesn’t have any valid
python
code, it checks the next highest voted answer for code blocks.
>>> from stackoverflow import quick_sort, split_into_chunks
>>> print(quick_sort.sort([1, 3, 2, 5, 4]))
[1, 2, 3, 4, 5]
>>> print(list(split_into_chunks.chunk("very good chunk func")))
['very ', 'good ', 'chunk', ' func']
>>> print("I wonder who made split_into_chunks", split_into_chunks.__author__)
I wonder who made split_into_chunks https://stackoverflow.com/a/35107113
>>> print("but what's the license? Can I really use this?", quick_sort.__license__)
but what's the license? Can I really use this? CC BY-SA 3.0
>>> assert("nice, attribution!")
This module is licensed under whatever license you want it to be as long as the license is compatible with the fact that I blatantly copied multiple lines of code from the Python standard library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for stackoverflow-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6d819490acf56966c02faeae3ac7c815e57a327e6e380572e8e4e529c794b09 |
|
MD5 | e5e7ac104d99864f4c5c1cd41f6d2fa4 |
|
BLAKE2b-256 | 25e5250c4e1fecbe89b4ba7973bc3496b63ca68e89ccddc2423809ce28c9e237 |