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 |
|---|---|---|---|---|---|---|---|
dcd02e0a7b626111bc0fc344df9f6fff2de832ae | Add a (bad) example of missing method. | examples/missingmethod.py | examples/missingmethod.py | Python | 0.000074 | @@ -0,0 +1,449 @@
+#!/usr/bin/python3%0A%0A%22%22%22Send an invalid request with missing method member.%22%22%22%0A%0Afrom simpleclient import send_data_to_socket%0A%0AEXAMPLE = %7B%0A %22params%22: %7B%0A %22filter%22: %7B%0A 'store': 'catalog',%0A 'schema': 'product',%0A 'id... | |
57b9fcfa5b200ec971f8f3070447cbc98026f5a5 | add example of variable-length array branch | examples/tree/vararray.py | examples/tree/vararray.py | Python | 0.000004 | @@ -0,0 +1,786 @@
+#!/usr/bin/env python%0A%22%22%22%0A=================================%0ATrees with variable-length arrays%0A=================================%0A%0AThis example demonstrates how to create a tree with a variable-length array.%0A%22%22%22%0Aprint(__doc__)%0A%0Afrom rootpy.tree import Tree, TreeModel, In... | |
8ab83988f66270c76b28f36e8263f029011e773b | use Task & Job, a Task has many Jobs | farmer/models.py | farmer/models.py | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
s... | Python | 0.000021 | @@ -149,11 +149,12 @@
ass
-Job
+Task
(mod
@@ -594,52 +594,8 @@
) %0A%0A
- result = models.TextField(null = True)%0A%0A
@@ -963,47 +963,199 @@
-tmpdir = '/tmp/ansible_%25s' %25 time.time(
+self.start = datetime.now()%0A self.save()%0A%0A # initial jobs%0A cmd_shell = s... |
d692508e9c6fba847f3bb179bbfd3684e6ebcef0 | Add py solution for 384. Shuffle an Array | py/shuffle-an-array.py | py/shuffle-an-array.py | Python | 0.99853 | @@ -0,0 +1,801 @@
+from random import randint%0Aclass Solution(object):%0A%0A def __init__(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A %22%22%22%0A self.nums = nums%0A%0A def reset(self):%0A %22%22%22%0A Resets the array to its original configuration and ret... | |
6c7b9a0315bf12fb3e40ddd49f43fe8bec5c6132 | Create 0001_0.py | pylyria/0001/0001_0.py | pylyria/0001/0001_0.py | Python | 0.019732 | @@ -0,0 +1,632 @@
+# -*- coding: utf-8 -*-%0A#!/usr/bin/env python%0A#%E7%AC%AC 0001 %E9%A2%98%EF%BC%9A%E5%81%9A%E4%B8%BA Apple Store App %E7%8B%AC%E7%AB%8B%E5%BC%80%E5%8F%91%E8%80%85%EF%BC%8C%E4%BD%A0%E8%A6%81%E6%90%9E%E9%99%90%E6%97%B6%E4%BF%83%E9%94%80%EF%BC%8C%E4%B8%BA%E4%BD%A0%E7%9A%84%E5%BA%94%E7%94%A8%E7%94%9F%E... | |
706a88810abc1be1fcfa799b7bb46a1c8e774d59 | add pygithub.login_github() | codekit/pygithub.py | codekit/pygithub.py | Python | 0.000001 | @@ -0,0 +1,850 @@
+%22%22%22%0Apygithub based functions intended to replace the github3.py based functions in%0Acodetools.%0A%22%22%22%0A%0Aimport logging%0Afrom public import public%0Afrom github import Github%0Aimport codekit.codetools as codetools%0A%0Alogging.basicConfig()%0Alogger = logging.getLogger('codekit')%0A... | |
b68c8eab696f5950c4cd528bf60506469c97d08a | Create fixer.py | fixer.py | fixer.py | Python | 0.000001 | @@ -0,0 +1,2839 @@
+from datetime import datetime%0Afrom typing import List, TypeVar%0A%0Aimport requests%0A%0ABASE_URL = 'https://api.fixer.io/'%0ACURRENCY_CHOICE = %5B%22EUR%22, %22AUD%22, %22BGN%22, %22BRL%22, %22CAD%22, %22CHF%22, %22CNY%22, %22CZK%22,%0A %22DKK%22, %22GBP%22, %22HKD%22, %22HRK%22... | |
16ec8043799c7aac029c5528f1c00f96070434d4 | Move build view names function to utils | foundry/utils.py | foundry/utils.py | Python | 0 | @@ -0,0 +1,1139 @@
+from django.conf import settings%0A%0A%0Adef _build_view_names_recurse(url_patterns=None):%0A %22%22%22%0A Returns a tuple of url pattern names suitable for use as field choices%0A %22%22%22%0A if not url_patterns:%0A urlconf = settings.ROOT_URLCONF%0A url_patterns = __impo... | |
f13045b5f933078225b89405a786c14da34d0af5 | Add ClamAV script to analyze HTTPS traffic for viruses | scripts/clamav.py | scripts/clamav.py | Python | 0 | @@ -0,0 +1,1087 @@
+import pyclamd%0Afrom libmproxy.flow import decoded%0A%0A#http://www.eicar.org/85-0-Download.html%0A%0Aclamd = pyclamd.ClamdUnixSocket()%0Atry:%0A # test if server is reachable%0A clamd.ping()%0Aexcept AttributeError, pyclamd.ConnectionError:%0A # if failed, test for network socket%0A cl... | |
805b393c51d9fa82f0dd28aa502378dfcf80924b | Add a binary demo. | reggie/demos/binary.py | reggie/demos/binary.py | Python | 0 | @@ -0,0 +1,1452 @@
+import os%0Aimport numpy as np%0Aimport mwhutils.plotting as mp%0Aimport mwhutils.grid as mg%0A%0Aimport reggie as rg%0A%0A%0Aif __name__ == '__main__':%0A cdir = os.path.abspath(os.path.dirname(__file__))%0A data = np.load(os.path.join(cdir, 'xy.npz'))%0A%0A # create the GP and optimize th... | |
def9592885ab4093973e8547de5deac3b7022515 | Create MaxSubarray_003.py | leetcode/053-Maximum-Subarray/MaxSubarray_003.py | leetcode/053-Maximum-Subarray/MaxSubarray_003.py | Python | 0.000053 | @@ -0,0 +1,275 @@
+class Solution:%0A # @param %7Binteger%5B%5D%7D nums%0A # @return %7Binteger%7D%0A def maxSubArray(self, nums):%0A res, tmp = nums%5B0%5D, nums%5B0%5D%0A for i in range(1, len(nums)):%0A tmp = max(tmp + nums%5Bi%5D, nums%5Bi%5D)%0A res = max(res, tmp)%0A%0... | |
67300787f1f910065a88396f99f0d4dd25bec2d1 | apply monkeypatch | buildbot.tac | buildbot.tac | import os
from twisted.application import service
from buildbot.master import BuildMaster
basedir = '.'
rotateLength = 10000000
maxRotatedFiles = 10
configfile = 'master.cfg'
# Default umask for server
umask = None
# if this is a relocatable tac file, get the directory containing the TAC
if basedir == '.':
impo... | Python | 0.000001 | @@ -4,16 +4,71 @@
ort os%0A%0A
+from monkeypatch import apply_patches%0Aapply_patches()%0A%0A
from twi
|
8078bdd4c239770860ab05c2b10a919455ea84f3 | Correct return value from track_info | mycroft/skills/playback_control/__init__.py | mycroft/skills/playback_control/__init__.py | import sys
from os.path import dirname, abspath, basename
from mycroft.skills.media import MediaSkill
from adapt.intent import IntentBuilder
from mycroft.messagebus.message import Message
from mycroft.configuration import ConfigurationManager
import subprocess
import time
import requests
from os.path import dirname... | Python | 0.000001 | @@ -5276,321 +5276,14 @@
-if self.current:%0A track_info = self.current.track_info()%0A if track_info is not None:%0A data = %7B'current_track': track_info%5B'name'%5D,%0A 'artist': track_info%5B'album'%5D%7D%0A self.speak_dialog('currentl... |
e85bab14ab8058ba14d1f73dd2d47d8c38318c48 | Add db_sqlite.py | db_sqlite.py | db_sqlite.py | Python | 0.000019 | @@ -0,0 +1,14 @@
+import sqlite3
| |
266a3a3ddb99afc6fa696bdd2b7d3dc770b921ea | Add enroller talking to redis | spanky/lib/enroll.py | spanky/lib/enroll.py | Python | 0 | @@ -0,0 +1,582 @@
+import redis%0A%0A%0Aclass Enroller(object):%0A%0A def __init__(self, config):%0A self.config = config%0A%0A @property%0A def conn(self):%0A if not hasattr(self, '_conn'):%0A self._conn = redis.StrictRedis(host='localhost', port=6379, db=0)%0A return self._con... | |
95ceeb0af4e549e0d211b4e1ba6157d26ad5e44d | Fix race between MQ and mongo setting QueuedAt | sync_scheduler.py | sync_scheduler.py | from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
from datetime import datetime
from pymongo.read_preferences import ReadPreference
import kombu
import time
Sync.InitializeWorkerBindings()
producer = kombu.Producer(Sync._channel, Sync._exchange)
while True:
queuein... | Python | 0.000001 | @@ -200,16 +200,71 @@
ort time
+%0Afrom tapiriik.settings import MONGO_FULL_WRITE_CONCERN
%0A%0ASync.I
@@ -630,12 +630,200 @@
s =
-set(
+%5Bx%5B%22_id%22%5D for x in users%5D%0A%09db.users.update(%7B%22_id%22: %7B%22$in%22: scheduled_ids%7D%7D, %7B%22$set%22: %7B%22QueuedAt%22: queueing_at%7D, %22$unset%22: %7B%22N... |
e532a4a5ba6706974dc1245b269f18fa0e82cb66 | Create duplicates.py | module/duplicates.py | module/duplicates.py | Python | 0.000391 | @@ -0,0 +1,185 @@
+import os%0Aimport sys%0A%0A%0Adef search(dir)%0A for root, subdirs, files in os.walk(dir):%0A print('Dir(%25s)' %25 root)%0A%0A for filename in files:%0A print('- File(%25s)' %25 r)%0A
| |
c8271b02c3636aa9620cce8b85c823ff0ec35c4a | Add a mobile device test of the Skype website | examples/test_skype_site.py | examples/test_skype_site.py | Python | 0.000001 | @@ -0,0 +1,1526 @@
+%22%22%22%0AThis is a mobile device test for Chromium-based browsers (such as MS Edge)%0AUsage: pytest test_skype_site.py --mobile --browser=edge%0A%0ADefault mobile settings for User Agent and Device Metrics if not specifed:%0A User Agent: --agent=%22Mozilla/5.0 (Linux; Android 9; Pixel 3... | |
cd551b16069f2814a0ae8bf5f2e104b09b7f9a90 | Fix feed refresh interval computation. | oneflow/core/tasks/refresh.py | oneflow/core/tasks/refresh.py | # -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License... | Python | 0 | @@ -3473,16 +3473,460 @@
', feed)
+%0A if feed.fetch_interval %3E 86399:%0A interval_days = feed.fetch_interval / 86400%0A interval_seconds = feed.fetch_interval - (%0A interval_days * 86400)%0A%0A interval = timedelta(days=... |
ea54e294d68962ec370dc1dc2381720f53ce6f01 | Add local_settings.py stuff | voiexp/local_settings_example.py | voiexp/local_settings_example.py | Python | 0.000001 | @@ -0,0 +1,250 @@
+SECRET_KEY = '.uadjgfi67&%25%E2%82%ACyuhgsdfakjhgayv&/%25yugjhdfsc$y53'%0A%0A# SECURITY WARNING: don't run with debug turned on in production!%0ADEBUG = False%0A%0AALLOWED_HOSTS = %5B'127.0.0.1', 'some.example.com', %5D%0A%0ALANGUAGE_CODE = 'fi-fi'%0ATIME_ZONE = 'Europe/Helsinki'%0A%0A
| |
8daf4237aa84a6b032e7627afb31b29a44f47ddc | Add another .py file for progress bar | ProgressBar.py | ProgressBar.py | Python | 0.000001 | @@ -0,0 +1,2456 @@
+import sys, time%0D%0Afrom CmdFormat import CmdFormat%0D%0A%0D%0Aclass ProgressBar(CmdFormat):%0D%0A def __init__(self, count = 0, total = 0, width = 80, bWithheader=True, bWithPercent=True,barColor='white'):%0D%0A super(CmdFormat, self).__init__()%0D%0A self.count = count%0D%0A ... | |
5e3b2ca14c4cc421e47d2709fe52390ee51eee11 | Create S3toSQS.py | SQS/S3toSQS.py | SQS/S3toSQS.py | Python | 0.000001 | @@ -0,0 +1,2918 @@
+%22%22%22%0ACopyright 2016 Nicholas Christian%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License.%0AYou may obtain a copy of the License at%0A http://www.apache.org/licenses/LICENSE-2.0%0AUnless required by appli... | |
f0e733a3f62d37dc25d70b334dd3e1e46936477d | Add missing non-important migration | homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py | homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py | Python | 0.003209 | @@ -0,0 +1,610 @@
+# -*- 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 ('info_transportation', '0015_line_type'),%0A %5D%0A%0A operations = %5B%0A migrations.Alte... | |
468a4c181768f0dcfcaa40201c26015b7c94e39e | add random gesture test | home/moz4r/Test/random.py | home/moz4r/Test/random.py | Python | 0 | @@ -0,0 +1,900 @@
+%EF%BB%BFimport random%0Afrom time import sleep%0A%0Ai01 = Runtime.createAndStart(%22i01%22, %22InMoov%22)%0Ai01.startHead(%22COM3%22)%0A%0Asleep(1)%0A%0A%0Adef MoveHeadRandomize():%0A%09if IcanMoveHeadRandom==1:%0A%09%09i01.moveHead(random.randint(50,130),random.randint(50,130))%0A%09%09%0A%0AMoveHe... | |
bb63af8be9abf1bcc8f3716bbd1a1a375685533f | Add a new feed bot, abusehelper.contrib.abusech.feodoccbot, for catching abuse.ch's Feodo Tracker RSS feed. | abusehelper/contrib/abusech/feodoccbot.py | abusehelper/contrib/abusech/feodoccbot.py | Python | 0 | @@ -0,0 +1,861 @@
+from abusehelper.core import bot%0A%0Afrom . import host_or_ip, split_description, AbuseCHFeedBot%0A%0A%0Aclass FeodoCcBot(AbuseCHFeedBot):%0A feed_type = %22c&c%22%0A%0A feeds = bot.ListParam(default=%5B%22https://feodotracker.abuse.ch/feodotracker.rss%22%5D)%0A%0A # The timestamp in the ti... | |
e3d1c0d76db56689f9654c85e63f24c352c88a01 | Use consistent modname calculation. | fedmsg/commands/collectd.py | fedmsg/commands/collectd.py | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | Python | 0 | @@ -1796,44 +1796,114 @@
-modname = msg%5B'topic'%5D.split('.')%5B3%5D
+processor = fedmsg.meta.msg2processor(msg, **self.hub.config)%0A modname = processor.__name__.lower()
%0A
|
94c125925b61a57bd29e9265dc993e1d868f2b7f | Create Selenium_Google.py | Selenium_Google.py | Selenium_Google.py | Python | 0 | @@ -0,0 +1,479 @@
+__author__ = 'Christie'%0A#%0Afrom selenium import webdriver%0Afrom selenium.webdriver.common.keys import Keys%0A%0Abrowser = webdriver.Firefox()%0A%0Abrowser.get('http://www.google.com')%0Aassert 'Google' in browser.title%0A%0A#browser.get('http://www.yahoo.com')%0A#assert 'Yahoo' in browser.title%0... | |
b00ae10f9ad841131ead33aa690587b7e2c50976 | Add fetch recipe for fletch | recipes/fletch.py | recipes/fletch.py | Python | 0.000016 | @@ -0,0 +1,1057 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Aimport sys%0A%0Aimport recipe_util # pylint: disable=F0401%0A%0A# This class doesn't need an __init__ method, so we disable the ... | |
76c25395590aa9dee64ca138633f01b62ac0d26b | Add new provider migration for osf registrations | providers/io/osf/registrations/migrations/0001_initial.py | providers/io/osf/registrations/migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,685 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-07-08 16:17%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport share.robot%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('share', '0001_initial'),%0A ('dj... | |
81391212d0e0cecfbce14195e1ca8cd1d96a6671 | Create Euler_2.py | Euler_2.py | Euler_2.py | Python | 0.002755 | @@ -0,0 +1,172 @@
+fib = 1%0Afib2 = 2%0Atemp = 0%0Atotal = 0%0A%0Awhile temp %3C= 4000000:%0A temp = fib2%0A if temp %25 2 == 0:%0A total += temp%0A temp = fib + fib2%0A fib = fib2%0A fib2 = temp%0Aprint(total)%0A
| |
2c115a1b437aa36b42f74c04136601d9362dd5f6 | add cutflow | rootpy/tree/cutflow.py | rootpy/tree/cutflow.py | Python | 0.000002 | @@ -0,0 +1,415 @@
+import struct%0A%0Aclass Cutflow(object):%0A%0A def __init__(self, names):%0A %0A self.__names = names%0A self.__dict = dict((name, '0') for name in names)%0A%0A def __setitem__(self, item, value):%0A%0A self.__dict%5Bitem%5D = str(int(bool(value)))%0A %0A def bits... | |
a5b2db02926573ec1bc338d611af9f0ca363b237 | add convoluving response function | convoluving_response.py | convoluving_response.py | Python | 0.00001 | @@ -0,0 +1,1103 @@
+import numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport scipy.stats%0Afrom scipy.stats import gamma%0Afrom stimuli import events2neural%0A%0Adef hrf(times):%0A %22%22%22 Return values for HRF at given times %22%22%22%0A # Gamma pdf for the peak%0A peak_values = gamma.pdf(times, 6)%0A ... | |
7a91235b1d6ed45a5452c455dd86797bbf092d17 | Update S3Session.py | mongodb_consistent_backup/Upload/S3/S3Session.py | mongodb_consistent_backup/Upload/S3/S3Session.py | import logging
from boto import config
from boto.s3 import S3Connection
class S3Session:
def __init__(self, access_key, secret_key, s3_host='s3.amazonaws.com', secure=True, num_retries=5, socket_timeout=15):
self.access_key = access_key
self.secret_key = secret_key
self.s3_host ... | Python | 0.000001 | @@ -13,64 +13,34 @@
ng%0A%0A
-from boto import config%0Afrom boto.s3 import S3Connection
+import boto%0Aimport boto.s3
%0A%0A%0Ac
@@ -446,16 +446,21 @@
tion in
+boto.
config.s
@@ -478,24 +478,29 @@
+boto.
config.remov
@@ -522,24 +522,29 @@
on)%0A
+boto.
config.add_s
@@ -558,32 +558,37 @@
... |
7c755e7839f7c602a6c93b1aa2f5011e89d15c85 | Create command for generating prices for flavors | nodeconductor/iaas/management/commands/addmissingpricelistflavors.py | nodeconductor/iaas/management/commands/addmissingpricelistflavors.py | Python | 0 | @@ -0,0 +1,1057 @@
+from __future__ import unicode_literals%0A%0Afrom django.contrib.contenttypes.models import ContentType%0Afrom django.core.management.base import BaseCommand%0A%0Afrom nodeconductor.cost_tracking.models import DefaultPriceListItem%0Afrom nodeconductor.iaas.models import Flavor, Instance%0A%0A%0Aclas... | |
2616d8f3ef51a8551ac14a9e83b0298b8165093a | Add work-in-progress script to fixup a standalone plugin library. | Superbuild/Projects/apple/fixup_plugin2.py | Superbuild/Projects/apple/fixup_plugin2.py | Python | 0 | @@ -0,0 +1,1918 @@
+#!/usr/bin/env python%0A%0Aimport subprocess%0Aimport os%0A%0Aplugin = 'libVelodyneHDLPlugin.dylib'%0AparaviewBuildDir = '/source/paraview/build'%0A%0Anameprefix = '@executable_path/../Libraries/'%0Aprefix = '@executable_path/../Libraries/'%0A%0A# The official ParaView OSX binaries are built with hd... | |
735135c5570edd38324fe3e94aa2f4c2f3043627 | Migrate data from contact_for_research_via and into contact_for_research_methods many to many field | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | Python | 0.000002 | @@ -0,0 +1,1153 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Afrom django.db.models import Q%0A%0A%0Adef migrate_contact_for_research_via_field_data(apps, schema_editor):%0A ContactResearchMethod = apps.get_model(%22legalaid%22, %22ContactResearchMethod... | |
59ac9745064dd02903e35c1c51781505bad505df | add gunicorn config | gunicorn.conf.py | gunicorn.conf.py | Python | 0.000001 | @@ -0,0 +1,89 @@
+%0A%0Abind = %22unix:/tmp/mygpo.sock%22%0Aworkers = 2%0Aworker_class = %22gevent%22%0Amax_requests = 10000%0A
| |
830a41911c5a2bc3982f35a6c6da38f6c659e78b | Create /pypardot/objects/tests/__init__.py | pypardot/objects/tests/__init__.py | pypardot/objects/tests/__init__.py | Python | 0.000005 | @@ -0,0 +1 @@
+%0A
| |
f740dd60e7a4493269679e469c7f1ee5e24ff5af | add build/errors file | conary/build/errors.py | conary/build/errors.py | Python | 0.000001 | @@ -0,0 +1,326 @@
+%0Aclass BuildError(Exception):%0A def __init__(self, msg):%0A self.msg = msg%0A%0A def __repr__(self):%0A%09return self.msg%0A%0A def __str__(self):%0A%09return repr(self)%0A %0Aclass RecipeFileError(BuildError):%0A pass%0A%0A%0Aclass RecipeDependencyError(RecipeFileError):%0A ... | |
18f385de7b287a932192f690cb74ff70a452cf47 | test settings file | fpurlfield/test_settings.py | fpurlfield/test_settings.py | Python | 0.000001 | @@ -0,0 +1,1298 @@
+# Django settings for test_project project.%0A%0ADEBUG = True%0ATEMPLATE_DEBUG = DEBUG%0AADMINS = ()%0AMANAGERS = ADMINS%0A%0ADATABASES = %7B%0A 'default': %7B%0A 'ENGINE': 'django.db.backends.sqlite3',%0A 'NAME': ':memory:',%0A %7D,%0A%7D%0A%0A# TIME_ZONE = 'America/Chicago'%0A#... | |
6ade5da25f8f265611f5b959f4e763ae3f070155 | Add support CentOS 6.4 | python/lib/cloudutils/utilities.py | python/lib/cloudutils/utilities.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 0 | @@ -3815,53 +3815,8 @@
e 6.
-2%22) != -1 or version.find(%22CentOS release 6.3
%22) !
|
62c85cf12b388411919b86ac498908336bfd5e12 | Create password_checker.py | Challenge-172/02-Intermediate-2/password_checker.py | Challenge-172/02-Intermediate-2/password_checker.py | Python | 0.000267 | @@ -0,0 +1,301 @@
+#!/usr/bin/python%0Aimport hashlib%0Aimport uuid%0A%0Apassword = 'test123' %0A%0Af = open('salt.txt')%0Asalt = f.read()%0Af.close()%0A%0Af = open('encrypted.txt')%0Ahashed_password = f.read()%0Af.close()%0A%0Aif hashlib.sha512(password + salt).hexdigest() == hashed_password:%0A%09print 'ACCESS GRANTE... | |
6507cc1dc85ffb7b26b89cc2dc1fce057fefc554 | Fix #8960 - Decora Wi-Fi Switch unable to set brightness (#8989) | homeassistant/components/light/decora_wifi.py | homeassistant/components/light/decora_wifi.py | """
Interfaces with the myLeviton API for Decora Smart WiFi products.
See:
http://www.leviton.com/en/products/lighting-controls/decora-smart-with-wifi
Uses Leviton's cloud services API for cloud-to-cloud integration.
"""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR... | Python | 0 | @@ -3639,24 +3639,29 @@
elf._switch.
+data.
get('minLeve
@@ -3704,16 +3704,21 @@
_switch.
+data.
get('max
|
446984ad7b102587beac03d4329b5d0c061e2095 | Add preserve_{current_canvas,batch_state} and invisible_canvas context managers | rootpy/context.py | rootpy/context.py | Python | 0.000004 | @@ -0,0 +1,1358 @@
+from contextlib import contextmanager%0A%0Aimport ROOT%0A%0A@contextmanager%0Adef preserve_current_canvas():%0A %22%22%22%0A Context manager which ensures that the current canvas remains the current%0A canvas when the context is left.%0A %22%22%22%0A %0A old = ROOT.gPad.func()%0A ... | |
7cb77ef66cad41e1b5d4907272b899a24a689c2d | Test for #423 | test/algorithms/refinement/tst_dials-423.py | test/algorithms/refinement/tst_dials-423.py | Python | 0 | @@ -0,0 +1,2441 @@
+#!/usr/bin/env cctbx.python%0A%0A#%0A# Copyright (C) (2017) STFC Rutherford Appleton Laboratory, UK.%0A#%0A# Author: David Waterman.%0A#%0A# This code is distributed under the BSD license, a copy of which is%0A# included in the root directory of this package.%0A#%0A%0A%22%22%22 Test the situatio... | |
32fcd5393402d868d8741385705f58b9e8eb7703 | Update __init__.py | mycroft/version/__init__.py | mycroft/version/__init__.py | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | Python | 0.000072 | @@ -980,17 +980,17 @@
UILD = 1
-0
+1
%0A# END_V
|
9cb122793d531690b621b4fa8f91481a105305e3 | Add new module: minion.list | salt/modules/minion.py | salt/modules/minion.py | Python | 0.000004 | @@ -0,0 +1,2417 @@
+# -*- coding: utf-8 -*-%0A'''%0AModule to provide information about minions%0A'''%0A%0A# Import Python libs%0Aimport os%0A%0A# Import Salt libs%0Aimport salt.utils%0Aimport salt.key%0A%0A%0Adef list():%0A '''%0A Return a list of accepted, denied, unaccepted and rejected keys.%0A This is the... | |
91645e4abf4fa128a59257584ba385c19b642425 | Add @s0undtech's nb_open module | salt/utils/nb_popen.py | salt/utils/nb_popen.py | Python | 0 | @@ -0,0 +1,3166 @@
+# -*- coding: utf-8 -*-%0A'''%0A saltcloud.utils.nb_popen%0A ~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A Non blocking subprocess Popen.%0A%0A :codeauthor: :email:%60Pedro Algarvio (pedro@algarvio.me)%60%0A :copyright: %C2%A9 2013 by the SaltStack Team, see AUTHORS for more details.%0A :license:... | |
f6e32ae48265232f25866dd9060b7cb80551e333 | Create main.py | main.py | main.py | Python | 0.000347 | @@ -0,0 +1,1636 @@
+%0Adef calcProbPos(bPlus,bMinus,cPlus,cMinus):%0A probPos = ((bPlus/cPlus)*(cPlus/(cPlus+cMinus)))/((bPlus+bMinus)/(cPlus+cMinus))%0A return probPos%0A %0Adef calcMean(t,i):%0A m = t/i%0A return m%0A%0Aprint('Enter a statement without punctuation:')%0AuserStatement = input().l... | |
87a9769af3d201b925a5a4a259ccbd007257b1d3 | add python test: read_pack.py | test/read_pack.py | test/read_pack.py | Python | 0.00414 | @@ -0,0 +1,133 @@
+import os%0Aimport msgpack%0A%0Af = open(%22/tmp/data.bin%22, %22r%22)%0Apackage = f.read(1024)%0Af.close()%0A%0Adata = msgpack.unpackb(package)%0Aprint data
| |
3912416390ebe5df3c883b280cc6acac5169c1f7 | Add test to check if elements have at least one owner | tests/test_elements_have_owner.py | tests/test_elements_have_owner.py | Python | 0 | @@ -0,0 +1,1788 @@
+%22%22%22%0AFor all relevant model elements, check if there is at least one %22owner%22%0A(%22owner%22 is a derived union).%0A%0AThis is needed to display all elements in the tree view.%0A%22%22%22%0A%0Aimport itertools%0A%0Aimport pytest%0A%0Aimport gaphor.SysML.diagramitems%0Aimport gaphor.UML.dia... | |
5307d1cf69c943f7f5fe9dfd475c93f317e8ebb7 | add import script for West Lancashire | polling_stations/apps/data_collection/management/commands/import_west_lancashire.py | polling_stations/apps/data_collection/management/commands/import_west_lancashire.py | Python | 0 | @@ -0,0 +1,434 @@
+from data_collection.management.commands import BaseXpressWebLookupCsvImporter%0A%0Aclass Command(BaseXpressWebLookupCsvImporter):%0A council_id = 'E07000127'%0A addresses_name = 'West Lancashire - PropertyPostCodePollingStationWebLookup-2017-03-08.TSV'%0A stations_name = 'West Lanca... | |
93997e72f63dd586d1a683475f49a466571a9fb0 | Create index.py | index.py | index.py | Python | 0.000016 | @@ -0,0 +1,43 @@
+#!/usr/bin/python %0Aprint(%22Hello, World!%22);%0A
| |
4a48b8dd804f9a287d35b697d851a660eec80a75 | Add tests for simple enums | tests/richenum/test_simple_enums.py | tests/richenum/test_simple_enums.py | Python | 0 | @@ -0,0 +1,1236 @@
+import unittest%0Afrom richenum import EnumConstructionException, enum%0A%0A%0ABreakfast = enum(%0A COFFEE=0,%0A OATMEAL=1,%0A FRUIT=2)%0A%0A%0Aclass SimpleEnumTestSuite(unittest.TestCase):%0A%0A def test_members_are_accessible_through_attributes(self):%0A self.assertEqual(Breakfa... | |
92075a04b0835b1209eaa806c2aeb44ca371ff2b | Add harfbuzz 0.9.40 | packages/harfbuzz.py | packages/harfbuzz.py | Python | 0 | @@ -0,0 +1,285 @@
+Package ('harfbuzz', '0.9.40',%0A%09sources = %5B'http://www.freedesktop.org/software/%25%7Bname%7D/release/%25%7Bname%7D-%25%7Bversion%7D.tar.bz2'%5D,%0A%09configure_flags = %5B%0A%09%09'--disable-silent-rules',%0A%09%09'--without-cairo',%0A%09%09'--without-freetype',%0A%09%09'--without-glib',%0A%09... | |
564bf6484347fed1d3346ff42d79e4bba02a3c98 | add firs test | test_add_group.py | test_add_group.py | Python | 0.999776 | @@ -0,0 +1,2250 @@
+# -*- coding: utf-8 -*-%0Afrom selenium.webdriver.firefox.webdriver import WebDriver%0Afrom selenium.webdriver.common.action_chains import ActionChains%0Aimport time, unittest%0A%0Adef is_alert_present(wd):%0A try:%0A wd.switch_to_alert().text%0A return True%0A except:%0A ... | |
774b59a2bba95c4b617ac49e279bcbe73d6b6f3b | Add a script to plot timing data | profiling/plot.py | profiling/plot.py | Python | 0.000002 | @@ -0,0 +1,597 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport glob%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0A%0Acsv_files = glob.glob('*.csv')%0A%0Afig = plt.figure()%0Aax = fig.add_subplot(111)%0A%0Acolors = iter(plt.cm.rainbow(np.linspace(0,1,len(csv_files))))%0A%0Afor csv_file ... | |
e4cc622b6c296f57324eccba2b1ed3ff2201868d | Reverse a singly linked list | python/interviewquestions/reverse_linked_list.py | python/interviewquestions/reverse_linked_list.py | Python | 0.999671 | @@ -0,0 +1,1154 @@
+%22%22%22%0AGiven a singly linked list, reverse it in place and return the head%0Aof the new list.%0A%22%22%22%0A%0Aimport unittest%0A%0Aclass Node(object):%0A def __init__(self, value):%0A self.value = value%0A self.next = None%0A%0A def __repr__(self):%0A return %22%3CN... | |
48c4a4fe9531123d6ca2b9af18162c916af09cc9 | Create moto_parser.py | Bootloader/moto_parser.py | Bootloader/moto_parser.py | Python | 0.000054 | @@ -0,0 +1 @@
+%0A
| |
13fdc81cb32842dc5e0f05d2aa84c997cd59daa3 | Add test that, if we failed to open the log file, we don't try to write to it. | IPython/core/tests/test_logger.py | IPython/core/tests/test_logger.py | Python | 0 | @@ -0,0 +1,517 @@
+%22%22%22Test IPython.core.logger%22%22%22%0A%0Aimport nose.tools as nt%0A%0A_ip = get_ipython()%0A%0Adef test_logstart_inaccessible_file():%0A try:%0A _ip.logger.logstart(logfname=%22/%22) # Opening that filename will fail.%0A except IOError:%0A pass%0A else:%0A nt.as... | |
a8b3af76c1a6cbf61887f5721fd10bf2ef24b2f8 | Create A_Salinity_vertical_section_zy_movie.py | Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py | Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py | Python | 0.000574 | @@ -0,0 +1,782 @@
+ %0A %0A %0A %0A %0A %0A %0A %0A %0A plt.figure(2)%0A ax = plt.subplot(projection=ccrs.PlateCarree());%0A ds1%5B'S'%5D.where(ds1.hFacC%3E0)%5Bnt,:,:,280%5D.plot()%0A plt.title('Vertical Section (yz) of Salinity (XC = 0E)')%0A plt.text(5,5,nt,ha='center',wrap=True)%0A ax.coastlines()%0A... | |
76e412121b80c39d9facc09a51d9b8aa4cdb9722 | Add Check timeouts functionality | OAB/oab_check_timeouts.py | OAB/oab_check_timeouts.py | Python | 0.000001 | @@ -0,0 +1,2732 @@
+#!/usr/bin/python%0A%0Aimport argparse%0Aimport pycurl%0Aimport re%0Aimport csv%0Afrom StringIO import StringIO%0Afrom urllib import urlencode%0Afrom sys import exit%0A%0A# Arguments handling%0A%0A# Setting output filenames%0Ainputfile = %22lalala_nok.csv%22%0Afilename_ok = %22output_ok.csv%22%0Afil... | |
a1337ca14fe2f21c849bd27132bdee079ac47e59 | Add Session Support | app/Session.py | app/Session.py | Python | 0 | @@ -0,0 +1,1700 @@
+#!/usr/bin/python%0A# -*- coding:utf-8 -*-%0A# Powered By KK Studio%0A# Session Support For Tornado%0A%0Aimport hashlib%0Aimport os%0Aimport time%0Aimport json%0A%0A%0Aclass Session:%0A%0A%0A def __init__(self,prefix='',session_id=None,expires=7200,redis=None):%0A self.redis = redis%0A ... | |
f9f5d2b040618bc7d7c26383218fad390bf9dd0a | add unit test_connection_detail_retriever | tests/test_common/test_cloudshell/test_connection_detail_retriever.py | tests/test_common/test_cloudshell/test_connection_detail_retriever.py | Python | 0.000002 | @@ -0,0 +1,1060 @@
+from unittest import TestCase%0A%0Afrom mock import Mock%0A%0Afrom common.cloudshell.conn_details_retriever import ResourceConnectionDetailsRetriever%0A%0A%0Aclass TestConnectionDetailRetriever(TestCase):%0A def test_connection_detail_retriever(self):%0A helpers = Mock()%0A cs_retri... | |
c5a6bfdca30a5111e641ebe4b2eac40b21b8ce74 | FIx CPU time consuming in green_poller poll() | oslo_messaging/_drivers/zmq_driver/poller/green_poller.py | oslo_messaging/_drivers/zmq_driver/poller/green_poller.py | # Copyright 2015 Mirantis, Inc.
#
# 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 or ... | Python | 0.000071 | @@ -656,76 +656,8 @@
let%0A
-import six%0A%0Afrom oslo_messaging._drivers import common as rpc_common
%0Afro
@@ -844,32 +844,36 @@
queue =
-six.moves
+eventlet
.queue.
+Light
Queue()%0A
@@ -1533,368 +1533,108 @@
-incoming = None%0A try:%0A with eventlet.Timeout(timeout, exception=rpc_commo... |
f5675a1cebfe6aa0f8dda3b94aa30139e2528c49 | Create broadcast.py | plugins/broadcast.py | plugins/broadcast.py | Python | 0.000001 | @@ -0,0 +1,530 @@
+@bot.message_handler(commands=%5B'bc'%5D)%0Adef bc_msg(message):%0A if message.from_user.id in ADMINS_IDS:%0A if len(message.text.split()) %3C 2:%0A bot.reply_to(message, %22What should I broadcast?%22)%0A return%0A bcmsg = message.text.replace(%22/bc %22,%22%22)%0A allmembers = l... | |
d34d1d50b853d3a205cbc60a75dd3911a9253b4e | update backend | app/scraper.py | app/scraper.py | Python | 0.000001 | @@ -0,0 +1,1116 @@
+import collections%0Aimport json%0Aimport httplib2%0Afrom oauth2client.client import GoogleCredentials%0A%0Afrom lib import Term%0A%0Adef get_http():%0A http = httplib2.Http()%0A GoogleCredentials.get_application_default().create_scoped(%5B%0A 'https://www.googleapis.com/auth/firebase.d... | |
620401abdb33b335452df709a1a1f2c4bc55cd4c | Add challenge day 6 | leetcode/challenge/day06.py | leetcode/challenge/day06.py | Python | 0.000003 | @@ -0,0 +1,626 @@
+%22%22%22%0D%0AGiven an array of strings, group anagrams together.%0D%0A%0D%0AExample:%0D%0A%0D%0AInput: %5B%22eat%22, %22tea%22, %22tan%22, %22ate%22, %22nat%22, %22bat%22%5D,%0D%0AOutput:%0D%0A%5B%0D%0A %5B%22ate%22,%22eat%22,%22tea%22%5D,%0D%0A %5B%22nat%22,%22tan%22%5D,%0D%0A %5B%22bat%22%5D%0... | |
7af8cc6d59a1d52e7decc90ecb9472f1c5825aa3 | Create ds_hash_two_sum.py | leetcode/ds_hash_two_sum.py | leetcode/ds_hash_two_sum.py | Python | 0.000169 | @@ -0,0 +1,731 @@
+# @file Two Sum%0A# @brief Given an array and target, find 2 nums in array that sum to target%0A%0A# https://leetcode.com/problems/two-sum/%0A%0A'''%0AGiven an array of integers, return indices of the two numbers such that they%0Aadd up to a specific target.%0AYou may assume that each input would ha... | |
6a84ed3872303aa5b05462982406749d7bd447d4 | Create main.py | main.py | main.py | Python | 0 | @@ -0,0 +1,892 @@
+#!/usr/bin/env python%0A# Command line script to convert a single given number to and from several units%0A%0Aimport argparse%0Afrom src.convert import kilometers_to_miles, miles_to_kilometers, %5C%0Ayears_to__minutes, minutes_to_years%0A%0A#parse args%0Aparse = argparse.ArgumentParser()%0Aparse.add_... | |
7629a1cd27c80c5ebff91c4d01bf648f9d4c9b3c | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
dbb147018a92426c5c9e19a523e0bd8d4c277035 | Create LED_GPIO.py | setup/gpio/LED_GPIO.py | setup/gpio/LED_GPIO.py | Python | 0.000001 | @@ -0,0 +1,461 @@
+%0A%0Aimport time%0Aimport lgpio%0A%0A#17,27,22%0A%0ALED = 17%0A%0A# open the gpio chip and set the LED pin as output%0Ah = lgpio.gpiochip_open(0)%0Algpio.gpio_claim_output(h, LED)%0A%0Atry:%0A while True:%0A # Turn the GPIO pin on%0A lgpio.gpio_write(h, LED, 1)%0A time.sleep(... | |
d856ea5597230b3befeb03049c45f3706bec5844 | add kael-crontab cli | kael/cron/cli.py | kael/cron/cli.py | Python | 0.000003 | @@ -0,0 +1,811 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0A@version:%0A@author:%0A@time: 2017/6/15%0A%22%22%22%0Aimport os%0A%0Aimport click%0A%0A%0A@click.group()%0Adef cli():%0A pass%0A%0A%0Adef _check_task_is_py(command):%0A command = command.strip()%0A head = command.split(' ')%5B0%5D... | |
599ed110458d5bcf23b74a95c5c472cc376ed702 | Create field_notes.py | djspace/application/field_notes.py | djspace/application/field_notes.py | Python | 0.000001 | @@ -0,0 +1,51 @@
+# adding all the fields we need for this form..%0A# %0A
| |
f4b0135a48ee94d8504ddf24dcc16b8036c05f2c | add test file | tests/app_test.py | tests/app_test.py | Python | 0.000001 | @@ -0,0 +1,437 @@
+import os%0Aimport app%0Aimport unittest%0Aimport tempfile%0A%0Aclass FlaskrTestCase(unittest.TestCase):%0A%0A def setUp(self):%0A self.db_fd, app.app.config%5B'DATABASE'%5D = tempfile.mkstemp()%0A app.app.config%5B'TESTING'%5D = True%0A self.app = app.app.test_client()%0A ... | |
27ab639a4a48c263a6ba2f53030d65136580bdb4 | Remove useless constant. | astm/client.py | astm/client.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
import socket
import time
from .asynclib import loop
from .codec import encode_message
f... | Python | 0.000002 | @@ -1886,10 +1886,8 @@
mpts
-=3
):%0A
|
5b83b5e9a4e07af3f3dcd37d4f613039a42336e3 | Add salt.modules.container_resource | salt/modules/container_resource.py | salt/modules/container_resource.py | Python | 0.000042 | @@ -0,0 +1,3323 @@
+# -*- coding: utf-8 -*-%0A'''%0ACommon resources for LXC and systemd-nspawn containers%0A%0AThese functions are not designed to be called directly, but instead from the%0A:mod:%60lxc %3Csalt.modules.lxc%3E%60 and the (future) :mod:%60nspawn%0A%3Csalt.modules.nspawn%3E%60 execution modules.%0A'''%0A%... | |
8c2b90d4d2c9fc8ad759284719eab4dd346ccab2 | Add tests | test.py | test.py | Python | 0.000001 | @@ -0,0 +1,1020 @@
+%22%22%22%0ASimple test of CxoTime. The base Time object is extremely well%0Atested, so this simply confirms that the add-on in CxoTime works.%0A%22%22%22%0A%0Aimport pytest%0Aimport numpy as np%0A%0Afrom cxotime import CxoTime%0A%0Atry:%0A from Chandra.Time import DateTime%0A HAS_DATETIME = ... | |
815ef4b4b0dce640077e1f8ecd2fbe95598bf539 | Create existing comments' owners records | src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py | src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py | Python | 0 | @@ -0,0 +1,1448 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: peter@reciprocitylabs.com%0A# Maintained By: peter@reciprocitylabs.com%0A%0A%22%22%22%0AAdd comments' owners informa... | |
b73c75bbafb53864a86f95949d6a028f9e79f718 | Add Tile class | tile.py | tile.py | Python | 0 | @@ -0,0 +1,149 @@
+from __future__ import division%0A%0Aclass Tile(object):%0A def __init__(self, x, y, z):%0A self.x = x%0A self.y = y%0A self.height = z%0A%0A
| |
9cc26c8a95ab4e6ffa9c991b5a575c7e6d62dae4 | add pytest for util.location | pytests/util/test_location.py | pytests/util/test_location.py | Python | 0 | @@ -0,0 +1,1475 @@
+import pytest%0Aimport json%0A%0Aimport util.location%0A%0A%0A@pytest.fixture%0Adef urllib_req(mocker):%0A util.location.reset()%0A return mocker.patch(%22util.location.urllib.request%22)%0A%0A%0A@pytest.fixture%0Adef primaryLocation():%0A return %7B%0A %22country%22: %22Middle Earth... | |
c9690cabe3c4d1d02307e3594a2cac505f4a166d | Add new image moments functions | photutils/utils/_moments.py | photutils/utils/_moments.py | Python | 0.000002 | @@ -0,0 +1,1707 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst%0Afrom __future__ import (absolute_import, division, print_function,%0A unicode_literals)%0A%0Aimport numpy as np%0A%0Afrom ..centroids import centroid_com%0A%0A%0A__all__ = %5B'_moments_central', '_moments'%5D%0A... | |
6a3c960640741036c3f444547cada1e1b7a24100 | Add first unit test for api | tests/test_api.py | tests/test_api.py | Python | 0 | @@ -0,0 +1,775 @@
+import os%0Aimport sys%0Aimport json%0Aimport responses%0Aimport unittest%0A%0ACWD = os.path.dirname(os.path.abspath(__file__))%0AMS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))%0A%0A# Allow import of api.py%0Aif os.path.join(MS_WD, 'utils') not in sys.path:%0A sys.path.insert(... | |
d0432f1d3d48634c00027b71eb131c5e36827c4b | Add dropdown element located in widget bar | src/lib/constants/element/widget_bar/dropdown.py | src/lib/constants/element/widget_bar/dropdown.py | Python | 0 | @@ -0,0 +1,392 @@
+SELECTOR = %22.inner-nav-item%22%0A%0ACLAUSES = %22Clauses%22%0ACONTRACTS = %22Contracts%22%0ADATA_ASSETS = %22Data Assets%22%0AFACILITIES = %22Facilities%22%0AMARKETS = %22Markets%22%0AORG_GROUPS = %22Org Groups%22%0APOLICIES = %22Policies%22%0APROCESSES = %22Processes%22%0APRODUCTS = %22Products%22... | |
763680e57b28a9746050206cd63450bf11c3e512 | Fix ProgramEditor permissions to not include Program delete | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py | Python | 0 | @@ -0,0 +1,1536 @@
+%0A%22%22%22Fix ProgramEditor permissions%0A%0ARevision ID: 10adeac7b693%0ARevises: 8f33d9bd2043%0ACreate Date: 2013-10-10 00:12:57.391754%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '10adeac7b693'%0Adown_revision = '8f33d9bd2043'%0A%0Aimport json%0Aimport sqlalchemy as... | |
da488fa4505de818a5efcec13fdb7963d5051389 | Create util.py | util.py | util.py | Python | 0.000002 | @@ -0,0 +1,546 @@
+import requests%0Aimport logging%0A%0Adef downloadRedditUrl(url):%0A%09print %22downloadRedditUrl(): Downloading url: %7B%7D%22.format(url)%0A%09#assert url.startswith('https://www.reddit.com/r/learnprogramming/')%0A%09%0A %0A%09headers = %7B%0A %09%09'User-Agent': 'Searching Reddit bot version 1... | |
2beac94eb32fc4adb976c4a10018de8518e4bada | Add wsgi file | wsgi.py | wsgi.py | Python | 0.000001 | @@ -0,0 +1,1261 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Copyright 2016 Eugene Frolov %3Ceugene@frolov.net.ru%3E%0A#%0A# All Rights Reserved.%0A#%0A# 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 obta... | |
7c095c82e1b6a16da65b8fcfaf77d9a606321d76 | Create sum67.py | Python/CodingBat/sum67.py | Python/CodingBat/sum67.py | Python | 0.001155 | @@ -0,0 +1,218 @@
+# http://codingbat.com/prob/p108886%0A%0Adef sum67(nums):%0A sum = 0%0A %0A i = 0%0A while i %3C len(nums):%0A if nums%5Bi%5D == 6:%0A while nums%5Bi%5D != 7:%0A i += 1%0A else:%0A sum += nums%5Bi%5D%0A i += 1%0A %0A return sum%0A
| |
28f41fcfc80bc562343e510e3e0e5e57d97d27ea | Create Scrap_share_marketdata.py | Scrap_share_marketdata.py | Scrap_share_marketdata.py | Python | 0.000002 | @@ -0,0 +1,978 @@
+import urllib%0Aimport re%0A%0A#TItile scrap of any website %0A%0A# regex='%3Ctitle%3E(.+?)%3C/title%3E'%0A# pattern =re.compile(regex)%0A%0A# htmlfile = urllib.urlopen(%22https://www.cnn.com%22)%0A# htmltext=htmlfile.read()%0A# titles=re.findall(pattern,htmltext)%0A# print titles%0A%0A# Scrap using ... | |
1ec2f110c16de75503092df873693e2929baa8cd | add the "Cargos Importantes" field | candidates/migrations/0018_cr_add_important_posts_field.py | candidates/migrations/0018_cr_add_important_posts_field.py | Python | 0 | @@ -0,0 +1,951 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import models, migrations%0A%0Adef add_extra_field(apps, schema_editor):%0A ExtraField = apps.get_model('candidates', 'ExtraField')%0A if settings.ELECTION_APP == 'cr':%0A ... | |
0f5a52a215f8f1e16ab5ddf622a541919ab760ce | Fix up language detector. | aleph/analyze/language.py | aleph/analyze/language.py | import logging
import langid
# https://github.com/saffsd/langid.py
from aleph.analyze.analyzer import Analyzer
log = logging.getLogger(__name__)
THRESHOLD = 0.9
CUTOFF = 30
class LanguageAnalyzer(Analyzer):
def analyze_text(self, document, meta):
if len(meta.languages):
return
lang... | Python | 0.000043 | @@ -750,21 +750,22 @@
for
-table
+record
in docu
@@ -773,50 +773,17 @@
ent.
-tables:%0A for row in table:%0A
+records:%0A
@@ -807,10 +807,18 @@
in r
-ow
+ecord.data
.val
@@ -836,28 +836,24 @@
-
if not text
@@ -887,36 +887,32 @@
-
continue%0A ... |
57fe1a44c2285f39cc1454bbd6cfb3ce621348c3 | Add a test to validate the user creation | aligot/tests/test_user.py | aligot/tests/test_user.py | Python | 0.000001 | @@ -0,0 +1,1073 @@
+# coding: utf-8%0A%0Afrom django.core.urlresolvers import reverse%0Afrom django.test import TestCase%0Afrom rest_framework import status%0Afrom rest_framework.test import APIClient%0A%0Afrom ..models import User%0A%0A%0Aclass TestUser(TestCase):%0A%0A def setUp(self):%0A self.client = APIC... | |
d63235026ec40857d3cbeef67064879d4b180eeb | add pip_upgrade | _bin/pip_upgrade.py | _bin/pip_upgrade.py | Python | 0.000001 | @@ -0,0 +1,177 @@
+#!/usr/bin/env python%0A%0Aimport pip%0Afrom subprocess import call%0A%0Afor dist in pip.get_installed_distributions():%0A call(%22pip install --upgrade %22 + dist.project_name, shell=True)%0A
| |
cba5577517659e13511dcd45c996fd292cbd1cf8 | Add Eq typeclass definition | typeclasses/eq.py | typeclasses/eq.py | Python | 0.000182 | @@ -0,0 +1,1047 @@
+# typeclasses, an educational implementation of Haskell-style type%0A# classes, in Python%0A#%0A# Copyright (C) 2010 Nicolas Trangez %3Ceikke eikke com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Lesser General Public%0A# License... | |
bdb7dcef2a214e18505b3465b66068fb9658739c | Update tests | corehq/apps/app_manager/tests/test_bulk_app_translation.py | corehq/apps/app_manager/tests/test_bulk_app_translation.py | import codecs
from django.test import SimpleTestCase
from corehq.apps.app_manager.const import APP_V2
from corehq.apps.app_manager.models import Application, Module
from corehq.apps.app_manager.tests.util import TestFileMixin
from corehq.apps.app_manager.translations import \
process_bulk_app_translation_upload, e... | Python | 0.000001 | @@ -3798,17 +3798,20 @@
el(%22one
-%3C
+<
two%22, 0
@@ -3879,17 +3879,20 @@
bel(%22un
-%3C
+<
deux%22,
|
dead36578f93ab2eb3a0b403a8da75b1ab0e3b12 | Remove the lock on the table ir_sequence and use FOR UPDATE | bin/addons/base/ir/ir_sequence.py | bin/addons/base/ir/ir_sequence.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of asses... | Python | 0.000042 | @@ -2724,53 +2724,8 @@
'):%0A
- cr.execute('lock table ir_sequence')%0A
@@ -2844,24 +2844,35 @@
active=True
+ FOR UPDATE
', (sequence
|
2c7a40679e6202446a2e1076e19832589abf9ef9 | Add test mobile flatpage | geotrek/api/tests/test_mobile_flatpage.py | geotrek/api/tests/test_mobile_flatpage.py | Python | 0 | @@ -0,0 +1,2233 @@
+from __future__ import unicode_literals%0A%0Aimport json%0A%0Afrom django.contrib.auth.models import User%0Afrom django.core.urlresolvers import reverse%0Afrom django.test.testcases import TestCase%0A%0Afrom geotrek.flatpages.factories import FlatPageFactory%0Afrom geotrek.flatpages.models import Fl... | |
4afd2553625db404cdfedfcf336079b3d9d723e3 | Add test for auth service pre-run time validation checks. | st2auth/tests/unit/test_validation_utils.py | st2auth/tests/unit/test_validation_utils.py | Python | 0 | @@ -0,0 +1,2657 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (the %2... | |
b413af07917f3555edb4b69c4d4a0e4d5c4a629f | Create boolean_logic_from_scratch.py | boolean_logic_from_scratch.py | boolean_logic_from_scratch.py | Python | 0.999243 | @@ -0,0 +1,412 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Boolean Logic from Scratch%0A#Problem level: 7 kyu%0A%0Adef func_or(a,b):%0A #your code here - do no be lame and do not use built-in code!%0A if bool(a) or bool(b):%0A return True%0A return False %0A%0Adef func_xor(a,b):%0A ... | |
df9c8b2c2e616937afdbf09fc4a76ac7b821c8a5 | Add test (which we fail at the moment) | bugimporters/tests/test_spider.py | bugimporters/tests/test_spider.py | Python | 0 | @@ -0,0 +1,1627 @@
+import os%0A%0Aimport bugimporters.main%0Afrom mock import Mock%0A%0A%0AHERE = os.path.dirname(os.path.abspath(__file__))%0A%0A# Create a global variable that can be referenced both from inside tests%0A# and from module level functions functions.%0A%0Abug_data_transit = %7B%0A 'get_fresh_urls': N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.