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 |
|---|---|---|---|---|---|---|---|
42c496c78fe2dcc06df65641ba1df33c02e41533 | Revert "updates" | cvlib_example.py | cvlib_example.py | Python | 0 | @@ -0,0 +1,326 @@
+%22%22%22Example using cvlib.%22%22%22%0Aimport cvlib as cv%0Afrom cvlib.object_detection import draw_bbox%0Aimport cv2%0A%0Aimg = image = cv2.imread(%22assets/sv.jpg%22)%0Abbox, label, conf = cv.detect_common_objects(img, model=%22largess%22)%0Aprint(label)%0A%0Aoutput_image = draw_bbox(img, bbox, l... | |
5831dee7a6c14c85933658610ae991fbc0af9442 | Add basic tests for stream.me plugin (#391) | tests/test_plugin_streamme.py | tests/test_plugin_streamme.py | Python | 0 | @@ -0,0 +1,631 @@
+import unittest%0A%0Afrom streamlink.plugins.streamme import StreamMe%0A%0A%0Aclass TestPluginStreamMe(unittest.TestCase):%0A def test_can_handle_url(self):%0A # should match%0A self.assertTrue(StreamMe.can_handle_url(%22http://www.stream.me/nameofstream%22))%0A%0A # shouldn't... | |
2b9909004a761047fd935ad51b06102032dbe30a | Create __init__.py | src/nupic/research/frameworks/htm/temporal_memory/__init__.py | src/nupic/research/frameworks/htm/temporal_memory/__init__.py | Python | 0.000429 | @@ -0,0 +1,1209 @@
+# ----------------------------------------------------------------------%0A# Numenta Platform for Intelligent Computing (NuPIC)%0A# Copyright (C) 2022, Numenta, Inc. Unless you have an agreement%0A# with Numenta, Inc., for a separate license for this software code, the%0A# following terms and condi... | |
4ebfc2e6ffb21fd55ef1fc4f1fd836153b2da545 | Add tests for all exceptions | tests/unit/test_exceptions.py | tests/unit/test_exceptions.py | Python | 0 | @@ -0,0 +1,2015 @@
+# coding: utf-8%0A%0Aimport pytest%0Aimport responses%0Aimport kiteconnect.exceptions as ex%0A%0A%0A@responses.activate%0Adef test_wrong_json_response(kiteconnect):%0A responses.add(%0A responses.GET,%0A %22%25s%25s%22 %25 (kiteconnect.root, kiteconnect._routes%5B%22portfolio.positi... | |
cec436eba6174fbf52dc7908e1d5218cd9bea1e7 | add tests around internal classes of Vcf class | tests/vcf_tests/file_tests.py | tests/vcf_tests/file_tests.py | Python | 0 | @@ -0,0 +1,1234 @@
+from unittest import TestCase, main%0Afrom svtools.vcf.file import Vcf%0A%0Aclass Test_Format(TestCase):%0A def test_init(self):%0A f = Vcf.Format('GT', 1, 'String', '%22Genotype%22')%0A self.assertEqual(f.id, 'GT')%0A self.assertEqual(f.number, '1')%0A self.assertEqua... | |
f131cd221b2ce6fc144b2aa9882cb0ad1b116675 | Add (failing) tests for the dashboard | tests/views/test_dashboard.py | tests/views/test_dashboard.py | Python | 0.000001 | @@ -0,0 +1,1802 @@
+#!/usr/bin/env python2.5%0A#%0A# Copyright 2011 the Melange authors.%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/L... | |
920870a310a3c32b851dfe5927aad48d7b86b0c0 | Update model verbose names | project/bhs/migrations/0008_auto_20190514_0904.py | project/bhs/migrations/0008_auto_20190514_0904.py | Python | 0.000001 | @@ -0,0 +1,776 @@
+# Generated by Django 2.1.8 on 2019-05-14 16:04%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('bhs', '0007_auto_20190513_1349'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterModelOptions(%0A name... | |
226c2f36b9cc8257ce99bd15648be4aba2ccb606 | Move utility functions for checking passported benefits into separate module | cla_public/apps/checker/utils.py | cla_public/apps/checker/utils.py | Python | 0 | @@ -0,0 +1,261 @@
+from cla_public.apps.checker.constants import PASSPORTED_BENEFITS, %5C%0A NASS_BENEFITS%0A%0A%0Adef passported(benefits):%0A return bool(set(benefits).intersection(PASSPORTED_BENEFITS))%0A%0A%0Adef nass(benefits):%0A return bool(set(benefits).intersection(NASS_BENEFITS))%0A
| |
6185e7bbc12c3bc9aba1efcfd53275cc109f2e91 | Add a snippet. | python/pyqt/pyqt5/widget_QPainter_draw_polygon.py | python/pyqt/pyqt5/widget_QPainter_draw_polygon.py | Python | 0.000002 | @@ -0,0 +1,1677 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# See https://www.youtube.com/watch?v=96FBrNR3XOY%0A%0Aimport sys%0Afrom PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QVBoxLayout%0Afrom PyQt5.QtGui import QPainter, QBrush, QColor, QPen, QPolygon%0Afrom PyQt5.QtCore import ... | |
d56b94ef5acaafcaf11ebcb4ccb5b61390448974 | Update loading to use results.AddValue(...) | tools/perf/metrics/loading.py | tools/perf/metrics/loading.py | # Copyright 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.
from metrics import Metric
class LoadingMetric(Metric):
"""A metric for page loading time based entirely on window.performance"""
def Start(self, page,... | Python | 0.000001 | @@ -182,16 +182,51 @@
t Metric
+%0Afrom telemetry.value import scalar
%0A%0Aclass
@@ -729,17 +729,72 @@
ults.Add
-(
+Value(scalar.ScalarValue(%0A results.current_page,
'load_st
@@ -812,24 +812,25 @@
load_start)
+)
%0A%0A dom_co
@@ -960,25 +960,80 @@
results.Add
-(
+Value(scalar.ScalarValue(%0A ... |
7d917f7cbf6f00eec93d97adcdb545ae55c5b345 | Add core actions file | opps/core/actions.py | opps/core/actions.py | Python | 0.000001 | @@ -0,0 +1,1442 @@
+# coding: utf-8%0Aimport csv%0A%0Afrom django.http import HttpResponse%0Afrom django.utils.translation import ugettext_lazy as _%0Afrom django.utils import timezone%0A%0A%0Adef export_to_csv(modeladmin, request, queryset):%0A %22%22%22Exporting queryset results and filter into CSV%22%22%22%0A ... | |
65245e2ef91952f3d9383f520f8e875b8a2a2648 | add translate type | modularodm/fields/BooleanField.py | modularodm/fields/BooleanField.py | from . import Field
from ..validators import validate_boolean
class BooleanField(Field):
# default = False
validate = validate_boolean
def __init__(self, *args, **kwargs):
super(BooleanField, self).__init__(*args, **kwargs) | Python | 0.000017 | @@ -137,16 +137,42 @@
_boolean
+%0A translate_type = bool
%0A%0A de
|
ef2bad889159941b344808cb88179135d3908f19 | Add missing file | GroupedPurchaseOrder/api.py | GroupedPurchaseOrder/api.py | Python | 0.000006 | @@ -0,0 +1,2143 @@
+####################################################################################################%0A# %0A# GroupedPurchaseOrder - A Django Application.%0A# Copyright (C) 2014 Fabrice Salvaire%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of ... | |
7b118afcc96edf335d5c259adc3e2065648ace6f | update site URL | conf.py | conf.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
# Data about this site
BLOG_AUTHOR = "chronodekar"
BLOG_TITLE = "Note To Self"
SITE_URL = "https://note2self-abrahamvarricatt.github.io/"
BLOG_EMAIL = "no@email.here"
BLOG_DESCRIPTION = "Snippets of information"
# Multi-lingual settings (Not... | Python | 0 | @@ -166,17 +166,16 @@
= %22http
-s
://note2
@@ -182,35 +182,22 @@
self
--
+.
abraham
-varricatt.github.io
+-v.com
/%22%0AB
|
b2dd561322f6f277f470eae425028412a209da93 | Add Repository class and module | morenines/repository.py | morenines/repository.py | Python | 0 | @@ -0,0 +1,1015 @@
+import os%0A%0Afrom morenines import output%0Afrom morenines import util%0A%0Afrom morenines.index import Index%0Afrom morenines.ignores import Ignores%0A%0A%0ANAMES = %7B%0A 'repo_dir': '.morenines',%0A 'index': 'index',%0A 'ignore': 'ignore',%0A%7D%0A%0A%0Aclass Repository(object):%0A ... | |
8273d67aaf74f4f05aa9c9fa86f710a937c708d4 | Test that submitting twice works | mysite/profile/tests.py | mysite/profile/tests.py | import django.test
from search.models import Project
import twill
from twill import commands as tc
from twill.shell import TwillCommandLoop
from django.test import TestCase
from django.core.servers.basehttp import AdminMediaHandler
from django.core.handlers.wsgi import WSGIHandler
from StringIO import StringIO
# FIXM... | Python | 0 | @@ -1624,16 +1624,224 @@
'Babel')
+%0A tc.fv('add_contrib', 'project', 'Baber')%0A tc.fv('add_contrib', 'contrib_text', 'msgctxt support')%0A tc.fv('add_contrib', 'url', 'http://babel.edgewall.org/ticket/54')%0A tc.submit()
%0A%0A
@@ -1969,10 +1969,35 @@
Babel')%0A
+ tc.find(... |
22b851b9c787f6075d1d555dfdf98aed1ef9ef35 | Add bite_size_tag_name field to search.models.Bug. | mysite/search/models.py | mysite/search/models.py | from django.db import models
from django.core.files.base import ContentFile
from django.core.files.images import get_image_dimensions
from django.conf import settings
import datetime
import StringIO
import Image
import uuid
from django.db.models import Q
from mysite.customs import ohloh
def get_image_data_scaled(imag... | Python | 0 | @@ -6568,16 +6568,74 @@
t=False)
+%0A bize_size_tag_name = models.CharField(max_length=50)
%0A%0A al
|
292b3c99fc294f9855bd7eb26b0089a04a5f93b5 | Create match_x_y_repetitions.py | regex/repetitions/python3/match_x_y_repetitions.py | regex/repetitions/python3/match_x_y_repetitions.py | Python | 0.000195 | @@ -0,0 +1,69 @@
+Regex_Pattern = r'%5E%5Cd%7B1,2%7D%5Ba-zA-z%5D%7B3,%7D%5C.%7B0,3%7D$'%09# Do not delete 'r'.%0A
| |
f3c8d092b67ad16bdd0937651ef34e3d84b15e2b | Add coverage for composer's send_email function (#2174) | webapp/tests/test_composer.py | webapp/tests/test_composer.py | Python | 0 | @@ -0,0 +1,1381 @@
+import mock%0A%0Afrom urllib3.response import HTTPResponse%0Afrom graphite.util import BytesIO%0A%0Afrom .base import TestCase%0Atry:%0A from django.urls import reverse%0Aexcept ImportError: # Django %3C 1.10%0A from django.core.urlresolvers import reverse%0A%0A%0Aclass ComposerTest(TestCase)... | |
c39c8955782c3015f30a9ef7f8e8783ac105ae70 | add harvester for dailyssrn: | scrapi/harvesters/dailyssrn.py | scrapi/harvesters/dailyssrn.py | Python | 0 | @@ -0,0 +1,1880 @@
+from __future__ import unicode_literals%0A%0Afrom dateutil.parser import parse%0A# from datetime import date, timedelta%0A%0Aimport furl%0Afrom lxml import etree%0A%0Afrom scrapi import requests%0A# from scrapi import settings%0Afrom scrapi.base import XMLHarvester%0Afrom scrapi.linter import RawDoc... | |
118627a170e3ba3cf8863b3bb0cdaf9b5e0441ff | Create monte_carlo_sliced_doughnut.py | monte_carlo_sliced_doughnut.py | monte_carlo_sliced_doughnut.py | Python | 0.000314 | @@ -0,0 +1,1535 @@
+#center of mass of a sliced doughnut%0A%0Afrom random import random%0Afrom math import pi,sin,cos,atan %0A%0AM=100000000 #number of samples%0Ay_samples = 0 #samples which have been in correct y range%0Ax_samples = 0 #samples which have been in correct x range%0A%0A#do something r... | |
ee29d0b8a6fd2995441904452d90068bb0fe9af8 | add explicit mk_rd/mk_wr | pclib/ifcs/MemMsg.py | pclib/ifcs/MemMsg.py | #=========================================================================
# MemMsg
#=========================================================================
# Contains memory request and response messages.
from pymtl import *
import math
#-------------------------------------------------------------------------
# ... | Python | 0 | @@ -2389,16 +2389,354 @@
rn msg%0A%0A
+ def mk_rd( s, addr, len_ ):%0A%0A msg = s()%0A msg.type_ = MemReqMsg.TYPE_READ%0A msg.addr = addr%0A msg.len = len_%0A msg.data = 0%0A%0A return msg%0A%0A def mk_wr( s, addr, len_, data ):%0A%0A msg = s()%0A msg.type_ = MemReqMsg.TYPE_WR... |
e74f78a663a8467e19d071d8e68ef11689c0b7ec | Add replay.py | perf/tests/replay.py | perf/tests/replay.py | Python | 0.000001 | @@ -0,0 +1,2238 @@
+from __future__ import division, print_function, absolute_import%0A%0Aimport os%0Aimport perf%0Aimport tempfile%0A%0A%0Adef get_raw_values(filename, run_id):%0A bench = perf.Benchmark.load(filename)%0A run = bench.get_runs()%5Brun_id%5D%0A inner_loops = run._get_inner_loops()%0A raw_valu... | |
e8561caeb3c95633e99f540965d33a67046df3e5 | Add __init__ module for the `msgpack_rpc` subpackage | neovim/msgpack_rpc/__init__.py | neovim/msgpack_rpc/__init__.py | Python | 0.000009 | @@ -0,0 +1,1224 @@
+%22%22%22Msgpack-rpc subpackage.%0A%0AThis package implements a msgpack-rpc client. While it was designed for%0Ahandling some Nvim particularities(server-%3Eclient requests for example), the%0Acode here should work with other msgpack-rpc servers.%0A%22%22%22%0Afrom .async_session import AsyncSession... | |
92cb3088d63ff6fc511c01d1d151f1f1857df496 | create smiles tokenizer unit test | deepchem/feat/tests/test_smiles_tokenizer.py | deepchem/feat/tests/test_smiles_tokenizer.py | Python | 0 | @@ -0,0 +1,824 @@
+# Requriments - transformers, tokenizers%0A%0Afrom unittest import TestCase%0Afrom deepchem.feat.smiles_tokenizer import SmilesTokenizer%0Afrom transformers import RobertaForMaskedLM%0A%0A%0Aclass TestSmilesTokenizer(TestCase):%0A %22%22%22Tests the SmilesTokenizer to load the USPTO vocab file and a... | |
97d455da87d3175c1d5cf2ce3091f26184cf4a10 | Add heos discoverable (#250) | netdisco/discoverables/heos.py | netdisco/discoverables/heos.py | Python | 0 | @@ -0,0 +1,296 @@
+%22%22%22Discover Heos devices.%22%22%22%0Afrom . import SSDPDiscoverable%0A%0A%0Aclass Discoverable(SSDPDiscoverable):%0A %22%22%22Add support for discovering DLNA services.%22%22%22%0A%0A def get_entries(self):%0A %22%22%22Get all the HEOS devices.%22%22%22%0A return self.find_b... | |
7e02831897baae9206fd2c0d53fc1c313c780074 | Test case fixed | erpnext/accounts/doctype/payment_request/test_payment_request.py | erpnext/accounts/doctype/payment_request/test_payment_request.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.accounts.doctype.payment_request.payment_re... | Python | 0.000001 | @@ -937,32 +937,36 @@
t%22: %22_Test Bank
+USD
- _TC%22,%0A%09%09%22curre
|
b90e3b0bce680154d7fea8ed071f740db963c402 | fix bug 1458641: fix reports-clean crontabber app | alembic/versions/e70541df7ed7_bug_1458641_fix_reports_clean.py | alembic/versions/e70541df7ed7_bug_1458641_fix_reports_clean.py | Python | 0 | @@ -0,0 +1,488 @@
+%22%22%22bug 1458641 fix reports clean crontabber app%0A%0ARevision ID: e70541df7ed7%0ARevises: 3474e98b321f%0ACreate Date: 2018-05-02 18:20:19.064954%0A%0A%22%22%22%0A%0Afrom alembic import op%0Afrom socorro.lib.migrations import load_stored_proc%0A%0A%0A# revision identifiers, used by Alembic.%0Are... | |
307816d3b6cb5e57f50f80e10eccd0a701c698a9 | Fix syntax errors. | pymatgen/io/abinitio/__init__.py | pymatgen/io/abinitio/__init__.py | from .calculations import *
from .eos import *
from .pseudos import *
from .netcdf import *
from .events import *
from .task import *
from .workflow import *
| Python | 0.000017 | @@ -1,32 +1,4 @@
-from .calculations import *%0A
from
@@ -89,16 +89,17 @@
om .task
+s
import
@@ -114,16 +114,45 @@
workflow
+s import *%0Afrom .calculations
import
|
d4e6f44c5257afd02883bd739cf6b3953e398857 | Create auth.py | photonix/photos/auth.py | photonix/photos/auth.py | Python | 0.000001 | @@ -0,0 +1,1032 @@
+import os%0A%0Afrom django.contrib.auth import get_library_model%0A%0Aimport graphene%0Afrom graphene_django.types import DjangoObjectType%0Aimport graphql_jwt%0A%0ALibrary = get_library_model()%0A%0Aclass Mutation(graphene.ObjectType):%0A token_auth = graphql_jwt.ObtainJSONWebToken.Field()%0A ... | |
2e084358f3ff38c40ba443b5fadf549bded82eb7 | FIX typo in example. My bad. | examples/decomposition/plot_faces_decomposition.py | examples/decomposition/plot_faces_decomposition.py | """
============================
Faces dataset decompositions
============================
This example applies to :ref:`olivetti_faces` different unsupervised
matrix decomposition (dimension reduction) methods from the module
:py:mod:`sklearn.decomposition` (see the documentation chapter
:ref:`decompositions`) .
"""... | Python | 0.000001 | @@ -3151,16 +3151,17 @@
_cluster
+s
=n_compo
|
ed05755f1f5213cdd95203f51d0097bfbd91e6e1 | Create FindtheDifference_BitandHash.py | leetcode/389-Find-the-Difference/FindtheDifference_BitandHash.py | leetcode/389-Find-the-Difference/FindtheDifference_BitandHash.py | Python | 0.000001 | @@ -0,0 +1,391 @@
+class Solution(object):%0A def findTheDifference(self, s, t):%0A %22%22%22%0A :type s: str%0A :type t: str%0A :rtype: str%0A %22%22%22%0A chrs = %7B%7D%0A res = 0%0A for w in t:%0A if w not in chrs:%0A chrs%5Bw%5D = ... | |
fddcad6de86d8d1dbd37c549b0d4258260c13a3a | Read in sample text file 'proteinGroups.txt' | proteinGroups.py | proteinGroups.py | Python | 0.000001 | @@ -0,0 +1,280 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Thu Oct 8 20:48:41 2015%0A%0A@author: student%0A%22%22%22%0A%0Aimport pandas as pd%0A#import numpy as np%0A%0A# read in file%0Adf = pd.read_table('/Users/student/Desktop/pubs/Sample text files/proteinGroups.txt', index_col=0)%0A#print df.dtypes%0Aprin... | |
558d45ed0b9c3d375daa81383125e0c4664df7af | Add adwaita-icon-theme | packages/adwaita-icon-theme.py | packages/adwaita-icon-theme.py | Python | 0 | @@ -0,0 +1,85 @@
+GnomeXzPackage ('adwaita-icon-theme', version_major = '3.16', version_minor = '2.1')%0A
| |
af2a0a851be91931f96a7e9d44a1e8c460d70918 | Migrate creation date to new casebooks | web/main/migrations/0052_migrate_casebook_dates.py | web/main/migrations/0052_migrate_casebook_dates.py | Python | 0.000002 | @@ -0,0 +1,658 @@
+# Generated by Django 2.2.10 on 2020-04-14 11:38%0A%0Afrom django.db import migrations%0Afrom main.models import Casebook%0A%0Adef copy_old_dates(app, schema):%0A update_cbs = %5B%5D%0A for casebook in Casebook.objects.select_related('old_casebook').all():%0A if casebook.old_casebook:%0A... | |
a62b95b4764ab0cab3d14f98798319913c83c044 | fix name display | quora/pyquora.py | quora/pyquora.py | import requests
from bs4 import BeautifulSoup
import feedparser
import re
### Configuration ###
POSSIBLE_FEED_KEYS = ['link', 'id', 'published', 'title', 'summary']
### Enumerated Types ###
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, ke... | Python | 0.000001 | @@ -777,16 +777,74 @@
turn s%0A%0A
+def render_name(user):%0A return user.replace('-', ' ')%0A%0A
def get_
@@ -2918,20 +2918,33 @@
:
+render_name(
user
+)
,%0A
|
7e53ec5de1d094eafa6a0bba6efcdaf845d5a7b8 | Create 0007.py | pylyria/0007/0007.py | pylyria/0007/0007.py | Python | 0.00013 | @@ -0,0 +1,1275 @@
+#! /usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# vim:fenc=utf-8%0A# Copyright By PyLyria%0A# CreateTime: 2016-03-04 19:36:40%0Aimport os%0A%0Adef get_path(root = os.curdir):%0A root += os.sep%0A for path, dirs, files in os.walk(root):%0A for file_name in files:%0A yield ... | |
0b4c873ad2d0923e88fbee5b52435ff1ee68d03c | Create PedidoVer.py | backend/Models/Grau/PedidoVer.py | backend/Models/Grau/PedidoVer.py | Python | 0 | @@ -0,0 +1,320 @@
+from Framework.Pedido import Pedido%0Afrom Framework.ErroNoHTTP import ErroNoHTTP%0A%0Aclass PedidoVer(Pedido):%0A%0A%09def __init__(self,variaveis_do_ambiente):%0A%09%09super(PedidoVer, self).__init__(variaveis_do_ambiente)%0A%09%09try:%0A%09%09%09self.id = self.corpo%5B'id'%5D%09%09%09%0A%09%09exce... | |
d72f6c0d989c3f40d460b1ce5d45b7ebf27ec295 | create tests for kornia | tests/test_kornia.py | tests/test_kornia.py | Python | 0 | @@ -0,0 +1,508 @@
+import unittest%0A%0Aimport cv2%0Aimport torch%0Aimport kornia%0A%0Aclass TestOpenCV(unittest.TestCase):%0A def test_imread_opencv(self):%0A img = cv2.imread('/input/tests/data/dot.png')%0A img_t = kornia.image_to_tensor(img)%0A%0A self.assertEqual(img.shape, (1, 1, 3))%0A ... | |
e3d0681cf2e449b06abebabb7e8726079997eb01 | Add reflex game | reflex/reflex.py | reflex/reflex.py | Python | 0.000021 | @@ -0,0 +1,2228 @@
+from microbit import *%0Aimport random%0A%0Ascore = 0%0Apixel = None%0Afade_step = 300%0Aclicked = False%0AMAX_PAUSE = 3000%0A%0A%0Adef get_rand_coord(limit=4):%0A return random.randint(0, limit)%0A%0A%0Adef get_rand_side():%0A return random.choice(%5B-1, 1%5D)%0A%0A%0Adef handle_correct_click... | |
998e7ac87ef6e96bb5d421860683f87e8b373428 | Create view.py | blobstore-python/src/app/view.py | blobstore-python/src/app/view.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
9c22d354da4c09d2e98b657d334e7594df1042d7 | Create q2.py | work/q2.py | work/q2.py | Python | 0.000114 | @@ -0,0 +1,257 @@
+def union(arr1, arr2):%0A result = %5B%5D%0A for i in range(1, len(arr1)):%0A result.append(arr1%5Bi%5D)%0A result.append(arr2%5Bi%5D)%0A return result%0A%0Adef create_array():%0A return %5Bx for x in range(0,100)%5D%0A%0Aprint(union(create_array(), create_array()))%0A
| |
c100a97b4a2edb838fa5fd19f80909a86addf761 | Version 3.2.1 | tvrenamr/__init__.py | tvrenamr/__init__.py | __version__ = (3, 2, 0)
def get_version():
return '.'.join(map(str, __version__))
| Python | 0.000001 | @@ -18,9 +18,9 @@
2,
-0
+1
)%0A%0Ad
|
4e1f87bf7805d20e52015b8c283181e4035de54b | Create _init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/cmd/_init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/cmd/_init_.py | Python | 0.000145 | @@ -0,0 +1 @@
+%0A
| |
40ef5b1a6347d54eeb043c64f36286768b41dc3e | Add lldbToolBox.py scaffolding in ./utils for adding lldb python helpers to use when debugging swift. | utils/lldbToolBox.py | utils/lldbToolBox.py | Python | 0.00001 | @@ -0,0 +1,994 @@
+%22%22%22%0ALLDB Helpers for working with the swift compiler.%0A%0ALoad into LLDB with 'command script import /path/to/lldbToolBox.py'%0A%0AThis will also import LLVM data formatters as well, assuming that llvm is next%0Ato the swift checkout.%0A%22%22%22%0A%0Aimport os%0A%0AREPO_BASE = os.path.abspa... | |
e0db4982016a724c368feafbe4182016dc0fa67d | Create mongo_to_csv.py | mongo_to_csv.py | mongo_to_csv.py | Python | 0.000362 | @@ -0,0 +1,2132 @@
+import unicodecsv%0Aimport sys%0Afrom pymongo import MongoClient%0A%0A# call this with 3 arguments: 1) mongodb uri 2) collection nam e3) output filename%0A%0Aclass generic_converter:%0A%0A def __init__(self):%0A self.header_dict = %7B%7D%0A%0A def retrieve_headers(self, test_dict, name_... | |
f5c8f8d819143b4a49064847a6eb1a7813a3f06b | Create solution.py | hackerrank/algorithms/sorting/easy/closest_numbers/py/solution.py | hackerrank/algorithms/sorting/easy/closest_numbers/py/solution.py | Python | 0.000018 | @@ -0,0 +1,516 @@
+#!/bin/python%0A%0Asize = int(raw_input())%0Avalues = sorted(%5Bint(value) for value in raw_input().split()%5D%5B:size%5D)%0Adifferences = sorted(%5B(values%5Bi - 1%5D, values%5Bi%5D) for i in range(1, len(values))%5D, key = lambda x : abs(x%5B0%5D - x%5B1%5D))%0Ai = 1%0Awhile (i %3C len(differences)... | |
823bf93a9d931ed106ac4ed83f0448215c38580a | Create network_auth.py | network_auth.py | network_auth.py | Python | 0.000003 | @@ -0,0 +1,1321 @@
+#!/usr/bin/python%0A# Authenticates against a LAN using HTTP Basic Auth%0A%0Aimport sys%0A%0Aif len(sys.argv) != 4:%0A print (%22Invalid arguments%22)%0A print (%22Proper syntax is: %22 + sys.argv%5B0%5D + %22 %5Burl%5D %5Busername%5D %5Bpassword%5D%22)%0A sys.exit(1)%0A%0Aimport requests%0... | |
1b440f67d3150d066014bddeaa718eee8216f602 | add SWSFinance test. | restclients/tests.py | restclients/tests.py | from django.utils import unittest
#from restclients.test.sws.compatible import SWSTest
from restclients.test.sws.term import SWSTestTerm
from restclients.test.sws.err404.dao import SWSTestDAO404
from restclients.test.sws.err500.dao import SWSTestDAO500
from restclients.test.sws.invalid_dao import SWSTestInvalidDAO
fro... | Python | 0.00005 | @@ -32,60 +32,224 @@
st%0A%0A
-#from restclients.test.sws.compatible import SWSTest
+from restclients.test.library.mylibinfo import MyLibInfoTest%0Afrom restclients.test.sws.compatible import SWSTest%0Afrom restclients.test.sws.financial import SWSFinance%0Afrom restclients.test.sws.notice import SWSNotice
%0Afro
@@ ... |
0cad5e1673069d0fb8f2abb4eb6b062e3461fb70 | Add fortran ABI mismatch test for scipy.linalg. | scipy/linalg/tests/test_build.py | scipy/linalg/tests/test_build.py | Python | 0 | @@ -0,0 +1,1652 @@
+from subprocess import call, PIPE, Popen%0Aimport sys%0Aimport re%0A%0Aimport numpy as np%0Afrom numpy.testing import TestCase, dec%0A%0Afrom scipy.linalg import flapack%0A%0A# XXX: this is copied from numpy trunk. Can be removed when we will depend on%0A# numpy 1.3%0Aclass FindDependenciesLdd:%0A ... | |
096a1d94c2f54246d51954b59fc5c3fdb28154b2 | add persistence strategy enum | keen/__init__.py | keen/__init__.py | __author__ = 'dkador'
| Python | 0.000002 | @@ -15,8 +15,398 @@
dkador'%0A
+%0Aclass PersistenceStrategy:%0A %22%22%22%0A An enum that defines the persistence strategy used by the KeenClient.%0A Currently supported: DIRECT, which means any time add_event is called the%0A client will call out directly to Keen, or REDIS, which means add_event%0A wi... |
46d7ce6a8ce93eb439617cb942d3a7e923b2ed7a | hello world | example/hello.py | example/hello.py | Python | 0.999981 | @@ -0,0 +1,22 @@
+print(%22Hello World!%22)%0A
| |
295dc1e11563350181558001366275369df90639 | Add a sysutil module | sahgutils/sysutil.py | sahgutils/sysutil.py | Python | 0 | @@ -0,0 +1,987 @@
+# System utility functions%0Afrom subprocess import Popen, PIPE%0A%0Adef exec_command(cmd_args):%0A %22%22%22Execute a shell command in a subprocess%0A%0A Convenience wrapper around subprocess to execute a shell command%0A and pass back stdout, stderr, and the return code. This function%0A ... | |
74034ccc6d1b7436c81520fb287330b852d54c62 | Create a.py | a.py | a.py | Python | 0.000489 | @@ -0,0 +1,1578 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# Simple Bot to reply to Telegram messages. This is built on the API wrapper, see%0A# echobot2.py to see the same example built on the telegram.ext bot framework.%0A# This program is dedicated to the public domain under the CC0 license.%0Aimport ... | |
e2dbee01734a981e8fcbbdca7d7d96f0506f929b | Create b.py | b.py | b.py | Python | 0.000018 | @@ -0,0 +1,7 @@
+b = 43%0A
| |
ef7b6fb0bbe0c0d263a8c28ccaed1365f50f0ad9 | Solve Knowit2019/07 | knowit2019/07.py | knowit2019/07.py | Python | 0.99801 | @@ -0,0 +1,463 @@
+def zee_special_divison_operator(exp_r, x):%0A for y_d in range(2, 27644437):%0A b = y_d * x%0A r = b %25 27644437%0A%0A if exp_r == r:%0A break%0A%0A return y_d%0A%0A%0Adef test_special():%0A assert 13825167 == zee_special_divison_operator(5897, 2)%0A asse... | |
849321eb5a34518afa85e0e5643c1a8f30aad4dc | remove encoding | petl/io/xlsx.py | petl/io/xlsx.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import locale
from petl.util.base import Table
def fromxlsx(filename, sheet=None, range_string=None, row_offset=0,
column_offset=0, **kwargs):
"""
Extract a table from a sheet in an Excel .xlsx file.
... | Python | 0.9998 | @@ -2443,27 +2443,8 @@
True
-, encoding=encoding
)%0A
|
54bc1400a90408a77751b9fda275ec963a2db0bc | lowercase SettlementCode | source_data/etl_tasks/refresh_master.py | source_data/etl_tasks/refresh_master.py | import sys, os
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import IntegrityError
from datapoints.models import Indicator, DataPoint, Region, Campaign, Office, Source
from source_data.models import VCMSummaryNew,VCMSettlement,ProcessStatus
from django.contrib.auth.models import... | Python | 0.999852 | @@ -2190,50 +2190,8 @@
):%0A%0A
- print row_dict%5B'SettlementCode'%5D%0A%0A
@@ -2233,17 +2233,17 @@
w_dict%5B'
-S
+s
ettlemen
@@ -2243,17 +2243,17 @@
ttlement
-C
+c
ode'%5D.re
@@ -3254,11 +3254,11 @@
ct%5B'
-KEY
+key
'%5D +
|
e61dbf66d6f73e4999a5ff9f732a8df0637fdbf2 | Add an example of SQLalchemy model | server/models.py | server/models.py | Python | 0.000051 | @@ -0,0 +1,477 @@
+from flask.ext.sqlalchemy import SQLAlchemy%0A%0Aapp.config%5B'SQLALCHEMY_DATABASE_URI'%5D = 'sqlite:////tmp/test.db'%0Adb = SQLAlchemy(app)%0A%0Aclass User(db.Model):%0A id = db.Column(db.Integer, primary_key=True)%0A username = db.Column(db.String(80), unique=True)%0A email = db.Column(db.... | |
b6fb4cadb9ac1506fef3a230ee7ec983daa64922 | Remove tail | judge/templatetags/markdown/lazy_load.py | judge/templatetags/markdown/lazy_load.py | from copy import deepcopy
from django.contrib.staticfiles.templatetags.staticfiles import static
from lxml import html
def lazy_load(tree):
blank = static('blank.gif')
for img in tree.xpath('.//img'):
src = img.get('src')
if src.startswith('data'):
continue
noscript = html... | Python | 0.001071 | @@ -334,16 +334,68 @@
cript')%0A
+ copy = deepcopy(img)%0A copy.tail = ''%0A
@@ -410,29 +410,20 @@
.append(
-deepcopy(img)
+copy
)%0A
|
eb145b78d4c84a29ee77fbe77142dee6f97f67dd | put urls and getter in its own file | filemail/urls.py | filemail/urls.py | Python | 0 | @@ -0,0 +1,966 @@
+import os%0Afrom errors import FMConfigError%0A%0A%0Abase_url = 'https://www.filemail.com'%0A%0Aapi_urls = %7B%0A 'login': 'api/authentication/login',%0A 'logout': 'api/authentication/logout',%0A 'init': 'api/transfer/initialize',%0A 'get': 'api/transfer/get',%0A 'complete': 'api/trans... | |
beb549ba090a1a72761a7e81feb3edcbf85ca543 | Add files via upload | first_attempt.py | first_attempt.py | Python | 0 | @@ -0,0 +1,21 @@
+print(%22Hello world%22)%0A
| |
747fa222d1e382ced363ced9d2565f384769316c | add button listener | button-listen.py | button-listen.py | Python | 0.000001 | @@ -0,0 +1,633 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Afrom time import time, sleep%0Aimport RPi.GPIO as GPIO%0A%0A%0Adef main(argv=sys.argv):%0A channel = int(argv%5B1%5D)%0A GPIO.setmode(GPIO.BCM)%0A%0A try:%0A GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)%0A%0A ts = 0%0A%0A ... | |
8dc7f657e816ab9becbabcf032e62d088f2b6b3c | Add network visualization tool | viz.py | viz.py | Python | 0 | @@ -0,0 +1,1286 @@
+import os%0Aimport json%0Aimport hashlib%0A%0Adef get_data_path():%0A if not 'OPENSHIFT_DATA_DIR' in os.environ:%0A return '../data/data.json'%0A else:%0A return os.path.join(os.environ%5B'OPENSHIFT_DATA_DIR'%5D, 'data.json')%0A%0Adef get_data():%0A if not os.path.isfile(get_d... | |
0f3815ed22c4e25d311f36e0d9be9c5b38bd32bd | Create the basic structure for the topic handler. | handler/topic.py | handler/topic.py | Python | 0 | @@ -0,0 +1,284 @@
+class IndexHandler(BaseHandler):%0A%0Aclass ViewHandler(BaseHandler):%0A%0Aclass CreateHandler(BaseHandler):%0A%0Aclass EditHandler(BaseHandler):%0A%0Aclass FavoriteHandler(BaseHandler):%0A%0Aclass CancelFavoriteHandler(BaseHandler):%0A%0Aclass VoteHandler(BaseHandler):%0A%0Aclass ReplyEditHandler(Ba... | |
b48a17f45bbb9a2202c8c3fcb377037b92961f0b | Create na.py | na.py | na.py | Python | 0.000005 | @@ -0,0 +1,8 @@
+hjghjgj%0A
| |
00f2a9ae8a7deaa8a0cb49b9f1ce5b9b6a41f654 | handle None for timestamps | src/robot/result/configurer.py | src/robot/result/configurer.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0.000387 | @@ -2589,16 +2589,33 @@
if
+not timestamp or
utils.eq
|
48a9b87dd86d600cdab4224c84aa5ce0685b775c | Add fetch data file | python/fetch.py | python/fetch.py | Python | 0.000001 | @@ -0,0 +1,2089 @@
+#!/usr/bin/env python%0A%0Aimport time%0Aimport json%0Aimport requests%0A%0Aheaders = %7B%0A %22Host%22: %22xgs15.c.bytro.com%22,%0A %22User-Agent%22: %22Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0%22,%0A %22Accept%22: %22text/plain, */*; q=0.01%22,%0A ... | |
3c7e8f08699fa6d2b004f86e6bdb0bc4792ae8c2 | Create regex.py | python/regex.py | python/regex.py | Python | 0.000212 | @@ -0,0 +1,126 @@
+# re.IGNORECASE can be used for allowing user to type arbitrary cased texts.%0AQUIT_NO_CASE = re.compile('quit', re.IGNORECASE)%0A
| |
b01c602f156b5a72db1ea4f27989aa5b1afdada8 | ADD Cleaning before each test | src/behavior/features/terrain.py | src/behavior/features/terrain.py | Python | 0 | @@ -0,0 +1,277 @@
+from lettuce import *%0Aimport requests%0A%0ATARGET_URL='http://localhost:8080'%0A%0AtenantList = %5B %22511%22, %22615%22, %22634%22, %22515%22 %5D%0A%0A@before.each_scenario%0Adef cleanContext(feature):%0A for tenant in tenantList:%0A url = TARGET_URL + '/pap/v1/' + tenant%0A r = requests.de... | |
5f4263b6968c839bd67a60f4a2ffd89f8b373193 | Update __init__.py | tendrl/provisioning/objects/definition/__init__.py | tendrl/provisioning/objects/definition/__init__.py | import pkg_resources
from ruamel import yaml
from tendrl.commons import objects
class Definition(objects.BaseObject):
internal = True
def __init__(self, *args, **kwargs):
self._defs = True
super(Definition, self).__init__(*args, **kwargs)
self.data = pkg_resources.resource_string(_... | Python | 0.000072 | @@ -531,16 +531,92 @@
(self):%0A
+ if self._parsed_defs:%0A return self._parsed_defs%0A %0A
|
f784228170557643bc5cb1efc61ea38b45796210 | Add flask application | app.py | app.py | Python | 0.000001 | @@ -0,0 +1,163 @@
+# -*- coding: utf-8 -*-%0Afrom flask import Flask%0A%0Aapp = Flask(__name__)%0A%0A%0A@app.route('/')%0Adef main():%0A return 'hello'%0A%0A%0Aif __name__ == %22__main__%22:%0A app.run()%0A
| |
ef67bf3d8a418399fca676502a87ccb7d3914ed1 | Add module with common potentials, with force versions for some | Lib/potentials.py | Lib/potentials.py | Python | 0 | @@ -0,0 +1,1501 @@
+import numpy as np%0Aimport utils%0A%0Adef LJ(r_0, U_0):%0A '''%0A Lennard-Jones with minimum at (r_0, -U_0).%0A '''%0A r_0_6 = r_0 ** 6%0A def func(r_sq):%0A six_term = r_0_6 / r_sq ** 3%0A return U_0 * (six_term ** 2 - 2.0 * six_term)%0A return func%0A%0Adef step(r_... | |
1ece8c8640214d69a224f94f1b1ac93ec53d7699 | Add image processing system (dummy) | chunsabot/modules/images.py | chunsabot/modules/images.py | Python | 0 | @@ -0,0 +1,201 @@
+from chunsabot.botlogic import brain%0A%0A@brain.route(%22@image%22)%0Adef add_image_description(msg, extras):%0A attachment = extras%5B'attachment'%5D%0A if not attachment:%0A return None%0A%0A return %22asdf%22%0A
| |
84be951a9160e9998f3ed702542cee7274081091 | Create __init__.py | spectrum/__init__.py | spectrum/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
254f4ef03ad50c2227850e8d67b45697a211a42d | Update command.py | src/command.py | src/command.py | # -*- coding: utf-8 -*-
import math
def parse_command(commands, game_stats):
"""
Parse a command from a player and run it.
Parameters
----------
command : command from the player (str).
game_stats : stat of the game (dic).
Return
------
game_stats : game stat after the command exe... | Python | 0.000002 | @@ -4235,16 +4235,18 @@
ze'%5D%5B1%5D%0A
+%09%0A
%09damages
@@ -4283,16 +4283,16 @@
mages'%5D%0A
-
%09ship_ab
@@ -4393,16 +4393,18 @@
on'%5D%5B1%5D%0A
+%09%0A
%09distanc
@@ -4468,16 +4468,18 @@
derly )%0A
+%09%0A
%09if dist
@@ -4521,16 +4521,19 @@
nge'%5D :%0A
+%09%09%0A
%09%09for el
@@ -4575,16 +4575,20 @@
... |
92fde42097c4e0abbf5a7835a72f58f52c9b8499 | Create example.py | Python/example.py | Python/example.py | Python | 0.000001 | @@ -0,0 +1,28 @@
+#This is an example script.%0A
| |
3a56b89aacad2f948bf85b78c0834edf7c8d8d01 | Add missing file. | renamer/util.py | renamer/util.py | Python | 0.000001 | @@ -0,0 +1,1410 @@
+import re%0A%0A%0Aclass ConditionalReplacer(object):%0A def __init__(self, cond, regex, repl):%0A super(ConditionalReplacer, self).__init__()%0A%0A self.cond = re.compile(cond)%0A self.regex = re.compile(regex)%0A self.repl = repl%0A%0A @classmethod%0A def fromSt... | |
066673aea6887d9272646d8bac8f99c69387e61d | add management command to check the status of a bounced email | corehq/util/management/commands/check_bounced_email.py | corehq/util/management/commands/check_bounced_email.py | Python | 0 | @@ -0,0 +1,3086 @@
+from django.core.management.base import BaseCommand%0A%0Afrom corehq.util.models import (%0A BouncedEmail,%0A PermanentBounceMeta,%0A ComplaintBounceMeta,%0A)%0A%0A%0Aclass Command(BaseCommand):%0A help = %22Check on the bounced status of an email%22%0A%0A def add_arguments(self, pars... | |
fea6011cf14e87492d511db3ed9415f5938929bf | add ex8 | ex8.py | ex8.py | Python | 0.99848 | @@ -0,0 +1,353 @@
+formatter = %22%25r %25r %25r %25r%22%0A%0Aprint formatter %25(1, 2, 3, 4)%0Aprint formatter %25 (%22one%22, %22two%22, %22three%22, %22four%22)%0Aprint formatter %25(True, False, False, True)%0Aprint formatter %25(formatter, formatter, formatter,formatter)%0Aprint formatter %25 (%0A %22I had this... | |
2ea014495f559072c5ecfac0b1117979793cf042 | Create ruuvitag-web.py | ruuvitag-web.py | ruuvitag-web.py | Python | 0 | @@ -0,0 +1,1773 @@
+#!/usr/bin/python3%0A%0Afrom flask import Flask, render_template%0Afrom datetime import datetime, timedelta%0Aimport sqlite3%0Aimport json%0Aimport random%0A%0Aapp = Flask(__name__)%0A%0Adef randomRGB():%0A r, g, b = %5Brandom.randint(0,255) for i in range(3)%5D%0A return r, g, b, 1%0A%0A%0A@a... | |
2becf3b5223da8dc8d312462ae84f32ec3aff129 | Create hw1.py | hw1.py | hw1.py | Python | 0.000015 | @@ -0,0 +1,2386 @@
+# Name: Yicheng Liang%0A# Computing ID: yl9jv%0A%0Aimport math%0A%0Ak = raw_input(%22Please enter the value for k: %22)%0Awhile (not k.isdigit()):%0A k = raw_input(%22Please enter a number for k: %22)%0Ak = int(k)%0A %0Am = raw_input(%22Please enter the value for M: %22)%0Awhile (not m.isdigit... | |
6274ee8d776c829998dfaa56cb419d1263242a48 | Add topological sorting in Python | Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py | Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py | Python | 0.000001 | @@ -0,0 +1,935 @@
+'''%0ATopological sort.%0ATaken from : %0Ahttp://stackoverflow.com/questions/15038876/topological-sort-python%0A'''%0A%0Afrom collections import defaultdict%0Afrom itertools import takewhile, count%0A%0Adef sort_topologically(graph):%0A levels_by_name = %7B%7D%0A names_by_level = defaultdict(se... | |
df52febb14761d741a20dcdc1cbfd5ea8cd7e07b | add my bing script as an example | bingaling.aclark.py | bingaling.aclark.py | Python | 0 | @@ -0,0 +1,751 @@
+#!/usr/bin/python%0A%0Aimport re%0A%0Aimport baseformat%0Aimport bingaling%0A%0Abingcheck_restr = r'(%5Ba4%5D%5Bc%5D%5Bl1%5D%5Ba4%5D%5Br%5D%5Bk%5D)%7C(%5Ba4%5D%5Bl1%5D%5Bi1%5D)'%0Abingcheck_full = re.compile(r'(('+'%5Cx04%5Cx65'+r')%7C('+'%5Cx04%5Cx63'r')%7C(%5B%5E%5Cw%5C-'+'%5Cx04'+r'%5D)%7C(%5E)%7... | |
d95732ce90c5c9ac571ffc78b45eaa4424a11038 | Create nested_scrape.py | nested_scrape.py | nested_scrape.py | Python | 0.000001 | @@ -0,0 +1,1013 @@
+%22%22%22 PROJECT SCRAPER %22%22%22%09%09%0A%0Afrom bs4 import BeautifulSoup%0Aimport urllib2%0A%0A%0A%0Adef scraper(url, outer_tag, outer_attr, outer_attr_name, inner_tag, inner_attr, inner_attr_name):%0A%0A%09''' BEAUTIFUL SOUP INIT '''%0A%09web=urllib2.urlopen(url)%0A%09soup=BeautifulSoup(web,'ht... | |
147a0815f21f807ac6a3e1c39c820e2b8364ad02 | Tweak style. | script/libuv.py | script/libuv.py | #!/usr/bin/env python
# Downloads and compiles libuv.
from __future__ import print_function
import os
import os.path
import platform
import shutil
import subprocess
import sys
LIB_UV_VERSION = "v1.6.1"
LIB_UV_DIR = "build/libuv"
def ensure_dir(dir):
"""Creates dir if not already there."""
if os.path.isdir(dir... | Python | 0 | @@ -402,18 +402,16 @@
dir.%22%22%22%0A
-
%0A if pl
@@ -566,16 +566,25 @@
ck_call(
+%0A
%5B'cmd',
|
d2ed4e7a0d8edafa250044e8b9ecf319c14b85e0 | add pkc.py | pkc.py | pkc.py | Python | 0.000308 | @@ -0,0 +1,1043 @@
+class PkcError(BaseException):%0A pass%0A%0Aclass PkcTypeError(TypeError, PkcError):%0A pass%0A%0Aclass PkcCertificateError(ValueError, PkcError):%0A pass%0A%0Aclass PkcPublickeyError(ValueError, PkcError):%0A pass%0A%0Adef pkc_extract_publickey_from_certificate(certificate):%0A if ty... | |
3641160e055128c0d799926229959fef33ffa26e | use our own django style, width increased to flow nicely with default toolbar | ckeditor/widgets.py | ckeditor/widgets.py | from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from django.utils.encoding import force_unicode
from django.utils impo... | Python | 0 | @@ -506,10 +506,14 @@
': '
-v2
+django
',%0A
@@ -570,11 +570,11 @@
h':
-618
+835
,%0A
|
b716ae64ec574d741386b1dfc18c76e9bddec9a0 | add closure example | closure.py | closure.py | Python | 0.000001 | @@ -0,0 +1,1154 @@
+%22%22%22%0A%25%25closure cell magic for running the cell in a function,%0Areducing pollution of the namespace%0A%0A%25%25forget does the same thing, but explicitly deletes new names,%0Arather than wrapping the cell in a function.%0A%22%22%22%0A%0Afrom IPython.utils.text import indent%0A%0Adef closu... | |
7d28f97fb16684c58cf9e55bcca213e853741ca4 | Create rmq.py | rmq.py | rmq.py | Python | 0.000002 | @@ -0,0 +1,950 @@
+#!/usr/local/bin/python3%0Afrom sys import stdin%0Afrom math import ceil, log%0Afrom decimal import Decimal as d%0A%0Aclass RMQ(object):%0A def __init__(self, numbers):%0A self.e = %5B%5D%0A n = len(numbers)%0A %0A if (n & (n-1))!=0:%0A x = ceil(log(n, 2))%0A nn = 2**x;%0A ... | |
72678c437f1b1110fb8a14c78dcdd4c3c8b64157 | Add initial version of bot script | rtm.py | rtm.py | Python | 0 | @@ -0,0 +1,840 @@
+import time%0Afrom slackclient import SlackClient%0A%0Atoken = 'kekmao'%0Asc = SlackClient(token)%0Ateam_join_event = 'team_join'%0A%0A%0Adef send_welcome_message(user):%0A user_id = user%5B'id'%5D%0A response = sc.api_call('im.open', user=user_id)%0A try:%0A dm_channel_id = response%... | |
4c499d366429f68ff29c7a2f93553b06f3697405 | Add missing oslo/__init__.py | oslo/__init__.py | oslo/__init__.py | Python | 0.000007 | @@ -0,0 +1,629 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or ag... | |
c18bbb7cb752e6a4421b98c100f682f3c7c45882 | Fix bug 1254581 - Exclude file upload view from zone middleware. | kuma/wiki/middleware.py | kuma/wiki/middleware.py | from django.http import HttpResponseRedirect
from django.shortcuts import render
from kuma.core.utils import urlparams
from .exceptions import ReadOnlyException
from .jobs import DocumentZoneURLRemapsJob
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag for a specific message.
""... | Python | 0 | @@ -906,16 +906,17 @@
if
+(
request.
@@ -935,17 +935,34 @@
OST' and
-
+%0A (
'$subscr
@@ -981,16 +981,46 @@
est.path
+ or '$files' in request.path))
:%0A
|
5ee021af46f7b6420b5edeac38f5f34f675fa625 | create basic crawler | crawler.py | crawler.py | Python | 0.000005 | @@ -0,0 +1,2475 @@
+# -*- coding:utf-8 -*-%0A%0Afrom urllib import request, parse, error%0Afrom time import sleep%0Aimport re, os%0A%0Astart_tid = '2507213' # change initial url at here%0ASEXINSEX_URLS_PREFIX = 'http://www.sexinsex.net/forum/'%0Aencoding = 'gbk'%0Apath = os.path.abspath('.')%0Asleeptime = 0%0A%0Adef g... | |
5f3a665e4611ae8faf82fcfb2804a0fd9aa84d2b | Create majority_number_iii.py | lintcode/majority_number_iii/py/majority_number_iii.py | lintcode/majority_number_iii/py/majority_number_iii.py | Python | 0.999146 | @@ -0,0 +1,458 @@
+class Solution:%0A %22%22%22%0A @param nums: A list of integers%0A @param k: As described%0A @return: The majority number%0A %22%22%22%0A def majorityNumber(self, nums, k):%0A import collections%0A %0A ratio = 1.0 / k * len(nums)%0A counter = collection... | |
8be862467344b9cf45b567008f10face0ed3ebf3 | Create zhconvert.py for Alpha 1.0.3 | packages/zhconvert.py | packages/zhconvert.py | Python | 0 | @@ -0,0 +1,611 @@
+import requests%0A%0A_url = 'http://opencc.byvoid.com/convert/'%0A%0Adef toTraditional(text):%0A # if len(text) %3E 100:%0A req = requests.post(_url, data=%7B'text':text,'config':'s2t.json','precise':'0'%7D)%0A return req.text%0A # else:%0A # result = ''%0A # for segment in ... | |
22f550dd3499d7d063501a2940a716d42362f6bc | Add missing file. | migrations/versions/0031_add_manage_team_permission.py | migrations/versions/0031_add_manage_team_permission.py | Python | 0.000001 | @@ -0,0 +1,1485 @@
+%22%22%22empty message%0A%0ARevision ID: 0031_add_manage_team_permission%0ARevises: 0030_add_template_permission%0ACreate Date: 2016-02-26 10:33:20.536362%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '0031_add_manage_team_permission'%0Adown_revision = '0030_add_template_... | |
950fa531697ec82a56a742241d941e0573559ffd | fix merge conflict. plugin_parser now handles templates if not core or modes | plugin_parser.py | plugin_parser.py | #!/usr/bin/env python2.7
import ConfigParser
import os
import shutil
import sys
def add_plugins(plugin_url):
# !! TODO keep track of changes so that they can be removed later on
try:
os.system("git config --global http.sslVerify false")
os.system("cd /tmp && git clone "+plugin_url)
if ... | Python | 0 | @@ -2970,32 +2970,34 @@
+el
if filename == %22
@@ -4189,32 +4189,150 @@
ite(configfile)%0A
+ else:%0A shutil.copyfile(subdir+%22/%22+filename, dest+filename)%0A
exce
|
f9d399fb9fa923c68581279085566ba479349903 | test for api export endpoint | onadata/apps/api/tests/viewsets/test_export_viewset.py | onadata/apps/api/tests/viewsets/test_export_viewset.py | Python | 0.000001 | @@ -0,0 +1,2507 @@
+import os%0A%0Afrom django.test import RequestFactory%0A%0Afrom onadata.apps.api.viewsets.export_viewset import ExportViewSet%0Afrom onadata.apps.main.tests.test_base import TestBase%0A%0A%0Aclass TestDataViewSet(TestBase):%0A%0A def setUp(self):%0A super(self.__class__, self).setUp()%0A ... | |
890f2d61db6925eb9baba74421fecd1aba205c96 | 922. Sort Array By Parity II | LeetCode/SortArrayByParity2.py | LeetCode/SortArrayByParity2.py | Python | 0.999988 | @@ -0,0 +1,1013 @@
+%22%22%22%0Agiven half of them are even and half are odd and internal order between odd and even indexes doesn't matter,%0Awe can scan odd and even indexes until we find a pair that need to be swapped and swap that.%0AUnder the assumptions everything can be put in place with swaps like that.%0A%22%2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.