commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
f681f6ac7764b0944434c69febb2b3b778f2aad7 | add 2 | leetcode/2.py | leetcode/2.py | Python | 0.999999 | @@ -0,0 +1,1277 @@
+# Definition for singly-linked list.%0A# class ListNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0A%0Aclass Solution(object):%0A def addTwoNumbers(self, l1, l2):%0A %22%22%22%0A :type l1: ListNode%0A :type l2: ListNode%0A ... | |
45686564547ccf1f40516d2ecbcf550bb904d59c | Create lc1032.py | LeetCode/lc1032.py | LeetCode/lc1032.py | Python | 0.000002 | @@ -0,0 +1,2663 @@
+import queue %0A%0Aclass Node:%0A def __init__(self, s=''):%0A self.s = s%0A self.end = False%0A self.fail = None%0A self.children = None%0A def get(self, index):%0A if self.children == None:%0A return None%0A return self.children%5Bindex%5D... | |
4df1339140dfe7491058fa4ff6ed6a0be82d4cab | Add "time" role to the mixpanel time dimension | cubes/backends/mixpanel/store.py | cubes/backends/mixpanel/store.py | # -*- coding=utf -*-
from ...model import Cube, create_dimension
from ...model import aggregate_list
from ...browser import *
from ...stores import Store
from ...errors import *
from ...providers import ModelProvider
from ...logging import get_logger
from .mixpanel import *
from .mapper import cube_event_key
from strin... | Python | 0.000004 | @@ -469,24 +469,44 @@
e%22: %22time%22,%0A
+ %22role%22: %22time%22,%0A
%22levels%22
|
2c2d594b7d8d5d74732e30c46859779b88621baa | Create __init__.py | FireModules/__init__.py | FireModules/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
54a10f78a6c71d88e1c2441bb636e6b636f74613 | add unit test | rstem/led2/test_unittest.py | rstem/led2/test_unittest.py | Python | 0.000001 | @@ -0,0 +1,3120 @@
+#!/usr/bin/python3%0A%0Aimport unittest%0Aimport os%0Afrom rstem import led2%0A%0A# TODO: single setup for all testcases????%0A# TODO: make hardware versions that you can optionally skip%0A%0Aif __name__ == '__main__':%0A unittest.main()%0A %0Adef query(question):%0A ret = int(input(questio... | |
f0587e44be1c7f85dbbf54e1d6c47458a4960d7c | Create date_time.py | date_time.py | date_time.py | Python | 0.000939 | @@ -0,0 +1,1032 @@
+#!/usr/bin/env python%0A# -*_ coding: utf-8 -*-%0Aimport datetime%0Aimport sys%0A%0A%0Adef main():%0A%0A now = datetime.datetime.now()%0A%0A while True:%0A user_request = input(%22%5CnCurrent %5Btime, day, date%5D: %22)%0A%0A if user_request == %22quit%22:%0A sys.exit(... | |
c15f8805d3ce5eab9f46dc24a6845ce27b117ac3 | Add TeamTest | dbaas/account/tests/test_team.py | dbaas/account/tests/test_team.py | Python | 0 | @@ -0,0 +1,720 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, unicode_literals%0Afrom django.test import TestCase%0Afrom django.db import IntegrityError%0Afrom . import factory%0Afrom ..models import Team%0Afrom drivers import base%0A%0Aimport logging%0A%0ALOG = logging.getLogger(__name__)%0A%0Ac... | |
264863c1a8d60dd35babec22470626d13ebf3e66 | Remove unused import.t | debug_toolbar/panels/__init__.py | debug_toolbar/panels/__init__.py | from __future__ import absolute_import, unicode_literals
import warnings
from django.template.defaultfilters import slugify
from django.template.loader import render_to_string
class Panel(object):
"""
Base class for panels.
"""
# name = 'Base'
# template = 'debug_toolbar/panels/base.html'
#... | Python | 0 | @@ -72,59 +72,8 @@
gs%0A%0A
-from django.template.defaultfilters import slugify%0A
from
|
4bfd69bc49b17e7844077949560bd6259ea33e9b | test the root scrubadub api | tests/test_api.py | tests/test_api.py | Python | 0.000007 | @@ -0,0 +1,1963 @@
+import unittest%0Aimport scrubadub%0A%0A%0Aclass APITestCase(unittest.TestCase):%0A%0A def test_clean(self):%0A %22%22%22Test the top level clean api%22%22%22%0A self.assertEqual(%0A scrubadub.clean(%22This is a test message for example@exampe.com%22),%0A %22Th... | |
cd906789b4ed339542722c04dd09f8aca04fd7ff | add missing revision | crowdsourcing/migrations/0170_task_price.py | crowdsourcing/migrations/0170_task_price.py | Python | 0.000004 | @@ -0,0 +1,446 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2017-05-24 00:15%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('crowdsourcing', '0169_auto_20170524_0002'),%0A %5D%... | |
369dff642883ded68eca98754ce81369634da94d | Add box tests | tests/test_box.py | tests/test_box.py | Python | 0.000001 | @@ -0,0 +1,811 @@
+import pytest%0A%0Afrom rich.box import ASCII, DOUBLE, ROUNDED, HEAVY%0A%0A%0Adef test_str():%0A assert str(ASCII) == %22+--+%5Cn%7C %7C%7C%5Cn%7C-+%7C%5Cn%7C %7C%7C%5Cn%7C-+%7C%5Cn%7C-+%7C%5Cn%7C %7C%7C%5Cn+--+%5Cn%22%0A%0A%0Adef test_repr():%0A assert repr(ASCII) == %22Box(...)%22%0A%0A%0Adef... | |
dbaad481ab9ddbdccd4430765e3eee0d0433fbd8 | Create doc_check.py | doc_check.py | doc_check.py | Python | 0.000001 | @@ -0,0 +1,1500 @@
+import requests,json,ctypes,time%0A%0Atasks = %5B%0A # speciality_id, clinic_id, name '' - for any name, description%0A (40,279,'','%D0%9D%D0%B5%D0%B2%D1%80%D0%BE%D0%BB%D0%BE%D0%B3'),%0A (2122,314,'%D0%93%D1%83%D1%81%D0%B0%D1%80%D0%BE%D0%B2','%D0%94%D0%B5%D1%80%D0%BC%D0%B0%D1%82%D0%BE%D0%BB... | |
8eec6e7596e8a5bd8159753be2aeaaffb53f613b | Add Python version | Python/shorturl.py | Python/shorturl.py | Python | 0.000023 | @@ -0,0 +1,938 @@
+class ShortURL:%0A%09%22%22%22%0A%09ShortURL: Bijective conversion between natural numbers (IDs) and short strings%0A%0A%09ShortURL.encode() takes an ID and turns it into a short string%0A%09ShortURL.decode() takes a short string and turns it into an ID%0A%0A%09Features:%0A%09+ large alphabet (51 cha... | |
7a5ca2f63dab36664ace637b713d7772870a800a | Create make-fingerprint.py | make-fingerprint.py | make-fingerprint.py | Python | 0.000102 | @@ -0,0 +1 @@
+%0A
| |
cd7187dc916ebbd49a324f1f43b24fbb44e9c9dc | Create afstand_sensor.py | afstand_sensor.py | afstand_sensor.py | Python | 0.000011 | @@ -0,0 +1,317 @@
+import gpiozero%0Afrom time import sleep%0A%0Asensor = gpiozero.DistanceSensor(echo=18,trigger=17,max_distance=2, threshold_distance=0.5)%0Aled = gpiozero.LED(22)%0A%0Awhile True:%0A afstand = round(sensor.distance*100)%0A print('obstakel op', afstand, 'cm')%0A if sensor.in_range:%0A ... | |
f1bda6deeb97c50a5606bea59d1684d6d96b10b4 | Create api_call.py | PYTHON/api_call.py | PYTHON/api_call.py | Python | 0.000002 | @@ -0,0 +1,1475 @@
+def product_import_tme(request):%0A # /product/product_import_tme/%0A%0A token = '%3Cyour's token(Anonymous key:)%3E'%0A app_secret = '%3CApplication secret%3E'%0A%0A params = %7B%0A 'SymbolList%5B0%5D': '1N4007',%0A 'Country': 'PL',%0A 'Currency': 'PLN',%0A '... | |
1166ef7520ee26836402f028cb52ed95db7173e6 | Add CTC_new_refund_limited_all_payroll migration file | webapp/apps/taxbrain/migrations/0058_taxsaveinputs_ctc_new_refund_limited_all_payroll.py | webapp/apps/taxbrain/migrations/0058_taxsaveinputs_ctc_new_refund_limited_all_payroll.py | Python | 0 | @@ -0,0 +1,503 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('taxbrain', '0057_jsonreformtaxcalculator_errors_warnings_text'),%0A %5D%0A%0A operations = %5B%0... | |
fc1a9b7870f4d7e789c3968df6ddda698a7c4d62 | update to search all the TEMPLATES configurations | django_extensions/compat.py | django_extensions/compat.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from io import BytesIO
import csv
import six
import codecs
import importlib
import django
from django.conf import settings
#
# Django compatibility
#
def load_tag_library(libname):
"""Load a templatetag library on multiple Django versions.
Re... | Python | 0 | @@ -1177,40 +1177,60 @@
_var
- is not None and template_key in
+:%0A for tdict in templates_var:%0A if
tem
@@ -1238,26 +1238,33 @@
late
-s_var%5B0%5D:%0A
+_key in tdict:%0A
retu
@@ -1263,16 +1263,22 @@
+
return t
empl
@@ -1277,23 +1277,12 @@
rn t
-emplates_var%5B0%5D
+d... |
55d9610f519713b889ffb68daa3c72ef6c349d3d | Add ExportPPMs.py script. | TrueType/ExportPPMs.py | TrueType/ExportPPMs.py | Python | 0 | @@ -0,0 +1,1471 @@
+#FLM: Export PPMs%0A%0A%22%22%22%0AThis script will write (or overwrite) a 'ppms' file in the same directory %0Aas the opened VFB file. This 'ppms' file contains the TrueType stem values %0Aand the ppm values at which the pixel jumps occur. These values can later %0Abe edited as the 'ppms' file is u... | |
5aff575cec6ddb10cba2e52ab841ec2197a0e172 | Add SignalTimeout context manager | Utils/SignalTimeout.py | Utils/SignalTimeout.py | Python | 0.000001 | @@ -0,0 +1,1375 @@
+# Taken from https://gist.github.com/ekimekim/b01158dc36c6e2155046684511595d57%0Aimport os%0Aimport signal%0Aimport subprocess%0A%0A%0Aclass Timeout(Exception):%0A %22%22%22This is raised when a timeout occurs%22%22%22%0A%0A%0Aclass SignalTimeout(object):%0A %22%22%22Context manager that raise... | |
e18ee4aacd42ec28b2d54437f61d592b1cfaf594 | Create national_user_data_pull.py | custom/icds_reports/management/commands/national_user_data_pull.py | custom/icds_reports/management/commands/national_user_data_pull.py | Python | 0.000125 | @@ -0,0 +1,1769 @@
+import csv%0A%0Afrom django.core.management.base import BaseCommand%0Afrom corehq.apps.reports.util import get_all_users_by_domain%0Afrom custom.icds_reports.const import INDIA_TIMEZONE%0Afrom custom.icds_reports.models import ICDSAuditEntryRecord%0Afrom django.db.models import Max%0A%0A%0Aclass Com... | |
ed157602d965be952aadc9fe33b2e517c7f98ccf | Add urls | dumpling/urls.py | dumpling/urls.py | Python | 0.000013 | @@ -0,0 +1,199 @@
+from django.conf.urls import include, url%0A%0Afrom . import views%0A%0Aurlpatterns = %5B%0A url(r'css/(?P%3Cname%3E.*)%5C.css$', views.styles, name='styles'),%0A url(r'(?P%3Cpath%3E.*)', views.PageView.as_view()),%0A%5D%0A
| |
380178c585d4b9e2689ffdd72c9fa80be94fe3a9 | add more calculation | examples/ingap_gaas_radeta_paper.py | examples/ingap_gaas_radeta_paper.py | Python | 0 | @@ -0,0 +1,1196 @@
+__author__ = 'kanhua'%0A%0A%0Aimport numpy as np%0Afrom scipy.interpolate import interp2d%0Aimport matplotlib.pyplot as plt%0Afrom scipy.io import savemat%0Afrom iii_v_si import calc_2j_si_eta, calc_3j_si_eta%0A%0A%0Aif __name__==%22__main__%22:%0A algaas_top_ere=np.logspace(-7,0,num=50)%0A al... | |
93b38901b25f6c5db4700343050c5bb2fc6ef7e6 | add utility to make digraph out of router | emit/graphviz.py | emit/graphviz.py | Python | 0 | @@ -0,0 +1,322 @@
+def make_digraph(router, name='router'):%0A header = 'digraph %25s %7B%5Cn' %25 name%0A footer = '%5Cn%7D'%0A%0A lines = %5B%5D%0A for origin, destinations in router.routes.items():%0A for destination in destinations:%0A lines.append('%22%25s%22 -%3E %22%25s%22;' %25 (or... | |
c16620dffd2cd6396eb6b7db76a9c29849a16500 | Add support for cheminformatics descriptors | components/lie_structures/lie_structures/cheminfo_descriptors.py | components/lie_structures/lie_structures/cheminfo_descriptors.py | Python | 0 | @@ -0,0 +1,702 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0Afile: cheminfo_molhandle.py%0A%0ACinfony driven cheminformatics fingerprint functions%0A%22%22%22%0A%0Aimport logging%0A%0Afrom twisted.logger import Logger%0A%0Afrom . import toolkits%0A%0Alogging = Logger()%0A%0A%0Adef available_descriptors():%0A %22%22%2... | |
718b8dcb87ae2b78e5ce0aded0504a81d599daf7 | Create envToFish.py | envToFish.py | envToFish.py | Python | 0 | @@ -0,0 +1,496 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport subprocess%0A%0AbadKeys = %5B'HOME', 'PWD', 'USER', '_', 'OLDPWD'%5D%0Awith open('profile.fish', 'w') as f:%0A for key, val in os.environ.items():%0A if key in badKeys:%0A continue%0A if key == 'PATH':%0A f.write(%22... | |
01328db808d3f5f1f9df55117ef70924fb615a6a | Create config reader | escpos/config.py | escpos/config.py | Python | 0.000001 | @@ -0,0 +1,2043 @@
+from __future__ import absolute_import%0A%0Aimport os%0Aimport appdirs%0Afrom localconfig import config%0A%0Afrom . import printer%0Afrom .exceptions import *%0A%0Aclass Config(object):%0A%0A _app_name = 'python-escpos'%0A _config_file = 'config.ini'%0A%0A def __init__(self):%0A self... | |
0f43f3bdc9b22e84da51e490664aeedc4295c8c9 | Add test for ELB | tests/test_elb.py | tests/test_elb.py | Python | 0.000001 | @@ -0,0 +1,347 @@
+# -*- coding: utf-8 -*-%0Afrom jungle import cli%0A%0A%0Adef test_elb_ls(runner, elb):%0A %22%22%22test for elb ls%22%22%22%0A result = runner.invoke(cli.cli, %5B'elb', 'ls'%5D)%0A assert result.exit_code == 0%0A%0A%0Adef test_elb_ls_with_l(runner, elb):%0A %22%22%22test for elb ls -l%22%... | |
c1bf53c5c278cafa3b1c070f8a232d5820dcb7a4 | add elb list test. | tests/test_elb.py | tests/test_elb.py | Python | 0 | @@ -0,0 +1,1412 @@
+from __future__ import (absolute_import, print_function, unicode_literals)%0Afrom acli.output.elb import (output_elb_info, output_elbs)%0Afrom acli.services.elb import (elb_info, elb_list)%0Afrom acli.config import Config%0Afrom moto import mock_elb%0Aimport pytest%0Afrom boto3.session import Sessio... | |
ee3e04d32e39d6ac7ef4ac7abc2363a1ac9b8917 | Add an example for the music module | example_music.py | example_music.py | Python | 0.000002 | @@ -0,0 +1,308 @@
+from screenfactory import create_screen%0Afrom modules.music import Music%0Aimport config%0Aimport time%0Aimport pygame%0A%0Ascreen = create_screen()%0A%0Amusic = Music(screen)%0Amusic.start()%0A%0Awhile True:%0A%09if config.virtual_hardware:%0A%09%09pygame.time.wait(10)%0A%09%09for event in pygame.e... | |
4be66a6e7a9852b59fb3a18e6bd85c6b6734be83 | add index back | billy/bin/commands/ensure_indexes.py | billy/bin/commands/ensure_indexes.py | from __future__ import print_function
from billy.core import db
from billy.bin.commands import BaseCommand
from billy.core import settings
import pymongo
class MongoIndex(BaseCommand):
name = 'mongo-index'
help = '''make indexes'''
def add_args(self):
self.add_argument(
'collections',... | Python | 0.000001 | @@ -3704,17 +3704,16 @@
-#
%5B(settin
@@ -3764,17 +3764,16 @@
-#
('type'
@@ -3810,17 +3810,16 @@
-#
%5D,%0A
|
54718d95c4398d816546b45ed3f6a1faf2cdace8 | add modules/flexins/nsversion.py | modules/flexins/nsversion.py | modules/flexins/nsversion.py | Python | 0 | @@ -0,0 +1,1963 @@
+%22%22%22Analysis and Check the FlexiNS software version.%0A%0A%22%22%22%0Aimport re%0Afrom libs.checker import ResultInfo,CheckStatus%0Afrom libs.log_spliter import LogSpliter,LOG_TYPE_FLEXI_NS%0Afrom libs.tools import read_cmdblock_from_log%0A%0A## Mandatory variables %0A##------------------------... | |
ec41564bb99c8e79bcee1baabd75d2282601415c | add refund | shopify/resources/refund.py | shopify/resources/refund.py | Python | 0 | @@ -0,0 +1,116 @@
+from ..base import ShopifyResource%0A%0A%0Aclass Refund(ShopifyResource):%0A _prefix_source = %22/admin/orders/$order_id/%22%0A
| |
e7247c8c70a8cfefaee057e0c731aa5dab41ca9a | Create Contours.py | Contours.py | Contours.py | Python | 0 | @@ -0,0 +1,283 @@
+from PIL import Image%0Afrom pylab import *%0A%0A#read image into an array%0Aim = array(Image.open('s9.jpg').convert('L'))%0A%0A#create a new figure%0Afigure()%0A%0A#don't use colors%0Agray()%0A%0A#show contours%0Acontour(im,origin = 'image')%0Aaxis('equal')%0Aaxis('off')%0A%0Afigure()%0Ahist(im.flat... | |
9315c59746e2be9f2f15ff2bae02e1b481e9a946 | Create mr.py | mr.py | mr.py | Python | 0.000004 | @@ -0,0 +1,512 @@
+Mapper:%0A%0A#!/usr/bin/python%0A%0Aimport sys%0A%0Awhile 1:%0A line = sys.stdin.readline()%0A if line == %22%22:%0A break%0A fields = line.split(%22,%22)%0A year = fields%5B1%5D%0A runs = fields%5B8%5D%0A%0A if year == %221956%22:%0A print runs%0A%0A%0AReducer: %0A#!/u... | |
c91e231c8d71458a7c347088ad7ec6431df234d7 | add ss.py to update proxy automatically | ss.py | ss.py | Python | 0 | @@ -0,0 +1,149 @@
+# -*- coding:utf8 -*-%0A%0Aimport urllib2%0A%0Aresponse = urllib2.urlopen(%22http://boafanx.tabboa.com/boafanx-ss/%22)%0Ahtml = response.read()%0Aprint(html%5B:20000%5D)
| |
4015a16ec32660d25646f62772876d53166f46f2 | Add files via upload | PEP.py | PEP.py | Python | 0 | @@ -0,0 +1,2064 @@
+#-*- coding: utf-8 -*- %0Afrom optparse import OptionParser%0Aimport genLabelData,genUnlabelData,mainEdit,genVecs%0Aimport os.path%0A%0Adef parse_args():%0A%09parser = OptionParser(usage=%22RNA editing prediction%22, add_help_option=False)%0A%09parser.add_option(%22-f%22, %22--feature%22, default=%... | |
8016dbc50238d2baf5f89c191ec3355df63af1a2 | Implement basic flask app to add subscribers | app.py | app.py | Python | 0.000001 | @@ -0,0 +1,425 @@
+import iss%0A%0Afrom flask import Flask, request, render_template%0A%0A%0Aapp = Flask(__name__)%0A%0A%0A@app.route('/', methods=%5B'GET'%5D)%0Adef index():%0A return render_template()%0A%0A%0A@app.route('/subscribe', methods=%5B'POST'%5D)%0Adef subscribe():%0A number = request.form%5B'number'%5... | |
341890bfff2d8a831e48ebb659ce7f31d4918773 | Update utils.py | tendrl/commons/central_store/utils.py | tendrl/commons/central_store/utils.py | from tendrl.commons.etcdobj import fields
def to_etcdobj(cls_etcd, obj):
for attr, value in vars(obj).iteritems():
if not attr.startswith("_"):
setattr(cls_etcd, attr, to_etcd_field(attr, value))
return cls_etcd
def to_etcd_field(name, value):
type_to_etcd_fields_map = {dict: fields.... | Python | 0.000001 | @@ -129,12 +129,8 @@
if
-not
attr
@@ -147,24 +147,146 @@
h(%22_%22):%0A
+ continue%0A if attr in %5B%22attrs%22, %22enabled%22, %22obj_list%22, %22obj_value%22, %22atoms%22, %22flows%22%5D:%0A continue%0A
seta
|
9d41eba840f954595a5cebbacaf56846cd52c1f4 | add new file | functions.py | functions.py | Python | 0.000006 | @@ -0,0 +1,15 @@
+def add(a,b):%0A%0A
| |
3000a9c0b7213a3aeb9faa0c01e5b779b2db36d4 | add a noisy bezier example (todo: should noise be part of the animation, or stay out of it?) | examples/example_bezier_noise.py | examples/example_bezier_noise.py | Python | 0 | @@ -0,0 +1,2081 @@
+if __name__ == %22__main__%22:%0A import gizeh%0A import moviepy.editor as mpy%0A%0A from vectortween.BezierCurveAnimation import BezierCurveAnimation%0A from vectortween.SequentialAnimation import SequentialAnimation%0A%0A import noise%0A%0A def random_color():%0A import ra... | |
510fad764abd26e76d130dfa6d9b053709cd149e | Add and correct some comments and docstrings. | examples/julia-set/bench_dist.py | examples/julia-set/bench_dist.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | Python | 0 | @@ -1208,20 +1208,21 @@
te plane
+.
%22%22%22%0A
-
re_s
@@ -1581,16 +1581,19 @@
%0A# This
+is
exactly
@@ -1928,24 +1928,56 @@
ax, n_max):%0A
+ %22%22%22Time a function call.%22%22%22%0A
local_dr
@@ -2261,16 +2261,16 @@
start%0A%0A%0A
-
def plot
@@ -2302,24 +2302,61 @@
, engines):%0A
+ %22%22%... |
05c7d62e0e26000440e72d0700c9806d7a409744 | Add migrations for game change suggestions | games/migrations/0023_auto_20171104_2246.py | games/migrations/0023_auto_20171104_2246.py | Python | 0 | @@ -0,0 +1,888 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.2 on 2017-11-04 21:46%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('games', '0022_in... | |
ad073b043b2965fb6a1939682aeca8ac90259210 | add daily import to database | daily.py | daily.py | Python | 0 | @@ -0,0 +1,1753 @@
+import datetime%0Aimport httplib%0Aimport urllib%0Aimport redis%0Aimport json%0Afrom datetime import timedelta%0A%0A#now = datetime.datetime.now();%0A#today = now.strftime('%25Y-%25m-%25d')%0A#print today%0Ardb = redis.Redis('localhost')%0A%0A%0Adef isfloat(value):%0A%09try:%0A%09%09float(value)%0A%... | |
09d51aef1127b55fdc6bf595ca85285d9d7d64d1 | Add wrapwrite utility method | gignore/utils.py | gignore/utils.py | Python | 0.000001 | @@ -0,0 +1,235 @@
+import sys%0A%0A%0Adef wrapwrite(text):%0A %22%22%22%0A :type text: str%0A%0A :rtype: str%0A %22%22%22%0A text = text.encode('utf-8')%0A try: # Python3%0A sys.stdout.buffer.write(text)%0A except AttributeError:%0A sys.stdout.write(text)%0A
| |
617a44bcce3e6e19383065f7fcab5b44ceb82714 | add logger | log.py | log.py | Python | 0.000026 | @@ -0,0 +1,240 @@
+import logging%0D%0Aimport sys%0D%0A%0D%0Alogger = logging.getLogger('micro-meta')%0D%0Alogger.setLevel(logging.DEBUG)%0D%0Afh = logging.StreamHandler(sys.stdout)%0D%0Afh.setLevel(logging.DEBUG)%0D%0A%0D%0Alogger.addHandler(fh)%0D%0A%0D%0Alogger.debug('test')%0D%0Alogger.info('test')
| |
a38b313799b7c0cdc25ff68161c2b2890db8e16d | Create log.py | log.py | log.py | Python | 0.000002 | @@ -0,0 +1,728 @@
+import glob%0Aimport pandas as pd%0A%0Alogs = %5Blog for log in glob.glob(%22*.log%22)%5D%0A%0Adataset = %7B%22id%22: %5B%5D,%0A %22pos%22: %5B%5D,%0A %22affinity (kcal/mol)%22: %5B%5D,%0A %22rmsd l.b.%22: %5B%5D,%0A %22rmsd u.b.%22: %5B%5D%7D%0A%0Afor log in l... | |
7263d7546aec62834fa19f20854522eba4916159 | add simple http server | run.py | run.py | Python | 0 | @@ -0,0 +1,500 @@
+import sys%0Aimport BaseHTTPServer%0Afrom SimpleHTTPServer import SimpleHTTPRequestHandler%0A%0A%0AHandlerClass = SimpleHTTPRequestHandler%0AServerClass = BaseHTTPServer.HTTPServer%0AProtocol = %22HTTP/1.0%22%0A%0Aif sys.argv%5B1:%5D:%0A port = int(sys.argv%5B1%5D)%0Aelse:%0A port = 8000%0... | |
e6d420296b3f2234382bdcdf1122abc59af148ed | add plot function for classification | mousestyles/visualization/plot_classification.py | mousestyles/visualization/plot_classification.py | Python | 0.000009 | @@ -0,0 +1,1291 @@
+import numpy as np%0Aimport pandas as pd%0Aimport matplotlib.pyplot as plt%0A%0A%0Adef plot_performance(model):%0A %22%22%22%0A Plots the performance of classification model.It%0A is a side-by-side barplot. For each strain, it plots%0A the precision, recall and F-1 measure.%0A Paramet... | |
a1ec669f4c494709dc9b8f3e47ff4f84b189b2e9 | add get_workflow_name.py | .circleci/get_workflow_name.py | .circleci/get_workflow_name.py | Python | 0.000002 | @@ -0,0 +1,1987 @@
+# Copyright 2018 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by a... | |
3abf7e60d3bd028f86cb6aa2e1e1f3d4fff95353 | Create BinaryTreeMaxPathSum_001.py | leetcode/124-Binary-Tree-Maximum-Path-Sum/BinaryTreeMaxPathSum_001.py | leetcode/124-Binary-Tree-Maximum-Path-Sum/BinaryTreeMaxPathSum_001.py | Python | 0.000023 | @@ -0,0 +1,1315 @@
+# Definition for a binary tree node.%0A# class TreeNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0Aclass Solution(object):%0A def maxPathSum(self, root):%0A %22%22%22%0A :type root: TreeNode%0A ... | |
59fd4bf04c8c89cdc87673de94788c5d34d4e5fe | Create Goldbach.py | Goldbach.py | Goldbach.py | Python | 0 | @@ -0,0 +1,811 @@
+import math%0A#Funcion para saber si un numero es 3 o no%0Adef es_primo(a):%0A contador = 0%0A verificar= False%0A for i in range(1,a+1):%0A if (a%25 i)==0:%0A contador = contador + 1%0A if contador %3E= 3:%0A verificar=True%0A break%0A if contador==2 or verificar==False... | |
e33774beb2f2b1264f654605294f0ad837fa7e8b | Add message_link function | utils/backends.py | utils/backends.py | Python | 0.000001 | @@ -0,0 +1,614 @@
+%22%22%22%0AHandle backend specific implementations.%0A%22%22%22%0A%0Adef message_link(bot, msg):%0A %22%22%22%0A :param bot: Plugin instance.%0A :param msg: Message object.%0A :returns: Message link.%0A %22%22%22%0A backend = bot.bot_config.BACKEND.lower()%0A if backend == 'gi... | |
f509d556cc4a20b55be52f505fcee200c5d44ef2 | add rehex util | scripts/rehex.py | scripts/rehex.py | Python | 0.000001 | @@ -0,0 +1,500 @@
+import simplejson%0Aimport binascii%0Aimport sys%0Aimport pdb%0Afrom pprint import pprint%0Aimport sys, os%0Asys.path.append( os.path.join( os.path.dirname(__file__), '..' ) )%0Asys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) )%0Aimport dashlib%0A# ============================... | |
cf881dd1ba8c98dd116f2269bf0cfd38f14a7b40 | add a reel OVSFtree | OVSFTree.py | OVSFTree.py | Python | 0.000001 | @@ -0,0 +1,1198 @@
+import math%0AnumberOfMobile=512%0Aclass Node:%0A def __init__(self, val):%0A self.l = None%0A self.r = None%0A self.v = val%0A%0Aclass Tree:%0A def __init__(self):%0A self.root = None%0A self.root=Node(1)%0A thislevel = %5Bself.root%5D%0A for i... | |
632c4dffe8a217ca07410d0a353455a4c6142d39 | Solve problem 29 | problem029.py | problem029.py | Python | 0.99998 | @@ -0,0 +1,92 @@
+#!/usr/bin/env python3%0A%0Aprint(len(set(a**b for a in range(2, 101) for b in range(2, 101))))%0A
| |
b1815075ac1a1697c99a6293c8cc7719060ab9b2 | Add cpuspeed sensor | homeassistant/components/sensor/cpuspeed.py | homeassistant/components/sensor/cpuspeed.py | Python | 0.000001 | @@ -0,0 +1,1984 @@
+%22%22%22%0Ahomeassistant.components.sensor.cpuspeed%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0AShows the current CPU speed.%0A%0AFor more details about this platform, please refer to the documentation at%0Ahttps://home-assistant.io/components/sensor.cpuspeed.html%0A%22%22%22%0Aimport logging%0A%0... | |
0ba15652a5624cf8fa42f4caf603d84c09a0698b | Add kata: 6 kyu | 6_kyu/Decode_the_Morse_code.py | 6_kyu/Decode_the_Morse_code.py | Python | 0.999999 | @@ -0,0 +1,288 @@
+# @see: https://www.codewars.com/kata/decode-the-morse-code%0Adef decodeMorse(morseCode):%0A return ' '.join(%0A map(lambda m_word: ''.join(%0A map(lambda m_symbol: MORSE_CODE%5Bm_symbol%5D,%0A m_word.split())),%0A morseCode.strip().split(' '))... | |
6837bbf2a1816d97b6c517bcb244aa51cf1eb7ba | Create robots_txt.py | robots_txt.py | robots_txt.py | Python | 0.000064 | @@ -0,0 +1,161 @@
+import urlib.request%0Aimport io%0A%0Adef ger_robots_txt(url):%0A if url.endswith('/')%0A path = url%0A else: %0A path - url + '/'%0A%0A# https://reddit.com/%0A%0A
| |
b36192eec53664f9178bfc4000d89b8ca9be1544 | Add merge migration | osf/migrations/0030_merge.py | osf/migrations/0030_merge.py | Python | 0 | @@ -0,0 +1,331 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2017-01-24 18:57%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0029_merge'),%0A ('osf', '0029_externalaccount_d... | |
db41bce3d90cfada9916baa8f9267cd9e6160a94 | Add an example for opening a file. | examples/open_file.py | examples/open_file.py | Python | 0 | @@ -0,0 +1,170 @@
+import numpy as np%0Aimport pyh5md%0A%0Af = pyh5md.H5MD_File('poc.h5', 'r')%0A%0Aat = f.trajectory('atoms')%0A%0Aat_pos = at.data('position')%0A%0Ar = at_pos.v.value%0A%0Aprint r%0A%0Af.f.close()%0A
| |
2cd57876c72d5c941bcb1ae497df48dbbc943ba9 | Create new package. (#6213) | var/spack/repos/builtin/packages/r-forecast/package.py | var/spack/repos/builtin/packages/r-forecast/package.py | Python | 0 | @@ -0,0 +1,2298 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
c192042bbaf9060ce3a76f1cbabc5f380fa4bfd6 | Adding uppercase character | src/Character.py | src/Character.py | Python | 0.999723 | @@ -0,0 +1,799 @@
+import pygame%0Afrom sprite import *%0Afrom constants import *%0A%0Aclass Character:%0A%09def __init__(self):%0A%09%09self.sprite = Sprite('../resources/char.png')%0A%09%09self.health = 10%0A%09%09self.speed = 40%0A%0A%09def move(self, direction):%0A%09%09#pos = self.sprite.getPosition()%0A%09%09char... | |
10eb703867fd10df543a141837c2a57d1052ba2c | Rename file with correct pattern | ideascube/conf/kb_civ_babylab.py | ideascube/conf/kb_civ_babylab.py | Python | 0.000001 | @@ -0,0 +1,1248 @@
+# -*- coding: utf-8 -*-%0A%22%22%22KoomBook conf%22%22%22%0Afrom .kb import * # noqa%0Afrom django.utils.translation import ugettext_lazy as _%0A%0ALANGUAGE_CODE = 'fr'%0AIDEASCUBE_NAME = 'BabyLab'%0AHOME_CARDS = STAFF_HOME_CARDS + %5B%0A %7B%0A 'id': 'blog',%0A %7D,%0A %7B%0A ... | |
f31fcd789254f95b311f4fa4009a04ad919c2027 | add url update migration | accelerator/migrations/0049_update_fluent_redirect_url.py | accelerator/migrations/0049_update_fluent_redirect_url.py | Python | 0.000001 | @@ -0,0 +1,1302 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.18 on 2019-04-11 11:35%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0Afrom accelerator.sitetree_navigation.sub_navigation import (%0A create_directory_subnav,%0A create_events_subnav,%0A create_home_s... | |
96ba88c74a77f3b71ef4a8b51c29013d16e23973 | Create tofu/plugins/MISTRAL/Inputs with empty __init__.py | tofu/plugins/MISTRAL/Inputs/__init__.py | tofu/plugins/MISTRAL/Inputs/__init__.py | Python | 0.000017 | @@ -0,0 +1 @@
+%0A
| |
1ca7e5f02f095c4a5164c2e9e0f939e67853966f | Fix get_solution_path in UserSolution | problems/models.py | problems/models.py | from base.util import with_timestamp, with_author
from django.db import models
from djangoratings.fields import RatingField
from base.models import MediaRemovalMixin
from competitions.models import Competition
# Solution-related models
@with_author
@with_timestamp
class UserSolution(MediaRemovalMixin, models.Model)... | Python | 0 | @@ -419,24 +419,41 @@
on_path(self
+, *args, **kwargs
):%0A r
|
35317e778b2fe1d238e21954df1eac0c5380b00b | Add corpus fetch from database | generate_horoscope.py | generate_horoscope.py | Python | 0 | @@ -0,0 +1,2354 @@
+#!/usr/bin/env python3%0A# encoding: utf-8%0A%0Aimport argparse%0Aimport sqlite3%0Aimport sys%0A%0A%22%22%22generate_horoscope.py: Generates horoscopes based provided corpuses%22%22%22%0A%0A__author__ = %22Project Zodiacy%22%0A__copyright__ = %22Copyright 2015, Project Zodiacy%22%0A%0A_parser = argp... | |
0b03dd638dd5ac3358d89a5538c707d5412b84ae | Add basic network broker state machine | broker/network.py | broker/network.py | Python | 0 | @@ -0,0 +1,1949 @@
+from hypothesis.stateful import GenericStateMachine%0A%0Aclass NetworkBroker(GenericStateMachine):%0A %22%22%22%0A Broker to coordinate network traffic%0A%0A nodes = A map of node ids to node objects.%0A network = An adjacency list of what nodes can talk to each other. If a is%0A ... | |
c48be39a1f04af887349ef7f19ecea4312425cf9 | initialize for production | shoppley.com/shoppley/apps/offer/management/commands/initialize.py | shoppley.com/shoppley/apps/offer/management/commands/initialize.py | Python | 0.000001 | @@ -0,0 +1,986 @@
+from django.core.management.base import NoArgsCommand%0Afrom shoppleyuser.models import Country, Region, City, ZipCode, ShoppleyUser%0Aimport os, csv%0Afrom googlevoice import Voice%0A%0AFILE_ROOT = os.path.abspath(os.path.dirname(__file__))%0A%0Aclass Command(NoArgsCommand):%0A%09def handle_noargs(s... | |
00f3e74387fc7a215af6377cb90555d142b81d74 | Add acoustics module with class AcousticMaterial. | pyfds/acoustics.py | pyfds/acoustics.py | Python | 0 | @@ -0,0 +1,1053 @@
+class AcousticMaterial:%0A %22%22%22Class for specification of acoustic material parameters.%22%22%22%0A%0A def __init__(self, sound_velocity, density,%0A shear_viscosity=0, bulk_viscosity=0,%0A thermal_conductivity=0, isobaric_heat_cap=1, isochoric_heat_cap=1):... | |
0d097139d62afa05a2af099ea2e83ddd4bb6344d | Move common segment imports | powerline/segments/common.py | powerline/segments/common.py | # -*- coding: utf-8 -*-
import os
import re
import socket
from powerline.lib.vcs import guess
from powerline.lib import memoize
# Weather condition code descriptions available at http://developer.yahoo.com/weather/#codes
weather_conditions_codes = {
u'〇': [25, 34],
u'⚑': [24],
u'☔': [5, 6, 8, 9, 10, 11, 12, 35, 4... | Python | 0.000001 | @@ -32,68 +32,8 @@
os%0A
-import re%0Aimport socket%0A%0Afrom powerline.lib.vcs import guess
%0Afro
@@ -469,16 +469,31 @@
name():%0A
+%09import socket%0A
%09if not
@@ -744,16 +744,53 @@
anch():%0A
+%09from powerline.lib.vcs import guess%0A
%09repo =
@@ -926,16 +926,27 @@
=None):%0A
+%09import re%0A
%09cwd = ... |
60e65d31c943f63e646b39350f18e6d177fbb66b | Add okupy.common.test_helpets.set_request | okupy/common/test_helpers.py | okupy/common/test_helpers.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django.test import TestCase
from django.contrib.messages.storage.cookie import CookieStorage
class OkupyTestCase(TestCase):
def _get_matches(self, response, text):
""" Get messages that match the given text """
messages = self._get_messag... | Python | 0.000007 | @@ -63,20 +63,96 @@
ngo.
-test
+contrib.auth.models import AnonymousUser%0Afrom django.contrib.messages.middleware
import
Test
@@ -151,81 +151,740 @@
ort
-TestCase%0Afrom django.contrib.messages.storage.cookie import CookieStorage
+MessageMiddleware%0Afrom django.contrib.sessions.middleware import SessionMiddlew... |
b25a172cd89e8811e5cb38414bdf86ef5a5afaee | fix ABC for py2.7 | rhea/system/cso.py | rhea/system/cso.py |
from __future__ import absolute_import
from abc import ABCMeta, abstractclassmethod
from myhdl import Signal, SignalType, always_comb
class ControlStatusBase(metaclass=ABCMeta):
def __init__(self):
self._isstatic = False
@property
def isstatic(self):
return self._isstatic
@isstati... | Python | 0.99992 | @@ -156,16 +156,31 @@
tusBase(
+object):%0A __
metaclas
@@ -184,18 +184,21 @@
lass
-=
+__ =
ABCMeta
-):
+%0A
%0A
@@ -230,490 +230,1573 @@
-self._isstatic = False%0A%0A @property%0A def isstatic(self):%0A return self._isstatic%0A%0A @isstatic.setter%0A def isstatic(self, val):%0A ... |
682b52e3f5b1f1de5009e7fc7fac95f453dbe631 | Enable more content in header/footer | rinohlib/templates/manual.py | rinohlib/templates/manual.py |
from rinoh.document import Document, DocumentPart, Page, PORTRAIT
from rinoh.dimension import PT, CM
from rinoh.layout import Container, FootnoteContainer, Chain
from rinoh.paper import A4
from rinoh.structure import Section, Heading, TableOfContents, Header, Footer
# page definition
# ----------------------------... | Python | 0 | @@ -156,17 +156,69 @@
r, Chain
+, %5C%0A UpExpandingContainer, DownExpandingContainer
%0A
-
from rin
@@ -512,16 +512,52 @@
= 2*CM%0A%0A
+ header_footer_distance = 14*PT%0A%0A
def
@@ -1361,16 +1361,88 @@
footer:%0A
+ header_bottom = self.body.top - self.header_footer_distance%0A
@@ ... |
c0ab9b755b4906129988348b2247452b6dfc157f | Add a module to set the "display name" of a dedicated server | plugins/modules/dedicated_server_display_name.py | plugins/modules/dedicated_server_display_name.py | Python | 0 | @@ -0,0 +1,2408 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import (absolute_import, division, print_function)%0A%0Afrom ansible.module_utils.basic import AnsibleModule%0A%0A__metaclass__ = type%0A%0ADOCUMENTATION = '''%0A---%0Amodule: dedicated_server_display_name%0Ashort_description: Modify t... | |
ffdee2f18d5e32c2d0b4f4eb0cebe8b63ee555f7 | Document tools/mac/dump-static-initializers.py more. | tools/mac/dump-static-initializers.py | tools/mac/dump-static-initializers.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import re
import subprocess
import sys
# Matches for example:
# [ 1] 000001ca 64 (N_SO ) 00 0000 ... | Python | 0.000002 | @@ -182,16 +182,330 @@
file.%0A%0A
+%22%22%22%0ADumps a list of files with static initializers. Use with release builds.%0A%0AUsage:%0A tools/mac/dump-static-initializers.py out/Release/Chromium%5C Framework.framework.dSYM/Contents/Resources/DWARF/Chromium%5C Framework %0A%0ADo NOT use mac_strip_release=0 or compone... |
8fbc5877fa97b6b8df621ff7afe7515b501660fc | Convert string to camel case | LeetCode/ConvertStringToCamelCase.py | LeetCode/ConvertStringToCamelCase.py | Python | 0.999999 | @@ -0,0 +1,246 @@
+def to_camel_case(text):%0A if len(text) %3C 2:%0A return text%0A capped_camel = %22%22.join(%5Bword.title() for word in text.replace('-','_').split('_')%5D)%0A return capped_camel if text%5B0%5D.isupper() else capped_camel%5B0%5D.lower()+capped_camel%5B1:%5D%0A
| |
98abb69d2c5cd41e9cdf9decc1180fe35112bc28 | Add initial base for the feed handler | backend/feed_daemon.py | backend/feed_daemon.py | Python | 0 | @@ -0,0 +1,3073 @@
+import feedparser%0Aimport psycopg2%0Aimport sys%0Aimport configparser%0Aimport logging%0A%0Aclass FeedHandler():%0A def __init__(self):%0A self.config = configparser.ConfigParser(interpolation=None)%0A self.config.read(('config.ini',))%0A %0A logging.basicConfig(format='%... | |
c684ab17fc83242ee32db4b4c4bf57a7798acae4 | Add ordering prefix | examples/00_empty_window.py | examples/00_empty_window.py | Python | 0.000114 | @@ -0,0 +1,306 @@
+import ModernGL%0Afrom ModernGL.ext.examples import run_example%0A%0A%0Aclass Example:%0A def __init__(self, wnd):%0A self.wnd = wnd%0A self.ctx = ModernGL.create_context()%0A%0A def render(self):%0A self.ctx.viewport = self.wnd.viewport%0A self.ctx.clear(0.2, 0.4, 0... | |
c660de10b58b985273675396a214a3f4bf968a20 | Fix credentials initialization. | tools/telemetry/telemetry/core/backends/chrome/cros_test_case.py | tools/telemetry/telemetry/core/backends/chrome/cros_test_case.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry.core import browser_finder
from telemetry.core import extension_to_load
from telemetry.core import util
from teleme... | Python | 0.999998 | @@ -3147,29 +3147,8 @@
th)%0A
- credentials = %5B%5D%0A
@@ -3232,27 +3232,34 @@
-credentials
+username, password
= f.rea
@@ -3282,16 +3282,20 @@
it(':')%0A
+
retu
@@ -3297,20 +3297,53 @@
return
-credentials
+(username, password)%0A return (None, None)
%0A
|
35a683738f00a67b88f26fdc2453a29777fe7f82 | Add raw outputter | salt/output/raw.py | salt/output/raw.py | Python | 0.002716 | @@ -0,0 +1,133 @@
+'''%0APrint out the raw python data, the original outputter%0A'''%0A%0Adef ouput(data):%0A '''%0A Rather basic....%0A '''%0A print(data)%0A
| |
ad284dfe63b827aaa1ca8d7353e1bf1a54ea4fdf | Change arduino board from first example from mega to nano | src/arduino_sourcecodes/src/arduino_serial_nodes/connect_arduino_nano1.py | src/arduino_sourcecodes/src/arduino_serial_nodes/connect_arduino_nano1.py | Python | 0.000005 | @@ -0,0 +1,3410 @@
+#!/usr/bin/env python%0A%0A#####################################################################%0A# Software License Agreement (BSD License)%0A#%0A# Copyright (c) 2011, Willow Garage, Inc.%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modifi... | |
821d21b3c98c18bc96e65651266ca69e58cfa2ee | test caching on heroku | src/viz/views.py | src/viz/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.core import serializers
from viz.models import PollingStationResult, PartyResult, PollingStation, Election, Municipality, RegionalElectoralDistrict, District, State, Party, RawData
from django.http im... | Python | 0 | @@ -802,24 +802,54 @@
_api.dtl')%0A%0A
+@cache_page(60 * 60) # 60mins%0A
def api_resu
@@ -1575,38 +1575,8 @@
e)%0A%0A
-@cache_page(60 * 60) # 60mins%0A
def
|
07528bd828c28a18f3118481d1cdb9cf1287fd0b | Revert "don't track django.wsgi". It is part of the documentation. | railroad/sample/django.wsgi | railroad/sample/django.wsgi | Python | 0 | @@ -0,0 +1,1044 @@
+# Copyright 2010 ITA Software, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless requi... | |
2d65862d77338dc503e34f389de1dc3bc553b6cd | Add DomainCaseRuleRun to admin site | corehq/apps/data_interfaces/admin.py | corehq/apps/data_interfaces/admin.py | Python | 0 | @@ -0,0 +1,532 @@
+from django.contrib import admin%0Afrom corehq.apps.data_interfaces.models import DomainCaseRuleRun%0A%0A%0Aclass DomainCaseRuleRunAdmin(admin.ModelAdmin):%0A%0A list_display = %5B%0A 'domain',%0A 'started_on',%0A 'finished_on',%0A 'status',%0A 'cases_checked',%0... | |
017f276bb9544578417444c34ce2c04d87bb5852 | Fix zds #323 | markdown/extensions/emoticons.py | markdown/extensions/emoticons.py | # Emoticon extension for python-markdown
# Original version :
# https://gist.github.com/insin/815656/raw/a68516f1ffc03df465730b3ddef6de0a11b7e9a5/mdx_emoticons.py
#
# Patched by cgabard for supporting newer python-markdown version and extend for support multi-extensions
import re
import markdown
from markdown.inlinepa... | Python | 0 | @@ -798,17 +798,28 @@
ON_RE =
-'
+r'(?=(%5E%7C%5CW))
(?P%3Cemot
@@ -826,16 +826,26 @@
icon%3E%25s)
+(?=(%5CW%7C$))
' %25 '%7C'.
|
56ee8843c355ffa56f7c2583d8d524e1ecfd29c3 | Create __init__.py | module/submodule/tests/__init__.py | module/submodule/tests/__init__.py | Python | 0.000429 | @@ -0,0 +1,2 @@
+ %0A
| |
5e1d5644b2279b31191870b4a8099f3f6f31e851 | Enable admin for Project, Platform, Dataset | ncharts/admin.py | ncharts/admin.py | Python | 0 | @@ -0,0 +1,364 @@
+from django.contrib import admin%0Afrom ncharts.models import Project, Platform, Dataset%0A%0Aclass ProjectAdmin(admin.ModelAdmin):%0A pass%0A%0Aclass PlatformAdmin(admin.ModelAdmin):%0A pass%0A%0Aclass DatasetAdmin(admin.ModelAdmin):%0A pass%0A%0Aadmin.site.register(Project,ProjectAdmin)%0A... | |
23808a3d65db23163969aeb08adaa29f6403e720 | Fix a test | test/lib/lint/policy/test_abstract_policy.py | test/lib/lint/policy/test_abstract_policy.py | import unittest
from lib.lint.policy.abstract_policy import AbstractPolicy
class ConcretePolicy(AbstractPolicy):
def __init__(self):
super().__init__()
self.description = 'Found something invalid'
self.reference = 'http://example.com'
self.level = 0
class TestAbstractPolicy(unitt... | Python | 0.999999 | @@ -587,32 +587,60 @@
: 3,%0A %7D%0A%0A
+ node = %7B'pos': pos%7D%0A
env = %7B'
@@ -666,16 +666,16 @@
e.vim'%7D%0A
-
%0A
@@ -857,24 +857,110 @@
ample.com',%0A
+ 'position': %7B%0A 'column': 3,%0A 'line': 3,%0A
@@ -1003,23 +1003... |
e1c6f344e804f0d972dbc685b9492a126d74a7d3 | Create new management app | usingnamespace/management/__init__.py | usingnamespace/management/__init__.py | Python | 0.000001 | @@ -0,0 +1,2824 @@
+from pyramid.config import Configurator%0Afrom pyramid.session import SignedCookieSessionFactory%0Afrom pyramid.settings import asbool%0Afrom pyramid.wsgi import wsgiapp2%0A%0Adefault_settings = (%0A ('route_path', str, '/management'),%0A ('domain', str, ''),%0A)%0A%0A# Stolen from pyramid_deb... | |
4fbb9ca1b055b040214c82dc307f69793947b800 | Add handler for syncing wallets to server | api/sync_wallet.py | api/sync_wallet.py | Python | 0 | @@ -0,0 +1,1114 @@
+import urlparse%0Aimport os, sys%0Aimport json%0Atools_dir = os.environ.get('TOOLSDIR')%0Alib_path = os.path.abspath(tools_dir)%0Asys.path.append(lib_path)%0Afrom msc_apps import *%0A%0Adata_dir_root = os.environ.get('DATADIR')%0A%0Adef sync_wallet_response(request_dict):%0A if not request_dict.has... | |
eefa26090a4ff8fc23908afa83c87c2d54568929 | add pager duty sample alert plugin, closes #249 | alerts/plugins/pagerDutyTriggerEvent.py | alerts/plugins/pagerDutyTriggerEvent.py | Python | 0 | @@ -0,0 +1,2607 @@
+# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this%0A# file, You can obtain one at http://mozilla.org/MPL/2.0/.%0A# Copyright (c) 2014 Mozilla Corporation%0A#%0A# Contributors:%0A# Jeff Bryner jbryner@mozilla.... | |
32ea116ff172da3e7f0eeb7d9dea6b9a0378be08 | Add persistance | persistance.py | persistance.py | Python | 0.998588 | @@ -0,0 +1,1594 @@
+import numpy as np%0Aimport os%0A%0Afrom itertools import izip%0A%0A%0AT_FILE = %22t.npy%22%0AC_FILE = %22c.npy%22%0AK_FILE = %22k.npy%22%0AU_FILE = %22u.npy%22%0AFP_FILE = %22fp.npy%22%0AIER_FILE = %22ier.npy%22%0AMSG_FILE = %22msg.txt%22%0A%0Adef saveSplines(directory, splines):%0A%09((t, c, k), u... | |
a34318312199e6dab8ca3db92f247f0bda369e17 | Add missing testcase file | exercises/tests/testcase.py | exercises/tests/testcase.py | Python | 0.000003 | @@ -0,0 +1,1060 @@
+# This file is part of Workout Manager.%0A# %0A# Workout Manager is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any late... | |
ac8c78682e77d77be44910c36057e0217477b0a4 | Test OAI endpoint model | tests/test_models/test_oai_endpoint.py | tests/test_models/test_oai_endpoint.py | Python | 0 | @@ -0,0 +1,849 @@
+from django.test import TestCase%0Afrom core.models import OAIEndpoint%0A%0A%0Aclass OAIEndpointTestCase(TestCase):%0A @classmethod%0A def setUpTestData(cls):%0A cls.attributes = %7B%0A 'name': 'Test OAI Endpoint',%0A 'endpoint': 'http://oai.example.com',%0A ... | |
613a0056e12a28232542aaf561831d276868e413 | Add parametric map generator, good for wrinkles | programs/kinbody-creator/openraveMapGenerator.py | programs/kinbody-creator/openraveMapGenerator.py | Python | 0 | @@ -0,0 +1,1854 @@
+#!/usr/bin/python%0A%0A#import lxml.etree%0A#import lxml.builder%0Afrom lxml import etree%0A%0A#E = lxml.builder.ElementMaker()%0A%0A#KINBODY=E.KinBody%0A#BODY=E.Body%0A#GEOM=E.Geom%0A#EXTENTS=E.Extents%0A#TRANSLATION=E.Translation%0A#DIFUSSECOLOR=E.diffuseColor%0A%0A# User variables%0AnX = 3%0AnY =... | |
668c28fd55daa93e0024e14e7137f78919e93e2c | Add python client script | docs/basement_weather.py | docs/basement_weather.py | Python | 0.000003 | @@ -0,0 +1,1073 @@
+#!/usr/bin/python%0Aimport sys%0Aimport commands%0Aimport Adafruit_DHT%0Aimport twitter%0Aimport requests%0Aimport json%0A%0Adate = commands.getoutput('TZ=%22:Canada/Atlantic%22 date')%0A%0A#Get temp and humidity%0Ahumidity, temperature = Adafruit_DHT.read_retry(11, 4)%0Amessage = 'Temp: %7B0:0.1f%7... | |
5a221296e9e7cc59e4fe4c85b178db06c1376f13 | Add product streamfield migrations | demo/apps/catalogue/migrations/0012_auto_20160617_1115.py | demo/apps/catalogue/migrations/0012_auto_20160617_1115.py | Python | 0 | @@ -0,0 +1,940 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport wagtail.wagtailcore.fields%0Aimport wagtail.wagtailcore.blocks%0Aimport wagtail.wagtailimages.blocks%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ... | |
a9b35aff92c099aa52ce9e1ca1cb0df169a54ef5 | Add author to header. | publisher/writer.py | publisher/writer.py | __all__ = ['writer']
import docutils.core as dc
import docutils.writers
from docutils import nodes
from docutils.writers.latex2e import (Writer, LaTeXTranslator,
PreambleCmds)
class Translator(LaTeXTranslator):
def __init__(self, *args, **kwargs):
LaTeXTranslator.__i... | Python | 0 | @@ -397,24 +397,99 @@
field = ''%0A%0A
+ author_names = %5B%5D%0A author_institutions = %5B%5D%0A author_emails = %5B%5D%0A%0A
def visi
@@ -633,21 +633,21 @@
hor_
-stack
+names
.append(
%5Bsel
@@ -642,17 +642,16 @@
.append(
-%5B
self.enc
@@ -668,17 +668,16 @@
stext())
-%5D
)%0A
@@ -995,32 +9... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.