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 |
|---|---|---|---|---|---|---|---|
fb37af691d63ab8a43d50701d6b1f8ae027e2e1b | Create dfirwizard.py | dfirwizard.py | dfirwizard.py | Python | 0 | @@ -0,0 +1,399 @@
+#!/usr/bin/python%0A# Sample program or step 1 in becoming a DFIR Wizard!%0A# No license as this code is simple and free!%0Aimport sys%0Aimport pytsk3%0Aimagefile = %22Stage2.vhd%22%0Aimagehandle = pytsk3.Img_Info(imagefile)%0ApartitionTable = pytsk3.Volume_Info(imagehandle)%0Afor partition in partit... | |
ac83a8bbef2c61021c39c77ef3c14675383edc62 | Fix a typo. | packs/st2/actions/lib/action.py | packs/st2/actions/lib/action.py | from st2actions.runners.pythonrunner import Action
from st2client.client import Client
from st2client.models.datastore import KeyValuePair # pylint: disable=no-name-in-module
from lib.utils import filter_none_values
__all__ = [
'St2BaseAction'
]
class St2BaseAction(Action):
def __init__(self, config):
... | Python | 0.999957 | @@ -106,16 +106,15 @@
els.
-datastor
+keyvalu
e im
|
d8319f2189f9383038a5ac28aeebc71f56f51687 | Make pyxdg optional. | udiskie/mount.py | udiskie/mount.py | import warnings
warnings.filterwarnings("ignore", ".*could not open display.*", Warning)
warnings.filterwarnings("ignore", ".*g_object_unref.*", Warning)
import logging
import optparse
import os
import dbus
import gobject
import gio
import pynotify
from xdg.BaseDirectory import xdg_config_home
import udiskie.device... | Python | 0 | @@ -245,16 +245,25 @@
notify%0A%0A
+try:%0A
from xdg
@@ -299,16 +299,90 @@
fig_home
+%0Aexcept ImportError:%0A xdg_config_home = os.path.expanduser('~/.config')
%0A%0Aimport
|
7ff614950163b1fb6a8fe0fef5b8de9bfa3a9d85 | Add a test for the hard-coded re() partial frac form | transmutagen/tests/test_partialfrac.py | transmutagen/tests/test_partialfrac.py | Python | 0.000035 | @@ -0,0 +1,377 @@
+from sympy import together, expand_complex, re, im, symbols%0A%0Afrom ..partialfrac import t%0A%0Adef test_re_form():%0A theta, alpha = symbols('theta, alpha')%0A%0A # Check that this doesn't change%0A re_form = together(expand_complex(re(alpha/(t - theta))))%0A assert re_form == (t*re(al... | |
7522ffb9f6934de02d5d326d5f798d42a2da800d | add script to find old experimental apis | pdfium/find_old_experimental.py | pdfium/find_old_experimental.py | Python | 0 | @@ -0,0 +1,1574 @@
+#!/usr/bin/env python3%0A#%0A# Copyright 2019 Miklos Vajna. 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#%0A%0A%22%22%22Finds my old + experimental APIs.%22%22%22%0A%0Aimport subprocess%0Aimport time%0A%0A%0Adef mai... | |
05dd8bdfeab63b3096e8f7d98032088133d1f0e5 | Add function provider to get osm data | campaign_manager/provider.py | campaign_manager/provider.py | Python | 0 | @@ -0,0 +1,1554 @@
+import json%0Aimport hashlib%0Aimport os%0A%0Afrom reporter import config%0Afrom reporter.utilities import (%0A split_bbox,%0A)%0Afrom reporter.osm import (%0A load_osm_document%0A)%0Afrom urllib.parse import quote%0Afrom reporter.queries import TAG_MAPPING, OVERPASS_QUERY_MAP%0A%0A%0Adef get_... | |
9305f158b71f65923ee37de2805324db362e0db6 | Add DRF LocalDateTimeField | arcutils/drf/serializers.py | arcutils/drf/serializers.py | Python | 0 | @@ -0,0 +1,325 @@
+from django.utils import timezone%0A%0Afrom rest_framework import serializers%0A%0A%0Aclass LocalDateTimeField(serializers.DateTimeField):%0A%0A %22%22%22Converts datetime to local time before serialization.%22%22%22%0A%0A def to_representation(self, value):%0A value = timezone.localtime... | |
3f9aae149dba5c9b68ff6f7fd83cadf3fd6b1d7d | Add automorphic number implementation (#7978) | maths/automorphic_number.py | maths/automorphic_number.py | Python | 0 | @@ -0,0 +1,1558 @@
+%22%22%22%0A== Automorphic Numbers ==%0AA number n is said to be a Automorphic number if%0Athe square of n %22ends%22 in the same digits as n itself.%0A%0AExamples of Automorphic Numbers: 0, 1, 5, 6, 25, 76, 376, 625, 9376, 90625, ...%0Ahttps://en.wikipedia.org/wiki/Automorphic_number%0A%22%22%22%0A... | |
34391723f44c81ceab77fd3200ee34c9f1b2d4b2 | add plugin factory | pilot/common/pluginfactory.py | pilot/common/pluginfactory.py | Python | 0 | @@ -0,0 +1,1404 @@
+#!/usr/bin/env python%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# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Authors:%0A# - Wen Guan, wen.guan@cern... | |
9f016a58a98ba89b9feae68dd01e752d75a628ec | Update test_client.py | tests/test_client.py | tests/test_client.py | import pytest
from mock import patch, Mock
from plaid import Client, require_access_token
def test_require_access_token_decorator():
class TestClass(object):
access_token = 'foo'
@require_access_token
def some_func(self):
return True
obj = TestClass()
obj.some_func()... | Python | 0.000002 | @@ -2451,19 +2451,19 @@
ert
-not
ret is
+not
None
|
9346ca997d723cbfedf383eb78db2f62552f8a7c | Fix empty image list test. | tests/test_comics.py | tests/test_comics.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
import tempfile
import shutil
from itertools import islice
from unittest import TestCase
from dosagelib import scraper
class _ComicTester(TestCase):
"""Basic comic test class."""
... | Python | 0.000076 | @@ -741,16 +741,43 @@
images =
+ 0%0A for image in
strip.g
@@ -786,17 +786,19 @@
Images()
-%0A
+:%0A
@@ -805,28 +805,22 @@
-if len(images) == 0:
+ images += 1
%0A
@@ -836,18 +836,24 @@
-empty += 1
+self.save(image)
%0A
@@ -861,28 +861,22 @@
-for image in
+if not... |
61cd24aef4c9c8ef72527e75991c23873892ec3b | Change listener module file | platform/listener/__init__.py | platform/listener/__init__.py | Python | 0.000001 | @@ -0,0 +1,61 @@
+'''%0AModule to handle data synchronization with contacts.%0A'''%0A
| |
18378b201cae7e23889031044fa6ddbaf50946c5 | check langauge detecting for lett files where we know the expetected language from the URL | baseline/check_lett_lang.py | baseline/check_lett_lang.py | Python | 0 | @@ -0,0 +1,2436 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport os%0A%0Adoc2lang = %7B%7D%0A%0Aif __name__ == %22__main__%22:%0A import argparse%0A parser = argparse.ArgumentParser()%0A parser.add_argument('referencepairs', type=argparse.FileType('r'))%0A parser.add_argument('-s... | |
1bbfb6fe5080de9326bd7a35afe893bf59744bdf | add ASGI plugin/middleware tests. | honeybadger/tests/contrib/test_asgi.py | honeybadger/tests/contrib/test_asgi.py | Python | 0 | @@ -0,0 +1,1735 @@
+import pprint%0Aimport unittest%0Afrom async_asgi_testclient import TestClient%0Aimport aiounittest%0Aimport mock%0Afrom honeybadger import contrib%0A%0Aclass SomeError(Exception):%0A pass%0A%0Adef asgi_app():%0A %22%22%22Example ASGI App.%22%22%22%0A async def app(scope, receive, send):%0A... | |
10dd7a4a70fe639b806e004bc0a0d6fb791279a3 | Add a utility script: | utils/misc/grep-svn-log.py | utils/misc/grep-svn-log.py | Python | 0.000301 | @@ -0,0 +1,2410 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AGreps and returns the first svn log entry containing a line matching the regular%0Aexpression pattern passed as the only arg.%0A%0AExample:%0A%0Asvn log -v %7C grep-svn-log.py '%5E D.+why_are_you_missing.h$'%0A%22%22%22%0A%0Aimport fileinput, re, sys, StringI... | |
8dc7a1e239dc22dd4eb69cfe1754586e3a1690dc | Test javascript using the "js" | tests/test_run_js.py | tests/test_run_js.py | Python | 0 | @@ -0,0 +1,392 @@
+import os%0A%0Afrom py2js import JavaScript%0A%0Adef f(x):%0A return x%0A%0Adef test(func, run):%0A func_source = str(JavaScript(func))%0A run_file = %22/tmp/run.js%22%0A with open(run_file, %22w%22) as f:%0A f.write(func_source)%0A f.write(%22%5Cn%22)%0A f.write(run)... | |
05b47d5346281d7c899063fa9eda604f5c466431 | Make sure we build the tools used for testing minidumps on Android. | build/all_android.gyp | build/all_android.gyp | # Copyright (c) 2012 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.
# This is all.gyp file for Android to prevent breakage in Android and other
# platform; It will be churning a lot in the short term and eventually be mer... | Python | 0.000461 | @@ -2873,32 +2873,394 @@
pad_unittests',%0A
+ # Also compile the tools needed to deal with minidumps, they are%0A # needed to run minidump tests upstream.%0A '../breakpad/breakpad.gyp:dump_syms#host',%0A '../breakpad/breakpad.gyp:symupload#host',%0A '../breakpad/b... |
e44bd0b5a5db15b99a06b7561b8146554b1419d2 | Add genesisbalance class #217 | bitshares/genesisbalance.py | bitshares/genesisbalance.py | Python | 0 | @@ -0,0 +1,1163 @@
+# -*- coding: utf-8 -*-%0Afrom .account import Account%0Afrom .instance import BlockchainInstance%0Afrom graphenecommon.genesisbalance import (%0A GenesisBalance as GrapheneGenesisBalance,%0A GenesisBalances as GrapheneGenesisBalances,%0A)%0A%0Afrom bitsharesbase.account import Address, Public... | |
3dd71c02ea1fa9e39054bd82bf9e8657ec77d6b9 | Add a script to recover the chat_id | tools/get_chat_id.py | tools/get_chat_id.py | Python | 0 | @@ -0,0 +1,931 @@
+#! /usr/bin/python3%0A# -*- coding:utf-8 -*-%0A%0A# by antoine@2ohm.fr%0A%0Aimport sys%0Aimport time%0Aimport telepot%0A%0Adef handle(msg):%0A content_type, chat_type, chat_id = telepot.glance(msg)%0A print(%22%5Ctchat_id: %7B%7D%22.format(chat_id))%0A%0A if content_type == 'text' and msg%5B... | |
e950a53b2a392014fbfd7b9827a9f3f0b12a377b | add connector test class | connectortest.py | connectortest.py | Python | 0 | @@ -0,0 +1,696 @@
+import unittest%0Aimport threading%0Aimport re%0Aimport message%0Aimport StringIO%0Afrom connector import Connector, AppConnector%0Aimport SocketServer%0Afrom threadserver import DetailServer%0Afrom datetime import datetime%0Afrom PIL import Image%0A%0A%0Aclass App:%0A def update_msg(self, txtmsg)... | |
f97868b89da50532413465250d84308b84276296 | add script | scripts/getliblist.py | scripts/getliblist.py | Python | 0.000001 | @@ -0,0 +1,806 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport os%0A%0Adef getlibs(invcf):%0A rgs = %7B%7D%0A with open(invcf, 'r') as vcf:%0A for line in vcf:%0A if not line.startswith('#'):%0A chrom, pos, id, ref, alt, qual, filter, info, format, sample = line.strip().split('... | |
fda7d76e4b10a1b43e3612742585d9abcc7b27da | Rename tags.py to search.py | tiddlywebplugins/tank/search.py | tiddlywebplugins/tank/search.py | Python | 0.000003 | @@ -0,0 +1,1890 @@
+%22%22%22%0ARoutines associated with finding and listing tags.%0A%0AAn experiment for now.%0A%22%22%22%0A%0Afrom tiddlyweb.model.bag import Bag%0Afrom tiddlyweb.model.policy import PermissionsError%0Afrom tiddlywebplugins.whoosher import get_searcher, query_parse%0A%0A%0Adef list_tags(environ, start... | |
eac6545d0700d2a6c3de43db5ea8d46cfea12464 | Update link.py | link.py | link.py | Python | 0 | @@ -0,0 +1,438 @@
+from module import XMPPModule%0Aimport halutils%0Aimport re, requests%0A %0Aclass Link(XMPPModule):%0A %0A def handleMessage(self, msg):%0A obj = re.match('.*(http%5Bs%5D?://.*)+', msg%5B'body'%5D)%0A %0A if obj:%0A addr = obj.group(1)%0A webpage = requests.g... | |
c29e430301dc854dc7bd83ebc2a588cea70589a6 | Fix has_perm issue in get_project_list | sentry/web/helpers.py | sentry/web/helpers.py | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponse
from django.template ... | Python | 0 | @@ -394,16 +394,32 @@
Project
+Member, Project%0A
%0A%0Adef ge
@@ -675,39 +675,83 @@
update(dict(
+%0A
(p
+m
.p
-k, p)
+roject_id, pm.project)%0A
for p
+m
in Project.
@@ -741,32 +741,38 @@
or pm in Project
+Member
.objects.filter(
@@ -775,30 +775,56 @@
ter(
-member_set__user=user)
+u... |
1510a0faeff91f6f6ed7a1c5929628d430cb0506 | Update file identification tools | fpr/migrations/0010_update_fido_136.py | fpr/migrations/0010_update_fido_136.py | Python | 0 | @@ -0,0 +1,836 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Adef data_migration(apps, schema_editor):%0A IDTool = apps.get_model('fpr', 'IDTool')%0A IDTool.objects.filter(description='Fido', version='1.3.5').update(version='1.3.6')%0A ... | |
93548efe9eb04dd9659e3cc76c711d967e8770df | Create filereader.py | filereader.py | filereader.py | Python | 0 | @@ -0,0 +1,1107 @@
+#!/usr/bin/python%0Aimport os%0Aimport re%0Afrom optparse import OptionParser%0ASUFFIX=%22.out%22%0A%0Adef main () :%0A global filename%0A parser = OptionParser()%0A parser.add_option(%22-f%22, %22--file%22, dest=%22filename%22,%0A help=%22the file to update%22, metavar... | |
23ab301f4773892f6db7321105f79ba0c48404a3 | add urls | src/doc/expedient/source/developer/sshaggregate/urls.py | src/doc/expedient/source/developer/sshaggregate/urls.py | Python | 0.000006 | @@ -0,0 +1,392 @@
+from django.conf.urls.defaults import *%0A%0Aurlpatterns = patterns('sshaggregate.views',%0A url(r'%5Eaggregate/create/$', 'aggregate_crud', name='sshaggregate_aggregate_create'),%0A url(r'%5Eaggregate/(?P%3Cagg_id%3E%5Cd+)/edit/$', 'aggregate_crud', name='sshaggregate_aggregate_edit'),%0A u... | |
fed2e3f9bdb3a00b077b5e7df1aed4d927b77b6c | Add test for Clifford drudge by quaternions | tests/clifford_test.py | tests/clifford_test.py | Python | 0 | @@ -0,0 +1,697 @@
+%22%22%22Test for the Clifford algebra drudge.%22%22%22%0A%0Afrom drudge import CliffordDrudge, Vec, inner_by_delta%0A%0A%0Adef test_clifford_drudge_by_quaternions(spark_ctx):%0A %22%22%22Test basic functionality of Clifford drudge by quaternions.%0A %22%22%22%0A%0A dr = CliffordDrudge(%0A ... | |
09a0689b8e521c1d5c0ea68ac448dc9ae7abcff5 | Read the header of a fits file and/or look up a single key (case insensitive). | fitsHeader.py | fitsHeader.py | Python | 0 | @@ -0,0 +1,859 @@
+#!/usr/bin/env python%0A# -*- coding: utf8 -*-%0A%0A# My imports%0Afrom __future__ import division%0Afrom astropy.io import fits%0Afrom pydoc import pager%0Aimport argparse%0A%0A%0Adef _parser():%0A parser = argparse.ArgumentParser(description='View the header of a fits file')%0A parser.add_arg... | |
b674f921a8e5cffb2d3e320f564c61ca01455a9f | Add command to generate a csv of talk titles and video reviewers | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | Python | 0.000011 | @@ -0,0 +1,864 @@
+import sys%0Aimport csv%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom django.contrib.auth import get_user_model%0Afrom wafer.talks.models import Talk, ACCEPTED, PROVISIONAL%0A%0A%0Aclass Command(BaseCommand):%0A help = (%22List talks and the associated video_reviewer emails.%2... | |
3db3c22d83071550d8bbd70062f957cf43c5e54a | Add a compatibility module, because of Python 2/3 compatibility issues. | cart/_compatibility.py | cart/_compatibility.py | Python | 0 | @@ -0,0 +1,460 @@
+import sys%0A%0Ais_py3 = sys.version_info%5B0%5D %3E= 3%0A%0A%0Adef utf8(string):%0A %22%22%22Cast to unicode DAMMIT!%0A Written because Python2 repr always implicitly casts to a string, so we%0A have to cast back to a unicode (and we now that we always deal with valid%0A unicode, because... | |
156b7dfc11f24a7d77d2280e8ddade3cb7a474b7 | Add a script for listing all Elasticsearch indexes | misc/list_all_es_indexes.py | misc/list_all_es_indexes.py | Python | 0 | @@ -0,0 +1,1325 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8%0A%0Aimport boto3%0Aimport hcl%0Aimport requests%0A%0A%0Adef get_terraform_vars():%0A s3_client = boto3.client(%22s3%22)%0A tfvars_body = s3_client.get_object(%0A Bucket=%22wellcomecollection-platform-infra%22,%0A Key=%22terraform.tfv... | |
006a921f19f6c4f64d694c86346ad85ada2c8bb8 | Add tests for subclass support | tests/subclass_test.py | tests/subclass_test.py | Python | 0 | @@ -0,0 +1,3129 @@
+#! /usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# vi:ts=4:et%0A%0Atry:%0A import unittest2 as unittest%0Aexcept ImportError:%0A import unittest%0Aimport pycurl%0A%0ACLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare)%0A%0Aclass SubclassTest(unittest.TestCase):%0A def test_basecla... | |
c8816f509a661ed53c166d843ebfb7dcb6b8d75a | use only single threaded svrlight | examples/undocumented/python_modular/regression_svrlight_modular.py | examples/undocumented/python_modular/regression_svrlight_modular.py | ###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm... | Python | 0 | @@ -546,17 +546,17 @@
-5,1e-2,
-3
+1
%5D,%5Btrain
|
7327250621dc34a1e7c2f1998333d65024583168 | add simple test | tests/test_commands.py | tests/test_commands.py | Python | 0.00057 | @@ -0,0 +1,759 @@
+# Copyright 2014 Rackspace, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless req... | |
2b2f11cc7650fc5c40cd21a6e8ad671656fc9b21 | add quicksort | quicksort.py | quicksort.py | Python | 0.00001 | @@ -0,0 +1,728 @@
+'''%0AQuickSort implementation%0A'''%0A%0A%0Adef quick_sort(arr, l, r):%0A i = l%0A j = r%0A x = arr%5B(l + r) / 2%5D%0A%0A if len(arr) == 0:%0A return arr%0A else:%0A while True:%0A while arr%5Bi%5D %3C x:%0A i += 1%0A while arr%5Bj%5... | |
177590fd65b3daa4aad77e3297fd0b92ae74f04c | Simplify MQTT light code | homeassistant/components/light/mqtt.py | homeassistant/components/light/mqtt.py | """
homeassistant.components.light.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT light.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.mqtt/
"""
from functools import partial
import logging
import homeassistant.components.mqt... | Python | 0.033981 | @@ -718,267 +718,8 @@
'%5D%0A%0A
-CONF_TOPICS = %5Btyp + topic%0A for typ in ('', 'brightness_', 'rgb_')%0A for topic in ('state_topic', 'command_topic')%5D%0ACONF_VALUE_TEMPLATES = %5Btyp + '_value_template'%0A for typ in ('state', 'brightness', 'rgb')%5D%0A%0A
%0Ad... |
9cdc580ea9292fbd06cff38620de3697f1b60270 | Stop landscape.io/pylint complaining about cli args | tvrenamr/cli/core.py | tvrenamr/cli/core.py | #!/usr/bin/env python
from __future__ import absolute_import
import functools
import logging
import sys
import click
from tvrenamr import errors
from tvrenamr.cli.helpers import (build_file_list, get_config, start_dry_run,
stop_dry_run)
from tvrenamr.logs import start_logging
from ... | Python | 0 | @@ -3273,16 +3273,56 @@
ilelist,
+ #pylint: disable-msg=too-many-arguments
%0A
@@ -3379,16 +3379,56 @@
o_cache,
+ #pylint: disable-msg=too-many-arguments
%0A
@@ -3486,32 +3486,72 @@
ive, rename_dir,
+ #pylint: disable-msg=too-many-arguments
%0A no_r
@@ -3611,16 +3611,56 @@
ls, the,
+ #pyl... |
b102a2769dc70deb2055a2d4ae0bf11f48c13f9d | add game window | core/core.py | core/core.py | Python | 0.000001 | @@ -0,0 +1,989 @@
+# -*- coding: utf-8 -*-%0Aimport pygame%0Afrom pygame.locals import *%0A%0Aclass App:%0A def __init__(self):%0A self._running = True%0A self._display_surf = None%0A self.size = self.weight, self.height = 1024, 576%0A%0A def on_init(self):%0A pygame.init()%0A s... | |
fb6dd1a92471697b8665364dfaa7fedc519d00ed | Create properties.py | data/properties.py | data/properties.py | Python | 0.000001 | @@ -0,0 +1,967 @@
+import libtcodpy as libtcod%0Aclass Object():%0A def __init__(self, x, y, char, color, screen):%0A self.x = x%0A self.y = y%0A self.char = char%0A self.color = color%0A self.screen = screen%0A%0A%0A def draw_object(self):%0A #Set the color of the charac... | |
a2ba0c1658850064f55de1a99c3c2a49ef847b8d | Add join_by draft | drafts/join_by.py | drafts/join_by.py | Python | 0 | @@ -0,0 +1,920 @@
+def join_by(op, dicts, start=EMPTY):%0A dicts = list(dicts)%0A if not dicts:%0A return %7B%7D%0A elif len(dicts) == 1:%0A return dicts%5B0%5D%0A%0A result = %7B%7D%0A for d in dicts:%0A for k, v in iteritems(d):%0A if k in result:%0A resul... | |
79602383ece3835e6ed94d14f3254190104bd03d | Fix aliases with bash | thefuck/shells/bash.py | thefuck/shells/bash.py | import os
from ..conf import settings
from ..const import ARGUMENT_PLACEHOLDER
from ..utils import memoize
from .generic import Generic
class Bash(Generic):
def app_alias(self, alias_name):
# It is VERY important to have the variables declared WITHIN the function
return '''
function {n... | Python | 0.000001 | @@ -412,16 +412,23 @@
+export
TF_ALIAS
@@ -455,16 +455,23 @@
+export
TF_SHELL
@@ -508,16 +508,23 @@
+export
PYTHONIO
|
0d8bfef0a629f6f8fb07415df21812eb1d458cde | Remove unnecessary lines after Android gyp fix Review URL: https://codereview.appspot.com/6353066 | gyp/bench.gyp | gyp/bench.gyp | # GYP file to build performance testbench.
#
{
'includes': [
'apptype_console.gypi',
],
'targets': [
{
'target_name': 'bench',
'type': 'executable',
'include_dirs' : [
'../src/core',
'../src/gpu',
],
'includes': [
'bench.gypi'
],
'dependenc... | Python | 0.000264 | @@ -2008,151 +2008,8 @@
%7D%5D,%0A
- %5B 'skia_os == %22android%22', %7B%0A 'dependencies!': %5B%0A 'android_system.gyp:Android_EntryPoint',%0A %5D,%0A %7D%5D,%0A
|
235cc3a7529b36e11a7935e15c90f496210d7c31 | implement method for generating request signature | scup/auth.py | scup/auth.py | Python | 0 | @@ -0,0 +1,228 @@
+import hashlib%0Aimport time%0A%0Adef get_request_signature(private_key):%0A%09current_time = int(time.time())%0A%0A%09message = '%7B%7D%7B%7D'.format(current_time, private_key)%0A%0A%09digest = hashlib.md5(message).hexdigest()%0A%0A%09return current_time, digest%0A
| |
5834f2e259834b325cf076b36af634dc6b64f442 | Add info if not parsed | intelmq/bots/parsers/generic/parser.py | intelmq/bots/parsers/generic/parser.py | from intelmq.lib.bot import Bot, sys
from intelmq.lib.message import Event
from intelmq.bots import utils
import re
class GenericBot(Bot):
# Generic parser, will simply parse and add named group to event
# for example if you have the regex :
# '^\s*(?P<ip>(?:(?:\d){1,3}\.){3}\d{1,3})'
# You will have an item 'ip' in ... | Python | 0 | @@ -389,16 +389,88 @@
ssage()%0A
+ self.logger.debug(%22Will apply regex %25s%22 %25 self.parameters.regex)
%0A
@@ -570,47 +570,8 @@
ine%0A
- self.logger.debug(row)%0A
@@ -1088,129 +1088,318 @@
rs..
-%0A event.add('feed', self.parameters.feed)%0A even... |
9b5590458463744597da1769694e826ed9c27414 | Comment failing doctests. | scikits/learn/utils/crossval.py | scikits/learn/utils/crossval.py | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
# $Id$
import exceptions
import numpy as np
def leave_one_out(n):
"""
Leave-One-Out cross validation:
Provides train/test indexes to split data in train test sets
Parameters
===========
n: int
Total num... | Python | 0 | @@ -357,20 +357,59 @@
======%0A
+ # commented doctest, see issue #34
%0A
+ #
%3E%3E%3E imp
@@ -423,24 +423,26 @@
py as np%0A
+ #
%3E%3E%3E from sc
@@ -474,24 +474,26 @@
crossval%0A
+ #
%3E%3E%3E n_sampl
@@ -514,24 +514,26 @@
= 5, 10%0A
+ #
%3E%3E%3E X = np.
@@ -567,24 +567,26 @@
eatures)%0... |
d046968c5b16239b4ce3fbe17b6359339f3e7b9b | Add vcf convertor | utils/vcf_convertor.py | utils/vcf_convertor.py | Python | 0.000001 | @@ -0,0 +1,596 @@
+#! -*- coding: utf-8 -*-%0A%0Aimport re%0Aimport json%0A%0Aperson_patten = re.compile(r'BEGIN:VCARD(.*?)END:VCARD', re.DOTALL)%0Afullname_patten = re.compile(r'FN:(.*?)%5Cn')%0Amobile_patten = re.compile(r':%5C+*?(%5Cd%7B9%7D%5Cd*?)%5Cn')%0A%0Af = open(r'iCloud vCard.vcf')%0Afc = f.read()%0Apeople = ... | |
3a1b4ceb2ae989495d2453c612ac6645fdf59726 | Create cisco_vlan_extract.py | cisco/cisco_vlan_extract.py | cisco/cisco_vlan_extract.py | Python | 0.000049 | @@ -0,0 +1,1467 @@
+from ciscoconfparse import CiscoConfParse as ccp%0A%0A%0Adef extract_vlan(vlans):%0A %22%22%22%0A Will convert ACTIVE vlans in the 'show vlan' command .....%0A %0A switch#show vlan%0A VLAN Name Status Ports%0A ---- -------------------------------- ---... | |
08d66a82ea47832654aa17f0323df6ce57691fcb | add setup.py | verdenskart/setup.py | verdenskart/setup.py | Python | 0.000001 | @@ -0,0 +1,252 @@
+#!/usr/bin/env python%0A%0Afrom setuptools import setup, find_packages%0A%0Asetup(%0A name=%22bokeh-worldmap%22,%0A version=%220.1.0%22,%0A packages=find_packages(%22src%22),%0A package_data=%7B%7D,%0A package_dir=%7B%22%22: %22src%22%7D,%0A entry_points=%7B%22console_scripts%22: %5... | |
421ba879a36c1bd817fa27aa780476d2008eb6d0 | Revert "Add sleep between image detach" | fuel_health/tests/smoke/test_create_volume.py | fuel_health/tests/smoke/test_create_volume.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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... | Python | 0 | @@ -631,20 +631,8 @@
ging
-%0Aimport time
%0A%0Afr
@@ -4618,86 +4618,8 @@
e')%0A
-%09# Sleeping due to non-syncronous procedure and potential race.%0A%09time.sleep(5)
%0A
|
5bb7d25765655f83c42b5e7abc1093f7f85f7950 | bump version to 0.8.16 | 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 | @@ -984,9 +984,9 @@
= 1
-5
+6
%0A# E
|
3088fcd2d42b4e59601c103cc01cec1d949f6f57 | Improve OldPersian | ielex/lexicon/migrations/0093_fix_oldPersian.py | ielex/lexicon/migrations/0093_fix_oldPersian.py | Python | 0 | @@ -0,0 +1,1173 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0Afrom django.db import migrations%0A%0A%0Adef forwards_func(apps, schema_editor):%0A '''%0A OldPersian doesn't have lexemes for some meanings.%0A This migration generates them.%0A '''%0A # Models to work with:%0A La... | |
6516b73210a575376bc78005ae28c0e843303b24 | add theano how-to-perform | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | Python | 0.000071 | @@ -0,0 +1,1177 @@
+import numpy as np%0Aimport theano%0Aimport theano.tensor as T%0Afrom theano.tensor.nnet import conv2d%0A%0A# original image 3D (3x3x4) (RGB Channel, height, width)%0Aimg = %5B%5B%5B1, 2, 3, 4%5D,%0A %5B1, 1, 3, 1%5D,%0A %5B1, 3, 1, 1%5D%5D,%0A%0A %5B%5B2, 2, 3, 4%5D,%0A %5B2,... | |
a99f0678815c2e998c25a0aaf9f2c79ad0d18610 | Add package 'ui' | source/ui/__init__.py | source/ui/__init__.py | Python | 0.000034 | @@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-%0A%0A## %5Cpackage ui%0A%0A# MIT licensing%0A# See: LICENSE.txt%0A
| |
00b995719aaf11c2d7c3126e29b94b74f0edf8d2 | add test | osf_tests/test_downloads_summary.py | osf_tests/test_downloads_summary.py | Python | 0.000002 | @@ -0,0 +1,1058 @@
+# encoding: utf-8%0Aimport mock%0Aimport pytest%0Aimport pytz%0Aimport datetime%0A%0Afrom django.utils import timezone%0A%0Afrom addons.osfstorage import utils%0Afrom addons.osfstorage.tests.utils import StorageTestCase%0A%0Afrom osf_tests.factories import ProjectFactory%0A%0Afrom scripts.analytics.... | |
d764a483497afc5d029a82db14cc5cc88f45f4c0 | Add an extension to allow for an addFixedIp action on instances | nova/api/openstack/contrib/multinic.py | nova/api/openstack/contrib/multinic.py | Python | 0 | @@ -0,0 +1,2771 @@
+# Copyright 2011 OpenStack LLC.%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 obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/license... | |
c13d1347889cf574d3e6b9b835dadbca5fdc2d6c | Add wheel module for the salt key system | salt/wheel/key.py | salt/wheel/key.py | Python | 0 | @@ -0,0 +1,878 @@
+'''%0AWheel system wrapper for key system%0A'''%0A%0Aimport salt.key%0A%0Adef list_all():%0A '''%0A List the keys under a named status%0A '''%0A skey = salt.key.Key(__opts__)%0A return skey.list_all()%0A%0Adef accept(match):%0A '''%0A Accept keys based on a glob match%0A '''%0... | |
95a8ed6dcb19f322c9a14957da207efb8be10f5d | Customize makemessages to support ignoring fuzzy | hqscripts/management/commands/makemessages.py | hqscripts/management/commands/makemessages.py | Python | 0 | @@ -0,0 +1,1022 @@
+from django.core.management.commands import makemessages%0A%0A%0Aclass Command(makemessages.Command):%0A def add_arguments(self, parser):%0A super().add_arguments(parser)%0A parser.add_argument('--no-fuzzy', action='store_true', help='Remove fuzzy strings.')%0A%0A def handle(self... | |
597a1c12223fec5deefcd31b3a00b06d1095b32d | Add check replication step | dbaas/workflow/steps/util/region_migration/check_replication.py | dbaas/workflow/steps/util/region_migration/check_replication.py | Python | 0 | @@ -0,0 +1,1109 @@
+# -*- coding: utf-8 -*-%0Aimport logging%0Afrom util import full_stack%0Afrom workflow.steps.util.base import BaseStep%0Afrom workflow.exceptions.error_codes import DBAAS_0020%0Afrom time import sleep%0ALOG = logging.getLogger(__name__)%0A%0A%0Aclass CheckReplication(BaseStep):%0A%0A def __unicod... | |
fb6c84e7703092f495324fe57041717403803e7f | Add scrape_symbols.py placeholder. | scrape_symbols.py | scrape_symbols.py | Python | 0 | @@ -0,0 +1,100 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0Adef main():%0A pass%0A%0Aif __name__ == '__main__':%0A main()%0A
| |
fe479bf2a8ec547922c6643bbdf0ba768eb79c9d | Add script to simulate multiple games | ludo/simulator.py | ludo/simulator.py | Python | 0 | @@ -0,0 +1,682 @@
+#!/usr/bin/env python3%0Afrom game import Game%0A%0Aprint(%22Welcome to a game of ludo!%22)%0A%0Aaverage_throw_counter = 0%0Amin_throws_per_game = 10000000%0Amax_throws_per_game = 0%0ANUM_GAMES = 100%0A%0Afor i in range(0, NUM_GAMES):%0A%0A game = Game()%0A throw_counter = 0%0A%0A while game... | |
b5b21a151b219ae5f9a017ea0bda95c1d0be92ca | Fix Csv validation | tools/telemetry/telemetry/csv_page_benchmark_results.py | tools/telemetry/telemetry/csv_page_benchmark_results.py | # Copyright (c) 2012 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 telemetry.page_benchmark_results import PageBenchmarkResults
class CsvPageBenchmarkResults(PageBenchmarkResults):
def __init__(self, results_write... | Python | 0.000011 | @@ -1443,24 +1443,28 @@
= %5C%0A
+set(
self.values_
@@ -1501,22 +1501,106 @@
ames
+)
%0A
-if self._
+header_names_written_to_writer = %5C%0A set(self._header_names_written_to_writer)%0A if
head
@@ -2053,22 +2053,16 @@
%25 (repr(
-self._
header_n
|
a8f172752a72d93537820322b9ce62b601be6c5f | Fix cpplint warning. | script/cpplint.py | script/cpplint.py | #!/usr/bin/env python
import fnmatch
import os
import subprocess
import sys
IGNORE_FILES = [
'app/win/resource.h',
'browser/atom_application_mac.h',
'browser/atom_application_delegate_mac.h',
'browser/native_window_mac.h',
'browser/ui/cocoa/event_processing_window.h',
'browser/ui/cocoa/atom_menu_controlle... | Python | 0 | @@ -92,32 +92,8 @@
= %5B%0A
- 'app/win/resource.h',%0A
'b
@@ -194,32 +194,70 @@
_window_mac.h',%0A
+ 'browser/resources/win/resource.h',%0A
'browser/ui/co
|
4c5e4cb960a266482dac21eaeb0b568359c58b39 | Add py-backcall (#8701) | var/spack/repos/builtin/packages/py-backcall/package.py | var/spack/repos/builtin/packages/py-backcall/package.py | Python | 0.000001 | @@ -0,0 +1,1549 @@
+##############################################################################%0A# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
7975ef9f34cc578de968e1a1c8e6f731c164641a | Create 1.5_countstrings.py | CrackingCodingInterview/1.5_countstrings.py | CrackingCodingInterview/1.5_countstrings.py | Python | 0.001266 | @@ -0,0 +1,699 @@
+%22%22%22%0Agiven a string, return a string counting all the occurences %0Aof each character if the count %3E 1%0A%22%22%22%0A%0Adef compress(string_to_compress):%0A%0A if len(string_to_compress) %3C 2%0A return string_to_compress%0A%0A groups = %5B%5D%0A previous_character = string_t... | |
c89cce1a47c1e379958d7cced624ec0317cd3407 | Add demo for non-blocking with poll(). | examples/demo3.py | examples/demo3.py | Python | 0 | @@ -0,0 +1,759 @@
+import os%0Aimport sys%0Asys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))%0Aimport logging%0Aimport threading%0Aimport xmpp2%0Aimport time%0Aimport select%0Afrom xmpp2 import XML%0A%0A# non-blocking, poll example.%0AUSERNAME = 'yourusername'%0APASSWORD = 'yourpassword'%0ASERVER = 'ex... | |
bb1ce480184d4e78f121f9e473e58f47b80de53a | Create FirstLinuxFile.py | FirstLinuxFile.py | FirstLinuxFile.py | Python | 0 | @@ -0,0 +1,11 @@
+#%EF%BC%81/usr/bin%0A
| |
f724f5b488f23a6ceb2314aa18933b5fac3f5aab | Add courseware migration. | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | Python | 0 | @@ -0,0 +1,556 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.25 on 2019-10-01 18:58%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('courseware', '0012_adjust_fields'),%0A %5D%0A%0A ope... | |
1e65555a08ff3ee1a06e92d9dd054abf3cfaf711 | Add a migration to update to final tree fields | media_tree/migrations/0003_alter_tree_fields.py | media_tree/migrations/0003_alter_tree_fields.py | Python | 0 | @@ -0,0 +1,909 @@
+# -*- 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 ('media_tree', '0002_mptt_to_treebeard'),%0A %5D%0A%0A operations = %5B%0A migrations.Alter... | |
fb5f6bf999b2cd8b674bc2c89f74f1413fc8ee1e | Add command line interface to play | command_line_tic_tac_toe.py | command_line_tic_tac_toe.py | Python | 0.000001 | @@ -0,0 +1,2710 @@
+#!/usr/bin/env python3%0A%0Aimport cmd%0Afrom tictactoe.ai_player import AIPlayer%0Afrom tictactoe.human_player import HumanPlayer%0Afrom tictactoe.game_controller import GameController%0Afrom tictactoe.board_stringification import BoardStringification%0A%0Aclass CommandLineTicTacToe(cmd.Cmd):%0A ... | |
6d59e6d37d6f33f3513a1c6b1cb7d0d9062f391e | Create ClassesandInstances.py | EmployeeManagementSystem/Findings/ClassesandInstances.py | EmployeeManagementSystem/Findings/ClassesandInstances.py | Python | 0 | @@ -0,0 +1,1195 @@
+#Creating and instantiating python classes%0A#classes - they allow us to logically group data(attributes) and functions (methods)%0A'''class Employee:%0A pass%0Aprint (%22Class (Blueprint) vs Instance%22)%0Aemp1 = Employee()%0Aemp2 = Employee()%0Aprint (emp1)%0Aprint (emp2)%0A%0Aprint (%22instanc... | |
ec22c2d82ff4f045b992014d17ada850359c2ab6 | change folder layout | patterning_algorithm/color_halftone.py | patterning_algorithm/color_halftone.py | Python | 0.000001 | @@ -0,0 +1,2211 @@
+# This program takes a raster color image and produces its raster color halftone using patterning algorithm .%0A# Split the image into C, M, Y, K.%0A# Rotate each separated image by 0, 15, 30, and 45 degrees respectively.%0A# Take the half-tone of each image (dot size will be proportional to the int... | |
eced1499c4b82ce83f954a0364b02f2116a11326 | Add quick verification checker. | src/Scripts/verify.py | src/Scripts/verify.py | Python | 0 | @@ -0,0 +1,1126 @@
+# Take a ground truth file produced by the verifier and a match file and compare them.%0A# Output is in fully normalized format, the same as VerifyCommand.cpp produces.%0A#%0A%0A# TODO: remove hardcoded paths.%0A%0A# file format:%0A# term,docId,%5B0-3%5D%0A# 0: true positive%0A# 1: false postive%0A#... | |
7d82a39b23c0e821b47732b826cfa655facfe330 | reorder sections: `outputs` directly after `build` | conda_smithy/lint_recipe.py | conda_smithy/lint_recipe.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import itertools
import os
import re
import jinja2
import ruamel.yaml
from conda_build.metadata import ensure_valid_license_family
EXPECTED_SECTION_ORDER = ['package', 'source', 'build', 'requirements',
'outputs', ... | Python | 0 | @@ -261,26 +261,21 @@
uild', '
-requiremen
+outpu
ts',%0A
@@ -298,21 +298,26 @@
'
-outpu
+requiremen
ts', 'te
|
b1ef133904540b7f49e22ac52a0f844963be829e | Add basic test for discovery loader | nose2/tests/functional/test_discovery_loader.py | nose2/tests/functional/test_discovery_loader.py | Python | 0 | @@ -0,0 +1,954 @@
+from nose2.tests._common import FunctionalTestCase, support_file%0Afrom nose2 import events, loader, session%0Afrom nose2.plugins.loader.discovery import DiscoveryLoader%0A%0A%0Aclass Watcher(events.Plugin):%0A def __init__(self):%0A self.called = %5B%5D%0A%0A def loadTestsFromModule(sel... | |
2de3ab69c0725312663ecd94378c5b267a6c5ab1 | Add graph_data.py with a graph_ratings function | graph_data.py | graph_data.py | Python | 0.000053 | @@ -0,0 +1,1150 @@
+%22%22%22Graph properties and patterns of the raw data%0A%0A.. moduleauthor:: Jan Van Bruggen %3Cjancvanbruggen@gmail.com%3E%0A%22%22%22%0Aimport matplotlib.pyplot as plt%0A%0A%0Adef graph_ratings():%0A num_points = 1e5%0A ratings = rating_counts('data/mu/all.dta', num_points)%0A rating_num... | |
7a861623987225bd786301dfe6dea78173ddaf1a | Create generator.py | Testing_Hadoop/generator.py | Testing_Hadoop/generator.py | Python | 0.000001 | @@ -0,0 +1,240 @@
+import time%0Astart_time = time.time()%0Afo = open(%22hadoop_test_data.txt%22, %22wb%22)%0Afor i in range(0,9):%0A for i in range(0,10000000):%0A fo.write(%22Hadoop %22);%0Afo.close()%0Aprint(%22--- %25s seconds ---%22 %25 (time.time() - start_time))%0A
| |
963aa3fd9830d1a4817a26a2e8a5676174e30d19 | Add new migration | planner/migrations/0005_auto_20150711_1117.py | planner/migrations/0005_auto_20150711_1117.py | Python | 0 | @@ -0,0 +1,524 @@
+# -*- 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 ('planner', '0004_auto_20150616_1926'),%0A %5D%0A%0A operations = %5B%0A migrations.RenameF... | |
ea9b6920c88ac40a72aadd70199a52f27a1c097e | Create RespostaListar.py | backend/Models/Predio/RespostaListar.py | backend/Models/Predio/RespostaListar.py | Python | 0 | @@ -0,0 +1,242 @@
+from Framework.Resposta import Resposta%0Afrom Models.Predio.Predio import Predio as ModelPredio%0Aclass RespostaListar(Resposta):%0A%0A%09def __init__(self,predios):%0A%09%09self.corpo = %5B%5D%0A%09%09for predio in predios:%0A%09%09%09self.corpo.append(ModelPredio(predio))%0A
| |
87804aef17874339e7b58df0c3bcb29338fa412a | add country regions include Minsk | belarus_region_borders_include_minsk.py | belarus_region_borders_include_minsk.py | Python | 0.999999 | @@ -0,0 +1,880 @@
+from _helpers import cursor_wrap, dump%0A%0A%0A@cursor_wrap%0Adef main(cursor):%0A sql = %22%22%22%0A SELECT r.osm_id, c.name AS country, r.name AS region, ST_AsGeoJSON(r.way)%0A FROM osm_polygon c%0A LEFT JOIN osm_polygon r ON ST_Contains(c.way, r.way)%0A WHERE c.osm_i... | |
b5bc7827fb2452e82789129b918861157010c58e | Create pokebot.py | pokebot.py | pokebot.py | Python | 0.000005 | @@ -0,0 +1,1925 @@
+#!/usr/bin/python3%0A#%0A# Author: Luke%0A%0Aimport time, ts3, sys, traceback%0A%0AUSER = 'serveradmin' # Query user%0APASS = '' # Query Password%0AHOST = 'localhost' # Query Server-host%0APORT = '10011' # Query Server-Port%0ASID = 1 # Serveradmin sid (dont touch)%0A%... | |
4f87a0e144bf738e523cd1f8d914f39090275fee | add review status to individuals | xbrowse_server/base/migrations/0008_individual_review_status.py | xbrowse_server/base/migrations/0008_individual_review_status.py | Python | 0 | @@ -0,0 +1,645 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.4 on 2016-10-05 09:07%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('base', '0007_auto_20160826_1327'),%0A %5D%0A%0A ... | |
85b9d1eed3aea2ed56b85819f6e2269aef9dd128 | Add MemAvailable to default keys. | src/collectors/memory/memory.py | src/collectors/memory/memory.py | # coding=utf-8
"""
This class collects data on memory utilization
Note that MemFree may report no memory free. This may not actually be the case,
as memory is allocated to Buffers and Cache as well. See
[this link](http://www.linuxatemyram.com/) for more details.
#### Dependencies
* /proc/meminfo or psutil
"""
im... | Python | 0 | @@ -451,16 +451,36 @@
ING = %5B%0A
+ 'MemAvailable',%0A
'Mem
|
34bc4b9e5731c94ae4655deb338d67aa3f9a1f63 | Create project.py | project.py | project.py | Python | 0.000001 | @@ -0,0 +1,1665 @@
+from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound%0Afrom ggame import LineStyle, Color%0A%0ASCREEN_WIDTH = 640%0ASCREEN_HEIGHT = 480%0A%0Agreen = Color(0x00ff00, 1)%0Ablack = Color(0, 1)%0Anoline = LineStyle(0, black)%0Abg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT... | |
681cc0a4160373fe82de59946b52e0e21611af84 | Print out all links on a page | linkLister.py | linkLister.py | Python | 0 | @@ -0,0 +1,263 @@
+import requests%0Aimport re%0A%0Aurl = raw_input(%22Enter URL with http or https prefix : %22 )%0Aprint url%0Awebsite= requests.get(url)%0A%0Ahtml = website.text%0Aprint html%0Alinklist = re.findall('%22((http%7Cftp)s?://.*?)%22',html)%0Aprint linklist%0Afor link in linklist:%0A print link%5B0%5D%... | |
6d4c3b77c9f0b4889ad5265113d9a87a0dc88377 | Add space in beused | src/ggrc/converters/errors.py | src/ggrc/converters/errors.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
WRONG_FILE_TYPE = (u"Line {line}: Wrong file type. Only .csv files are"
... | Python | 0.00469 | @@ -2687,16 +2687,17 @@
%22
+
used.%22)%0A
|
51f8b228ff1096769a06b47d026e81a166503a82 | add missing unit tests for previous commit | pymatgen/util/tests/test_decorators.py | pymatgen/util/tests/test_decorators.py | Python | 0 | @@ -0,0 +1,1309 @@
+import unittest%0Afrom pymatgen.util.decorators import lru_cache%0A%0A%0Aclass TestLRUCache(unittest.TestCase):%0A def test_function(self):%0A @lru_cache(2)%0A def cached_func(a, b):%0A return a + b%0A%0A #call a few times to get some stats%0A self.assertEqu... | |
61a6f6468462ed5db6c8e6c55bf29f0c503ff899 | add solution for H-Index | algorithms/hIndex/hIndex.py | algorithms/hIndex/hIndex.py | Python | 0.000002 | @@ -0,0 +1,374 @@
+class Solution(object):%0A def hIndex(self, citations):%0A %22%22%22%0A :type citations: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A n = len(citations)%0A c = collections.Counter(%5Bmin(x, n) for x in citations%5D)%0A s = reduce(lambda a, x: a + %5... | |
c2f0f5184665250949c32d16db0b521c357e3aa7 | Add solution to linkedListCycle problem. | python/src/linkedListCycle/linkedListCycle.py | python/src/linkedListCycle/linkedListCycle.py | Python | 0 | @@ -0,0 +1,1775 @@
+# Given a linked list, determine if it has a cycle in it.%0A%0A# Follow up:%0A# Can you solve it without using extra space?%0A%0A# Definition for singly-linked list.%0Aclass ListNode:%0A def __init__(self, x):%0A self.val = x%0A self.next = None%0A%0Aclass Solution:%0A # @param h... | |
2ab5d0bfdfe90279f3fffeeb51882cdbcb4e9135 | test genesis tests | tests/unit/modules/genesis_test.py | tests/unit/modules/genesis_test.py | Python | 0.000001 | @@ -0,0 +1,2276 @@
+# -*- coding: utf-8 -*-%0A'''%0A :codeauthor: :email:%60Rupesh Tare %3Crupesht@saltstack.com%3E%60%0A'''%0A%0A# Import Salt Testing Libs%0Afrom salttesting import TestCase, skipIf%0Afrom salttesting.mock import (%0A MagicMock,%0A patch,%0A NO_MOCK,%0A NO_MOCK_REASON%0A)%0A%0A# Import ... | |
4ec7abe5df2bdd4a68528fc9af14288b57fd72cc | add integration utest on Session | tests_with_openerp/test_session.py | tests_with_openerp/test_session.py | Python | 0 | @@ -0,0 +1,779 @@
+from unittest import TestCase%0Afrom anybox.recipe.odoo.runtime.session import Session%0Afrom openerp.tests.common import get_db_name%0A%0A%0Aclass SessionTestCase(TestCase):%0A%0A def setUp(self):%0A super(SessionTestCase, self).setUp()%0A self.session = Session(None, None, parse_co... | |
da1bda146b4762bc572cb28da30cfb09b1d083aa | add hikvision (#243) | netdisco/discoverables/hikvision.py | netdisco/discoverables/hikvision.py | Python | 0 | @@ -0,0 +1,393 @@
+%22%22%22Discover Hikvision cameras.%22%22%22%0Afrom . import MDNSDiscoverable%0A%0A%0Aclass Discoverable(MDNSDiscoverable):%0A %22%22%22Add support for discovering Hikvision cameras.%22%22%22%0A%0A def __init__(self, nd):%0A %22%22%22Initialize Hikvision camera discovery.%22%22%22%0A ... | |
f7b2b511bd6cca122782b39c9eb75ed4a4736717 | add benchmark | test/benchmark.py | test/benchmark.py | Python | 0.000002 | @@ -0,0 +1,277 @@
+import urllib2%0Aimport json%0A%0Aurl = %22http://localhost:3000/api?package=com.whatsapp%22%0A%0Afor i in range(5):%0A print 'Downloading '+ str(i)%0A res = urllib2.urlopen(url).read()%0A file = %22data-%22+str(i)+%22.json%22%0A with open(file, 'w') as outfile:%0A json.dump(res, o... | |
27622185e04bb652284597783287262e23bafa7d | Add minimal test case (failing) | plenum/test/node_request/test_apply_stashed_partially_ordered.py | plenum/test/node_request/test_apply_stashed_partially_ordered.py | Python | 0.000001 | @@ -0,0 +1,2407 @@
+import pytest%0A%0Afrom plenum.common.constants import DOMAIN_LEDGER_ID%0Afrom plenum.common.startable import Mode%0Afrom plenum.common.txn_util import reqToTxn%0Afrom plenum.test.delayers import cDelay%0Afrom plenum.test.helper import sdk_get_and_check_replies, sdk_send_random_requests, logger%0Afr... | |
cc7eb329a7d132947861ca1f2d4713cba1e4274a | Add tests! | test_processor.py | test_processor.py | Python | 0 | @@ -0,0 +1,2628 @@
+from ivl_enums import IvlElabType, IvlPortType, IvlDataDirection%0Afrom parsers import parse_modules_and_elabs%0Afrom utils import IvlNetManager%0A%0Aimport pytest%0Aimport sure # noqa%0A%0A%0A@pytest.yield_fixture%0Adef read_netlist():%0A # Read a netlist and parse it into modules and elabs.%0A... | |
823d10795b22b751647e79e77eecd381cf7a809d | create test file | test_threetaps.py | test_threetaps.py | Python | 0.000001 | @@ -0,0 +1,139 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22Tests for threetaps.%22%22%22%0A%0Aimport unittest%0A%0Aif __name__ == '__main__':%0A unittest.main()%0A
| |
f9fd2e3dcc4c25fd7561f8898e3845992553a8a8 | add wrapper script to launch tests | tests/run.py | tests/run.py | Python | 0.000001 | @@ -0,0 +1,316 @@
+#!/usr/bin/python%0A%0Aimport os%0A%0Aroot = os.path.join(os.path.dirname(__file__), '..')%0Aprog = os.path.join(os.path.dirname(__file__), 'qdjango-tests')%0A%0Apath = %5B%5D%0Afor component in %5B'db', 'http', 'script'%5D:%0A path.append(os.path.join(root, 'src', component))%0A%0Aos.system(%22LD... | |
e793612623653ae75df641eedfb2dc96e5230e4d | Set the user id in al linking | src/satosa/account_linking.py | src/satosa/account_linking.py | """
An account linking module for the satosa proxy
"""
import json
import logging
import requests
from jwkest.jwk import rsa_load, RSAKey
from jwkest.jws import JWS
from satosa.exception import SATOSAAuthenticationError
from satosa.internal_data import InternalResponse
from satosa.logging import satosa_logging
from... | Python | 0.000001 | @@ -3202,25 +3202,28 @@
nse.
+set_
user_id
- =
+(
message
+)
%0A
|
e8a6c0adc3aa77f8e0b1399fe076b43720acb823 | Test the API can run | tests/test_api.py | tests/test_api.py | Python | 0 | @@ -0,0 +1,433 @@
+# -*- coding: utf-8 -*-%0A%0Aimport subprocess%0Aimport requests%0Afrom unittest import TestCase%0Afrom nose.tools import assert_equal%0A%0A%0Aclass Test(TestCase):%0A%0A def setUp(self):%0A self.process = subprocess.Popen(%22openfisca-serve%22)%0A%0A def tearDown(self):%0A self.p... | |
690c08b2b35df2d81dc0977d8bd593c45806e1c2 | Add dumb log view test cases | tests/test_log.py | tests/test_log.py | Python | 0 | @@ -0,0 +1,305 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, unicode_literals%0Afrom flask import url_for%0A%0A%0Adef test_view_build_log(test_client):%0A test_client.get(url_for('log.build_log', sha='123456'))%0A%0A%0Adef test_view_lint_log(test_client):%0A test_client.get(url_for('log.li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.