question_id
int64
502
42.8M
parent_answer_post_id
int64
595
42.8M
prob
float64
0
0.87
snippet
stringlengths
0
12.1k
intent
stringlengths
11
198
id
stringlengths
9
20
25,291,466
35,115,518
0.000529
from formencode.variabledecode import variable_decode class MultipartFormencodeParser(parsers.MultiPartParser): def parse(self, stream, media_type=None, parser_context=None): result = super().parse(stream, media_type=media_type, parser_context=parser_context) data = variable_decode(result.data) return parsers.DataAndFiles(data, result.files)
django rest framework file upload with nested writable serializers
25291466_35115518_14
1,762,306
1,770,581
0.000529
from PyQt4.QtCore import QUrl html_path = resource_filename(sphinx.__name__, os.path.join('build', 'html'))
force unpacking of certain egg directories
1762306_1770581_17
42,364,851
42,364,973
0.000528
from itertools import product amin = 0 amax = 2
Python: Generating all n-length arrays combinations of values within a range
42364851_42364973_13
358,225
358,641
0.000528
log4j.appender.logfile.MaxBackupIndex = 0 log4j.appender.logfile.layout = org.apache.log4j.PatternLayout
log4j with timestamp per log entry
358225_358641_6
2,557,110
2,557,196
0.000527
FILE
What to put in a python module docstring?
2557110_2557196_13
1,695,556
5,171,262
0.000527
async = true sync = true
How do I mark an item as read with google reader api (using python)
1695556_5171262_2
22,011,481
26,852,052
0.000525
lngDiv.id = 'extractedLng' lngDiv.innerHtml = lng document.body.appendChild(lngDiv)
Get the parameters of a JavaScript function with Scrapy
22011481_26852052_9
30,726,956
31,022,959
0.000525
import yagmail yag = yagmail.SMTP(from_add, password)
Attachments getting attached twice using smptplib in python
30726956_31022959_8
1,465,662
23,707,260
0.000525
from heap.heap import heap h = heap() h['hello'] = 4
How can I implement decrease-key functionality in Python's heapq?
1465662_23707260_8
20,297,858
20,297,892
0.000525
from celery.task import PeriodicTask class InitialTasksStarter(PeriodicTask): starttime = datetime.now() + timedelta(minutes=1) run_every = crontab(month_of_year=starttime.month, day_of_month=starttime. day, hour=starttime.hour, minute=starttime.minute) def run(self, **kwargs): pass
Django celery task run at once on startup of celery server
20297858_20297892_11
8,727,486
8,728,045
0.000524
AUTH_LDAP_SERVER_URI = 'ldap://ldap.example.com' import ldap
LDAP in Django default admin
8727486_8728045_19
34,126,474
40,923,708
0.000524
description
Running certain steps once before a scenario outline - Python Behave
34126474_40923708_8
18,705,373
18,705,405
0.000523
ensure
Ruby equivalent for python try
18705373_18705405_6
40,819,846
40,819,897
0.000522
from address import AddressBook a = Addressbook()
Using my Python program
40819846_40819897_9
14,009,148
14,046,303
0.000522
from PIL import Image from PIL.ExifTags import TAGS
Exif reading library
14009148_14046303_14
18,194,374
26,541,647
0.000522
python import io
Default buffer size for a file on Linux
18194374_26541647_9
42,683,518
42,712,569
0.000522
import sys from pprint import pprint as p remove = ['/usr/lib/python2.7'] sys.path = [path for path in sys.path if path not in remove] import ctypes
pip in virtualenv cannot find ctypes
42683518_42712569_12
40,257,152
40,538,541
0.000522
from googleapiclient import discovery projectID = 'projects/<your_project_id>' modelName = projectID + '/models/<your_model_name>' credentials = GoogleCredentials.get_application_default() ml = discovery.build('ml', 'v1beta1', credentials=credentials)
Is there anyway Google App Engine apps can communicate or control Machine Learning models or tasks?
40257152_40538541_18
22,851,552
23,503,501
0.000521
from Cython.Compiler.Main import compile from numpy.distutils.misc_util import Configuration
Can I create a static Cython library using distutils?
22851552_23503501_9
34,237,253
34,285,205
0.000521
usedEdge = edge2
Detect centre and angle of rectangles in an image using Opencv
34237253_34285205_16
7,701,855
28,090,741
0.00052
import py2exe wd_base = ( 'C:\\Python27\\Lib\\site-packages\\selenium-2.44.0-py2.7.egg \\selenium\\webdriver' ) RequiredDataFailes = [('selenium/webdriver/firefox', [ '%s\\firefox\\webdriver.xpi' % wd_base, '%s\\firefox\\webdriver_prefs.json' % wd_base])]
Python - Trouble in building executable
7701855_28090741_16
29,148,488
37,267,495
0.00052
import gimpfu def register_save_handlers(): gimpfu.gimp.register_save_handler('file-svg-save', 'svg', '') def save_svg(img, drawable, filename, raw_filename): gimpfu.gimp.pdb.gimp_vectors_export_to_file(img, filename, None) gimpfu.register('file-svg-save', 'save an SVG (.svg) file', 'save an SVG (.svg) file', 'Dylan Grafmyre', 'Dylan Grafmyre', '2016', 'SVG', '*', [(gimpfu.PF_IMAGE, 'image', 'Input image', None), (gimpfu. PF_DRAWABLE, 'drawable', 'Input drawable', None), (gimpfu.PF_STRING, 'filename', 'The name of the file', None), (gimpfu.PF_STRING, 'raw-filename', 'The name of the file', None)], [], save_svg, on_query= register_save_handlers, menu='<Save>')
Export all SVG paths with Gimp Python plugin
29148488_37267495_18
14,383,034
15,053,936
0.000519
-bikes -cars
OpenCV Combining SURF with Neural Network
14383034_15053936_9
9,041,192
9,041,629
0.000519
void
How does SWIG wrap a map<string,string> in Python?
9041192_9041629_9
11,400,307
28,394,497
0.000519
from sqlalchemy.sql import select, false stmt = select([Beard, Moustache]).select_from(outerjoin(Beard, Moustache, false())).apply_labels().union_all(select([Beard, Moustache]). select_from(outerjoin(Moustache, Beard, false())).apply_labels())
RIGHT OUTER JOIN in SQLAlchemy
11400307_28394497_5
12,556,163
18,394,030
0.000518
import org.openqa.selenium.HasCapabilities import org.openqa.selenium.remote.RemoteWebDriver import org.openqa.selenium.support.events.EventFiringWebDriver
Get browser version using selenium webdriver
12556163_18394030_11
7,125,009
29,694,950
0.000517
x - small small medium large x - large xx - large
How to change legend size with matplotlib.pyplot
7125009_29694950_11
5,537,592
29,628,236
0.000517
import requests import browser_cookie
How to extract Firefox session cookie (python language preferred)
5537592_29628236_8
40,747,713
41,023,395
0.000517
old_vote = query(poll_user_id=session['poll_user_id'], poll=poll_id) if not old_vote: insert(poll_user_id=session['poll_user_id'], poll=poll_id, choice=form. choice) else: pass
flask save polls in cookie
40747713_41023395_13
17,791,481
41,110,107
0.000516
import re def get_property(prop, project): result = re.search('{}\\s*=\\s*[\\\'"]([^\\\'"]*)[\\\'"]'.format(prop), open(project + '/__init__.py').read()) return result.group(1) project_name = 'YOUR PROJECT'
Creating a __version__ attribute for python packages without getting into trouble
17791481_41110107_19
40,859,607
41,036,384
0.000516
fi done > README.rst
Add usage help of command line tool to README.rst
40859607_41036384_4
8,478,137
8,478,633
0.000515
beta
How redirect a shell command output to a Python script input ?
8478137_8478633_8
25,288,653
25,288,899
0.000515
5 / 6 bool(5 / 6) 6 / 5
Using '/' as greater than less than in Python?
25288653_25288899_14
16,900,919
16,903,181
0.000515
from oauth2client.appengine import CredentialsModel from oauth2client.appengine import StorageByKeyName
How to make 'access_type=offline' / server-only OAuth2 operations on GAE/Python?
16900919_16903181_8
7,912,820
32,020,282
0.000515
stationLat = -40 s stationLat
How do I change a value while debugging python with pdb?
7912820_32020282_3
2,044,574
2,044,679
0.000514
d = repr(pwd)
Determine if directory is under git control
2044574_2044679_1
12,556,163
18,394,030
0.000512
import org.openqa.selenium.HasCapabilities import org.openqa.selenium.remote.RemoteWebDriver
Get browser version using selenium webdriver
12556163_18394030_10
23,531,145
23,531,475
0.000512
from collections import defaultdict tree = lambda : defaultdict(tree) d = tree()
Pandas to D3. Serializing dataframes to JSON
23531145_23531475_15
34,873,056
34,878,072
0.000511
from bs4 import BeautifulSoup html = """ <div class="aa bb"></div> <div class="aa ccc"></div> <div class="aa"></div> """
How to use Beautiful4 to filter multi class
34873056_34878072_15
33,689,721
33,740,817
0.000511
import bitarray as bt
Calculating Precision, Recall and F-score in one pass - python
33689721_33740817_12
40,747,713
41,023,395
0.000511
old_vote = query(poll_user_id=session['poll_user_id'], poll=poll_id) if not old_vote: pass
flask save polls in cookie
40747713_41023395_12
42,381,902
42,639,502
0.00051
""" Compute cosine similarity between two words. Example:: >>> trained_model.similarity('woman', 'man') 0.73723527 >>> trained_model.similarity('woman', 'woman') 1.0 """
Interpreting negative Word2Vec similarity from gensim
42381902_42639502_4
10,121,861
10,121,989
0.00051
fmin = N / f2 fmin
Dividing large numbers in Python
10121861_10121989_11
3,217,334
3,219,275
0.00051
from bitstring import ConstBitStream s = ConstBitStream(filename='your_file')
Python: Searching/reading binary data
3217334_3219275_15
8,281,371
8,287,065
0.000509
import netifaces as ni ni.interfaces()
Python, How to get all external ip addresses with multiple NICs
8281371_8287065_13
22,002,968
22,118,379
0.000509
import sys TOKENBLANKS = 1 class MyClassNameTranslator: pass
Easy way to convert python source code to an AST with comments intact
22002968_22118379_18
34,803,234
34,860,388
0.000509
ON
Sqlalchemy: subquery in FROM must have an alias
34803234_34860388_10
25,291,466
35,115,518
0.000509
parsers = MultipartFormencodeParser,
django rest framework file upload with nested writable serializers
25291466_35115518_15
9,020,860
23,654,859
0.000507
from lockfile.pidlockfile import PIDLockFile from lockfile import AlreadyLocked pidfile = PIDLockFile('/var/run/mydaemon.pid', timeout=-1)
python-daemon context fails to start when a stale PID file is present
9020860_23654859_15
8,283,603
8,370,444
0.000507
ls python
Boost python on mac os x lion with custom python
8283603_8370444_5
36,724,300
41,984,775
0.000507
from geopy.geocoders import Nominatim geolocator = Nominatim() location = geolocator.geocode('Singapore')
Client IP Address to Closest AWS Region
36724300_41984775_18
8,893,209
8,893,965
0.000507
http = types.ModuleType('http') from .http import client
Relative import of submodule
8893209_8893965_17
39,397,034
39,398,969
0.000506
tr
Script works differently when ran from the terminal and ran from Python
39397034_39398969_10
12,605,498
12,614,001
0.000505
import sh
How to use subprocess popen Python
12605498_12614001_2
33,685,811
33,686,018
0.000505
str = ( """Monday and Tuesday and Wednesday and Thursday and Friday and Saturday and Sunday are the days of the week.""" ) import re
To replace but the last occurrence of string in a text
33685811_33686018_6
2,245,761
2,251,072
0.000505
import yaml sql = """ query : "SELECT * from cities WHERE name='Unknown';" count : 0 level : 1 name : "Check for cities whose name should be null" suggested_fix : "UPDATE cities SET name=NULL WHERE name='Unknown';\" """ sql_dict = yaml.safe_load(sql)
Python: Read configuration file with multiple lines per key
2245761_2251072_9
35,911,252
39,708,493
0.000505
import logging
Disable Tensorflow debugging information
35911252_39708493_2
34,803,234
34,860,388
0.000504
FROM
Sqlalchemy: subquery in FROM must have an alias
34803234_34860388_11
12,204,441
12,205,374
0.000504
pyResponse.cefResponse = cefResponse return pyResponse
Passing C++ pointer as argument into Cython function
12204441_12205374_4
5,275,082
5,462,639
0.000503
from settings_shared import DATABASES_SHARED DATABASES = DATABASES_SHARED.copy()
Single installation, multiple domains and apps?
5275082_5462639_2
10,122,101
10,123,634
0.000503
from functional import compose, foldr, partial compose_mult = partial(reduce, compose)
How to compose iterators?
10122101_10123634_14
33,248,866
33,249,103
0.000502
End
Distance from smallest to the largest element in lists (inside a list)
33248866_33249103_1
12,556,309
19,903,276
0.000501
def count_click(requests): from collections import Counter count = Counter(request.kwargs['url'] for request in requests) for url, count in list(count.items()): pass
Celery Task Grouping/Aggregation
12556309_19903276_15
26,762,015
26,889,541
0.0005
from psychopy import core from ctypes import windll windll.inpout32.Out32(portaddress, triggerCode) core.wait(0.05)
PsychoPy sending triggers on 64bit OS
26762015_26889541_14
3,783,677
3,785,223
0.000499
from bitstring import ConstBitStream s = ConstBitStream(filename='some_file')
How to read integers from a file that are 24bit and little endian using Python?
3783677_3785223_8
30,200,494
30,201,400
0.000499
X1
Referencing a numpy arrray without creating an expensive copy
30200494_30201400_12
15,031,136
19,276,499
0.000497
all_setup = """ import numpy as np ; from scipy.linalg import sqrtm ; from numpy.linalg import inv ; from numpy import sqrt a=.1 ; c=43.2 ; d=32.343""" timeit('sqrtm(inv(np.array([ ( a, 0, 0 ) , ( c, d, 0 ) , ( 0, 0, 1 ) ])))', setup=all_setup, number=num_to_run)
Efficient way to plotting multiple images with many patches in matplotlib?
15031136_19276499_10
9,525,220
9,788,109
0.000496
from eventlet import tpool def m(): pass
SQLAlchemy raises None, causes TypeError
9525220_9788109_17
24,187,248
24,187,326
0.000496
420 python3 420
Python 2to3 tool adds a vowel to my integer
24187248_24187326_7
37,206,459
37,379,419
0.000496
from tensorflow.contrib import learn train = pandas.read_csv('dbpedia_csv/train.csv', header=None) X_train, y_train = train[2], train[0] test = pandas.read_csv('dbpedia_csv/test.csv', header=None)
Tensorflow examples all fail due to AttributeError: 'module' object has no attribute 'datasets'
37206459_37379419_14
1,174,984
1,175,491
0.000496
from numpy import array nums = array(((0.01, 0.01, 0.02, 0.04, 0.03), (0.0, 0.02, 0.02, 0.03, 0.02), (0.01, 0.02, 0.02, 0.03, 0.02), (0.01, 0.0, 0.01, 0.05, 0.03))) print(nums.std(axis=1))
How to efficiently calculate a running standard deviation?
1174984_1175491_9
1,780,459
1,780,844
0.000496
import Stream._
How can I approximate Python's or operator for set comparison in Scala?
1780459_1780844_1
5,872,858
21,736,385
0.000495
import rtmidi_python as rtmidi vmidi_out = rtmidi.MidiOut() vmidi_out.open_virtual_port('My Virtual MIDI Output Port')
Configure Mac OS X MIDI programatically
5872858_21736385_13
20,180,543
20,180,597
0.000494
lxml == 2.3
How to check version of python modules?
20180543_20180597_0
9,299,346
9,300,826
0.000494
from sklearn.cross_validation import ShuffleSplit cv = ShuffleSplit(3, test_fraction=0.2, train_fraction=0.2, random_state=0) gs = GridSeachCV(clf, params_grid, cv=cv, n_jobs=-1, verbose=2)
Fastest SVM implementation usable in Python
9299346_9300826_9
20,297,858
20,297,892
0.000493
run_every = crontab(month_of_year=starttime.month, day_of_month=starttime. day, hour=starttime.hour, minute=starttime.minute) def run(self, **kwargs): pass
Django celery task run at once on startup of celery server
20297858_20297892_12
1,071,110
18,106,223
0.000493
import requests def translate_es_to_en(text): pass
Call Google Translate from Python
1071110_18106223_11
42,058,057
42,058,297
0.000492
flags
Creating a "bitmask" from several boolean numpy arrays
42058057_42058297_10
2,308,247
2,308,327
0.000492
import limits print(limits.shrt_max)
Find maximum signed short integer in python
2308247_2308327_7
15,158,599
15,158,767
0.000492
hand
Removing entries from a dictionary based on values
15158599_15158767_12
12,329,807
12,330,005
0.000492
daemon = False bind = 'unix:/tmp/gunicorn.sock' workers = multiprocessing.cpu_count() * 2 + 1
Django app deployment on nGINX
12329807_12330005_13
34,126,474
40,923,708
0.000491
""" Given some setup condition that only runs once per feature And some other run once setup action """
Running certain steps once before a scenario outline - Python Behave
34126474_40923708_7
21,366,290
21,366,908
0.000491
import re, sre_parse pattern = ( '(?P<DEF_FUNC>def (?P<NAME_FUNC>\\w+)\\s*\\((.*?)\\):)|(?P<OTHERS>\\w+)')
Pattern associated to a named group
21366290_21366908_12
30,382,187
33,944,561
0.000491
import jinja2 def render_jinja_html(template_loc, file_name, **context): pass
render jinja2 template without a Flask context
30382187_33944561_4
25,597,815
25,608,446
0.000491
import sys s = slice(0, sys.maxsize + 1) s
Slice endpoints invisibly truncated
25597815_25608446_15
27,486,589
27,487,021
0.00049
from setuptools import setup imp_spam = 'spam'
Python any of many dependencies
27486589_27487021_14
26,446,338
37,436,307
0.00049
from functools import partial from operator import mul double = partial(mul, 2)
How to multiply all integers inside list
26446338_37436307_9
13,329,617
13,733,665
0.00049
song_10_db_quierter = song - 10 song = song - 36
Change the volume of a wav file in python
13329617_13733665_14
3,250,749
3,250,975
0.000488
import sys V = list(range(100000))
Using Windows Python from Cygwin
3250749_3250975_11
20,774,745
21,539,806
0.000486
class TrackingProcessor: TProcessor
How to get client's IP in a python thrift server
20774745_21539806_2
19,984,596
19,984,704
0.000486
SPN
Numpy array of random matrices
19984596_19984704_9
32,490,629
42,302,885
0.000485
import arrow
Getting today's date in YYYY-MM-DD in Python?
32490629_42302885_2
20,731,851
26,175,910
0.000485
from google.net.proto.ProtocolBuffer import ProtocolBufferDecodeError
How to properly handle wrong urlsafe key provided?
20731851_26175910_4
1,556,554
10,063,883
0.000484
import jinja2 jinja2.__version__ a
jinja2: html escape variables
1556554_10063883_13
40,221,291
40,221,710
0.000484
txt = """Index1,1 ,2 ,3 Index2,1 ,2 ,3"""
How to fill Pandas index NaN's
40221291_40221710_16
7,117,143
7,141,077
0.000484
import timeit
Setting Pixels Quickly
7117143_7141077_4
26,081,300
26,110,278
0.000483
element
Pandas: Subtract row mean from each element in row
26081300_26110278_3
6,903,361
6,903,495
0.000483
current_indent = new_indent return INDENT
Lexer that recognizes indented blocks
6903361_6903495_4
28,035,839
28,041,309
0.000483
import io temp = """id text 363.327 text1 366.356 text2 37782 textn"""
How to delete a column from a data frame with pandas?
28035839_28041309_11
8,478,137
8,478,633
0.000482
gamma
How redirect a shell command output to a Python script input ?
8478137_8478633_9