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 |
|---|---|---|---|---|---|---|---|
6fb3c87f0f9b238eab71df6880568005e3a2b461 | add DuckDuckGo Instant Answer plugin | plugins/ddg.py | plugins/ddg.py | Python | 0.000002 | @@ -0,0 +1,1516 @@
+# coding=utf-8%0A%0Aimport json%0Aimport urllib.request%0A%0A@yui.threaded%0A@yui.command('duckduckgo', 'ddg')%0Adef ddg(argv):%0A '''Returns the Instant Answer for a given query. Usage: ddg -lang %3Cquery%3E'''%0A lang = 'en_US'%0A if len(argv) %3C 1:%0A return%0A%0A # check if a... | |
176940b006df7aeb759c3a985bd636887955926a | fix for issue 524 | pyglet/app/cocoa.py | pyglet/app/cocoa.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | Python | 0 | @@ -2259,16 +2259,74 @@
_menu()%0A
+ NSApp().setActivationPolicy_(0) # Mac OS X 10.6 %0A
|
e8576b67f8a3778c43a85e24d1cbc0e1985fe2ca | Add float.is_integer() example | trypython/basic/builtinfunc/float01.py | trypython/basic/builtinfunc/float01.py | Python | 0.002001 | @@ -0,0 +1,549 @@
+%22%22%22%0A%E7%B5%84%E3%81%BF%E8%BE%BC%E3%81%BF%E3%82%AF%E3%83%A9%E3%82%B9 float %E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99.%0A%0Afloat.is_integer() %E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%0A%22%22%22%0Afrom trypython.common.commoncls import SampleBase%0Afrom trypython.common.commo... | |
3b41e3bcc721d47ce5a7314af2ac4d9006598164 | add word class | pythonfiles/word.py | pythonfiles/word.py | Python | 0.006846 | @@ -0,0 +1,961 @@
+%0A#Comtains models for storing words and data returned from parsing websites%0A#%0Aclass word(object):%0A def __init__(self,name=None,part_of_speech=None,definition=None,context=None,subwords=None,count=None,rating=None):%0A self.name=name%0A self.part_of_speech=part_of_speech%0A se... | |
83f6febfc051c8d7d3462e9a60f4eae036fa0529 | guessing the number genetic algorithm | numberGuesser.py | numberGuesser.py | Python | 0.999916 | @@ -0,0 +1,1168 @@
+import random%0Aimport time%0A%0A%0Adef go(lower_bound, upper_bound, bots):%0A iterations = 1%0A target = random.randint(lower_bound, upper_bound)%0A%0A while True:%0A print(f%22Target number: %7Btarget%7D%22)%0A answers = %5Brandom.randint(lower_bound, upper_bound)%0A ... | |
6ac6202837cade41b1dad5af9a474be171255993 | Check that Constant is given Moments instance, not class | bayespy/inference/vmp/nodes/constant.py | bayespy/inference/vmp/nodes/constant.py | ################################################################################
# Copyright (C) 2011-2012,2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
import numpy as np
from .node import Node
class Constant(N... | Python | 0.998847 | @@ -295,16 +295,25 @@
ort Node
+, Moments
%0A%0Aclass
@@ -475,32 +475,196 @@
, x, **kwargs):%0A
+ if not isinstance(moments, Moments) and issubclass(moments, Moments):%0A raise ValueError(%22Give moments as an object instance instead of a class%22)%0A
self._mo
|
435004cebce00510db3bf36ae21b2cbf37020f32 | add petpvc specs file | nipype/interfaces/tests/test_auto_PETPVC.py | nipype/interfaces/tests/test_auto_PETPVC.py | Python | 0 | @@ -0,0 +1,1545 @@
+# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT%0Afrom ...testing import assert_equal%0Afrom ..petpvc import PETPVC%0A%0A%0Adef test_PETPVC_inputs():%0A input_map = dict(alpha=dict(argstr='-a %25.4f',%0A ),%0A args=dict(argstr='%25s',%0A ),%0A debug=dict(argstr='-d',%0A usede... | |
99e531ec0e86d7c1d34de154cc49584821f85904 | Make all metavars uppercased | powerline/commands/config.py | powerline/commands/config.py | # vim:fileencoding=utf-8:noet
from __future__ import (division, absolute_import, print_function)
import argparse
import powerline.bindings.config as config
class StrFunction(object):
def __init__(self, function, name=None):
self.name = name or function.__name__
self.function = function
def __call__(self, *ar... | Python | 0.999999 | @@ -1350,30 +1350,30 @@
%0A%09%09metavar='
-action
+ACTION
',%0A%09%09type=(l
@@ -1713,22 +1713,22 @@
etavar='
-action
+ACTION
',%0A%09%09hel
@@ -2015,25 +2015,25 @@
etavar='
-component
+COMPONENT
',%0A%09)%0A%09s
|
e3211df0a22571c9bd95f51d98dcc69dce7847aa | convert CT_GraphicalObjectData to xmlchemy | pptx/oxml/shapes/graphfrm.py | pptx/oxml/shapes/graphfrm.py | # encoding: utf-8
"""
lxml custom element class for CT_GraphicalObjectFrame XML element.
"""
from __future__ import absolute_import
from .. import parse_xml
from ..ns import nsdecls, qn
from .shared import BaseShapeElement
from .table import CT_Table
from ..xmlchemy import BaseOxmlElement, OneAndOnlyOne
class CT_G... | Python | 0.999995 | @@ -300,16 +300,27 @@
dOnlyOne
+, ZeroOrOne
%0A%0A%0Aclass
@@ -728,150 +728,23 @@
-@property%0A def tbl(self):%0A %22%22%22%0A The contained table object, or %7CNone%7C if not present.%0A %22%22%22%0A return self.find(qn
+tbl = ZeroOrOne
('a:
@@ -748,17 +748,16 @@
'a:tbl')
-)
%... |
c94653382a5a8aa2ec9af94f3aaa02ed5cae9b4c | Create test_send_sms.py | test_send_sms.py | test_send_sms.py | Python | 0.000002 | @@ -0,0 +1,1216 @@
+import serial%0Afrom curses import ascii%0A# since we need ascii code from CTRL-Z%0Aimport time%0A%0A# here we are testing sending an SMS via virtual serial port ttyUSB0 that was created by a USB serial modem%0A%0Aphonenumber = #enter phone number to send SMS to e.g. %22+441234123123%22%0ASMS = %22h... | |
c4f0d10e2112a391f716f58ffa449a490549fac6 | find kth smallest | Python/kthsmallest.py | Python/kthsmallest.py | Python | 0.999975 | @@ -0,0 +1,1078 @@
+'''%0AFind the k-th smallest element in a union of two given sorted arrays,%0Aa and b%0A'''%0A%0A# O(k) implementation%0Adef findkth(a, b, k):%0A %0A i = 0%0A j = 0%0A found = 1%0A while i %3C len(a) and j%3C len(b):%0A if a%5Bi%5D %3C b%5Bj%5D:%0A smaller = a%5Bi%5... | |
1dad9de4cf94d7f321176cf5b339b1a68f4ac6d2 | Add template to LanguageAdmin; #551 | judge/admin/runtime.py | judge/admin/runtime.py | from django.db.models import TextField
from django.forms import TextInput, ModelForm, ModelMultipleChoiceField
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from reversion.admin import VersionAdmin
from judge.models impor... | Python | 0 | @@ -871,16 +871,28 @@
iption',
+ 'template',
'proble
|
e262d176ecd7d8871a9e06ebc542cf473acf0925 | Add migration for transnational weights | reports/migrations/0004_transnational_weights.py | reports/migrations/0004_transnational_weights.py | Python | 0.000016 | @@ -0,0 +1,1040 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Afrom django_countries import countries%0A%0Adef populate_weights(apps, schema_editor):%0A Weights = apps.get_model(%22reports%22, %22Weights%22)%0A db_alias = schema_editor.connection.alia... | |
6ff99aa939bf07d18595507efeca6ada7fc267a5 | add a test thing for wilk | tools/ast-env.py | tools/ast-env.py | Python | 0.000003 | @@ -0,0 +1,2003 @@
+#!/usr/bin/env python%0A%0Aif __name__ == '__main__':%0A import os%0A import sys%0A import copy%0A import json%0A%0A sys.path.append(os.path.dirname(__file__))%0A%0A import logging%0A%0A logging.basicConfig(level=logging.DEBUG)%0A%0A import roush.db.database%0A from roush.... | |
b0577ce3b8b162ce3702430b189905f9beaae8d5 | Add script to clean up all FD phone and fax numbers. | firecares/firestation/management/commands/cleanup_phonenumbers.py | firecares/firestation/management/commands/cleanup_phonenumbers.py | Python | 0 | @@ -0,0 +1,1445 @@
+from django.core.management.base import BaseCommand%0Afrom firecares.firestation.models import FireDepartment%0Afrom phonenumber_field.modelfields import PhoneNumber%0Aimport re%0A%0A%22%22%22%0AThis command is for cleaning up every phone and fax number in the%0Adatabase. It removes all non-numeric ... | |
370fa8682b09de76af36129817e412270c8206c8 | add a new mgmt command for data analysis: compute the intersections of every pair of boundaries | boundaries/management/commands/compute_intersections.py | boundaries/management/commands/compute_intersections.py | Python | 0.000158 | @@ -0,0 +1,1548 @@
+from optparse import make_option%0A%0Afrom django.conf import settings%0Afrom django.core.management.base import BaseCommand%0Afrom django.contrib.gis.geos import MultiPolygon, Polygon%0A%0Afrom boundaries.models import BoundarySet, Boundary%0A%0Aclass Command(BaseCommand):%0A%09help = 'Create a rep... | |
66306f46417e8b0caa6b4e6d13d72e5ae6b226ef | include builds | corehq/apps/app_manager/management/commands/migrate_to_conditional_case_update.py | corehq/apps/app_manager/management/commands/migrate_to_conditional_case_update.py | from datetime import datetime
import traceback
from corehq.apps.app_manager.dbaccessors import wrap_app
from corehq.apps.app_manager.management.commands.helpers import AppMigrationCommandBase
from corehq.apps.domain.models import Domain
import random
def get_new_case_update_json(name_path):
return {
'ques... | Python | 0 | @@ -681,20 +681,19 @@
uilds =
-Fals
+Tru
e%0A ch
|
7a75174716ecbc0757c84f29ebbb3fd309521936 | add management command to fire all repeaters in a domain | corehq/apps/cleanup/management/commands/fire_repeaters.py | corehq/apps/cleanup/management/commands/fire_repeaters.py | Python | 0 | @@ -0,0 +1,808 @@
+import datetime%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom corehq.apps.receiverwrapper.models import RepeatRecord%0Afrom dimagi.utils.post import simple_post%0A%0A%0Aclass Command(BaseCommand):%0A args = '%3Cdomain%3E'%0A help = 'Fire all repeaters in a domain.'%... | |
d5d3fcfb331c1486acbfb004705b94b1923a0db8 | Add code to dump features into libsvm file format | Codes/SuperEdge/SuperEdge/dump_libsvm.py | Codes/SuperEdge/SuperEdge/dump_libsvm.py | Python | 0 | @@ -0,0 +1,738 @@
+import numpy as np%0Afrom datetime import datetime%0Afrom sklearn.datasets import dump_svmlight_file%0Aimport os.path as path%0A%0Adef main():%0A cache_path = 'largecache/'%0A feat_name = 'feat.dat'%0A lbl_name = 'lbl.dat'%0A feat_len = 4224 #1088%0A now = datetime.now()%0A lbl_memm... | |
269f1b743583609ecdc7658e35073db9b985634c | rename http.py | examples/http_example.py | examples/http_example.py | Python | 0.00223 | @@ -0,0 +1,350 @@
+from poyonga.client import Groonga%0A%0Ag = Groonga()%0A%0Acmds = %5B(%22status%22, %7B%7D),%0A (%22log_level%22, %7B%22level%22: %22warning%22%7D),%0A #(%22table_create%22, %7B%22name%22: %22Site%22, %22flags%22: %22TABLE_HASH_KEY%22%7D),%0A (%22select%22, %7B%22table%22: %22Sit... | |
3d976002db5de89c23071f32e0df2663ab7fa657 | Fix bug in OpenCage geocoder. | geopy/geocoders/opencage.py | geopy/geocoders/opencage.py | """
:class:`.OpenCage` is the Opencagedata geocoder.
"""
from geopy.compat import urlencode
from geopy.geocoders.base import Geocoder, DEFAULT_TIMEOUT, DEFAULT_SCHEME
from geopy.exc import (
GeocoderQueryError,
GeocoderQuotaExceeded,
)
from geopy.location import Location
from geopy.util import logger
__all__... | Python | 0 | @@ -3857,38 +3857,40 @@
unds%0A if
-bounds
+language
:%0A pa
@@ -3920,38 +3920,39 @@
uage%0A if
-bounds
+country
:%0A pa
|
95b304d2f0a9dc851926506795310f96c3312682 | Add SQL example. | examples/sql_rockstar.py | examples/sql_rockstar.py | Python | 0.000001 | @@ -0,0 +1,177 @@
+from RockStar import RockStar%0A%0Asql_code = %22SELECT 'Hello World!';%22%0Arock_it_bro = RockStar(days=400, file_name='hello_world.sql', code=sql_code)%0Arock_it_bro.make_me_a_rockstar()%0A
| |
d5cf05e40b638afbf12fd95cf721a22ad0f3281d | Create appointments.py | backend/appointments.py | backend/appointments.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
dfd35c528004476e1ea534561835bcc167338c72 | Add common javascript mimetypes to be detected as TextResponses, also improve mimetype detection to avoid querying twice classes dict | scrapy/core/downloader/responsetypes/__init__.py | scrapy/core/downloader/responsetypes/__init__.py | """
This module implements a class which returns the appropiate Response class
based on different criterias.
"""
from os.path import abspath, dirname, join
from mimetypes import MimeTypes
from scrapy.http import Response
from scrapy.utils.misc import load_object
from scrapy.utils.python import isbinarytext
from scra... | Python | 0 | @@ -715,32 +715,214 @@
p.XmlResponse',%0A
+ 'application/json': 'scrapy.http.TextResponse',%0A 'application/javascript': 'scrapy.http.TextResponse',%0A 'application/x-javascript': 'scrapy.http.TextResponse',%0A
'text/xm
@@ -965,16 +965,18 @@
'text
+/*
': 'scra
@@ -1481,28 +1481,24 @@... |
b017c43c9bf46cd2e1fd7380904a1b022b6930ba | Create __init__.py | beprof/__init__.py | beprof/__init__.py | Python | 0.000006 | @@ -0,0 +1,5 @@
+pass%0A
| |
6ef879ffec5b182c62c3673be155a1911291aef6 | fix #563: split prog parts before formating in item's name | beetsplug/duplicates.py | beetsplug/duplicates.py | # This file is part of beets.
# Copyright 2013, Pedro Silva.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, mod... | Python | 0 | @@ -1766,24 +1766,10 @@
s =
-shlex.split(prog
+%5Bp
.for
@@ -1783,25 +1783,67 @@
e=item.path)
-)
+ for p in shlex.split(prog)%5D%0A print args
%0A key = a
|
753388550e4ea7a8b09ddb22189021be3585a5e5 | Clean PlexUpdate plugin | beetsplug/plexupdate.py | beetsplug/plexupdate.py | """Updates an Plex library whenever the beets library is changed.
Put something like the following in your config.yaml to configure:
plex:
host: localhost
port: 32400
"""
import requests
from urlparse import urljoin
import xml.etree.ElementTree as ET
from beets import config
from beets.plugins impo... | Python | 0 | @@ -334,142 +334,8 @@
n%0A%0A%0A
-# Global variable to detect if database is changed that the update%0A# is only run once before beets exists.%0Adatabase_changed = False%0A%0A%0A
def
@@ -1441,35 +1441,46 @@
2400%7D)%0A%0A
-%0A@PlexUpdate.
+ self.register_
listen
+er
('databa
@@ -1489,18 +1489,50 @@
_chang... |
e5bdbfb075bf95b7834f2db8c7d6ffa69cb03bc0 | Create convnet_basic.py | Classifying_datasets/statoil/convnet_basic.py | Classifying_datasets/statoil/convnet_basic.py | Python | 0.000004 | @@ -0,0 +1,4 @@
+adi%0A
| |
6f3bb73dd387fd73022a20c3a45adf05213339cf | add new package (#20109) | var/spack/repos/builtin/packages/py-rosinstall-generator/package.py | var/spack/repos/builtin/packages/py-rosinstall-generator/package.py | Python | 0 | @@ -0,0 +1,840 @@
+# 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%0A%0Aclass PyRosinstallGenerator(PythonPackage):%0A %22%22%22A tool for generating rosinstal... | |
a2516d28c86fd23efcb893e59de42b33526bfe6f | Add a Python Tkinter example showing how to map a scale widget. | swig/tkgui.py | swig/tkgui.py | Python | 0 | @@ -0,0 +1,805 @@
+#!/usr/bin/env python%0A%0Aimport Tkinter%0Aimport sys%0Aimport mapper%0A%0Adef on_gui_change(x):%0A# print 'on_gui_change',x,x.__class__%0A sig_out.update_scalar(int(x))%0A%0Adef on_mapper_change(sig, x):%0A# print 'on_mapper_change', x, x.__class__%0A w.set(int(x))%0A%0Adev = mapper.dev... | |
99578401585435c08aed6f29e090fbde955423fd | Create good2d.py | rocksetta-examples/good2d.py | rocksetta-examples/good2d.py | Python | 0.000004 | @@ -0,0 +1,949 @@
+import tensorflow as tf%0Aimport numpy as np%0A%0A# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3%0Ax_data = np.random.rand(100).astype(%22float32%22)%0Ay_data = x_data * 0.1 + 0.3%0A%0A# Try to find values for W and b that compute y_data = W * x_data + b%0A# (We know that W should be... | |
35e51f55adfbe8383bfb3d34688eb7aee89a8351 | add shuffle_by_year script, to toss messages into yearly folders | shuffle_by_year.py | shuffle_by_year.py | Python | 0 | @@ -0,0 +1,1881 @@
+#!/usr/bin/env python%0A%0A# Q&D script to sort mail into subfolders by year.%0A# Reduces the burden upon the filesystem gnomes.%0A%0ADIRPATH = %22/stor0/backups/imapbak/rtucker/Fastmail-rey_fmgirl_com%22%0A%0Aimport email%0Aimport mailbox%0Aimport imap2maildir%0Aimport sys%0Aimport time%0Aimport os... | |
7423de8d2222e81693fe380a6b4c8638a96a9db8 | Create urls.py | urls.py | urls.py | Python | 0.000017 | @@ -0,0 +1,551 @@
+from django.conf.urls import patterns, include, url%0A%0A# Uncomment the next two lines to enable the admin:%0Afrom django.contrib import admin%0A%0Afrom pysoldev import settings%0A%0Aadmin.autodiscover()%0A%0Aurlpatterns = patterns('',%0A url(r'%5Eadmin/', include(admin.site.urls)),%0A url(r'%... | |
0079676729fa8023bea93fcf03bb48c4ff24a495 | add partition | resource-4/combinatorics/integer-partitions/partition1.py | resource-4/combinatorics/integer-partitions/partition1.py | Python | 0.000007 | @@ -0,0 +1,271 @@
+# counting partitions%0Adef partition1(n,k=-1):%0A%09if (k == -1):%0A%09%09return sum(%5Bpartition1(n,i) for i in range(1,n+1)%5D)%0A%09if (n %3C k):%0A%09%09return 0%0A%09if((n==0) or (n==1)):%0A%09%09return 1%0A%09if((k==1) or (n==k)):%0A%09%09return 1%0A%09return sum(%5Bpartition1(n-k,i) for i in ... | |
a787ceea91abf1c0fbeb3b97e063d3ec1aa61b57 | Create implement-rand10-using-rand7.py | Python/implement-rand10-using-rand7.py | Python/implement-rand10-using-rand7.py | Python | 0.000022 | @@ -0,0 +1,954 @@
+# Time: O(1)%0A# Space: O(1)%0A%0A# Given a function rand7 which generates a uniform random integer in the range 1 to 7,%0A# write a function rand10 which generates a uniform random integer in the range 1 to 10.%0A#%0A# Do NOT use system's Math.random().%0A#%0A# Example 1:%0A#%0A# Input: 1%0A# Outpu... | |
b659dd572bd92e10bde8899540792bdb26529a45 | add qdb_test | scripts/qdb_test.py | scripts/qdb_test.py | Python | 0.000001 | @@ -0,0 +1,367 @@
+from qdb import set_trace, RemoteCommandManager%0A%0Adef f():%0A in_f = True%0A return 'getting out of f'%0A%0Adef main():%0A set_trace(%0A uuid='qdb',%0A host='localhost',%0A port=8001,%0A cmd_manager=RemoteCommandManager(),%0A )%0A mutable_object = %7B%7D%... | |
5c02d7ccb9721e0b02cdd31edc36be095a4568e2 | test the Meta and the MetaMixin classes | tests/meta.py | tests/meta.py | Python | 0 | @@ -0,0 +1,1907 @@
+import unittest%0Aimport slumber%0A%0A%0Aclass MetaTestCase(unittest.TestCase):%0A%0A def test_init_kwargs_to_attributes(self):%0A m = slumber.Meta(item1=%22test%22, item2=41, item3=%22example%22)%0A%0A self.assertEqual(m.item1, %22test%22)%0A self.assertEqual(m.item2, 41)%0A... | |
4c3c9c6929ebc3f439ccf3bb7d3696f484b154bc | Add missing noop-migrations for PositiveIntegerField | karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py | karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py | Python | 0.00008 | @@ -0,0 +1,1241 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.1 on 2018-03-22 19:56%0Afrom __future__ import unicode_literals%0A%0Aimport django.core.validators%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('ticket', '0016_add... | |
af508daaf016b824c7518a36f9b92f571f0f65af | Implement management command for creating demo records of balance history (NC-842) | nodeconductor/structure/management/commands/init_balance_history.py | nodeconductor/structure/management/commands/init_balance_history.py | Python | 0 | @@ -0,0 +1,791 @@
+from datetime import timedelta%0A%0Afrom django.core.management.base import BaseCommand%0Afrom django.utils import timezone%0A%0Afrom nodeconductor.structure.models import BalanceHistory%0Afrom nodeconductor.structure.models import Customer%0A%0A%0Aclass Command(BaseCommand):%0A help = %22%22%22 I... | |
7f1883275e9aa0b489de99947db7daf87f616ed4 | solve k58 | chap06/k58.py | chap06/k58.py | Python | 0.999919 | @@ -0,0 +1,910 @@
+#%0A# usage: python k58.py %7Bfile name%7D %7Bnumber%7D%0A#%0A%0Aimport sys%0Afrom xml.etree import ElementTree as ET%0A%0Adef get_tuple(nll, dll):%0A return %5B%5Bp, %5Bn%5B1%5D for n in nl if n%5B0%5D == p%5D%5B0%5D,%0A %5Bd%5B1%5D for d in dl if d%5B0%5D == p%5D%5B0%5D%5D%0A ... | |
a9d0a3dcc5221adbca5142a0cd7548ef874afd45 | add script to make matrix | matrix/build_maxrix.py | matrix/build_maxrix.py | Python | 0.000001 | @@ -0,0 +1,840 @@
+WIDTH = 10%0AHEIGHT = 10%0AHORIZONTAL_NEXT = %22hnext%22%0AVERTICAL_NEXT = %22vnext%22%0ABASE = %22Cell%22%0A%0Aprint %22%22%22%0Aabstract sig %25(BASE)s %7B%0A %25(HORIZONTAL_NEXT)s: lone %25(BASE)s,%0A %25(VERTICAL_NEXT)s: lone %25(BASE)s%0A%7D%0A%22%22%22 %25 globals()%0A%0Afor x in range(WIDTH)... | |
9efc48eadfb896a70197f8963caa6034d9b4856d | store res_log in database instead of memory, add index | bin/addons/base/res/res_log.py | bin/addons/base/res/res_log.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0 | @@ -1051,15 +1051,8 @@
.osv
-_memory
):%0A
@@ -1815,52 +1815,8 @@
id,%0A
- 'create_date': fields.datetime.now,%0A
@@ -1895,16 +1895,396 @@
desc'%0A%0A
+ _index_name = 'res_log_uid_read'%0A def _auto_init(self, cr, context=%7B%7D):%0A super(res_log, self)._auto_init(cr, context)%0A ... |
98cbb29d008fc7abf1a066d9ecf7b3399395aefe | add users api | mcp/interface/users.py | mcp/interface/users.py | Python | 0.000001 | @@ -0,0 +1,885 @@
+import json%0A%0Afrom mcp import users%0Afrom mcp.interface import common%0A%0Aclass UsersHandler(common.AuthorizedHandler):%0A%09def forbidden(self):%0A%09%09return True%0A%0A%09def do_get(self):%0A%09%09return 200, json.dumps(list(iter(users.user_db)))%0A%0Aclass UserHandler(common.AuthorizedHandle... | |
6e165165974f99a30ba6dce528d97c03152eeab6 | Add tracegraph script | tracegraph.py | tracegraph.py | Python | 0.000001 | @@ -0,0 +1,2102 @@
+#!/usr/bin/python%0Aimport sys%0Aimport re%0A%0Aclass Host(object):%0A def __init__(self, step, name, ip):%0A self.step = step%0A self.name = name%0A self.ip = ip%0A self.pings = %5B%5D%0A%0A def add_ping(self, ping):%0A self.pings.append(ping)%0A%0A def max_ping(self):%0A retur... | |
8bc3c2c82b1b8f7e4582fe401c05c4c4f34cc345 | create structure for python | src/boat_servo_sail/setup.py | src/boat_servo_sail/setup.py | Python | 0.000261 | @@ -0,0 +1,469 @@
+## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD%0A## http://docs.ros.org/api/catkin/html/howto/format2/installing_python.html%0A## pdf download of the page in sources folder:%0A## docs-ros_installing_python.pdf%0Afrom distutils.core import setup%0Afrom catkin_pkg.python_setup import gen... | |
dc3df810c3c6ffea429e43ec0f8e6f006a9c1c6f | Create tensorCase.py | tensorCase.py | tensorCase.py | Python | 0.000002 | @@ -0,0 +1,553 @@
+import tensorflow as tf%0A%0Asess = tf.InteractiveSession()%0Ax = tf.random_uniform(%5B%5D)%0Ay = tf.random_uniform(%5B%5D)%0Aout1 = tf.cond(tf.greater(x,y), lambda:tf.add(x,y), lambda:(tf.subtract(x,y)))%0Aprint(x.eval(), y.eval(), out1.eval())%0A%0Ax = tf.random_uniform(%5B%5D,-1,1)%0Ay = tf.random... | |
6584d9e71c82097f65f316bf85b2f019350cfa58 | Add run_aiotest.py | run_aiotest.py | run_aiotest.py | Python | 0.000003 | @@ -0,0 +1,199 @@
+import aioeventlet%0Aimport aiotest.run%0Aimport eventlet%0A%0Aconfig = aiotest.TestConfig()%0Aconfig.new_event_pool_policy = aioeventlet.EventLoopPolicy%0Aconfig.sleep = eventlet.sleep%0Aaiotest.run.main(config)%0A
| |
50983c0a6d18e1ec8fcaed076f3c82b5935fe913 | Solve problem 23 | problem023.py | problem023.py | Python | 0.999965 | @@ -0,0 +1,458 @@
+#!/usr/bin/env python3%0A%0Afrom itertools import *%0A%0Adef divisors(n):%0A for d in takewhile(lambda d: d * d %3C= n, count(1)):%0A if n %25 d == 0:%0A yield d%0A if n // d != d:%0A yield n // d%0A%0Adef is_abundant_number(n):%0A return n %3C sum(di... | |
8db65dc2a6a99a0e6287b12f7bfdcd423a62e515 | Add test running harness | run_harness.py | run_harness.py | Python | 0 | @@ -0,0 +1,3077 @@
+import sys%0Aimport os%0Aimport subprocess%0Aimport shutil%0Aimport shlex%0Aimport collections%0Afrom babi_train import TrainExitStatus%0Afrom graceful_interrupt import GracefulInterruptHandler%0A%0ATaskSpec = collections.namedtuple(%22TaskSpec%22, %5B%22task_name%22, %22variant_name%22, %22run_para... | |
a423b0eb6277c260a16dc11f37088e496964cc0c | Create count-neighbours.py | home/count-neighbours.py | home/count-neighbours.py | Python | 0.000009 | @@ -0,0 +1,830 @@
+def checkio ( data ) :%0A %0A if len( data ) %3C 10 : return False%0A %0A if not any( c in data for c in %22abcdefghijklmnopqrstuvwxyz%22 ) : return False%0A if not any( c in data for c in %22ABCDEFGHIJKLMNOPQRSTUVWXYZ%22 ) : return False%0A if not any( c in data for c in %221234567... | |
557d21ffbbbf5cb8a452d6bc0b4c013daf8eabdc | Add new migration | server/store/migrations/0003_alter_testimonial_reviewer_location.py | server/store/migrations/0003_alter_testimonial_reviewer_location.py | Python | 0 | @@ -0,0 +1,390 @@
+# Generated by Django 4.1.3 on 2022-11-14 02:09%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A (%22store%22, %220002_initial%22),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A mode... | |
0df48d7159841f66cc4e8dac8e9a52727c69091e | add testcase for settings() | test/model.py | test/model.py | Python | 0 | @@ -0,0 +1,495 @@
+# -*- coding: utf-8 -*-%0A%0Aimport unittest%0Afrom cliez.conf import settings, Settings%0A%0A%0Aclass Model(object):%0A config_none = settings()%0A%0A def __init__(self):%0A self.config = settings()%0A pass%0A%0A pass%0A%0A%0Aclass ModelTestCase(unittest.TestCase):%0A def s... | |
b1c405950ce5be535796d6d31a329b5083dc91a9 | adding test_hello | test_hello.py | test_hello.py | Python | 0.999096 | @@ -0,0 +1,18 @@
+print %22Hello All%22%0A
| |
bb0e8032d325d2fd015a53d4513d632d12e8afb3 | Create pset2part3.py | pset2part3.py | pset2part3.py | Python | 0.000003 | @@ -0,0 +1,1010 @@
+balance = 270472%0AannualInterestRate = 0.21%0A# test case 1%0A# balance = 320000%0A# annualInterestRate = 0.2%0A# Lowest Payment: 29157.09%0A# test case 2%0A# balance = 999999%0A# annualInterestRate = 0.18%0A# Lowest Payment: 90325.03%0A%0Aepsilon = 0.01%0Alower = balance / 12%0Aupper = balance * (... | |
3f64c94f51698ab69fc1996d73a04bde58da9052 | Update build script. | client/scripts/build-plugin.py | client/scripts/build-plugin.py | import os, sys
import ue4config
import ue4util, gitutil, shutil, uploadutil
plugin_version = gitutil.get_short_version('.')
plugin_output_folder = os.path.abspath('./unrealcv-%s' % plugin_version)
def build_plugin():
UAT_script = ue4config.conf['UATScript']
if not os.path.isfile(UAT_script):
print('Ca... | Python | 0 | @@ -190,16 +190,83 @@
version)
+%0Aplugin_output_folder = ue4util.get_real_path(plugin_output_folder)
%0A%0Adef bu
|
1765ac3a12ea2a56b4e25e05cf1f1b531de5b2cf | Add External Temperature Probe from OpenWeather | pyexternal.py | pyexternal.py | Python | 0 | @@ -0,0 +1,1900 @@
+#!/usr/bin/env python%0A# Get External Temperature from OpenWeatherMap%0A# External informations are :%0A# - temperature%0A# - humidity%0A# - pressure%0A# - precipitation volume (each 3h)%0A%0Aimport urllib.request%0Aimport json%0Aimport pyowm%0Afrom datetime import datetime%0A%0Afrom pyserial impor... | |
9a37f573aa985b3bd876c2df4c3f83670fddab42 | add script to set script permissions | chmod.py | chmod.py | Python | 0.000001 | @@ -0,0 +1,391 @@
+import os, stat, sublime, sublime_plugin%0A%0A# Configuration%0Apkg = 'NSIS'%0Ascript = sublime.packages_path() + '/' + pkg + '/nsis_build.sh'%0A%0Adef plugin_loaded():%0A from package_control import events%0A%0A # chmod +x %3Cscript%3E%0A if (events.install(pkg) or events.post_upgrade(pkg))... | |
7cd1c65b77eb474f67f1e194ceeb7bcde2d2bdb9 | Create wsgi.py | NGeO/NGeO/wsgi.py | NGeO/NGeO/wsgi.py | Python | 0.000001 | @@ -0,0 +1,383 @@
+%22%22%22%0AWSGI config for NGeO project.%0A%0AIt exposes the WSGI callable as a module-level variable named %60%60application%60%60.%0A%0AFor more information on this file, see%0Ahttps://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/%0A%22%22%22%0A%0Aimport os%0Aos.environ.setdefault(%22DJANGO... | |
a7f1565efbdfa20d4d97d90a688b78da51533113 | Add new package: ycsb (#17788) | var/spack/repos/builtin/packages/ycsb/package.py | var/spack/repos/builtin/packages/ycsb/package.py | Python | 0 | @@ -0,0 +1,1654 @@
+# 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 Ycsb(Package):%0A %22%22%22Yahoo! Cloud Serving Benchma... | |
b7baf1e53f24bb96a0b09e9305f5f1e562cf3547 | Create analog_tester.py | home/moz4r/analog_tester.py | home/moz4r/analog_tester.py | Python | 0.000009 | @@ -0,0 +1,418 @@
+arduino = Runtime.createAndStart(%22arduino%22,%22Arduino%22)%0Aarduino.setBoardNano()%0Aarduino.connect(%22COM6%22)%0Aarduino.setAref(%22DEFAULT%22)%0Adef publishPin(pins):%09 %0A%09for pin in range(0, len(pins)):print(pins%5Bpin%5D.value)%0Aarduino.addListener(%22publishPinArray%22,%22python%22,%2... | |
5e6cfc84a4b34a292281ea466bf11facb680e72b | initialize radix sort file | radix_sort.py | radix_sort.py | Python | 0.000001 | @@ -0,0 +1,178 @@
+def radix_sort(array):%0A %22%22%22%0A Sorts an array of numbers using the least signficant digit radix algorithm.%0A %22%22%22%0A%0A%0Aif __name__ == '__main__':%0A print radix_sort.func_doc%0A
| |
3e54e311a747b1e032384c7a74a8ed9aeafe1e8d | Fix constructor for Bernoulli node | bayespy/inference/vmp/nodes/bernoulli.py | bayespy/inference/vmp/nodes/bernoulli.py | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | Python | 0 | @@ -1737,79 +1737,544 @@
-def __init__(self, p, **kwargs):%0A super().__init__(1, p, **kwarg
+@classmethod%0A def _constructor(cls, p, **kwargs):%0A %22%22%22%0A Constructs distribution and moments objects.%0A %22%22%22%0A p = cls._ensure_moments(p, cls._parent_moments%5B0%5D... |
0a16a2002e1247ad87a877de6aa85bb0844dc9c4 | tag tweaks | boards/NRF51TAG.py | boards/NRF51TAG.py | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at h... | Python | 0.000001 | @@ -856,18 +856,21 @@
%22EV_
-SERIAL1
+BLUETOOTH
%22,%0A
+#
'de
@@ -896,16 +896,17 @@
%22D15%22,%0A
+#
'defaul
@@ -928,16 +928,17 @@
%22D17%22,%0A
+#
'defaul
@@ -982,18 +982,18 @@
bles' :
-3
1
+5
0,%0A 'bin
@@ -1469,16 +1469,21 @@
(256 - 3
+ - 16
) * 1024
@@ -1565,16 +1565,20 @@
108 - 16
+ - 3
) # t... |
e96832e16a6e5746faeaf647c6cd681f1d2f9bca | Create break_fracmorse.py | break_fracmorse.py | break_fracmorse.py | Python | 0.998165 | @@ -0,0 +1,2687 @@
+# usage: python break_fracmorse.py 'CIPHERTEXTMESSAGE'%0A# ideally you'll want 200 or so characters to reliably decrypt, shorter will often work but not as reliably.%0A%0Aimport random%0Afrom ngram_score import ngram_score%0Aimport re%0Aimport sys%0Afrom pycipher import FracMorse%0A%0A#ctext = FracM... | |
decf4b1916a421fe996a31feb131b7ed9e4e3c36 | Add a simple benchmark script | numpy-benchmark-one.py | numpy-benchmark-one.py | Python | 0.000001 | @@ -0,0 +1,441 @@
+import timeit%0A%0Anormal_py_sec = timeit.timeit('sum (x*x for x in xrange(1000))',number = 10000)%0Anaive_np_sec = timeit.timeit('sum(na*na)',setup='import numpy as np; na=np.arange(1000)', number = 10000)%0Agood_np_sec = timeit.timeit('na.dot(na)',setup='import numpy as np; na=np.arange(1000)', num... | |
cb517a2cd1dea12fadf4f72147fecf0105cbd717 | include missing Message | palaverapi/message.py | palaverapi/message.py | Python | 0.000027 | @@ -0,0 +1,1385 @@
+# Adapted from https://github.com/kylef/irctk/blob/master/irctk/message.py%0A%0Afrom typing import List, Optional%0A%0A%0Aclass Message:%0A @classmethod%0A def parse(cls, string: str) -%3E 'Message':%0A prefix = None%0A parameters = %5B%5D%0A%0A if string.startswith('@'):%... | |
6db9688d7c078c8cf8d1b17305e89bb680a46e53 | Create lc1001.py | LeetCode/lc1001.py | LeetCode/lc1001.py | Python | 0.000003 | @@ -0,0 +1,1698 @@
+xs = %7B%7D%0Ays = %7B%7D%0Afs = %7B%7D%0Ass = %7B%7D%0Agrid = %7B%7D%0A%0Adef checkdic(xs, x):%0A if x not in xs:%0A xs%5Bx%5D = set()%0A%0Adef checkempty(xs, x):%0A if x not in xs:%0A return 1%0A if len(xs%5Bx%5D) == 0:%0A return 1%0A return 0%0A%0Adef remove(x, y)... | |
98aee2af9aa3f7dcc75969f1ec3118c40539793e | Add clone of Haskell version | pandoc-include-code.py | pandoc-include-code.py | Python | 0 | @@ -0,0 +1,2179 @@
+#! /usr/bin/env python3%0A%0Afrom sys import stdout, stderr, exit%0Aimport json%0A%0A%0Adef walktransform(tree):%0A if isinstance(tree, list):%0A return %5Bwalktransform(subtree)%0A for subtree%0A in tree%5D%0A elif not isinstance(tree, dict):%0A exi... | |
70a6553d9323b3522e492c414b67e76111519368 | Add file to create all files to school census. | scripts/data_download/school_census/create_all_files.py | scripts/data_download/school_census/create_all_files.py | Python | 0 | @@ -0,0 +1,784 @@
+import os%0Aimport commands%0Aimport time%0Aimport logging%0Aimport sys%0A%0Aif len(sys.argv) != 3 or (sys.argv%5B1:%5D%5B0%5D not in %5B'pt', 'en'%5D):%0A print %22ERROR! Use:%5Cn python scripts/data_download/school_census/create_files.py en/pt output_path%5Cn%22%0A exit()%0A%0Alogging.basicCo... | |
e8d596ffc074dea152a2d714e9f68bb9e5c75eaa | change serviceClass from CharField to ForeignKey | planetstack/core/models/slice.py | planetstack/core/models/slice.py | import os
from django.db import models
from core.models import PlCoreBase
from core.models import Site
from core.models import User
from core.models import Role
from core.models import DeploymentNetwork
# Create your models here.
class Slice(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Key... | Python | 0 | @@ -195,16 +195,53 @@
tNetwork
+%0Afrom core.models import ServiceClass
%0A%0A# Crea
@@ -1196,272 +1196,124 @@
-SVC_CLASS_CHOICES = (('besteffort', 'Best Effort'), ('silver', 'Silver'), ('gold','Gold'))%0A serviceClass = models.CharField(verbose_name=%22
+serviceClass = models.ForeignKey(
Service
-
Class
... |
91b58112f1c83048511fdab09f9aad58351eb991 | add new package (#23573) | var/spack/repos/builtin/packages/py-pycocotools/package.py | var/spack/repos/builtin/packages/py-pycocotools/package.py | Python | 0 | @@ -0,0 +1,792 @@
+# 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 PyPycocotools(PythonPackage):%0A %22%22%22Official APIs ... | |
ba169e32c41a1ea531526c80e4652ede4e7621e4 | Allow type inference tracking with dynamic loading. | Wrapping/Generators/Python/itkTypes.py | Wrapping/Generators/Python/itkTypes.py | # ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | Python | 0 | @@ -752,38 +752,8 @@
*/%0A%0A
-from typing import Dict, Any%0A%0A
%0A# n
@@ -789,24 +789,128 @@
s itkCType:%0A
+ # import locally to facilitate dynamic loading in itk/__init__.py%0A from typing import Dict, Any%0A%0A
__c_type
@@ -1504,24 +1504,131 @@
Type(name):%0A
+ # import locally to facilitate... |
638ee09f0f2958a955fbad42368ffc6bb2a2688a | Add minimal REST API script based on flask | pipeline/scripts/bb_pipeline_api.py | pipeline/scripts/bb_pipeline_api.py | Python | 0 | @@ -0,0 +1,1462 @@
+#!/usr/bin/env python3%0A%0Afrom tempfile import NamedTemporaryFile%0Aimport json%0Afrom threading import Lock%0A%0Aimport numpy as np%0Afrom flask import Flask, request%0Afrom scipy.misc import imread%0Afrom pipeline import Pipeline%0Afrom pipeline.objects import Image, Candidates, Saliencies, IDs%... | |
427caaa998ea03bf80a00aaf90833eb910cf909d | Add migration file | webapp/apps/taxbrain/migrations/0061_auto_20171220_1859.py | webapp/apps/taxbrain/migrations/0061_auto_20171220_1859.py | Python | 0.000001 | @@ -0,0 +1,1125 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Aimport webapp.apps.taxbrain.models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('taxbrain', '0060_auto_20171219_2153'),%0A %5D%0A%0A operat... | |
80d75bad57c8be1b08fbb2129bb0511c633446e2 | Create CertPaIT.py | plugins/feeds/public/CertPaIT.py | plugins/feeds/public/CertPaIT.py | Python | 0 | @@ -0,0 +1,1131 @@
+import logging%0Afrom datetime import datetime, timedelta%0Afrom core.observables import Hash%0Afrom core.feed import Feed%0Afrom core.errors import ObservableValidationError%0A%0Aclass CertPaIt(Feed):%0A%0A default_values = %7B%0A %22frequency%22: timedelta(minutes=30),%0A %22name%... | |
90a467a849bb05cd0922ca0808279bf009657150 | Create reverse_words.py | Google_Code_Jam/2010_Africa/Qualification_Round/B/reverse_words.py | Google_Code_Jam/2010_Africa/Qualification_Round/B/reverse_words.py | Python | 0.999848 | @@ -0,0 +1,690 @@
+#!/usr/bin/python -tt%0A%0A%22%22%22Solves problem B from Google Code Jam Qualification Round Africa 2010%0A(https://code.google.com/codejam/contest/351101/dashboard#s=p1)%0A%22Reverse Words%22%0A%22%22%22%0A%0Aimport sys%0A%0Adef main():%0A %22%22%22Reads problem data from stdin and prints answer... | |
3155a8ab725c1b1535a99229f31008587ceb3e64 | Add continuous finite test | HARK/ConsumptionSaving/tests/test_ConsRiskyContribModel.py | HARK/ConsumptionSaving/tests/test_ConsRiskyContribModel.py | Python | 0.000178 | @@ -0,0 +1,2008 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue Jan 26 10:06:51 2021%0A%0A@author: Mateo%0A%22%22%22%0A%0Aimport unittest%0Afrom copy import copy%0Aimport numpy as np%0Afrom HARK.ConsumptionSaving.ConsRiskyAssetModel import (%0A RiskyContribConsumerType,%0A init_riskyContrib%0A)%0A%0Aclas... | |
0f6961c10def1f1343c6c31d117e5ca87cefd4b7 | add openvas_vulns migration | alembic/versions/506c8e35ba7c_create_openvas_vuln_table.py | alembic/versions/506c8e35ba7c_create_openvas_vuln_table.py | Python | 0 | @@ -0,0 +1,740 @@
+%22%22%22create openvas_vuln table%0A%0ARevision ID: 506c8e35ba7c%0ARevises: 13b7c3d4c802%0ACreate Date: 2017-07-21 12:19:35.711173%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Aimport datetime%0A%0A%0Adef _get_date():%0A return datetime.datetime.now()%0A%0A# revision identif... | |
6ce0d934cfe8b9e93a833ff1d31915ffd14c643d | add new package (#25526) | var/spack/repos/builtin/packages/py-pydantic/package.py | var/spack/repos/builtin/packages/py-pydantic/package.py | Python | 0 | @@ -0,0 +1,789 @@
+# 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 PyPydantic(PythonPackage):%0A %22%22%22Data validation a... | |
f363864f7f6ad9da45cb3053816d500838821a27 | add new package (#27093) | var/spack/repos/builtin/packages/r-posterior/package.py | var/spack/repos/builtin/packages/r-posterior/package.py | Python | 0 | @@ -0,0 +1,1685 @@
+# 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 RPosterior(RPackage):%0A %22%22%22Tools for Working wit... | |
1596d091183d89c703e67555e81f24722dc0d8a2 | add import script for Chelmsford | polling_stations/apps/data_collection/management/commands/import_chelmsford.py | polling_stations/apps/data_collection/management/commands/import_chelmsford.py | Python | 0 | @@ -0,0 +1,374 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E07000070'%0A addresses_name = 'Democracy_Club__04May2017 (1).tsv'%0A stations_name = 'Democracy_Club__04May2017 (1).tsv'%0A election... | |
94e83a48d3700cdc7c9bb6bd9a14860d2665c655 | Add custom roster module | _modules/roster.py | _modules/roster.py | Python | 0 | @@ -0,0 +1,833 @@
+# import python libraries%0Aimport logging%0A%0A# import salt libraries%0Aimport salt.utils.files%0Aimport salt.utils.yaml%0A%0Alog = logging.getLogger(__name__)%0A%0Adef remove(roster, name):%0A '''%0A remove an entry from the salt-ssh roster%0A '''%0A with salt.utils.files.fopen(roster,... | |
8a043a2d3a9517c5eb84aea3e9916419f6136e23 | Add tests for IndexAbstractor. | test/lib/indexabstractor.py | test/lib/indexabstractor.py | Python | 0 | @@ -0,0 +1,2324 @@
+%22%22%22 The PyUnit test framework for the indexabstractor. %22%22%22%0A%0Aimport unittest%0A%0Afrom lib import parser%0Afrom lib.indexabstractor import *%0A%0Aclass indexTestCase(unittest.TestCase):%0A def setUp(self):%0A self.sumo = parser.Ontology('data/Merge.kif', name='SUMO')%0A ... | |
ee1358dd0e08e6a21d6431ab37858ef8a6c774dd | Add `[link to issue]` support to Jira-Github integration (#21376) | Utils/github_workflow_scripts/jira_integration_scripts/link_pr_to_jira_issue.py | Utils/github_workflow_scripts/jira_integration_scripts/link_pr_to_jira_issue.py | import argparse
import re
import sys
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
JIRA_HOST_FOR_REGEX = "https:\/\/jira-hq.paloaltonetworks.local\/browse\/"
JIRA_KEY_REGEX = "([A-Z][A-Z0-9]+-[0-9]+))\s?"
JIRA_FIXED_ISSUE_REGEX = f"[fF]ixes:\s?({JIRA_HOST_FOR_REGEX... | Python | 0 | @@ -61,16 +61,48 @@
urllib3%0A
+from blessings import Terminal%0A%0A
%0Aurllib3
@@ -320,24 +320,26 @@
%5BfF%5Dixes:%5Cs?
+.*
(%7BJIRA_HOST_
@@ -409,16 +409,18 @@
ates:%5Cs?
+.*
(%7BJIRA_H
@@ -2713,15 +2713,53 @@
-print(%22
+t = Terminal()%0A print(f%22%7Bt.red%7DERROR:
No l
@@ -2827,27 +2827,38 @@
... |
58de77d09564a43ae1934e2cee4543bc028c25c6 | Make android bot configuration more consistent. | build/android/pylib/device_settings.py | build/android/pylib/device_settings.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from pylib import content_settings
def ConfigureContentSettingsDict(device, desired_settings):
"""Configures device content setings from ... | Python | 0.000423 | @@ -1666,24 +1666,58 @@
partner': %7B%0A
+ 'network_location_opt_in': 0,%0A
'use_loc
@@ -1764,24 +1764,56 @@
/global': %7B%0A
+ 'assisted_gps_enabled': 0,%0A%0A
# Disabl
@@ -2044,24 +2044,348 @@
_zone': 0,%0A%0A
+ 'development_settings_enabled': 1,%0A%0A # Flag for allowing ActivityManagerServi... |
859d1031bc61cd4466953cbc7a5e282abff35e50 | Create database.py | database.py | database.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
c8d57138240e87c802b84cf0b2b01efd01c80e41 | Create solution.py | hackerrank/algorithms/implementation/easy/angry_professor/py/solution.py | hackerrank/algorithms/implementation/easy/angry_professor/py/solution.py | Python | 0.000018 | @@ -0,0 +1,464 @@
+#!/bin/python3%0A%0Aimport sys%0A%0Adef isClassCancelled(arrivalTimes, cancellationThreshold):%0A count = 0%0A %0A for arrivalTime in arrivalTimes: %0A if arrivalTime %3C= 0:%0A count += 1%0A %0A return count %3C cancellationThreshold%0A%0At = int(input... | |
02183bdcd1b3e4109568f5077a6074573bbd8bf9 | Add send_unsent.py. | send_unsent.py | send_unsent.py | Python | 0 | @@ -0,0 +1,636 @@
+#!/usr/bin/env python2%0A# -*- coding: utf8 -*-%0Aimport smtplib%0Aimport enseigner.model as model%0Aimport enseigner.emails as emails%0A%0Amails = model.Mail.all_unsent()%0A%0Ayesno = raw_input(u'Envoyer %25d mails ? ' %25 len(mails))%0A%0Aif yesno != 'yes':%0A exit(0)%0A%0Asender = emails.Sender... | |
eee8b3e96f7b0c9f24e7c43483bb6d74bd8a490a | add proto | servy/proto.py | servy/proto.py | Python | 0.000006 | @@ -0,0 +1,592 @@
+import json%0A%0Aclass Response(object):%0A @classmethod%0A def encode(cls, content):%0A return json.dumps(content)%0A%0A @classmethod%0A def decode(cls, content):%0A return json.loads(content)%0A%0A%0Aclass Request(object):%0A @classmethod%0A def encode(cls, proc, arg... | |
6f8d2e724f4aafb6b8295b8b0a1f915d5f21fa38 | fix script | tests/scripts/makereport.py | tests/scripts/makereport.py | # accepts 0,1, or 2 arguments. If a string starting with a number is handed in, it is assumed to be a subdirectory of the current directory to run on. If not specified, the newest build is used. Any other string is taken as the branch name for this test (or treated as mainline). Order of the arguments does not matter.
... | Python | 0.000003 | @@ -1042,16 +1042,133 @@
pop(0)%0A%0A
+if dirname==%22%22:%0A n=glob.glob(%22*/Build.xml%22)%0A n.sort(reverse=True)%0A dirname = n%5B0%5D.replace('/Build.xml','')%0A%0A
if len(g
@@ -1633,16 +1633,17 @@
%25H%25M%22)%0A%0A
+%0A
header =
|
afb6b73c92227a735f5ec8d97fba5ad959871202 | Check text instead of data-page attribute | test/browser_testing/features/pages/closing_disclosure.py | test/browser_testing/features/pages/closing_disclosure.py | from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support imp... | Python | 0.000001 | @@ -5142,34 +5142,12 @@
ent.
-get_attribute('data-page')
+text
%0A%0A
|
339bb5cd325c7b9c08b8a43994f55bbe1756fbde | validate redirect | signup/auth.py | signup/auth.py | Python | 0.000001 | @@ -0,0 +1,1930 @@
+# Copyright (c) 2014, Fortylines LLC%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions are met:%0A#%0A# * Redistributions of source code must retain the above copyright notice,%... | |
c6e85e35a090c33bc1d6813dce959c8d47588ae8 | send an email with current IP address | send_Email.py | send_Email.py | Python | 0 | @@ -0,0 +1,1039 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Fri Jun 16 12:14:51 2017%0A%0A@author: smrak%0A%22%22%22%0Aimport requests%0Aimport urllib3%0Afrom datetime import datetime%0A%0Adef getIP():%0A %22%22%22%0A Sebastijan Mrak:%0A get & reteurn a public IP address%0A %22%22%22%0A http... | |
c13968125383581e67804e11bc430391d355145a | Create DataStreamasDisjointIntervals.py | leetcode/352-Data-Stream-as-Disjoint-Intervals/DataStreamasDisjointIntervals.py | leetcode/352-Data-Stream-as-Disjoint-Intervals/DataStreamasDisjointIntervals.py | Python | 0 | @@ -0,0 +1,1450 @@
+# Definition for an interval.%0A# class Interval(object):%0A# def __init__(self, s=0, e=0):%0A# self.start = s%0A# self.end = e%0A%0Aclass SummaryRanges(object):%0A%0A def __init__(self):%0A %22%22%22%0A Initialize your data structure here.%0A %22%22%22%0A... | |
435220dda7eb928d9d959594d7986136f17da973 | Add actual url patter for #239 | popit/urls/rooturls.py | popit/urls/rooturls.py | Python | 0.000002 | @@ -0,0 +1,170 @@
+from django.conf.urls import url%0Afrom popit.views import *%0A%0A%0Aurlpatterns = %5B%0A url(r'%5E(?P%3Clanguage%3E%5Cw%7B2%7D)', api_root, name=%22api-root%22),%0A url(r'%5E$', api_root_all),%0A%5D%0A
| |
57297540c6b6be2f956fc27b175e15cde6b5aa76 | Add test for admin #4, VATINField in django.contrib.admin | vies/tests.py | vies/tests.py | from django.utils import unittest
from django.db.models import Model, CharField
from django.forms import Form, ModelForm
from vies import fields, VATIN
from vies import models
VALID_VIES = 'DE284754038'
VALID_VIES_COUNTRY_CODE = 'DE'
VALID_VIES_NUMBER = '284754038'
class VIESModel(Model):
vat = models.VATINFiel... | Python | 0 | @@ -9,29 +9,96 @@
ngo.
-utils import un
+contrib.admin.options import ModelAdmin%0Afrom django.contrib.admin.s
it
-t
es
-t
+ import AdminSite
%0Afro
@@ -180,16 +180,50 @@
odelForm
+%0Afrom django.utils import unittest
%0A%0Afrom v
@@ -3453,28 +3453,419 @@
.assertTrue(form.is_valid())
+%0A%0A%0A%0Aclass MockReque... |
3f6ebda543542a8b32b592ceaba62d8eee1fab5e | Version bump to s25.1 | src/ggrc/settings/default.py | src/ggrc/settings/default.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
DEBUG = False
TESTING = False
# Flask-SQLAlchemy fix to be less than `wait_time` ... | Python | 0 | @@ -727,16 +727,18 @@
N = %22s25
+.1
%22%0A%0A# Ini
|
f04f7555b06f5087100b336f3127b19e252b3794 | Fix issue 137 | pages/http.py | pages/http.py | """Page CMS functions related to the request object."""
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import loader, Context, RequestConte... | Python | 0 | @@ -645,16 +645,49 @@
'8000',%0A
+ 'HTTP_HOST': 'testhost',%0A
%7D)%0A
|
99f454b3fa62cffac922a7b3431e0024e6dfde3d | add data migration script | dataactcore/scripts/migrateDataBroker.py | dataactcore/scripts/migrateDataBroker.py | Python | 0.000001 | @@ -0,0 +1,2106 @@
+# migrate data using pg_dump and pg_restore%0A# data copied from tables:%0A# error_data:%0A# error_metadata%0A# file%0A# job_tracker:%0A# job%0A# submission%0A# job_dependency%0A# user_manager;%0A# users%0A# email_token%0A# validator:%0A# appropriation%0A# award_financial%0A# awa... | |
17bbd6d44ec7edd1a079b12a44c283a358b11b92 | add import script for Teignbridge (closes #865) | polling_stations/apps/data_collection/management/commands/import_teignbridge.py | polling_stations/apps/data_collection/management/commands/import_teignbridge.py | Python | 0 | @@ -0,0 +1,384 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E07000045'%0A addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsv'%0A stations_name = 'parl.2017-06-08/Version 1/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.