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
11,435,760
28,588,082
0.000733
wxPyEndBlockThreads(blocked) cout << 'Executed' << endl Py_XDECREF(arglist) Py_XDECREF(result)
Python Callback from SWIG PyObject_Call Segfault
11435760_28588082_13
8,174,437
8,175,796
0.000733
from twisted.internet import reactor, task d = task.deferLater(reactor, 0, myFunction, parameter1)
How to combine callLater and addCallback?
8174437_8175796_9
3,725,205
3,725,791
0.000732
var = Variables(['variables.cache', 'custom.py'], ARGUMENTS) var.AddVariables(PathVariable('LIBFOO', 'where the foo library is installed', 'C:\\default\\libfoo', PathVariable.PathIsDir))
SCons configuration file and default values
3725205_3725791_15
15,109,548
15,109,660
0.000732
import sys import time while True: pass
set pythonpath before import statements
15109548_15109660_13
15,109,548
15,109,660
0.000732
import sys import time while True: pass
set pythonpath before import statements
15109548_15109660_14
10,126,531
10,126,629
0.000732
import example example.fact(5) example.my_mod(7, 3)
SWIG and C++ shared library
10126531_10126629_11
23,703,870
23,704,655
0.000732
from Selenium2Library import Selenium2Library class CustomSeleniumLibrary(Selenium2Library): def get_webdriver_instance(self): pass
Pass existing Webdriver object to custom Python library for Robot Framework
23703870_23704655_16
20,297,858
20,297,892
0.000731
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)
Django celery task run at once on startup of celery server
20297858_20297892_9
35,544,015
35,552,089
0.00073
ls
How to freeze brew requirements like pip?
35544015_35552089_1
12,322,289
12,336,039
0.00073
quotes trades
KDB+ like asof join for timeseries data in pandas?
12322289_12336039_8
14,775,040
14,775,453
0.000729
scale_pow = 2 def my_formatter_fun(x, p): pass
matplotlib axis label format
14775040_14775453_16
20,705,027
21,045,736
0.000728
service.IgnoreSslErrors = true service.LoadImages = false service.ProxyType = 'none'
Selenium Webdriver + PhantomJS remains at about:blank for a specific site
20705027_21045736_5
537,077
4,464,661
0.000728
import pickle
Python, Sqlite3 - How to convert a list to a BLOB cell
537077_4464661_7
12,487,549
12,487,599
0.000727
"""class FooClass%i: import os as foo%i print foo%i.getcwd()"""
How safe is it to import a module multiple times?
12487549_12487599_8
29,647,326
29,649,072
0.000727
from multiprocessing import Pool def f(row_id): return vstack(res_rows, 'csr')
Sparse matrix dot product keeping only N-max values per result row
29647326_29649072_15
8,418,473
8,549,539
0.000726
libraries = libraries
Python Berkeley DB/Sqlite
8418473_8549539_3
5,596,135
5,598,541
0.000726
fprintf(stderr, ' built on %s %s with %s %s\n', __DATE__, __TIME__, CC_TYPE, CC_VERSION)
Run ffmpeg without outputting configuration information?
5596135_5598541_6
7,125,009
29,694,950
0.000726
xx - small x - small small
How to change legend size with matplotlib.pyplot
7125009_29694950_10
14,402,112
17,992,233
0.000725
import mylibrary def some_function(): pass
Namespace packages with a core part?
14402112_17992233_9
24,023,052
24,024,139
0.000725
from flask import Flask, Request from werkzeug.datastructures import ImmutableOrderedMultiDict class OrderedRequest(Request): parameter_storage_class = ImmutableOrderedMultiDict app = Flask(__name__)
How to get the Jinja2 generated input value data?
24023052_24024139_18
15,511,349
39,585,770
0.000724
from numpy import random mylist = [13, 23, 14, 52, 6, 23]
Select 50 items from list at random to write to file
15511349_39585770_5
17,888,152
17,888,444
0.000724
from itertools import takewhile s = '12//'
Parse string to int when string contains a number + extra characters
17888152_17888444_5
953,027
953,063
0.000724
def open(): pass import builtins print(open)
Explicit access to Python's built in scope
953027_953063_10
13,998,492
25,082,467
0.000723
import six d = dict(foo=1, bar=2) for k, v in six.iteritems(d): pass
iteritems in Python
13998492_25082467_14
1,811,010
1,811,052
0.000723
import decimal decimal.Decimal(-1000).exp()
Standard library - higher-precision floating point?
1811010_1811052_7
35,069,921
35,070,208
0.000723
sig
OCaml map a string to a list of strings
35069921_35070208_1
29,589,119
38,958,145
0.000723
import matplotlib.pyplot as plt fig_size[0] = 12 fig_size[1] = 9
Plot width settings in ipython notebook
29589119_38958145_9
17,152,760
17,152,796
0.000722
set del set set
How to restore a builtin that I overwrote by accident?
17152760_17152796_8
19,566,555
19,577,968
0.000722
blogService.js blogView.html app.module.js
Folder Structure for Python Django-REST-framework and Angularjs
19566555_19577968_19
2,183,008
2,433,820
0.000722
import django_tables provider = django_filters.AllValuesFilter(widget=django_filters.widgets. LinkWidget)
Hide filter items that produce zero results in django-filter
2183008_2433820_2
7,199,405
10,220,706
0.000722
import atom.http_core redirected_page = 'http://path/that/you/set?code=RANDOM-CODE' uri = atom.http_core.ParseUri(redirected_page)
Authenticating to Calendar with Python gdata and oAuth 2
7199405_10220706_13
20,074,604
20,074,951
0.000721
[Section] Value1 = Foo
Python configparser: Copy comments from input file
20074604_20074951_5
34,133,037
34,134,110
0.000721
a b2
Sort N-D numpy array by column with a smaller N-D array
34133037_34134110_4
16,994,174
31,764,294
0.00072
from flask import current_app logger = LocalProxy(lambda : current_app.logger) from core import logger
In Flask: How to access app Logger within Blueprint
16994174_31764294_16
3,050,298
3,050,374
0.00072
TWO
Parsing email with Python
3050298_3050374_7
4,565,935
5,964,786
0.00072
class StaticFinder(BaseStorageFinder): pass
Django staticfiles app help
4565935_5964786_12
1,620,940
10,606,663
0.00072
from itertools import product, starmap x, y = 8, 13
Determining neighbours of cell two dimensional list
1620940_10606663_6
7,181,757
7,183,004
0.000719
import numbers class NumberWithRounding(numbers.Integral): pass
How to implement division with round-towards-infinity in Python
7181757_7183004_9
14,755,882
14,755,996
0.000719
import timeit timeit.timeit(setup='import re', stmt= """r=re.compile(r"\\w+") for i in range(10): r.search(" jkdhf ")""")
Compiling Regular Expressions in Python
14755882_14755996_7
10,818,824
10,818,843
0.000719
import grp
How to set a files owner in python?
10818824_10818843_14
12,695,592
12,696,287
0.000718
self.policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=0 )
Error on running transaction with multiple entity groups through nosetests
12695592_12696287_2
386,753
386,763
0.000718
import struct response = 0, 0, 117, 143, 6
How do I convert part of a python tuple (byte array) into an integer
386753_386763_16
25,291,466
35,115,518
0.000718
from rest_framework import parsers from formencode.variabledecode import variable_decode
django rest framework file upload with nested writable serializers
25291466_35115518_13
4,070,601
28,853,080
0.000717
from base64 import b64encode ctx = sha.new('your_password') hash = '{SHA}' + b64encode(ctx.digest())
use python to create compatible ldap password (md5crypt) on windows
4070601_28853080_11
32,593,155
32,593,392
0.000717
none python26 - apple
psycopg2 installed successfully, but cannot be imported into python
32593155_32593392_16
18,224,991
38,479,523
0.000717
print(const.gravity) const.gravity = 9.0
how to set global const variables in python
18224991_38479523_14
19,569,701
19,707,600
0.000716
from twisted.web import client d = client.getPage(url=context.client.location(), postdata=str(context. envelope), method='POST', headers=context.client.headers()) d.addCallback(context.succeeded) from pprint import pprint
Benefits of twisted-suds - Async way of using python suds soap lib
19569701_19707600_14
40,224,066
40,225,839
0.000716
ipdb > next 11
ipdb commands obscured by variables
40224066_40225839_7
4,256,145
4,256,485
0.000716
import django def django_version(request): pass
Django template tag to display Django version
4256145_4256485_5
13,017,225
13,017,358
0.000716
def enumerated_columns(*rows): pass
Variable length 'yield'?
13017225_13017358_5
2,378,962
2,379,269
0.000716
tests = ['foo', ' foo', '\xa0foo'] import re for test in tests: pass
Returning the lowest index for the first non whitespace character in a string in Python
2378962_2379269_9
13,239,004
13,430,019
0.000716
END
Create SQL table with correct column types from CSV
13239004_13430019_1
845,926
848,611
0.000715
import win32api filelist = win32api.FindFiles('F:/recovery/My Music/*.*') filelist = [(i[9] if i[9] else i[8]) for i in filelist] for number, filename in enumerate(filelist): pass
Rename invalid filename in XP via Python
845926_848611_14
10,874,719
32,600,280
0.000715
from lxml.builder import ElementMaker, E M = ElementMaker(namespace=None, nsmap={None: 'http://www.w3.org/1999/xhtml'}) html = M.html(E.head(E.title('Test page')), E.body(E.p('Hello world')))
Recommended way to generate XHTML documents with lxml
10874719_32600280_18
4,992,739
4,992,948
0.000714
records
how to traverse through dict?
4992739_4992948_4
17,152,760
17,152,796
0.000714
set = 'oops' set del set
How to restore a builtin that I overwrote by accident?
17152760_17152796_9
2,245,761
2,251,072
0.000714
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';\" """
Python: Read configuration file with multiple lines per key
2245761_2251072_8
21,975,666
22,055,820
0.000714
if node() in ['dev1', 'dev2']: from local import * elif node() in ['prod1', 'prod2']: from production import *
Active Django settings file from Celery worker
21975666_22055820_16
557,460
557,538
0.000713
def context_myApp_settings(request): """Insert some additional information into the template context from the settings. Specifically, the LOGOUT_URL, MEDIA_URL and BADGES settings. """ from django.conf import settings
Django - having middleware communicate with views/templates
557460_557538_18
16,607,074
24,116,229
0.000713
packet = Base() packet.ParseFromString(msg) if packet.type == TYPE.A: packet = A()
Accessing field of Protobuf message of unknown type in Python
16607074_24116229_14
8,512,842
8,716,502
0.000712
import pylibmc from memcached_stats import MemcachedStats mem = MemcachedStats()
How do I check the content of a Django cache with Python memcached?
8512842_8716502_16
12,338,544
12,377,741
0.000712
import time from subprocess import check_call, check_output DIR = '/directory/to/watch/' REMOTE_DIR = 'user@my_server.com:/folder'
Track folder changes / Dropbox changes
12338544_12377741_16
4,070,601
28,853,080
0.000711
import sha from base64 import b64encode ctx = sha.new('your_password') hash = '{SHA}' + b64encode(ctx.digest())
use python to create compatible ldap password (md5crypt) on windows
4070601_28853080_13
2,448,418
36,946,398
0.000711
import win32net def if_user_in_group(group, member): members = win32net.NetLocalGroupGetMembers(None, group, 1)
Determine if current user is in Administrators group (Windows/Python)
2448418_36946398_12
8,512,842
8,716,502
0.000709
import pylibmc from memcached_stats import MemcachedStats mem = MemcachedStats() list(mem.keys())
How do I check the content of a Django cache with Python memcached?
8512842_8716502_18
21,148,655
25,011,466
0.000708
102
Python PySerial with Auto RTS through Half-Duplex RS-485 breakout board using Beaglebone Black Angstrom
21148655_25011466_3
18,372,952
18,373,060
0.000708
level url
Python, split tuple items to single stuff
18372952_18373060_13
1,037,406
1,037,423
0.000708
import urllib.request, urllib.error, urllib.parse from urlgrabber.keepalive import HTTPHandler keepalive_handler = HTTPHandler()
Python urllib2 with keep alive
1037406_1037423_18
9,232,568
10,319,754
0.000707
nose figleaf pinocchio
Identifying the dependency relationship for python packages installed with pip
9232568_10319754_4
1,028,992
1,029,099
0.000707
import pickle import marshal marshal.loads = pickle.loads
Full-text search on App Engine with Whoosh
1028992_1029099_9
11,435,760
28,588,082
0.000707
wxPyEndBlockThreads(blocked) cout << 'Executed' << endl Py_XDECREF(arglist)
Python Callback from SWIG PyObject_Call Segfault
11435760_28588082_14
27,208,891
27,208,914
0.000706
t = env.from_string( """ {% for field in fields %} <td> {{ item[field] }} </td> {% endfor %}""")
Jinja2 dictonary lookup using a variable key
27208891_27208914_10
13,687,703
15,872,842
0.000706
from bson import json_util objects = MyDoc.objects()
Return MongoEngine Documents as JSON
13687703_15872842_5
14,329,828
14,330,272
0.000706
branch = r.head.reference commit = r.head.commit
Edit a commit with gitpython
14329828_14330272_9
5,281,341
14,725,655
0.000705
fi
Get local network interface addresses using only proc?
5281341_14725655_2
35,084,518
35,084,583
0.000705
from enum import Enum class Color(Enum): pass
Validate against enum members in Python
35084518_35084583_19
7,249,488
7,254,337
0.000704
module_name = module.__name__ import_line = 'from %s import (%%s)' % module_name length = len(import_line) - 3 print(import_line % (',\n' + length * ' ').join([a for a in dir(module) if not re.match('__.*[^_]{2}', a)]))
Tool to help eliminate wildcard imports
7249488_7254337_8
4,070,601
28,853,080
0.000704
import sha from base64 import b64encode
use python to create compatible ldap password (md5crypt) on windows
4070601_28853080_12
34,508,431
40,630,956
0.000704
floatX = float32 device = cpu
Installing Theano on Windows - DLL load failed
34508431_40630956_5
22,011,481
26,852,052
0.000704
latDiv.innerHtml = lat
Get the parameters of a JavaScript function with Scrapy
22011481_26852052_6
9,340,881
9,341,150
0.000703
"""Make a copy of only the `keys` from dictionary `d`. Use `default` if a key is missing. """
Create a Python dictionary containing specific key–value pairs from another dictionary
9340881_9341150_9
19,469,932
19,470,001
0.000703
facebook
Project Name vs Application Name in Django
19469932_19470001_7
5,466,342
15,317,018
0.000703
from IPython.frontend.terminal.ipapp import TerminalIPythonApp app = TerminalIPythonApp.instance() app.initialize(argv=[])
Embedded interactive shell in IPython
5466342_15317018_9
1,762,306
1,770,581
0.000703
from doc import sphinx import os from PyQt4.QtCore import QUrl html_path = resource_filename(sphinx.__name__, os.path.join('build', 'html')) return QUrl(os.path.join(html_path, 'index.html'))
force unpacking of certain egg directories
1762306_1770581_15
2,764,055
2,765,556
0.000702
cont one two three four
How to pdb Python code with input?
2764055_2765556_11
5,522,326
10,419,708
0.000701
done done
Automatically build Sphinx documentation when a source file changes
5522326_10419708_2
373,020
25,214,024
0.000701
from AppKit import NSWorkspace active_app_name = NSWorkspace.sharedWorkspace().frontmostApplication( ).localizedName()
Finding the Current Active Window in Mac OS X using Python
373020_25214024_5
3,720,740
28,389,678
0.000701
__builtin__.myapp_PATH_TO_R_SOURCE = 'path.to.r.source' import someClass
Pass Variable On Import
3720740_28389678_13
34,802,316
34,802,317
0.000701
def _force_https(): if not app.debug: from flask import _request_ctx_stack if _request_ctx_stack is not None: reqctx = _request_ctx_stack.top reqctx.url_adapter.url_scheme = 'https'
Make Flask's url_for use the 'https' scheme in an AWS load balancer without messing with SSLify
34802316_34802317_17
20,400,135
20,400,262
0.0007
timeit('from __main__ import np, pd, a, b; pd.Series(np.concatenate([a,b]))', number=10000) timeit( 'from __main__ import np, pd, a, b; pd.concat([a, b], ignore_index=True)', number=10000)
Simple way to append a pandas series with same index
20400135_20400262_7
42,237,141
42,237,519
0.0007
from scipy.signal import argrelmax arr = np.random.randint(1000, size=10 ** 6)
Split a list into increasing sequences using itertools
42237141_42237519_5
39,646,760
39,646,997
0.0007
import functions for name in getattr(functions, '__all__', (n for n in vars(functions) if not n[0] == '_')): pass
Modules and variable scopes
39646760_39646997_12
11,331,175
11,332,078
0.000699
from distutils.command.build import build class my_build(build): def run(self): pass
Hook to add commands to distutils build?
11331175_11332078_15
10,507,577
10,507,679
0.000699
FROM
Matrix multiplication in python and mysql
10507577_10507679_0
6,509,856
6,517,725
0.000699
from paste.deploy.loadwsgi import appconfig config = appconfig('config:development.ini', 'myapp', relative_to='.') if config['env'] == 'production': pass
How to get Registry().settings during Pyramid app startup time?
6509856_6517725_12
15,238,120
15,238,187
0.000698
0.1 + 0.1 + 0.1 - 0.3 from decimal import Decimal
Keep trailing zeroes in python
15238120_15238187_6
6,091,784
6,091,840
0.000698
from tipfy import RequestHandler, Response from tipfy.ext.auth import AppEngineAuthMixin, user_required class MyHandler(RequestHandler, AppEngineAuthMixin): pass
How do I secure REST calls I am making in-app?
6091784_6091840_8
11,709,746
11,718,637
0.000697
from flask.ext.assets import Environment, Bundle assets = Environment(app) css_all = Bundle('reset.css', 'main.css', 'fonts.css')
How to not redefine url for static files in flask everytime
11709746_11718637_9
22,213,298
22,213,400
0.000697
import rpy2.robjects as robjects data = robjects.r(""" set.seed(1) x <- runif(5) """) print(np.array(data)) data[1] = 1.0
Creating same random number sequence in Python, NumPy and R
22213298_22213400_12
34,130,186
34,258,563
0.000697
repo
Static URL in cherrypy
34130186_34258563_8