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 |
|---|---|---|---|---|---|---|---|
7c3ed589ace907a71931b79902382b168a2ae80d | add direct_link_downloader | downloaders/direct_link_downloader.py | downloaders/direct_link_downloader.py | Python | 0.000001 | @@ -0,0 +1,1192 @@
+import os%0Afrom urllib.request import urlopen%0A%0A%0A%0Adef direct_link_download(url, file_path):%0A %22%22%22%0A :param url: direct link to an image%0A :param file_path: file path (including filename) to save image to%0A %22%22%22%0A # make sure the file_path param doesn't point to... | |
1455f6c563edd07a61dd826bde03137fff2d3f57 | add data for recipe 1.8 | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/08-calculating_with_dictionaries/main.py | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/08-calculating_with_dictionaries/main.py | Python | 0.000001 | @@ -0,0 +1,1312 @@
+def example_1():%0A prices = %7B%0A 'ACME': 45.23,%0A 'AAPL': 612.78,%0A 'IBM': 205.55,%0A 'HPQ': 37.20,%0A 'FB': 10.75%0A %7D%0A%0A min_price = min(zip(prices.values(), prices.keys()))%0A max_price = max(zip(prices.values(), prices.keys()))%0A print... | |
4879fc188c685e4676414a2f186d8d52998bc28d | Create task_3_3.py | PINp/2015/KAKURKIN_I_V/task_3_3.py | PINp/2015/KAKURKIN_I_V/task_3_3.py | Python | 0.999993 | @@ -0,0 +1,388 @@
+# %D0%97%D0%B0%D0%B4%D0%B0%D1%87%D0%B0 3. %D0%92%D0%B0%D1%80%D0%B8%D0%B0%D0%BD%D1%82 3.%0A# %D0%9D%D0%B0%D0%BF%D0%B8%D1%88%D0%B8%D1%82%D0%B5 %D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%83, %D0%BA%D0%BE%D1%82%D0%BE%D1%80%D0%B0%D1%8F %D0%B2%D1%8B%D0%B2%D0%BE%D0%B4%D0%B8%D1%82 %D0%B8%D0%BC%D1%8F... | |
8630d60a2ecdd2fac4153623ac64ba188e05d8b7 | Add source code. | pigrelay.py | pigrelay.py | Python | 0 | @@ -0,0 +1,1772 @@
+import os%0Aimport sys%0Aimport time%0Aimport socket%0Aimport logging%0A%0Alogging.basicConfig(level=logging.INFO)%0Alogger = logging.getLogger(__name__)%0A%0ASOCKFILE = %22/tmp/snort_alert%22%0ABUFSIZE = 65863%0A%0AIP = '127.0.0.1'%0APORT = 51234%0A%0A# TODO: TLS/SSL wrapper for socket%0A%0A%0Aclas... | |
5eaf4675baa161e17caaff4fe8dc21b38e292f40 | Add summary test | blaze/compute/tests/test_mongo_compute.py | blaze/compute/tests/test_mongo_compute.py | from __future__ import absolute_import, division, print_function
import pytest
pymongo = pytest.importorskip('pymongo')
from datetime import datetime
from toolz import pluck
from blaze import into, compute, compute_one
from blaze.compute.mongo import MongoQuery
from blaze.expr import TableSymbol, by
from blaze.comp... | Python | 0.000003 | @@ -5318,28 +5318,228 @@
events)) == set(%5B2, 3%5D)%0A
+%0A%0Adef test_summary_kwargs(t, bank):%0A expr = by(t.name, total=t.amount.sum(), avg=t.amount.mean())%0A result = compute(expr, bank)%0A assert result == %5B('Bob', 200.0, 600), ('Alice', 150.0, 300)%5D%0A
|
e15de99ae79e97becdc3d4a4a2bcf60e70e5d2d4 | Create escolas_ceara.senso_2013.py | raspagem/random/escolas_ceara.senso_2013.py | raspagem/random/escolas_ceara.senso_2013.py | Python | 0.000093 | @@ -0,0 +1,751 @@
+import urllib.request%0Aimport json%0A%0A#url = 'http://educacao.dadosabertosbr.com/api/cidades/ce'%0A#cidades = urllib.request.urlopen(url).read()%0A#cidades = json.loads(cidades.decode('utf-8'))%0A%0A#print('Lista de Cidades')%0A#%5Bprint(cidade.split(':')%5B1%5D) for cidade in cidades%5D%0A%0Aprin... | |
ef38b112a2cf46fe1bbb52a9633fd42fad03ddb0 | Update method name | rtv/subscriptions.py | rtv/subscriptions.py | import curses
import sys
import time
import logging
from .content import SubscriptionContent
from .page import BasePage, Navigator, BaseController
from .curses_helpers import (Color, LoadScreen, add_line)
__all__ = ['SubscriptionController', 'SubscriptionPage']
_logger = logging.getLogger(__name__)
class Subscriptio... | Python | 0.000002 | @@ -1133,16 +1133,17 @@
ent.
-get_list
+from_user
(sel
@@ -2402,8 +2402,9 @@
row, 1)
+%0A
|
43e48de2210873fd5ab6c9181f0aab7884c529be | Create app.py | reddit2telegram/channels/r_communism/app.py | reddit2telegram/channels/r_communism/app.py | Python | 0.000003 | @@ -0,0 +1,141 @@
+#encoding:utf-8%0A%0Asubreddit = 'communism'%0At_channel = '@r_communism'%0A%0A%0Adef send_post(submission, r2t):%0A return r2t.send_simple(submission)%0A
| |
d17c14df00c31af49080ff2f9fea8597a8861461 | Add recipe usage command for quick diagnostics. | starthinker_ui/recipe/management/commands/recipe_usage.py | starthinker_ui/recipe/management/commands/recipe_usage.py | Python | 0.0001 | @@ -0,0 +1,1405 @@
+###########################################################################%0A#%0A# Copyright 2022 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License ... | |
2b797879f3a4bf148575df1309369ed4532e4ab6 | bump version to 14.1.0 | zmq/sugar/version.py | zmq/sugar/version.py | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | Python | 0 | @@ -871,19 +871,16 @@
XTRA = '
-dev
'%0A__vers
|
5b2c328b94244fd6baf6403349919f3bc4f2d013 | add missing migration | meinberlin/apps/cms/migrations/0032_update_body.py | meinberlin/apps/cms/migrations/0032_update_body.py | Python | 0.000258 | @@ -0,0 +1,2509 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.18 on 2019-01-23 16:07%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport meinberlin.apps.cms.blocks%0Aimport wagtail.core.blocks%0Aimport wagtail.core.fields%0Aimport wagtail.images.blocks%0A%0A%0Aclass Migra... | |
e53a951ed98f460b603f43f6364d5d0a0f17a1ba | Add basic class structure, map functionality, and a set of consumer functions. | src/streamer.py | src/streamer.py | Python | 0 | @@ -0,0 +1,618 @@
+class pStream:%0A###PRIVATE FUNCTIONS%0A%0A def _builder(self, expression):%0A self.STR = expression%0A return self%0A%0A%0A###OVERRIDES%0A def next(self):%0A return next(self.STR)%0A%0A def __init__(self, iterable_thing):%0A self.STR = iterable_thing%0A%0A def... | |
82e871441010999e4a369b101019a34e7b03eca4 | add common csp-report URL | security/urls.py | security/urls.py | Python | 0 | @@ -0,0 +1,162 @@
+from django.conf.urls import patterns, include, url%0A%0Aurlpatterns = patterns('security.views',%0A url('%5E/csp-report/$', security.views.csp_report),%0A )%0A
| |
86c3f149726b58951e85f9bd6e324b032430b5ae | Deploy a schema template (#51379) | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | Python | 0 | @@ -0,0 +1,2798 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright: (c) 2018, Dag Wieers (@dagwieers) %3Cdag@wieers.com%3E%0A# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)%0A%0Afrom __future__ import absolute_import, division, print_function%0A__metaclass__ = ... | |
0b6709670179c0721b4f113d13bf34d9ac7715dd | Add a python plotter that compares the results of with Stirling numbers | test/indices.py | test/indices.py | Python | 0.000002 | @@ -0,0 +1,767 @@
+import matplotlib.pyplot as plt%0Aimport numpy%0A%0Afrom math import factorial%0A%0Adef binom(a,b):%0A return factorial(a) / (factorial(b)*factorial(a-b))%0A%0Adef stirling(n,k):%0A if n%3C=0 or n!=0 and n==k:%0A return 1%0A elif k%3C=0 or n%3Ck:%0A return 0%0A elif n==0 and... | |
7b179e4a420a3cd7a27f0f438a6eac462048bb93 | Add py solution for 554. Brick Wall | py/brick-wall.py | py/brick-wall.py | Python | 0.004967 | @@ -0,0 +1,977 @@
+import heapq%0Aclass Solution(object):%0A def leastBricks(self, wall):%0A %22%22%22%0A :type wall: List%5BList%5Bint%5D%5D%0A :rtype: int%0A %22%22%22%0A n_row = len(wall)%0A heap = %5B(wall%5Bi%5D%5B0%5D, i, 0) for i in xrange(n_row)%5D%0A heapq.he... | |
d6f029de32212d0865cb314a011cb4f607e6fa22 | Add function for avoiding pickeling functions. | distarray/dist/mpionly_utils.py | distarray/dist/mpionly_utils.py | """
Utilities for running Distarray in MPI mode.
"""
from __future__ import absolute_import
from importlib import import_module
from mpi4py import MPI as mpi
import distarray
from distarray.utils import uid
world = mpi.COMM_WORLD
world_rank = world.rank
client_rank = 0
def get_rank():
return world.rank
def ... | Python | 0 | @@ -269,16 +269,746 @@
k = 0%0A%0A%0A
+def push_function(context, key, func):%0A func_code = func.__code__%0A func_globals = func.__globals__ # noqa%0A func_name = func.__name__%0A func_defaults = func.__defaults__%0A func_closure = func.__closure__%0A%0A func_data = (func_code, func_name, func_defa... |
846ad2780ad2ccc9afbd6a224d567389bf09611f | add integer-to-english-words | vol6/integer-to-english-words/integer-to-english-words.py | vol6/integer-to-english-words/integer-to-english-words.py | Python | 0.999999 | @@ -0,0 +1,1392 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: Zeyuan Shang%0A# @Date: 2015-11-06 21:35:56%0A# @Last Modified by: Zeyuan Shang%0A# @Last Modified time: 2015-11-06 21:36:07%0Aclass Solution(object):%0A def numberToWords(self, num):%0A %22%22%22%0A :type num: int%0A ... | |
f02f8f5a68bd26d1ece32c50482729b7774b6e2a | Add a simple script for looking at connections. | scripts/simple-analysis.py | scripts/simple-analysis.py | Python | 0 | @@ -0,0 +1,770 @@
+#!/usr/bin/python%0A%0Afrom __future__ import print_function, division%0A%0Aimport networkx%0A%0Afrom reddit_meatspace.models import MeetupConnections%0A%0A%0Aconnections = MeetupConnections._byID(%222013%22)%0Adigraph = networkx.DiGraph()%0Afor connection, timestamp in connections._values().iteritem... | |
e3a36aaab3abe7c645e3b8491cd163dea8ff0fea | add python solution to "project euler - problem 4" | problem4.py | problem4.py | Python | 0 | @@ -0,0 +1,494 @@
+%0Adef is_palindrome(number):%0A%09number = str(number)%0A%09number_digits = len(number)%0A%09for i in xrange(0, number_digits/2):%0A%09%09if number%5Bi%5D != number%5Bnumber_digits-i-1%5D:%0A%09%09%09return False%0A%09return True%0A%0Adef test_it(n):%0A%09print n, is_palindrome(n)%0A%0Afor x in xran... | |
bf4b3d79f34e189a30b8168796fa1595bf49f1d7 | Fix field name | core/migrations/0002_auto_20150907_1413.py | core/migrations/0002_auto_20150907_1413.py | Python | 0.000003 | @@ -0,0 +1,378 @@
+# -*- 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 ('core', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.RenameField(%0A ... | |
404051ebc9d68c571be77e177b0455631f0c14ad | create basic model `Food` for run all tests | tests/models.py | tests/models.py | Python | 0.000003 | @@ -0,0 +1,344 @@
+from __future__ import unicode_literals%0A%0Afrom django.db import models%0Afrom django.utils.encoding import python_2_unicode_compatible%0A%0Afrom tags.fields import TagField%0A%0A%0A@python_2_unicode_compatible%0Aclass Food(models.Model):%0A name = models.CharField(max_length=50)%0A%0A tags =... | |
50ca8ffb078b37b472c1ccbbb2a4f21e8d7eade4 | fix gbformatting | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | """
Template tags for displaying sizes
"""
import datetime
from django import template
from django.utils import translation
from django.utils import formats
register = template.Library()
def int_format(value):
return int(value)
def float_format(value):
return formats.number_format(round(value, 1), 0)
de... | Python | 0.000002 | @@ -1525,17 +1525,24 @@
* 10
-00
+24 * 1024
* 10
-00
+24
, fl
|
106bce6081ed6c1c8442a1bb82aa39ef177bed8a | Solve problem 6 | problem006.py | problem006.py | Python | 0.999998 | @@ -0,0 +1,194 @@
+#!/usr/bin/env python3%0A%0Adef sumsq(maxnumber):%0A return sum(n**2 for n in range(1, maxnumber+1))%0A%0Adef sqsum(maxnumber):%0A return sum(range(1, maxnumber+1))**2%0A%0Aprint(sqsum(100) - sumsq(100))%0A
| |
fab193fa2c31b2e1cf58255d37f5e8dd63fef206 | Add high level for key signing | libnacl/sign.py | libnacl/sign.py | Python | 0.000001 | @@ -0,0 +1,1210 @@
+'''%0AHigh level routines to maintain signing keys and to sign and verify messages%0A'''%0A# Import libancl libs%0Aimport libnacl%0Aimport libnacl.utils%0Aimport libnacl.encode%0A%0A%0Aclass Signer(libnacl.utils.BaseKey):%0A '''%0A The tools needed to sign messages%0A '''%0A def __init__... | |
6332ca6fd715e730faf7e377843e2d2f8bfa2b84 | Create blink.py | linkit/blink.py | linkit/blink.py | Python | 0.000024 | @@ -0,0 +1,673 @@
+#!/usr/bin/python%0Aimport mraa # For accessing the GPIO%0Aimport time # For sleeping between blinks%0A%0A%0ALED_GPIO = 5 # we are using D5 pin%0AblinkLed = mraa.Gpio(LED_GPIO) # Get the LED pin object%0AblinkLed.dir(mraa.DIR_OUT) # Set the direction as output%0AledState... | |
56b5b0d9f1fd420e2ea7cdb0654d5c2f9d637189 | Add light theme | themes/light.py | themes/light.py | Python | 0.000001 | @@ -0,0 +1,886 @@
+from utils import colors%0A%0A%0A# Segments colors.%0AUSERATHOST_BG = colors.SMERALD%0AUSERATHOST_FG = colors.WHITE%0A%0ASSH_BG = colors.LIGHT_ORANGE%0ASSH_FG = colors.WHITE%0A%0ACURRENTDIR_BG = colors.MID_GREY%0ACURRENTDIR_FG = colors.LIGHT_GREY%0A%0AREADONLY_BG = colors.LIGHT_GREY%0AREADONLY_FG = c... | |
091e6a4450641ccc28dcd82e5225067425160cc2 | Replace follow question by "want answers" | quora/pyquora.py | quora/pyquora.py | import requests
from bs4 import BeautifulSoup
import feedparser
import re
### Configuration ###
POSSIBLE_FEED_KEYS = ['link', 'id', 'published', 'title', 'summary']
### Enumerated Types ###
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, ke... | Python | 0.999999 | @@ -480,31 +480,27 @@
LLOW=2,
-QUESTION_FOLLOW
+WANT_ANSWER
=3, ANSW
@@ -1627,31 +1627,27 @@
M_TYPES.
-QUESTION_FOLLOW
+WANT_ANSWER
%0A
@@ -4209,23 +4209,19 @@
PES.
-QUESTION_FOLLOW
+WANT_ANSWER
:%0A
@@ -4247,31 +4247,27 @@
ctivity.
-question_follow
+want_answer
s.append
@@ -4861,31 +4861,27 @@
ows=%... |
878d0b793c8efa1dafc246326d519685032ee9a7 | Add new package: influxdb (#17909) | var/spack/repos/builtin/packages/influxdb/package.py | var/spack/repos/builtin/packages/influxdb/package.py | Python | 0 | @@ -0,0 +1,1693 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0Aimport platform%0A%0A_versions = %7B%0A '1.8.1': %7B%0A 'Lin... | |
c1117f05934f76da72652d574aa240245d4724ff | new package (#6874) | var/spack/repos/builtin/packages/opa-psm2/package.py | var/spack/repos/builtin/packages/opa-psm2/package.py | Python | 0.618644 | @@ -0,0 +1,2468 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
60e64bac0a3cadccd0f35b5c8e8770b4edf0afff | add new package (#21793) | var/spack/repos/builtin/packages/virtuoso/package.py | var/spack/repos/builtin/packages/virtuoso/package.py | Python | 0 | @@ -0,0 +1,2429 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0A%0Afrom spack import *%0A%0A%0Aclass Virtuoso(AutotoolsPackage):%0A %22%22%22Virtuoso is ... | |
39b63523634801fe8ef2cca03e11b3875d84cdbd | Tweak syntax for f.close() concision, add typehints | flare/flare_io.py | flare/flare_io.py | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
f = open(filename, 'w')
... | Python | 0 | @@ -150,16 +150,21 @@
filename
+: str
, struct
@@ -286,35 +286,36 @@
ructures:%0A%09%22%22%22%0A%09
-f =
+with
open(filename,
@@ -318,17 +318,24 @@
me, 'w')
-%0A
+ as f:%0A%09
%09dump(%5Bs
@@ -391,19 +391,8 @@
der)
-%0A%09f.close()
%0A%0Ade
@@ -425,16 +425,21 @@
filename
+: str
):%0A%09%22%22%22%0A
@@ -550,... |
cb0d6124ea31e8fb9ff8957072a2b881b882127e | Add Timelapse script for sunrise timelapses | examples/hero9_timelapse_webcam.py | examples/hero9_timelapse_webcam.py | Python | 0 | @@ -0,0 +1,1400 @@
+import sys%0Aimport time%0Afrom goprocam import GoProCamera, constants%0Aimport threading%0Aimport logging%0A%0A%22%22%22%0AI use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly.%0A%0Apm2 start timelapse.py --cron %2230 7 * * *%22 --log timelapse.log --no-autorestart%0A%0AThis... | |
9d63571c5add6ff2ff064f41c9bc97a6943a69e9 | add missing migration | toucan/invitations/migrations/0002_auto_20161009_2158.py | toucan/invitations/migrations/0002_auto_20161009_2158.py | Python | 0.000258 | @@ -0,0 +1,604 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.2 on 2016-10-09 21:58%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('invitations', '0001_initial'),%0A %5D%0A%0A o... | |
4651e178ddbeac9211f8170e2e20f8a35ff0e3ab | Add a simple CLI script for writing out results of scripts | ocradmin/plugins/test_nodetree.py | ocradmin/plugins/test_nodetree.py | Python | 0 | @@ -0,0 +1,1233 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport json%0Asys.path.append(os.path.abspath(%22..%22))%0Aos.environ%5B'DJANGO_SETTINGS_MODULE'%5D = 'ocradmin.settings'%0A%0Asys.path.insert(0, %22lib%22)%0A%0Afrom nodetree import script%0Afrom nodetree.manager import ModuleManager%0A%0Adef run(node... | |
07c0ce9138f4e14c16e6223912d7fb53ab2db8ad | Version 4.1 | files/agent-find-rwx.py | files/agent-find-rwx.py | Python | 0 | @@ -0,0 +1,296 @@
+for pid, procinfo in VmmPy_ProcessListInformation().items():%0A try:%0A memmap = VmmPy_ProcessGetMemoryMap(pid, True)%0A for entry in memmap:%0A if '-rwx' in entry%5B'flags'%5D:%0A print(str(pid) + ': ' + procinfo%5B'name'%5D + ': ' + str(entry))%0A excep... | |
74fec13ce5ca0f011c8970e7664727b422597d9a | Add tools.genetics module (#41, #36)) | xentica/tools/genetics.py | xentica/tools/genetics.py | Python | 0 | @@ -0,0 +1,307 @@
+%22%22%22A collection of functions allowing genetics manipulations.%22%22%22%0A%0A%0Adef genome_crossover(*genomes):%0A %22%22%22%0A Crossover given genomes in stochastic way.%0A%0A :param genomes: A list of genomes (integers) to crossover%0A%0A :returns: Single integer, a resulting genom... | |
5f0ebdb043a313a784c723c36b87d316e276629f | Add recurring events experiment | experiments/python/pygame_recurring_events.py | experiments/python/pygame_recurring_events.py | Python | 0.000092 | @@ -0,0 +1,365 @@
+import pygame%0Aimport pygame.joystick%0Afrom pygame.locals import *%0A%0Adef main():%0A pygame.init()%0A clock = pygame.time.Clock()%0A ue = pygame.event.Event(USEREVENT, %7B'code':'drop'%7D)%0A pygame.time.set_timer(127, 500)%0A while(True):%0A events = pygame.event.get()%0A for... | |
4d34906eba347f56a13b193efa3cedb3f2ab2a24 | Add tests for ironic-dbsync. | ironic/tests/test_dbsync.py | ironic/tests/test_dbsync.py | Python | 0 | @@ -0,0 +1,1099 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A# -*- encoding: utf-8 -*-%0A#%0A# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Copyright 2013 Hewlett-Packard Development Company, L.P.%0A# All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0... | |
013ab6f195510a5097ba68c2e39277b154635bb7 | Set up the IDE device correctly, ie. with and using legacy ports. | src/dev/x86/SouthBridge.py | src/dev/x86/SouthBridge.py | # Copyright (c) 2008 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | Python | 0 | @@ -3776,17 +3776,39 @@
mmand =
-1
+0%0A ide.ProgIF = 0x80
%0A ide
|
3498c5e2c778c924397af8124544c2ce230e4d46 | reorder contribute form (bug 744631) | apps/mozorg/forms.py | apps/mozorg/forms.py | from django import forms
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.core.validators import EMPTY_VALUES
from product_details import product_details
FORMATS = (('H', 'HTML'), ('T', 'Text'))
class SideRadios(widgets.RadioFieldRenderer):
"""Render radio buttons as lab... | Python | 0 | @@ -2678,24 +2678,60 @@
sibility'),%0A
+ (' ', 'Other'),%0A
@@ -2875,44 +2875,8 @@
ue')
-,%0A (' ', 'Other')
)%0A%0Ac
|
71849714d809e882838e109d6906086b47fe68c5 | Create hubspot-amulet.py | CiO/hubspot-amulet.py | CiO/hubspot-amulet.py | Python | 0 | @@ -0,0 +1,299 @@
+import itertools%0A%0A%0Adef checkio(m):%0A for a, b, c in itertools.product(range(-180,181), repeat=3):%0A if not (a + b*m%5B1%5D%5B0%5D + c*m%5B2%5D%5B0%5D)%25360:%0A if (a*m%5B0%5D%5B1%5D + b + c*m%5B2%5D%5B1%5D)%25360 == 225:%0A if (a*m%5B0%5D%5B2%5D + b*m%5B1%... | |
5156c590b43f5a2bf577da224829c20bc3b97230 | add first example | libs/utils/filters.py | libs/utils/filters.py | Python | 0 | @@ -0,0 +1,1517 @@
+%0A# import glob%0A# import matplotlib.gridspec as gridspec%0A# import matplotlib.pyplot as plt%0A# import numpy as np%0A# import os%0A# import pandas as pd%0A# import pylab as pl%0A# import re%0A# import sys%0A# import trappy%0A%0A# Configure logging%0Aimport logging%0A%0Aclass Filters(object):%0A%... | |
4137fd528367cfc5caf8c89665e1d2ee0ceb8385 | Clean function cleans data correctly | Projects/Tracking/clean.py | Projects/Tracking/clean.py | Python | 0.000004 | @@ -0,0 +1,1423 @@
+import pandas as pd%0Afrom Code.config import get_path%0A%0A%0Adef clean_ble(df):%0A%0A PATH = get_path()%0A%0A # Remove unwanted columns%0A df = df.drop(%5B'clientmac', 'proximity', 'type', 'probetime_gmt', 'probetime'%5D, axis=1)%0A # Rename column headers%0A df.columns=%5B'id', 'da... | |
c0cf6739d3b10868eaae246c36eb691bff42a5aa | Add webdriver base test suite. | QA/pycopia/QA/webdriver.py | QA/pycopia/QA/webdriver.py | Python | 0 | @@ -0,0 +1,1549 @@
+#!/usr/bin/python2.5%0A# -*- coding: us-ascii -*-%0A# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab%0A#%0A# Copyright (C) 2010 Keith Dart %3Ckeith@dartworks.biz%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 ... | |
b1f22b33a60da2b27ac17090c0fa759e510dd051 | Create rlmradio.py | rlmradio.py | rlmradio.py | Python | 0.000001 | @@ -0,0 +1,534 @@
+#Grabs Current Info for RLM Radio Stream%0A%0Aimport requests%0Aimport re%0Afrom cloudbot import hook%0Aimport urllib%0Aimport urllib.request%0A%0Aurl = %22http://38.135.36.125:7359/7.html%22%0A%0A%0A@hook.command(%22rlmradio%22, autohelp=False)%0Adef rlmradio(text):%0A%0A url = %22http://38.135.3... | |
bc4b25b9c24ef0db58acbd1c8e24b3fee319314b | Solve challenge 13 | Challenges/chall_13.py | Challenges/chall_13.py | Python | 0.001318 | @@ -0,0 +1,955 @@
+#!/Applications/anaconda/envs/Python3/bin%0A# Python challenge - 13%0A# http://www.pythonchallenge.com/pc/return/disproportional.html%0A# http://www.pythonchallenge.com/pc/phonebook.php%0A%0Aimport xmlrpc.client%0A%0Adef main():%0A '''%0A Hint: phone that evil%0A %3Carea shape=%22circle%22 c... | |
78ea9019850dbf9b88d3f65a4a61139f01d2c496 | Add scratch genbank-gff-to-nquads.py which just opens a gff file atm | src/genbank-gff-to-nquads.py | src/genbank-gff-to-nquads.py | Python | 0 | @@ -0,0 +1,230 @@
+#!/usr/bin/env python%0A%0Aimport jargparse%0A%0Aparser = jargparse.ArgParser('Convert Genbank GFF into an n-quad file')%0Aparser.add_argument('gffPath', help='path to the GFF')%0Aargs = parser.parse_args()%0A%0Awith open(args.gffPath):%0A pass%0A
| |
48b724d7a2163c50be60d98933132b51347940bd | Create longest-line-of-consecutive-one-in-a-matrix.py | Python/longest-line-of-consecutive-one-in-a-matrix.py | Python/longest-line-of-consecutive-one-in-a-matrix.py | Python | 0.999548 | @@ -0,0 +1,853 @@
+# Time: O(m * n)%0A# Space: O(n)%0A%0Aclass Solution(object):%0A def longestLine(self, M):%0A %22%22%22%0A :type M: List%5BList%5Bint%5D%5D%0A :rtype: int%0A %22%22%22%0A if not M: return 0%0A result = 0%0A dp = %5B%5B%5B0%5D * 4 for _ in xrange(le... | |
148b2d3c9025f234ecc3ede02c39cfcb6295f39a | 1089. Duplicate Zeros | problems/test_1089_manual_copy.py | problems/test_1089_manual_copy.py | Python | 0.999999 | @@ -0,0 +1,957 @@
+import unittest%0Afrom typing import List%0A%0Aimport utils%0A%0A%0A# O(n) time. O(1) space. Array.%0Aclass Solution:%0A def duplicateZeros(self, arr: List%5Bint%5D) -%3E None:%0A %22%22%22%0A Do not return anything, modify arr in-place instead.%0A %22%22%22%0A num_zero... | |
23138ab91e5ac0ecf92a0968bf8e4abfa7d0c763 | Remove duplicates in all subdirectories - working raw version. | removedups.py | removedups.py | Python | 0 | @@ -0,0 +1,2438 @@
+import hashlib, csv, os%0A%0Adef md5(fname):%0A hash_md5 = hashlib.md5()%0A with open(fname, %22rb%22) as f:%0A for chunk in iter(lambda: f.read(4096), b%22%22):%0A hash_md5.update(chunk)%0A return hash_md5.hexdigest()%0A%0Adef process_directory_csv(current_dir_fullpath, s... | |
59736ee4dd82da7f7945723ec1cc89b19359b5c7 | Create LargestPrimeFactor.py | LargestPrimeFactor.py | LargestPrimeFactor.py | Python | 0.999046 | @@ -0,0 +1,382 @@
+#! Christian Ng%0Abase = 0%0Aprint(%22Enter an integer:%22)%0Abase = int(raw_input())%0Aprint %22Largest Factor is:%22%0A%0Awhile (base %25 2) == 0:%0A base = base/2%0A %0Aif base == 1 or base == -1:%0A%09print %222%22%0A%0Aincrement = 3%0A%0Awhile base != 1 and base != -1: %0A %0A while ... | |
e4414527c2d09bb03fa2a1ca0bb6f001ce43bcf4 | Upgrade Robot | lib/robot/writer/formatters.py | lib/robot/writer/formatters.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0.000001 | @@ -3664,16 +3664,59 @@
return
+table.type in %5B'test case', 'keyword'%5D and
bool(tab
|
99395e345f74bbedd29fd45eebe0738a3b5f4729 | Test api endpoint for package show | ckanext/archiver/tests/test_api.py | ckanext/archiver/tests/test_api.py | Python | 0 | @@ -0,0 +1,1455 @@
+import pytest%0Aimport tempfile%0A%0Afrom ckan import model%0Afrom ckan import plugins%0Afrom ckan.tests import factories%0Aimport ckan.tests.helpers as helpers%0A%0Afrom ckanext.archiver import model as archiver_model%0Afrom ckanext.archiver.tasks import update_package%0A%0A%0A@pytest.mark.usefixtu... | |
070a5192e4473bbbbf25a881080413f771f05801 | Add mockldap.ldap.functions taken from python-ldap | src/mockldap/ldap/functions.py | src/mockldap/ldap/functions.py | Python | 0.000001 | @@ -0,0 +1,601 @@
+import sys%0Afrom ldapobject import LDAPObject%0A%0Adef initialize(uri,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None):%0A %22%22%22%0A Return LDAPObject instance by opening LDAP connection to%0A LDAP host specified by LDAP URL%0A%0A Parameters:%0A uri%0A LDAP URL containing a... | |
2f93251e77589c0edbb8e560940d29764caac9e0 | Test password update functionality | tests/blueprints/authentication/test_views_password_update.py | tests/blueprints/authentication/test_views_password_update.py | Python | 0 | @@ -0,0 +1,2839 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0A:Copyright: 2006-2016 Jochen Kupperschmidt%0A:License: Modified BSD, see LICENSE for details.%0A%22%22%22%0A%0Afrom byceps.services.authentication.password.models import Credential%0Afrom byceps.services.authentication.password import service as password_serv... | |
0c59028a1ef33b3627e65955bafbf9b415c9bc34 | Add 457_Circular_Array_Loop.py (#34) | python/457_Circular_Array_Loop.py | python/457_Circular_Array_Loop.py | Python | 0 | @@ -0,0 +1,1149 @@
+class Solution:%0A def circularArrayLoop(self, nums: List%5Bint%5D) -%3E bool:%0A for i in range(len(nums)):%0A if nums%5Bi%5D == 0:%0A continue%0A %0A # if slow and fast pointers collide, then there exists a loop%0A slow = i%0A ... | |
ae484c893c9cbef5a80b908ba254885e1db4d0b3 | Create 0015_auto_20200128_1045.py | bluebottle/activities/migrations/0015_auto_20200128_1045.py | bluebottle/activities/migrations/0015_auto_20200128_1045.py | Python | 0.000001 | @@ -0,0 +1,1320 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2020-01-28 09:45%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0Aimport django.utils.timezone%0A%0A%0Aclass Migration(migrations.... | |
a59aef7c780c4d940ff56fa34ddf38de46056a6f | add package py-flask-compress (#7713) | var/spack/repos/builtin/packages/py-flask-compress/package.py | var/spack/repos/builtin/packages/py-flask-compress/package.py | Python | 0 | @@ -0,0 +1,1717 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
d48b17dc82e359aca962449c6df51aaea88a11d3 | add resource manager tests | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | Python | 0.000008 | @@ -0,0 +1,527 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Test the Resource manager.%0A%0A%22%22%22%0Afrom pyvisa.testsuite.keysight_assisted_tests import require_virtual_instr%0Afrom pyvisa.testsuite.keysight_assisted_tests.test_resource_manager import (%0A TestResourceManager as BaseTestResourceManager,%0A TestReso... | |
d623140b606d7ec9b874419b4414833d669f5677 | add a way to set the last sync date | crate_project/apps/crate/management/commands/set_last_sync.py | crate_project/apps/crate/management/commands/set_last_sync.py | Python | 0.000026 | @@ -0,0 +1,314 @@
+import redis%0A%0Afrom django.conf import settings%0Afrom django.core.management.base import BaseCommand%0A%0A%0Aclass Command(BaseCommand):%0A%0A def handle(self, *args, **options):%0A r = redis.StrictRedis(**getattr(settings, %22PYPI_DATASTORE_CONFIG%22, %7B%7D))%0A if args:%0A ... | |
4fd3c2fb2ac14fcfc7183108d2d3c79377d85790 | read router for grouptagvalue instead of hardcoding default | src/sentry/models/grouptagvalue.py | src/sentry/models/grouptagvalue.py | """
sentry.models.grouptagvalue
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.db import connections, models
from django.db.models... | Python | 0 | @@ -291,16 +291,24 @@
, models
+, router
%0Afrom dj
@@ -2001,32 +2001,76 @@
a maximum cost%0A
+ using = router.db_for_read(cls)%0A
curs
@@ -2090,17 +2090,13 @@
ons%5B
-'default'
+using
%5D.cu
|
ca96e71995c9daa17323a3285bee71c8d334c11e | Add abstract classifier | assisstant/keyboard/classification/abstract_classifier.py | assisstant/keyboard/classification/abstract_classifier.py | Python | 0.999999 | @@ -0,0 +1,371 @@
+from abc import ABC, abstractmethod, abstractproperty%0Aclass AbstractClassifier(ABC):%0A def __init__(self, freqs, duration, data=None):%0A self.freqs = freqs%0A self.duration = duration%0A if data:%0A self.data = data%0A self.train(data)%0A%0A @abstractmethod%0A ... | |
e089107eb52c320309b3ddd2ea2b6e764f74ff09 | Create LeverBox.py | _includes/LeverBox.py | _includes/LeverBox.py | Python | 0 | @@ -0,0 +1,1424 @@
+State_Probs = %7B(9,1,1,1,1,1,1,1,1,1) : 1%7D%0A%0Adef Modified_State(State,Indexes):%0A%09%0A%09New_State_List = list(State)%0A%09for i in Indexes:%0A%09%09New_State_List%5Bi%5D = 1%0A%09New_State = tuple(New_State_List)%0A%09return New_State%0A%0Adef Best_Case_Prob_For(State,Sum):%0A%09%09%0A%09Be... | |
2eb090b406a341c3b225e59779d0046cf76efc6c | Add download_feeds.py script | download_feeds.py | download_feeds.py | Python | 0 | @@ -0,0 +1,551 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys, os%0Aimport boto3%0A%0Abucketname = 'static.ucldc.cdlib.org'%0Aprefix = 'merritt/'%0A%0As3 = boto3.resource('s3')%0Abucket = s3.Bucket(bucketname)%0A%0Afor obj in bucket.objects.filter(Prefix=prefix):%0A if obj.key.endswith('.atom'):... | |
494c0603c4aedb83852a008fad2139c469b537fd | Rename histograms in memory_benchmark_unittest. | tools/perf/perf_tools/memory_benchmark_unittest.py | tools/perf/perf_tools/memory_benchmark_unittest.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from perf_tools import memory_benchmark
from telemetry.page import page_benchmark_unittest_base
class MemoryBenchmarkUnitTest(
page_benchmark_unittest_... | Python | 0.000056 | @@ -827,17 +827,17 @@
s = %5B'V8
-_
+.
MemoryEx
@@ -887,33 +887,33 @@
'V8
-_
+.
MemoryHeapSample
@@ -961,17 +961,17 @@
'V8
-_
+.
MemoryHe
|
0ea6bab984abee943d93cdfa90273b7a7aabcf8f | add new package : brltty (#15161) | var/spack/repos/builtin/packages/brltty/package.py | var/spack/repos/builtin/packages/brltty/package.py | Python | 0 | @@ -0,0 +1,1206 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Brltty(AutotoolsPackage):%0A %22%22%22BRLTTY is a backg... | |
a8c7d9a2ed9462506130157ce5eccad9121013a3 | add new package (#24004) | var/spack/repos/builtin/packages/r-afex/package.py | var/spack/repos/builtin/packages/r-afex/package.py | Python | 0 | @@ -0,0 +1,1690 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass RAfex(RPackage):%0A %22%22%22Analysis of Factorial Expe... | |
dee47d50ecf4f0e80a127d624027c1688d34b504 | Use 0/1 for raspberry pi cover GPIO writes rather than true/false (#13610) | homeassistant/components/cover/rpi_gpio.py | homeassistant/components/cover/rpi_gpio.py | """
Support for controlling a Raspberry Pi cover.
Instructions for building the controller can be found here
https://github.com/andrewshilliday/garage-door-controller
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.rpi_gpio/
"""
import logging
from... | Python | 0.001824 | @@ -2964,35 +2964,36 @@
elf._relay_pin,
-not
+0 if
self._invert_re
@@ -2991,24 +2991,31 @@
invert_relay
+ else 1
)%0A%0A @prop
@@ -3478,24 +3478,29 @@
._relay_pin,
+ 1 if
self._inver
@@ -3506,16 +3506,23 @@
rt_relay
+ else 0
)%0A
@@ -3594,19 +3594,20 @@
ay_pin,
-not
+0 if
self._i
@@ -3617,16 +36... |
c8cc7f6fe7c0f59697972602773d67b3fde40360 | Add basic filter classes. | penchy/filters.py | penchy/filters.py | Python | 0 | @@ -0,0 +1,639 @@
+class Filter(object):%0A %22%22%22%0A Base class for filters.%0A%0A Inheriting classes must implement:%0A - %60%60run(*inputs)%60%60 to run the filter on inputs which can be Producer or%0A Filter instances, after executing self.out has to be set to the%0A path of the p... | |
d46607c0d06e66346e2fddc76a28c9e8773c6d71 | Add option to specify the location of the API (fixes #8115) (#8118) | homeassistant/components/sensor/pi_hole.py | homeassistant/components/sensor/pi_hole.py | """
Support for getting statistical data from a Pi-Hole system.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.pi_hole/
"""
import logging
import json
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_va... | Python | 0 | @@ -607,14 +607,8 @@
= '/
-admin/
api.
@@ -739,33 +739,88 @@
y'%0A%0A
-DEFAULT_HOST = 'localhost
+CONF_LOCATION = 'location'%0ADEFAULT_HOST = 'localhost'%0A%0ADEFAULT_LOCATION = 'admin
'%0ADE
@@ -1536,32 +1536,102 @@
L): cv.boolean,%0A
+ vol.Optional(CONF_LOCATION, default=DEFAULT_LOCATION): cv.string,%0A
... |
8b95f442f3e78a5f3de539075379b88fc940e818 | add custom settings for momza | casepro/settings_production_momza.py | casepro/settings_production_momza.py | Python | 0 | @@ -0,0 +1,1471 @@
+from __future__ import unicode_literals%0Aimport os%0A%0A# import our default settings%0Afrom settings_production import * # noqa%0A%0A# Pods%0APODS = %5B%7B%0A 'label': %22family_connect_registration_pod%22,%0A 'title': %22Registration Information%22,%0A 'url': os.environ.get('REGISTRATIO... | |
797249c42c8c1c0d6eda05dbf9e9d16d2706b373 | Add LeNet example with custom scoring and train_samples_per_iteration. | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | Python | 0 | @@ -0,0 +1,868 @@
+from __future__ import print_function%0Aimport sys, os%0Asys.path.insert(1, os.path.join(%22..%22,%22..%22,%22..%22))%0Aimport h2o%0Afrom tests import pyunit_utils%0Afrom h2o.estimators.deepwater import H2ODeepWaterEstimator%0A%0Adef deepwater_lenet():%0A print(%22Test checks if Deep Water works fin... | |
26d095d44a02862a4d567537e824170e75930a9a | add email people script | fantasydota/scripts/email_users.py | fantasydota/scripts/email_users.py | Python | 0.000003 | @@ -0,0 +1,1151 @@
+from fantasydota import DBSession%0Afrom fantasydota.models import User%0Afrom pyramid_mailer import Mailer%0Afrom pyramid_mailer.message import Message%0A%0A%0Adef email_users():%0A session = DBSession()%0A for user in session.query(User).filter(User.email.isnot(%22%22)).all():%0A if u... | |
8cdbbbaf33cd09bc742761ce8cd5b79b185710cd | Introduce a timer based update of activities | webtool/server/management/commands/timer_update.py | webtool/server/management/commands/timer_update.py | Python | 0 | @@ -0,0 +1,2822 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import%0Afrom __future__ import unicode_literals%0Afrom __future__ import print_function%0A%0Aimport io%0A%0Aimport datetime%0Afrom django.core.management.base import BaseCommand%0A%0Afrom server.models import Instruction, Tour, Talk, Session... | |
eceee762dd3773aacceb52119014dad88e363c8d | Create find_subnets_with_broker.py | python/NetMRI_GUI_Python/find_subnets_with_broker.py | python/NetMRI_GUI_Python/find_subnets_with_broker.py | Python | 0.000001 | @@ -0,0 +1,771 @@
+# BEGIN-SCRIPT-BLOCK%0A#%0A# Script-Filter:%0A# true%0A#%0A# END-SCRIPT-BLOCK%0A%0Afrom infoblox_netmri.easy import NetMRIEasy%0Aimport re%0A%0A# This values will be provided by NetMRI before execution%0Adefaults = %7B%0A %22api_url%22: api_url,%0A %22http_username%22: http_username,%0A ... | |
c96b885d4446db96402d9770d71012dbcafcb8cf | install go-vcf-tools by manage.py command | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | Python | 0 | @@ -0,0 +1,1410 @@
+import os%0Aimport glob%0Aimport shutil%0Aimport tarfile%0Aimport platform%0A%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom django.conf import settings%0A%0Afrom lib.utils.io import get_url_content%0Afrom lib.utils import clogging%0Alog = clogging.getColorLogger(__name__... | |
76fbec63667f3844f2763d72e57e61c07209cdad | Create Meh.py | Meh/Meh.py | Meh/Meh.py | Python | 0.000001 | @@ -0,0 +1,363 @@
+import discord%0Afrom discord.ext import commands%0A%0Aclass Mycog:%0A %22%22%22My custom cog that does stuff!%22%22%22%0A%0A def __init__(self, bot):%0A self.bot = bot%0A%0A @commands.command()%0A async def mycom(self):%0A %22%22%22This does stuff!%22%22%22%0A%0A #Yo... | |
6bbac26ffb6f2131cad62df48b5afa3849ee8276 | add parameter 'force' in method 'init' to reinitialize existing parameters This is useful when creating a new database from a dump (reinitialize database.uuid, etc.) | openerp/addons/base/ir/ir_config_parameter.py | openerp/addons/base/ir/ir_config_parameter.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | Python | 0.000188 | @@ -1919,19 +1919,32 @@
self, cr
+, force=False
):%0A
-
@@ -2013,16 +2013,79 @@
meters.%0A
+ It overrides existing parameters if force is %60%60True%60%60.%0A
@@ -2146,16 +2146,108 @@
tems():%0A
+ # force=True skips search and always performs the 'if' body (because ids=False)%0... |
6693172856655329d99f038d54b1d8819fc1a9b6 | Add native code emitters example. | scripts/examples/02-Board-Control/native_emitters.py | scripts/examples/02-Board-Control/native_emitters.py | Python | 0 | @@ -0,0 +1,229 @@
+import time%0A%0A@micropython.asm_thumb%0Adef asm():%0A movw(r0, 42)%0A%0A@micropython.viper%0Adef viper(a, b):%0A return a + b%0A%0A@micropython.native%0Adef native(a, b):%0A return a + b%0A%0A%0Aprint(asm())%0Aprint(viper(1, 2))%0Aprint(native(1, 2))%0A%0A
| |
5cb43fbf0efadff7af68836243eb7e1711e7df1c | Add test_object script | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | Python | 0.000002 | @@ -0,0 +1,601 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0Aimport rospy%0Afrom jsk_2014_picking_challenge.msg import ObjectRecognition%0A%0Aleft_result = None%0Aright_result = None%0A%0Adef _cb_left(msg):%0A global left_result%0A left_result = dict(zip(msg.candidates, msg.probabilities))%0A%0Adef _c... | |
f56e86ff774a55e7882957a8928bdca98ce4c3e8 | Add missing migration | features/groups/migrations/0017_auto_20171127_1447.py | features/groups/migrations/0017_auto_20171127_1447.py | Python | 0.0002 | @@ -0,0 +1,639 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.7 on 2017-11-27 13:47%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport features.stadt.forms%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('groups', '0016_auto_2... | |
afedd723ad85b99c2ebd08246b5ed13b37cd62e9 | make psnr.py | src/psnr.py | src/psnr.py | Python | 0.001547 | @@ -0,0 +1,107 @@
+#%0A# psnr.py%0A# Created by pira on 2017/08/05.%0A#%0A%0A#coding: utf-8%0Au%22%22%22For PSNR(Peak Signal to Noise Ratio).%22%22%22
| |
5bb154f41f25d8c9bbd9067b29a03a5fc2dff371 | Add functional tests for floating IP. | openstack/tests/functional/network/v2/test_floating_ip.py | openstack/tests/functional/network/v2/test_floating_ip.py | Python | 0.000116 | @@ -0,0 +1,2796 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in wri... | |
a5720071a950185e5afb1992dd4b66b47aefc242 | Bump version 0.2.5 | accounting/__init__.py | accounting/__init__.py | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 4)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | Python | 0.000001 | @@ -84,17 +84,17 @@
(0, 2,
-4
+5
)%0A%0A%0Adef
|
fa6060a21767a0b5b2b3a10e4301e0c1a30134cb | Test the lit0,cmp before bra eliminator | i8c/tests/test_opt_lit0_cmp_before_bra.py | i8c/tests/test_opt_lit0_cmp_before_bra.py | Python | 0 | @@ -0,0 +1,709 @@
+from i8c.tests import TestCase%0A%0ASOURCE1 = %22%22%22%5C%0Adefine test::optimize_cmp_bra_const_const returns ptr%0A argument ptr x%0A%0A dup%0A load NULL%0A beq return_the_null%0A deref ptr%0A return%0Areturn_the_null:%0A%22%22%22%0A%0ASOURCE2 = %22%22%22%5C%0Adefine test::optimiz... | |
7be2721bfcbf3376ddce4d58f2cfe9680803f9bb | Create center_dmenu script. | center_dmenu.py | center_dmenu.py | Python | 0 | @@ -0,0 +1,1264 @@
+#!/usr/bin/env python2%0Afrom Xlib import display%0Aimport sys%0Afrom os import system%0A%0A%0Adef get_dimensions():%0A current_display = display.Display()%0A current_screen = current_display.screen()%0A return (current_screen%5B'width_in_pixels'%5D,%0A current_screen%5B'height_i... | |
a737c7cd26450ac5dfdab23aea6902f53976c538 | fix version in xformhistory for multiple xml versions | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | Python | 0 | @@ -0,0 +1,2097 @@
+import os%0Afrom onadata.settings.local_settings import XML_VERSION_MAX_ITER%0Afrom onadata.apps.fsforms.models import XformHistory%0Afrom django.core.management.base import BaseCommand%0Aimport re%0Aimport datetime%0A%0Adef check_version(instance, n):%0A for i in range(n, 0, -1):%0A p = r... | |
3837329e0d49796cfe9eabd2aeb026c206c5c4d8 | add admin ui for user upload record | corehq/apps/user_importer/admin.py | corehq/apps/user_importer/admin.py | Python | 0 | @@ -0,0 +1,855 @@
+import zipfile%0A%0Afrom io import BytesIO%0A%0Afrom django.contrib import admin%0Afrom django.http.response import HttpResponse%0A%0Afrom .models import UserUploadRecord%0A%0A%0Aclass UserUploadAdmin(admin.ModelAdmin):%0A list_display = ('domain', 'date_created')%0A list_filter = ('domain',)%0... | |
ba5a358ffefb5646a3911fafe2c394c9c52905f7 | add import script for Horsham | polling_stations/apps/data_collection/management/commands/import_horsham.py | polling_stations/apps/data_collection/management/commands/import_horsham.py | Python | 0 | @@ -0,0 +1,343 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E07000227'%0A addresses_name = 'Democracy_Club__04May2017.tsv'%0A stations_name = 'Democracy_Club__04May2017.tsv'%0A elections = %5B'... | |
3d4e3be7624f099f9b15c24a9161f474a733ebff | add a script for manual fixing of user profiles. Now I will fix the bug in the code… | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py | Python | 0 | @@ -0,0 +1,293 @@
+%0Afrom oneflow.profiles.models import UserProfile%0Aimport ast%0A%0Afor p in UserProfile.objects.all():%0A if type(p.data) == type(u''):%0A p.data = %7B%7D%0A%0A if type(p.register_request_data) == type(u''):%0A p.register_request_data = ast.literal_eval(p.register_request_data)%... | |
a3a48824b36ef62edaf128379f1baec5482166e7 | Save error_message for resources (SAAS-982) | src/nodeconductor_saltstack/migrations/0005_resource_error_message.py | src/nodeconductor_saltstack/migrations/0005_resource_error_message.py | Python | 0 | @@ -0,0 +1,650 @@
+# -*- 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 ('nodeconductor_saltstack', '0004_remove_useless_spl_fields'),%0A %5D%0A%0A operations = %5B%0A ... | |
bfb51cadc66f34a67686bef3b15e9197c9d0617b | Create ping_help.py | ping_help.py | ping_help.py | Python | 0.000023 | @@ -0,0 +1,237 @@
+import time%0Aimport subprocess%0Aimport os%0A%0Ahostname=raw_input('')%0A%0A#while 1:%0Aos.system(%22ping -c 10 -i 5 %22 + hostname + %22 %3E1.txt%22)%0Aos.system(%22awk -F'%5B= %5D' '%7Bprint $6,$10%7D' %3C 1.txt %3Efinal.txt%22)%0Aos.system(%22grep %5B0-9%5D final.txt %3Efinal1.txt%22)%0A%0A
| |
dacffcb3e79877e1ea5e71d1a2e67bd4edd865bf | Add SettingOverrideModel that exposes a SettingOverrideDecorator to QML | plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py | plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py | Python | 0 | @@ -0,0 +1,2061 @@
+# Copyright (c) 2015 Ultimaker B.V.%0A# Uranium is released under the terms of the AGPLv3 or higher.%0A%0Afrom PyQt5.QtCore import Qt, pyqtSlot, QUrl%0A%0Afrom UM.Application import Application%0Afrom UM.Qt.ListModel import ListModel%0A%0Aclass SettingOverrideModel(ListModel):%0A KeyRole = Qt.Use... | |
3652f1c666f3bf482862727838f0b4bbc9fea5e9 | fix bug 1076270 - add support for Windows 10 | alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py | alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py | Python | 0 | @@ -0,0 +1,924 @@
+%22%22%22bug 1076270 - support windows 10%0A%0ARevision ID: 17e83fdeb135%0ARevises: 52dbc7357409%0ACreate Date: 2014-10-03 14:03:29.837940%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '17e83fdeb135'%0Adown_revision = '52dbc7357409'%0A%0Afrom alembic import op%0Afrom socor... | |
f5ada694fae30f15498c775e8c4aa14a08459251 | Add slogan plugin | plugins/slogan.py | plugins/slogan.py | Python | 0.000001 | @@ -0,0 +1,586 @@
+import re%0Aimport requests%0Aimport urllib.parse%0A%0Aclass Plugin:%0A def __call__(self, bot):%0A bot.on_respond(r%22slogan(?:ise)? (.*)$%22, self.on_respond)%0A bot.on_help(%22slogan%22, self.on_help)%0A%0A def on_respond(self, bot, msg, reply):%0A url = %22http://www.sl... | |
779fb015913a17fcb8fb290515845e6b47c3ae50 | Create the converter (with span-conversion functionality) | latex2markdown.py | latex2markdown.py | Python | 0 | @@ -0,0 +1,680 @@
+%22%22%22%0AA Very simple tool to convert latex documents to markdown documents%0A%22%22%22%0Aimport re%0A%0A%0Aspan_substitutions = %5B%0A (r'%5C%5Cemph%5C%7B(.+)%5C%7D', r'*%5C1*'),%0A (r'%5C%5Ctextbf%5C%7B(.+)%5C%7D', r'**%5C1**'),%0A (r'%5C%5Cverb;(.+);', r'%60%5C1%60'),%0A ... | |
1ede6cd46c0fdde24a3e859e125a8c4929cd7170 | Add test for no task | projects/tests/test_resources.py | projects/tests/test_resources.py | import sure
from mock import MagicMock
from django.contrib.auth.models import User
from tastypie.test import ResourceTestCase
from tools.tests import MockGithubMixin
from tasks.models import Tasks
from .. import models
from . import factories
class ProjectsResourceCase(MockGithubMixin, ResourceTestCase):
"""User ... | Python | 0.999172 | @@ -5908,8 +5908,355 @@
sk_id))%0A
+%0A def test_attach_last_task_without_tasks(self):%0A %22%22%22Test attach last task without tasks%22%22%22%0A project = factories.ProjectFactory(owner=self.user)%0A response = self.api_client.get(%0A '%7B%7D%7B%7D/?with_last_task=true'.format(self... |
af86a3ad67747ea42fe2ed6a40d582c10fce319e | fix error when open subreddit | rtv/subreddit.py | rtv/subreddit.py | import curses
import sys
import webbrowser
from requests.exceptions import HTTPError
from .errors import SubredditNameError
from .page import BasePage
from .submission import SubmissionPage
from .content import SubredditContent
from .utils import LoadScreen, text_input, display_message, Color, ESCAPE
class SubredditP... | Python | 0.000005 | @@ -2318,16 +2318,38 @@
.derwin(
+1, n_cols-len(prompt),
n_rows-1
@@ -4162,8 +4162,9 @@
.YELLOW)
+%0A
|
2fdabf544c75096efafe2d14988efa28619643ab | add scheme | app/scheme_mongodb.py | app/scheme_mongodb.py | Python | 0.000032 | @@ -0,0 +1,2794 @@
+import pymongo%0Aimport bson%0Afrom bson import json_util%0Aimport warnings%0Afrom cStringIO import StringIO%0Afrom pymongo import Connection, uri_parser%0Aimport bson.son as son%0Aimport json%0Aimport logging%0A%0Adef open(url=None, task=None):%0A #parses a mongodb uri and returns the database%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.