Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Import arbitrary code from Stack Overflow as Python modules.

NotificationsYou must be signed in to change notification settings

drathier/stack-overflow-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Do you ever feel like all you’re doing is copy/pasting from StackOverflow?

Let’s take it one step further.

from stackoverflow import quick_sort will go through the searchresults
of[python] quick sort looking for the largest code block thatdoesn’t
syntax error in the highest voted answer from the highest votedquestion
and return it as a module. If that answer doesn’t have any validpython
code, it checks the next highest voted answer for code blocks.
>>>fromstackoverflowimportquick_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__)Iwonderwhomadesplit_into_chunkshttps://stackoverflow.com/a/35107113>>>print("but what's the license? Can I really use this?",quick_sort.__license__)butwhat'sthelicense?CanIreallyusethis?CCBY-SA3.0>>>assert("nice, attribution!")

This module is licensed under whatever license you want it to be aslong as the license is compatible with the fact that I blatantlycopied multiple lines of code from the Python standard library.

About

Import arbitrary code from Stack Overflow as Python modules.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp