Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drathier/stack-overflow-import
Import arbitrary code from Stack Overflow as Python modules.
https://github.com/drathier/stack-overflow-import
import stackoverflow
Last synced: 27 days ago
JSON representation
Import arbitrary code from Stack Overflow as Python modules.
- Host: GitHub
- URL: https://github.com/drathier/stack-overflow-import
- Owner: drathier
- Created: 2016-10-27T22:15:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-09T00:38:40.000Z (almost 3 years ago)
- Last Synced: 2024-10-01T19:03:32.880Z (about 1 month ago)
- Topics: import, stackoverflow
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 3,695
- Watchers: 62
- Forks: 128
- Open Issues: 12
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
- awesome-hilarious-repos - StackOverflow Importer - if you don't know the how to do it, just import some StackOverflow's answer's code (Libraries, Frameworks and SDKs)
- jimsghstars - drathier/stack-overflow-import - Import arbitrary code from Stack Overflow as Python modules. (Python)
README
StackOverflow Importer
======================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... code:: python
>>> 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.