Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stackoverflow-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

stackoverflow-0.1.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file stackoverflow-0.1.2.tar.gz.

File metadata

  • Download URL: stackoverflow-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for stackoverflow-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3baa4a1d063ba51c3dce6f27668dfe94c2e3a58bb38caf9bb08a6ff63101f52e
MD5 aadd639dbda1d89319e5d1c16b47f48c
BLAKE2b-256 26c72312382c982a5f9c007d40d0def5cf2de109ac35cab0bfd1debfcfa1fd9c

See more details on using hashes here.

File details

Details for the file stackoverflow-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: stackoverflow-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for stackoverflow-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0c880831394abfcd83486dfbed55b2286bddc0b18831d6a99f4b0005a4fc4296
MD5 05e7dd8f38955a94a912c108df372488
BLAKE2b-256 21d3a691bc970abd62734d8a4368258a5e799894e8782cdd0fcb332fa6b1bbd7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page