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 |
|---|---|---|---|---|---|---|---|
278cd37ada508701896c2669a215365785f5a261 | Add eval dispatch (copied from compyle) | evalExp.py | evalExp.py | Python | 0 | @@ -0,0 +1,760 @@
+from keywords import *%0Afrom reg import *%0Afrom parse import parse%0A%0Adef evalExp():%0A%09expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?%0A%09# expr = transformMacros(expr)%0A%09evalFunc = getEvalFunc(expr)%0A%09# evalFunc()%0A%09# reassign next step%0A%0Adef getEvalFunc(expr):%0A%09if ... | |
0ffd8c1b52b95ef61bcb2ecf7183d1abab55a3ce | Rename Documents to Attachments | smile_attachment/models/models.py | smile_attachment/models/models.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | Python | 0 | @@ -1916,12 +1916,14 @@
', '
-Docu
+Attach
ment
|
5de57ff00037d6f9a04307e60685f47f368cb29f | add example script to test calling the ffi | example.py | example.py | Python | 0 | @@ -0,0 +1,138 @@
+import scipcffi.ffi as s%0A%0Ascip_ptr = s.ffi.new('SCIP**')%0Arc = s.lib.SCIPcreate(scip_ptr)%0Aassert rc == s.lib.SCIP_OKAY%0Ascip = scip_ptr%5B0%5D%0A%0A
| |
e0871cd8c106a5f66bffd7a93759747b2f282c46 | make CommCareBuild.create_from_zip tolorate having directory entries like 'dist/' (by ignoring them) | corehq/apps/builds/models.py | corehq/apps/builds/models.py | from datetime import datetime
from zipfile import ZipFile
from couchdbkit.exceptions import ResourceNotFound
from couchdbkit.ext.django.schema import *
from corehq.apps.builds.jadjar import JadJar
class CommCareBuild(Document):
"""
#python manage.py shell
#>>> from corehq.apps.builds.models import CommCare... | Python | 0 | @@ -2083,16 +2083,35 @@
= %22dist%22
+ and path%5B-1%5D != %22%22
:%0A
|
3a2a311c3c3f8a6bc2f027bfa247d912122e512e | Add test for gaussian | tests/functions_tests/test_gaussian.py | tests/functions_tests/test_gaussian.py | Python | 0.000004 | @@ -0,0 +1,1410 @@
+import unittest%0A%0Aimport numpy%0A%0Aimport chainer%0Afrom chainer import cuda%0Afrom chainer import functions%0Afrom chainer import gradient_check%0Afrom chainer import testing%0Afrom chainer.testing import condition%0A%0A%0Aif cuda.available:%0A cuda.init()%0A%0A%0Aclass TestGaussian(unittest... | |
945c2c620634c2c816aa446d91773adb75cb87e3 | Add airmass tool | airmass.py | airmass.py | Python | 0 | @@ -0,0 +1,1458 @@
+#!/usr/env/python%0A%0Aimport argparse%0Aimport numpy as np%0Afrom astropy import units as u%0A%0A##-------------------------------------------------------------------------%0A## Parse Command Line Arguments%0A##-------------------------------------------------------------------------%0A## create a ... | |
12f2198a53d474bb69a6b9118fca0638dcce8aac | add data migration | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | Python | 0 | @@ -0,0 +1,1460 @@
+# Generated by Django 2.2.24 on 2022-03-07 12:10%0Aimport re%0A%0Afrom django.db import migrations%0A%0A%0Adef remove_community_participation_read_more_prompts(apps, schema_editor):%0A %22%22%22%0A Target read more prompts:%0A For more information, read about Judging at Mass Challenge.%0A ... | |
b166cd8cc95ceb56f8d03cacb8903b0936e69210 | Create solution.py | data_structures/linked_list/problems/find_pattern_in_linked_list/py/solution.py | data_structures/linked_list/problems/find_pattern_in_linked_list/py/solution.py | Python | 0.000018 | @@ -0,0 +1,874 @@
+import LinkedList%0A%0A# Linked List Node inside the LinkedList module is declared as:%0A#%0A# class Node:%0A# def __init__(self, val, nxt=None):%0A# self.val = val%0A# self.nxt = nxt%0A#%0A%0Adef FindPatternInLinkedList(head: LinkedList.Node, pattern: LinkedList.Node) -%3... | |
9bffe981c018213b87d015a20603c092567bbdf4 | Initialize multiple class setup; add remaining APIs | cobaltuoft/cobalt.py | cobaltuoft/cobalt.py | Python | 0 | @@ -0,0 +1,1691 @@
+from .endpoints import Endpoints%0Afrom .helpers import get, scrape_filters%0A%0A%0Aclass Cobalt:%0A def __init__(self, api_key=None):%0A self.host = 'http://cobalt.qas.im/api/1.0'%0A%0A self.headers = %7B%0A 'Referer': 'Cobalt-UofT-Python'%0A %7D%0A%0A if n... | |
54864841267c4d2cb53ce581c05d8ba9c15eef0c | Add lexer | balloon.py | balloon.py | Python | 0.000001 | @@ -0,0 +1,959 @@
+from pygments.lexer import *%0Afrom pygments.token import *%0A%0Aclass CustomLexer(RegexLexer):%0A name = 'Balloon'%0A aliases = %5B'balloon'%5D%0A filenames = '*.bl'%0A%0A tokens = %7B%0A 'root': %5B%0A%0A include('keywords'),%0A%0A (r'%5B%5D%7B%7D(),:;%5B%5D... | |
d0306518dcc395a051460115d7ef9488f26426cc | Add paper shortening tool: input text, output shorter text | shorten-pdf/shorten.py | shorten-pdf/shorten.py | Python | 0.999999 | @@ -0,0 +1,1349 @@
+#!/usr/bin/python%0A%0Aimport sys%0A%0ALONG_PARAGRAPH_THRESH = 400%0ALONG_START_LEN = 197%0ALONG_END_LEN = 197%0A%0Aif len(sys.argv) %3C 2:%0A print 'Give me a text file as an argument.'%0A sys.exit(0)%0A%0Af = open(sys.argv%5B1%5D) # open file%0At = f.read() # read text%0... | |
316a82c5465a13770404b6a302348f192618cd27 | Add an interface for eagerly evaluating command graph elements | libqtile/command_interface.py | libqtile/command_interface.py | Python | 0 | @@ -0,0 +1,2223 @@
+# Copyright (c) 2019, Sean Vig. All rights reserved.%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including without limitation the ri... | |
dff1f9176d7ce77a242263bfc9a0760cd31f0585 | Add a prototype for cached regex.compile() | regex_proxy.py | regex_proxy.py | Python | 0.000001 | @@ -0,0 +1,314 @@
+from regex import *%0Afrom regex import compile as raw_compile%0A%0A%0A_cache = %7B%7D%0A%0A%0A# Wrap regex.compile up so we have a global cache%0Adef compile(s, *args, **args):%0A global _cache%0A try:%0A return _cache%5Bs%5D%0A except KeyError:%0A r = raw_compile(s, *args, **... | |
231e19ed29314bc0d9aad3cd1d69b757364fce7d | Create pms.py | pms.py | pms.py | Python | 0 | @@ -0,0 +1,550 @@
+import serial%0A%0A# we stop terminal with raspi-config,%0A# we stop bluethooth from /boot/config.txt first,%0A# and currently UART device is /dev/ttyAMAO,%0A# but we still cannot read data from device%0A%0A# failure devices%0A#dev = %22ttyS0%22%0A%0A# work devices%0A#dev = %22ttyAMA0%22%0A#dev = %22... | |
7b1b343c552ee6f124ccceee05f1a6732657c9e1 | Add initial startup program (pox.py) | pox.py | pox.py | Python | 0.000002 | @@ -0,0 +1,807 @@
+#!/usr/bin/python%0A%0Afrom pox.core import core%0Aimport pox.openflow.openflow%0Aimport pox.topology.topology%0Aimport pox.openflow.of_01%0Aimport pox.dumb_l3_switch.dumb_l3_switch%0A%0A# Set default log level%0Aimport logging%0Alogging.basicConfig(level=logging.DEBUG)%0A%0A# Turn on extra info for ... | |
3834af9b3a6381ac7a2334c7bd2ae6d562e0f20b | Create HR_pythonIsLeap.py | HR_pythonIsLeap.py | HR_pythonIsLeap.py | Python | 0.000764 | @@ -0,0 +1,307 @@
+def is_leap(year):%0A leap = False%0A %0A # Write your logic here%0A # thought process%0A #if year%254==0:%0A # return True%0A #elif year%25100==0:%0A # return False%0A #elif year%25400==0:%0A # return True%0A %0A # Optimized, Python 3%0A return ((year%... | |
d160d73740c73e2cab8325179e7f0a9ee4ae8c50 | add disk_usage.py example script | examples/disk_usage.py | examples/disk_usage.py | Python | 0.000001 | @@ -0,0 +1,1172 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AList all mounted disk partitions a-la %22df%22 command.%0A%22%22%22%0A%0Aimport sys%0Aimport psutil%0A%0Adef convert_bytes(n):%0A if n == 0:%0A return %220B%22%0A symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')%0A prefix = %7B%7D%0A for i,... | |
7475b73072f0037fc53bcae59e331c4d5a997e86 | Add auto-fill test cases | depot/tests/test_checkout.py | depot/tests/test_checkout.py | Python | 0.000001 | @@ -0,0 +1,1109 @@
+from django.contrib.auth.models import User%0Afrom depot.models import Depot, Organization%0Afrom verleihtool.test import ClientTestCase%0A%0A%0Aclass AutoFillTestCase(ClientTestCase):%0A %22%22%22%0A Test cases asserting the auto-fill functionality for checkout-form%0A%0A :author: Stefan S... | |
0caa9035e06e6596a295ed2ed0a6238a2b09f353 | add PCA and TSNE representation | utils/postprocessing/representation.py | utils/postprocessing/representation.py | Python | 0 | @@ -0,0 +1,596 @@
+import numpy as np%0Afrom sklearn.decomposition import PCA%0Afrom sklearn.manifold import TSNE%0Aimport matplotlib.pyplot as plt%0A%0Adef PCA_representation(data, n_components):%0A%09pca = PCA(n_components=n_components)%0A%09return pca.fit_transform(data)%0A%0Adef TSNE_representation(data, n_componen... | |
3ee47b0adbc379d77f01df51927399ecf3fb24e6 | Add docstring and comment. | examples/mnist-autoencoder.py | examples/mnist-autoencoder.py | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import theanets
from utils import load_mnist, plot_layers, plot_images
g = climate.add_group('MNIST Example')
g.add_argument('--features', type=int, default=8, metavar='N',
help='train a model using N^2 hidden-layer features')
def ... | Python | 0 | @@ -16,16 +16,255 @@
python%0A%0A
+'''Single-layer autoencoder example using MNIST digit data.%0A%0AThis example shows one way to train a single-layer autoencoder model using the%0Ahandwritten MNIST digits.%0A%0AThis example also shows the use of climate command-line arguments.%0A'''%0A%0A
import c
@@ -564,16 +564,55... |
09112412a4814e3727def2547765546bf44c1e7d | Test joint refinement of 300 cspad images using Brewster 2018 methods. | test/algorithms/refinement/test_cspad_refinement.py | test/algorithms/refinement/test_cspad_refinement.py | Python | 0 | @@ -0,0 +1,1930 @@
+# Test multiple stills refinement.%0A%0Afrom __future__ import absolute_import, division, print_function%0A%0Aimport os%0A%0Afrom dxtbx.model.experiment_list import ExperimentListFactory%0Aimport procrunner%0A%0Adef test1(dials_regression, run_in_tmpdir):%0A %22%22%22%0A Refinement test of 300 CSP... | |
fa521b4358a06d1667864a09cd7195d3a6db764d | Add lc206_reverse_linked_list.py | lc206_reverse_linked_list.py | lc206_reverse_linked_list.py | Python | 0.000001 | @@ -0,0 +1,625 @@
+%22%22%22206. Reverse Linked List%0AEasy%0A%0AReverse a singly linked list.%0A%0AExample:%0AInput: 1-%3E2-%3E3-%3E4-%3E5-%3ENULL%0AOutput: 5-%3E4-%3E3-%3E2-%3E1-%3ENULL%0A%0AFollow up:%0AA linked list can be reversed either iteratively or recursively. Could you implement both?%0A%22%22%22%0A%0A# Defi... | |
2dd6049c1fa9340d14f4b73f843f7ed4408e84f5 | Prepare release script init | utils/create_release.py | utils/create_release.py | Python | 0 | @@ -0,0 +1,2157 @@
+#!/usr/bin/env python3%0Aimport os%0Aimport datetime%0Aimport subprocess%0Afrom distutils.version import StrictVersion%0A%0APROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))%0A%0A%0Adef main():%0A # git_clean = subprocess.check_output(%0A # %22git status --porcela... | |
2850713d0add5cb1ae084898bdd6929c0f5bfb3e | add simulated annealing stat script | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | Python | 0 | @@ -0,0 +1,1331 @@
+import GPy%0Aimport GPyOpt%0Aimport numpy as np%0Afrom sys import path%0Aimport pickle%0Aimport time%0Afrom tqdm import tqdm%0Apath.append(%22..%22)%0Apath.append(%22../..%22)%0Apath.append(%22../../..%22)%0A%0Afrom solver import SimulatedAnnealingSolver, RandomSolver%0Aimport map_converter as m%0A%... | |
edf2fd4c3c73a82f590ec3065cfdf6de4eb58e01 | Fix include_clients in PostfixCollector | src/collectors/postfix/postfix.py | src/collectors/postfix/postfix.py | # coding=utf-8
"""
Collect stats from postfix-stats. postfix-stats is a simple threaded stats
aggregator for Postfix. When running as a syslog destination, it can be used to
get realtime cumulative stats.
#### Dependencies
* socket
* json (or simeplejson)
* [postfix-stats](https://github.com/disqus/postfix-stats)... | Python | 0 | @@ -1446,12 +1446,14 @@
':
-T
+'t
rue
+'
,%0A
@@ -2579,16 +2579,26 @@
lients'%5D
+ == 'true'
and u'c
|
1d4693b6f5b6f8b3912aae1216665272a36b1411 | Add missing group.py | group.py | group.py | Python | 0.000387 | @@ -0,0 +1,218 @@
+from pygame.sprite import Group as pygame_Group%0A%0Aclass Group(pygame_Group):%0A def draw(self, onto, *args, **kw):%0A for sprite in self:%0A sprite.draw(*args, **kw)%0A super(Group, self).draw(onto)%0A
| |
b680141b9ec5468a5a0890edf25045a6af8b46c2 | Add run.py | run.py | run.py | Python | 0.000009 | @@ -0,0 +1,158 @@
+#!/usr/bin/python%0A# -*- coding:utf8 -*-%0A# Powered By KK Studio%0A%0Afrom app.DNStack import DNStack%0A%0Aif __name__ == %22__main__%22:%0A app = DNStack()%0A app.run()%0A
| |
d3e786b554bfafeb4f0c16635b80f9911acc4bba | add stacked auto encoder file. | sae.py | sae.py | Python | 0 | @@ -0,0 +1,2201 @@
+#coding: utf-8%0Aimport requests%0Aimport random, numpy%0Afrom aa import AutoEncoder%0A%0A%0Aclass StackedAutoEncoder:%0A def __init__(self, visible, hiddens):%0A # TODO: fine-tuning layer%0A num_of_nodes= %5Bvisible%5D + hiddens%0A self.auto_encoders = %5B%5D%0A for i... | |
13486556a15cdb2dbfe3f390f973942d93338995 | Create TryRecord.py | TryRecord.py | TryRecord.py | Python | 0.000001 | @@ -0,0 +1,1916 @@
+%22%22%22%0AExample usage of Record class%0A%0AThe MIT License (MIT)%0A%0ACopyright (c) %3C2016%3E %3CLarry McCaig (aka: Larz60+ aka: Larz60p)%3E%0A%0APermission is hereby granted, free of charge, to any person obtaining a%0Acopy of this software and associated documentation files (the %22Software%2... | |
8d94bbc272b0b39ea3a561671faf696a4851c1a1 | Create app.py | reddit2telegram/channels/MoreTankieChapo/app.py | reddit2telegram/channels/MoreTankieChapo/app.py | Python | 0.000003 | @@ -0,0 +1,151 @@
+#encoding:utf-8%0A%0Asubreddit = 'MoreTankieChapo'%0At_channel = '@MoreTankieChapo'%0A%0A%0Adef send_post(submission, r2t):%0A return r2t.send_simple(submission)%0A
| |
e5ae14b4438fc7ae15156615206453097b8f759b | add wave test | Python/WaveTest.py | Python/WaveTest.py | Python | 0.000007 | @@ -0,0 +1,1111 @@
+import requests%0A%0Adef text2code(text):%0A '''%0A convert a string to wave code%0A '''%0A ret = None%0A get_wave_params = %7B'type' : 'text', 'content' : text%7D%0A response = requests.post('http://rest.sinaapp.com/api/post', data=get_wave_params)%0A if response.status_code ==... | |
f6a725b5915575f61fcb7c34ac7b464cd304e7b5 | test mode shows user | dj/scripts/tweet.py | dj/scripts/tweet.py | #!/usr/bin/python
# tweets #client.slug, #video, title and blipurl
# shortens the URL and title if needed
# if over 140 char, url is shortened using bity,
# if still over, title is truncated.
import twitter
import urllib2
import urllib
import time
import pw # see pw_samp.py for sample.
from process import proces... | Python | 0.000001 | @@ -2065,17 +2065,67 @@
t mode:'
-,
+ %0A print 'user:', user%0A print
tweet%0A
|
561f595337106c60c55212dd87d90ed3002de07f | disable pretty json (reduces size by 30%) | runserver.py | runserver.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from threading import Thread
from pogom import config
from pogom.app import Pogom
from pogom.search import search_loop, set_cover, set_location
from pogom.utils import get_args, insert_mock_data
from pogom.models import create_tables, SearchConfig
from pogom.p... | Python | 0 | @@ -1961,16 +1961,70 @@
ot_path%0A
+ app.config%5B'JSONIFY_PRETTYPRINT_REGULAR'%5D = False%0A
app.
|
7b71bbd87234c8cbe8c7fa189c0617b4ca191989 | Add tweak_billing_log command | silver/management/commands/tweak_billing_log.py | silver/management/commands/tweak_billing_log.py | Python | 0.000004 | @@ -0,0 +1,893 @@
+import datetime as dt%0Afrom datetime import datetime%0Afrom optparse import make_option%0A%0Afrom django.core.management.base import BaseCommand%0Afrom django.utils import timezone%0A%0Afrom silver.models import Subscription, BillingLog%0A%0A%0Aclass Command(BaseCommand):%0A option_list = BaseCom... | |
1b023e8471dad22bfb6b8de0d30c0796c30e2a40 | Copy hello.py from add_snippet branch | hello.py | hello.py | Python | 0 | @@ -0,0 +1,2272 @@
+import cygroonga as grn%0Aimport datetime%0A%0Awith grn.Groonga():%0A with grn.Context() as ctx:%0A db = ctx.open_or_create_database(%22test.db%22)%0A table1 = ctx.open_or_create_table(%22table1%22,%0A grn.OBJ_TABLE_HASH_KEY %7C grn.OBJ_PERSISTENT,%0A c... | |
53b6b1f4b7f58b1a7d748f67e220bd4da147df0e | Create hello.py | hello.py | hello.py | Python | 0.999503 | @@ -0,0 +1,30 @@
+def main():%0A print(%22Hello!%22)%0A
| |
724e86e31b6584012af5afe458e0823b9a2ca7ab | Create a class named "CreateSpark", which is to solove the problem of "Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__" | myclass/class_create_spark.py | myclass/class_create_spark.py | Python | 0 | @@ -0,0 +1,2559 @@
+# -*- coding: utf-8 -*-%0A# !/usr/bin/python%0A################################### PART0 DESCRIPTION #################################%0A# Filename: class_save_word_to_database.py%0A# Description:%0A#%0A%0A%0A# Author: Shuai Yuan%0A# E-mail: ysh329@sina.com%0A# Create: 2015-11-17 20:43:09%0A# Last:%... | |
2bd453c4a7402f24cd43b49e73d0b95e371e6654 | add package Feature/sentieon (#9557) | var/spack/repos/builtin/packages/sentieon-genomics/package.py | var/spack/repos/builtin/packages/sentieon-genomics/package.py | Python | 0 | @@ -0,0 +1,1491 @@
+# Copyright 2013-2018 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%0Aimport os.path%0Afrom spack import *%0A%0A%0Aclass SentieonGenomics(Package):%0A %22%22%2... | |
8c1cd72d11836ad913af5c3614137358ddf3efee | add mgmt cmd to set related user | sources/management/commands/set_related_user.py | sources/management/commands/set_related_user.py | Python | 0 | @@ -0,0 +1,1861 @@
+from django.core.management.base import BaseCommand, CommandError%0Afrom django.core.mail import send_mail%0Afrom django.contrib.auth.models import User%0A# from sources.models import Person%0Aimport random%0A%0A%0Adef set_related_user(email_address, person_id):%0A obj = Person.objects.get(id=per... | |
8fd8b6edb0b6e7dee542410a4649a4d69756e3e7 | Handle strings as strings, and unicode as unicode | sentry/helpers.py | sentry/helpers.py | import logging
import urllib
import urllib2
import uuid
import django
from django.conf import settings
from django.utils.encoding import smart_unicode
from django.utils.hashcompat import md5_constructor
from sentry import conf
_FILTER_CACHE = None
def get_filters():
global _FILTER_CACHE
if _FILTER_CACHE... | Python | 0.998472 | @@ -2349,18 +2349,84 @@
ue,
-basestring
+unicode):%0A return force_unicode(value)%0A elif isinstance(value, str
):%0A
@@ -2453,23 +2453,18 @@
-value = unicode
+return str
(val
@@ -2495,23 +2495,22 @@
-value =
+return
force_u
@@ -2523,37 +2523,16 @@
(value)%0A
- return value%0A
... |
208077afd9b1ba741df6bccafdd5f008e7b75e38 | Add nftables test | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | Python | 0 | @@ -0,0 +1,2930 @@
+import os%0Aimport subprocess%0Afrom time import sleep%0Afrom oeqa.oetest import oeRuntimeTest%0A%0Aclass NftablesTest(oeRuntimeTest):%0A%0A def check_ssh_connection(self):%0A '''Check SSH connection to DUT port 2222'''%0A process = subprocess.Popen((%22ssh -o UserKnownHostsFile=/de... | |
3be145af359df5bcf928da1b984af8635ea33c27 | add model for parcels, temp until i figure out psql migrations in flask | farmsList/farmsList/public/models.py | farmsList/farmsList/public/models.py | Python | 0 | @@ -0,0 +1,445 @@
+# -*- coding: utf-8 -*-%0Afrom farmsList.database import (%0A Column,%0A db,%0A Model,%0A ReferenceCol,%0A relationship,%0A SurrogatePK,%0A)%0A%0A%0Aclass Parcel(SurrogatePK, Model):%0A __tablename__ = 'parcels'%0A name = Column(db.String(80), unique=True, nullable=False)%0A%0... | |
8a3425209090cb9acc6353ab6fccc0ec31cae804 | permutations II | backtracking/47.py | backtracking/47.py | Python | 0.999946 | @@ -0,0 +1,781 @@
+class Solution:%0A def permuteUnique(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: List%5BList%5Bint%5D%5D%0A %22%22%22%0A ret = %5B%5D%0A nums.sort()%0A used = %5B0%5D*len(nums)%0A self.dfs(ret, %5B%5D, nums, used)%0A ... | |
a5d63ec0f8f192aaeae8b9a7f1cf423d18de25dc | Add test runner to handle issue with import path | server/test.py | server/test.py | Python | 0 | @@ -0,0 +1,40 @@
+import pytest%0A%0Apytest.main('-x tests/')%0A
| |
8632b60718fa353797ffc53281e57a37caf9452f | Add config command for setting the address of rf sensors. | set_address.py | set_address.py | Python | 0 | @@ -0,0 +1,425 @@
+import zmq%0Aimport time%0Aimport sys%0Aprint sys.argv%5B1:%5D%0A%0A# ZeroMQ Context%0Acontext = zmq.Context()%0A%0Asock_live = context.socket(zmq.PUB)%0Asock_live.connect(%22tcp://%22+sys.argv%5B1%5D)%0A%0Atime.sleep(1)%0A# Send multipart only allows send byte arrays, so we convert everything to str... | |
f5f6bc0999d5b6f065adb81982ce3a322e1ab987 | add regression test for fit_spectrum() Python 3.x issue | nmrglue/analysis/tests/test_analysis_linesh.py | nmrglue/analysis/tests/test_analysis_linesh.py | Python | 0 | @@ -0,0 +1,1339 @@
+import numpy as np%0A%0A%0Aimport nmrglue as ng%0Afrom nmrglue.analysis.linesh import fit_spectrum%0A%0A%0Adef test_fit_spectrum():%0A _bb = np.random.uniform(0, 77, size=65536)%0A lineshapes = %5B'g'%5D%0A params = %5B%5B(13797.0, 2.2495075273313034)%5D,%0A %5B(38979.0, 5.8705... | |
c5a2167a63516c23390263408fcd2c9a4f654fc8 | Add tests for the parse method of the spider | webcomix/tests/test_comic_spider.py | webcomix/tests/test_comic_spider.py | Python | 0 | @@ -0,0 +1,1332 @@
+from webcomix.comic_spider import ComicSpider%0A%0A%0Adef test_parse_yields_good_page(mocker):%0A mock_response = mocker.patch('scrapy.http.Response')%0A mock_response.urljoin.return_value = %22http://xkcd.com/3/%22%0A mock_response.url = %22http://xkcd.com/2/%22%0A mock_selector = mocke... | |
fd5da951feee92c055853c63b698b44397ead6be | Add save function for use across the application | app/db_instance.py | app/db_instance.py | Python | 0 | @@ -0,0 +1,165 @@
+from app import db%0A%0Adef save(data):%0A try:%0A print(data)%0A db.session.add(data)%0A db.session.commit()%0A except Exception as e:%0A raise e%0A
| |
585fec12673ab0207f5b641a9ba0df4a510667ac | Add harvester for mblwhoilibrary | scrapi/harvesters/mblwhoilibrary.py | scrapi/harvesters/mblwhoilibrary.py | Python | 0.000001 | @@ -0,0 +1,871 @@
+'''%0AHarvester for the WHOAS at MBLWHOI Library for the SHARE project%0A%0AExample API call: http://darchive.mblwhoilibrary.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc%0A'''%0Afrom __future__ import unicode_literals%0A%0Afrom scrapi.base import helpers%0Afrom scrapi.base import OAIHarvest... | |
f5cc9c86b1cfbb2cda1b4c1c4c8656a6ca7a2a7f | Create graphingWIP.py | src/graphingWIP.py | src/graphingWIP.py | Python | 0 | @@ -0,0 +1,664 @@
+# -*- coding: utf-8 -*-%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.dates as md%0Aimport dateutil%0A%0A# create empty dynamic arrays %0Atemp_x = %5B%5D%0Ax = %5B%5D%0Ay = %5B%5D%0A%0Af = open(%22temp.log%22, %22r%22) # open log folder%0A%0Afor line in f: # load x and y values%0A%09temp_line... | |
534fcff9f812df4cef273ca7853df12647b25d06 | Add preliminary metrics file and import some from sklearn | metrics.py | metrics.py | Python | 0 | @@ -0,0 +1,127 @@
+from sklern.metrics import roc_curve as roc, roc_auc_score as auc%0A%0Adef enrichment_factor():%0A pass%0A%0Adef log_auc():%0A pass%0A%0A
| |
40e9825ee0a2ccf7c3e92d4fd6599c1976a240a3 | Add deprecated public `graphql` module | fbchat/graphql.py | fbchat/graphql.py | Python | 0.000001 | @@ -0,0 +1,730 @@
+# -*- coding: UTF-8 -*-%0A%22%22%22This file is here to maintain backwards compatability.%22%22%22%0Afrom __future__ import unicode_literals%0A%0Afrom .models import *%0Afrom .utils import *%0Afrom ._graphql import (%0A FLAGS,%0A WHITESPACE,%0A ConcatJSONDecoder,%0A graphql_color_to_enum,... | |
f98aa5f336cd81ad55bc46122821df3ad314a4cb | Add py-dockerpy-creds (#19198) | var/spack/repos/builtin/packages/py-dockerpy-creds/package.py | var/spack/repos/builtin/packages/py-dockerpy-creds/package.py | Python | 0 | @@ -0,0 +1,1294 @@
+# 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 PyDockerpyCreds(PythonPackage):%0A %22%22%22Python bind... | |
07a1612250a9c3b2de1ffe53fb916a8cff153c3f | add count of collisions | findCollisions.py | findCollisions.py | Python | 0.000017 | @@ -0,0 +1,567 @@
+from collections import Counter%0A%0Adef countCollisions(entries):%0A collisions = %5Bk for k,v in Counter(entries).items() if v%3E1%5D%0A num_collisions = len(collisions)%0A print(num_collisions,'word collisions:%5Cn',collisions)%0A return num_collisions%0A%0Adef countCollisionsInFile(fi... | |
4a0fa1028f22944f30e39c65806f0d123e18420f | Create input.py | input.py | input.py | Python | 0 | @@ -0,0 +1,102 @@
+ckey=%22%22%0Acsecret=%22%22%0Aatoken=%22%22%0Aasecret=%22%22%0A%0Aquery='' #Add keyword for which you want to start the miner%0A
| |
98499f07c6dcccba3605e9ab9c8eaef9463b0634 | Add some validators | indra/tools/stmt_validator.py | indra/tools/stmt_validator.py | Python | 0.000002 | @@ -0,0 +1,524 @@
+class StatementValidator:%0A def __init__(self):%0A%0A%0A%0Aclass DbRefsEntryValidator:%0A @staticmethod%0A def validate(entry):%0A raise NotImplementedError()%0A%0A%0Aclass ChebiPrefix(DbRefsEntryValidator):%0A @staticmethod%0A def validate(entry):%0A return not entry or... | |
ba1f04337d0653d4808427b5d07ed8673526b315 | add mygpo.wsgi | mygpo.wsgi | mygpo.wsgi | Python | 0.000135 | @@ -0,0 +1,1229 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A# my.gpodder.org FastCGI handler for lighttpd (default setup)%0A#%0A# This file is part of my.gpodder.org.%0A#%0A# my.gpodder.org is free software: you can redistribute it and/or modify it%0A# under the terms of the GNU Affero General Public License as p... | |
44da905cb7e0d81267d75ccfcb7ffa2669f02aeb | Change format index to support Python 2.6 | flask/wrappers.py | flask/wrappers.py | # -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... | Python | 0.000002 | @@ -6505,16 +6505,17 @@
bject: %7B
+0
%7D'.forma
|
1086259090a396b2a2ed40788d1cb8c8ff7c95f3 | fix the fixme | src/robotide/plugins/connector.py | src/robotide/plugins/connector.py | # Copyright 2008-2009 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 applicab... | Python | 0.000023 | @@ -1365,67 +1365,8 @@
gin%0A
- # FIXME: breaks in case the section does not exist%0A
@@ -1405,17 +1405,29 @@
lugins'%5D
-%5B
+.add_section(
plugin.n
@@ -1429,17 +1429,17 @@
gin.name
-%5D
+)
%0A
|
0d22f1ab7f4c83af280edb799f863fa0f46ea326 | Create generic views for index/login | app/views.py | app/views.py | Python | 0 | @@ -0,0 +1,752 @@
+from flask import render_template, flash, redirect%0Afrom app import app%0Afrom .forms.login import LoginForm%0A%0A%0A@app.route('/')%0A@app.route('/index')%0Adef index():%0A user = %7B'nickname': 'Mark'%7D # fake user%0A return render_template(%22index.html%22,%0A ti... | |
45939892a21bbf11ddcd1400d26cf2e94fa8ebac | add nox tests. | noxfile.py | noxfile.py | Python | 0 | @@ -0,0 +1,1104 @@
+import nox%0A%0APYTHON_VERSIONS = %5B%223.6%22, %223.7%22, %223.8%22%5D%0APACKAGE = %22abilian%22%0A%0A%0A@nox.session(python=%22python3.6%22)%0Adef lint(session):%0A # session.env%5B%22LC_ALL%22%5D = %22en_US.UTF-8%22%0A session.install(%22poetry%22, %22psycopg2-binary%22)%0A session.run(%... | |
5addf2c2992cfdedf06da58861dae93347e02fb9 | Support for nox test runner (alternative to tox), provides a workaround for #80. | noxfile.py | noxfile.py | Python | 0 | @@ -0,0 +1,1585 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (c) 2016 - 2020 -- Lars Heuer%0A# All rights reserved.%0A#%0A# License: BSD License%0A#%0A%22%22%22%5C%0ANox test runner configuration.%0A%22%22%22%0Aimport os%0Afrom functools import partial%0Aimport shutil%0Aimport nox%0A%0A%0A@nox.session(python=%223%22)%... | |
510b90d42dbccd0aa1e3ff48ee8dbe7230b65185 | Add script to compute some stats about data from energy consumption measures | get_stats_from.py | get_stats_from.py | Python | 0.000001 | @@ -0,0 +1,2373 @@
+import argparse%0Aimport csv%0Afrom glob import glob%0Aimport re%0Aimport statistics%0Aimport sys%0A%0Adef get_stats_from(files_names, files_content):%0A for i in range(len(files_content)):%0A file_name = files_names%5Bi%5D%0A file_content = files_content%5Bi%5D%0A print(%22F... | |
32dcc681a82ef2246d0fad441481d6e68f79ddd6 | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | Python | 0.000138 | @@ -0,0 +1,1550 @@
+#!/usr/bin/env python%0A%22%22%22Benchmark ln.%22%22%22%0A%0Afrom __future__ import print_function%0Aimport timeit%0A%0ANAME = %22ln%22%0AREPEATS = 3%0AITERATIONS = 1000000%0A%0A%0Adef print_version():%0A %22%22%22Print the TAP version.%22%22%22%0A print(%22TAP version 13%22)%0A%0A%0Adef print... | |
20b450c4cd0ff9c57d894fa263056ff4cd2dbf07 | Add a vim version of merge business hours | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | Python | 0.000001 | @@ -0,0 +1,365 @@
+from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions%0Afrom vim_turing_machine.vim_machine import VimTuringMachine%0A%0A%0Aif __name__ == '__main__':%0A merge_business_hours = VimTuringMachine(merge_business_hours_transitions(), debug=T... | |
137a7c6e98e0ba8bd916d4ba696b0f0f4e2cdc56 | Create uptime.py | plot-uptime/uptime.py | plot-uptime/uptime.py | Python | 0.000024 | @@ -0,0 +1 @@
+%0A
| |
e90c48ba46d7971386e01b3def9edbb2df5d74e8 | Create mummy.py | management/commands/mummy.py | management/commands/mummy.py | Python | 0.0034 | @@ -0,0 +1,744 @@
+%22%22%22%0A%0A1. Install model-mommy%0A%0A %60pip install model-mommy%60%0A%0A2. Use the command%0A%0A %60./manage mummy someotherapp.HilariousModelName:9000 yetanotherapp.OmgTheseModelNamesLawl:1%60%0A%0A%22%22%22%0Afrom django.conf import settings%0Afrom django.core.management.base import Ba... | |
24c7231f57d967c4b18a9f37df18b1a7d53e45e5 | Modify Caffe example to use module interface instead of the deprecated model interface. (#9095) | example/caffe/train_model.py | example/caffe/train_model.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 0 | @@ -3277,25 +3277,24 @@
= None%0A%0A
+%0A
mod
-el
= mx.mo
@@ -3298,351 +3298,36 @@
.mod
-el.FeedForward(%0A ctx = devs,%0A symbol = network,%0A num_epoch = args.num_epochs,%0A learning_rate = args.lr,%0A momentum = 0.9,%0A ... |
3b7de4dbe3611863620cb528092779d25efde025 | remove dj 3.2 warnings | data_exports/apps.py | data_exports/apps.py | Python | 0.000002 | @@ -0,0 +1,227 @@
+#!/usr/bin/env python%0Afrom django.apps import AppConfig%0Afrom django.utils.translation import gettext_lazy as _%0A%0A%0Aclass CsvExportConfig(AppConfig):%0A name = 'data_exports'%0A default_auto_field = %22django.db.models.AutoField%22%0A
| |
85c732e395e3db4ec63a0d8580d895363d82e4a0 | Add the salt.output module | salt/output.py | salt/output.py | Python | 0.000142 | @@ -0,0 +1,2452 @@
+%22%22%22%0AA simple way of setting the output format for data from modules%0A%22%22%22%0Aimport pprint%0A%0A# Conditionally import the json and yaml modules%0Atry:%0A import json%0A JSON = True%0Aexcept ImportError:%0A JSON = False%0Atry:%0A import yaml%0A YAML = True%0Aexcept Import... | |
9b0c335fc956c2d2156d169e3636d862ebfbadc0 | add a scraping script | hadairopink.py | hadairopink.py | Python | 0.000001 | @@ -0,0 +1,1458 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0ANo description.%0A%22%22%22%0A%0Aimport sys%0Afrom scrapy import cmdline, Request%0Afrom scrapy.linkextractors import LinkExtractor%0Afrom scrapy.spiders import CrawlSpider, Rule%0A%0ATARGET_DOMAIN = 'hadairopink.com'%0A%0AXPATH_IMAGE_SRC = '//div%5B@class=%22k... | |
285cddc3ed75f70e077738a206c50a57671245ea | add hello world script by pyThon | hello_flask.py | hello_flask.py | Python | 0.000003 | @@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-%0A%0Afrom flask import Flask%0Aapp = flask(__name__)%0A%0A@app.route('/')%0Adef hello_flask():%0A%09return 'Hello Flask!'%0A%0Aif __name__ == '__main__':%0A%09app.run()
| |
27ea547fbd7c936bd017b64b31ecf09ed991c6c0 | Add index to fixed_ips.address | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | Python | 0.000001 | @@ -0,0 +1,1088 @@
+# Copyright 2012 IBM%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless requ... | |
65258cf8d11e8e5c7cce3e07d9a389e5617948dd | Add boilerplate code | aoc.py | aoc.py | Python | 0.001915 | @@ -0,0 +1,1121 @@
+import argparse%0Aimport importlib%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A%0A parser = argparse.ArgumentParser(description=%22Advent of Code 2016%22)%0A parser.add_argument(%22--day%22, type=int, dest=%22days%22, nargs=%22+%22, default=range(1, 25))%0A parser.add_argument(%22--s... | |
02a5a09334eddd8003933948a8ea13e249a4a9dd | Tune bench expectation algorithm parameters. | bench/gen_bench_expectations.py | bench/gen_bench_expectations.py | #!/usr/bin/env python
# Copyright (c) 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.
""" Generate bench_expectations file from a given set of bench data files. """
import argparse
import bench_util
import os
import ... | Python | 0.998397 | @@ -393,17 +393,17 @@
PER = 1.
-0
+2
# Rati
@@ -453,17 +453,17 @@
WER = 1.
-5
+8
# Rati
@@ -506,17 +506,17 @@
IO = 0.0
-5
+8
# Furt
|
813eb3b6bdc01906e39f11f93b4a326fc2fb1ee5 | Add kitchen-sink base test | test/base.py | test/base.py | Python | 0.000001 | @@ -0,0 +1,891 @@
+import torch%0Afrom torch.autograd import Variable%0Aimport torch.nn as nn%0Aimport torch.nn.functional as F%0A%0Aimport os%0Aimport uuid%0Aimport torch2c%0A%0A%0Adef base_test():%0A%0A fc1 = nn.Linear(10,20)%0A fc1.weight.data.normal_(0.0,1.0)%0A fc1.bias.data.normal_(0.0,1.0)%0A%0A fc2 ... | |
407f7fcf8f481c57df59789b7f845928428f1bf9 | Add example script. | telegrambot/example.py | telegrambot/example.py | Python | 0 | @@ -0,0 +1,209 @@
+from telegrambot import TelegramBot, main%0Afrom telegrambot.commands import GetCommand%0A%0A%0Aclass DemoTelegramBot(TelegramBot, GetCommand):%0A pass%0A%0A%0Aif __name__ == '__main__':%0A main(bot_class=DemoTelegramBot)
| |
9fdd671d9c0b91dc789ebf3b24226edb3e6a072a | Add new migration to load metrics fixtures | sleep/migrations/0002_load_metrics.py | sleep/migrations/0002_load_metrics.py | Python | 0 | @@ -0,0 +1,351 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Afrom django.core.management import call_command%0A%0A%0Adef load_metrics():%0A call_command('loaddata', 'metrics.json')%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependen... | |
ef4d7e4fb43b5db29576f95625fd612c259731be | Create ServoSync.py | home/Mats/ServoSync.py | home/Mats/ServoSync.py | Python | 0.000001 | @@ -0,0 +1,301 @@
+port = %22COM99%22%0Aarduino = Runtime.start(%22arduino%22,%22Arduino%22)%0Avard = Runtime.start(%22va%22,%22VirtualArduino%22)%0Avard.connect(port)%0Aarduino.connect(port)%0Aservo1 = Runtime.start(%22servo1%22,%22Servo%22)%0Aservo2 = Runtime.start(%22servo2%22,%22Servo%22)%0Aservo1.attach(%22arduino... | |
ecfbaded5e03529d1b189b6b5fc8b2f8516c4b31 | Add hoster plugin for ARD mediathek | module/plugins/hoster/ARD.py | module/plugins/hoster/ARD.py | Python | 0 | @@ -0,0 +1,2481 @@
+%0Aimport subprocess%0Aimport re%0Aimport os.path%0Aimport os%0A%0Afrom module.utils import save_join, save_path%0Afrom module.plugins.Hoster import Hoster%0A%0A# Requires rtmpdump%0A# by Roland Beermann%0A%0Aclass RTMP:%0A # TODO: Port to some RTMP-library like rtmpy or similar%0A # TODO?: In... | |
b4b2775b115fb6ec506e982a9f98ee78342eb317 | the default sequence = 0 | res_currency_sequence/res_currency_sequence.py | res_currency_sequence/res_currency_sequence.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | Python | 0.999997 | @@ -1368,55 +1368,8 @@
%0A
- _defaults = %7B%0A 'sequence': 0,%0A %7D%0A
|
206ef4f7aad6c4ce51e4737a7d506a79061f1047 | Add an `import_or_skip` function to testing. | distarray/testing.py | distarray/testing.py | import unittest
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def comm_null_passes(fn):
"""Decorator. If `self.comm` is COMM_NULL, pass."""
@wraps(fn)
def wrapper(self, *args, **kwargs):
if self.comm == MPI.CO... | Python | 0 | @@ -9,16 +9,33 @@
nittest%0A
+import importlib%0A
from fun
@@ -162,16 +162,691 @@
_size%0A%0A%0A
+def import_or_skip(name):%0A %22%22%22Try importing %60name%60, raise SkipTest on failure.%0A%0A Parameters%0A ----------%0A name : str%0A Module name to try to import.%0A%0A Returns%0A -------%... |
80c1dba49bbdaf4d0d37e8a06549774d2afd019a | Add cosmo_viewer app | pvapp/cosmo_viewer.py | pvapp/cosmo_viewer.py | Python | 0 | @@ -0,0 +1,3196 @@
+################################################################################%0A#%0A# Copyright 2013 Kitware, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the Lice... | |
99ed96105fcbaa7b2836d19e1dde17bc49f23327 | Commit the basic skeleton | crawl_ptt.py | crawl_ptt.py | Python | 0.999616 | @@ -0,0 +1,1240 @@
+#!/usr/bin/env python%0A%0A%0Afrom pprint import pprint%0Aimport logging%0Afrom bs4 import BeautifulSoup%0Aimport requests%0A%0A%0Alogging.basicConfig(%0A format=(%0A '%25(asctime)s%5Ct%25(levelname)s%5Ct'%0A #'%25(processName)s%5Ct%25(threadName)s%5Ct'%0A '%25(name)s%5Ct%25(... | |
8287876963af72756c3ff9102526c56f3e28a8a2 | Test for file resources | tests/functional_tests/test_resources/test_file_resource.py | tests/functional_tests/test_resources/test_file_resource.py | Python | 0 | @@ -0,0 +1,530 @@
+# -*- coding: utf8 -*-%0A%0A%0Afrom tuttle.resources import FileResource%0Aimport tuttle.resources%0Afrom os import path%0A%0Aclass TestHttpResource():%0A%0A def test_real_resource_exists(self):%0A %22%22%22A real resource should exist%22%22%22%0A file_url = %22file://%7B%7D%22.forma... | |
14755cda032b5cb44626b2da66d943517427f947 | test for malformed db imports | tests/test_core.py | tests/test_core.py | Python | 0 | @@ -0,0 +1,213 @@
+%22%22%22unit tests for core.py%22%22%22%0A%0Aimport pytest%0A%0Aimport core%0A%0A%0Adef test_malformed_linkdatabase():%0A # pytest.set_trace()%0A with pytest.raises(EOFError):%0A core.LinkDatabase().load(db='tests/garbage.pickle')%0A
| |
3a59057f7465d9982e26b92cddafa0ea9ba48806 | Add new package: universal-ctags (#18962) | var/spack/repos/builtin/packages/universal-ctags/package.py | var/spack/repos/builtin/packages/universal-ctags/package.py | Python | 0 | @@ -0,0 +1,803 @@
+# 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 UniversalCtags(AutotoolsPackage):%0A %22%22%22Universal ... | |
f29e278a1b661224c9580d8275654a8c6fe7d3cf | add test for http.encode_request | tests/test_http.py | tests/test_http.py | Python | 0 | @@ -0,0 +1,1145 @@
+%22%22%22Test bbs2ch.http module.%22%22%22%0Afrom bbs2ch import http%0A%0A%0Adef test_host_path():%0A %22%22%22Return hostname and path from url.%22%22%22%0A assert (u'hoge.com', '/') == http.host_path(u'http://hoge.com/')%0A%0A%0Adef test_encode_request_get():%0A %22%22%22Return http reque... | |
f032556bf07b37f9544c71ecad7aed472021bc97 | Add script to update giving and teams receiving | sql/branch.py | sql/branch.py | Python | 0 | @@ -0,0 +1,591 @@
+import sys%0A%0Afrom gratipay import wireup%0A%0Adb = wireup.db(wireup.env())%0A%0Aparticipants = db.all(%22%22%22%0A SELECT p.*::participants%0A FROM participants p%0A WHERE (%0A SELECT error%0A FROM current_exchange_routes er%0A WHERE er.participant = p.id%0A ... | |
da66b2a2a2e2a73ffd986aea6ba5d086d43892fc | Add main smoketest | tests/test_main.py | tests/test_main.py | Python | 0.000002 | @@ -0,0 +1,165 @@
+import unittest%0Aimport sys%0Afrom chaser import main%0A%0A%0Aclass TestMain(unittest.TestCase):%0A%0A def test_smoke_main(self):%0A sys.argv = %5B%22chaser%22%5D%0A main()%0A
| |
ad1d349d49072b5bda6641db4f070704fde81e5f | Add FCC. | inspectors/fcc.py | inspectors/fcc.py | Python | 0 | @@ -0,0 +1,2604 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport datetime%0Aimport logging%0Aimport os%0Afrom urllib.parse import urljoin%0A%0Afrom bs4 import BeautifulSoup%0Afrom utils import utils, inspector%0A%0A# http://transition.fcc.gov/oig/oigreportsaudit.html%0A# Oldest report: 1994%0A%0A# option... | |
c510b27dea59eeae229cf30dabc39ae083f286b0 | Add better indexes | ureport/stats/migrations/0017_better_indexes.py | ureport/stats/migrations/0017_better_indexes.py | Python | 0.001981 | @@ -0,0 +1,855 @@
+# Generated by Django 3.2.6 on 2021-09-27 17:49%0A%0Afrom django.db import migrations%0A%0AINDEX_POLLSTATS_ORG_RESULT_SQL = %22%22%22%0ACREATE INDEX IF NOT EXISTS stats_pollstats_org_result on stats_pollstats (org_id, flow_result_id) WHERE flow_result_id IS NOT NULL;%0A%22%22%22%0A%0A%0AINDEX_POLLSTA... | |
b304b1087d69d4142a9df5ad2db339e5aafe3331 | Update category | news/views.py | news/views.py | from django.shortcuts import render, redirect,render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import TemplateView,DetailView
# Create your views here
from news.models import Slider,How_it_works,ArticleCategory,... | Python | 0.000001 | @@ -2105,16 +2105,21 @@
j__slug=
+self.
kwargs.g
|
fb86dcdd6046c7d35e932396ba541671727b4d01 | rearrange imports to standards | ngSe/utils.py | ngSe/utils.py | from time import time, sleep
from functools import wraps
from .exceptions import element_exceptions
def retry(f=None, timeout=30, interval=0.1):
"""
When working with a responsive UI, sometimes elements are not ready at the very second you request it
This wrapper will keep on retrying finding or interact... | Python | 0.021967 | @@ -2,59 +2,59 @@
rom
-time import time, sleep%0Afrom functools import wraps
+functools import wraps%0Afrom time import time, sleep
%0A%0Afr
|
d648aeb90158cb104ac6548887a39dc13dfa236f | add management cmd make_emails_lowercase | corehq/apps/users/management/commands/make_emails_lowercase.py | corehq/apps/users/management/commands/make_emails_lowercase.py | Python | 0.000212 | @@ -0,0 +1,469 @@
+from django.core.management import BaseCommand%0A%0Afrom corehq.apps.users.models import CouchUser%0A%0A%0Aclass Command(BaseCommand):%0A help = %22Makes emails into lowercase%22%0A%0A def handle(self, *args, **options):%0A for couch_user in CouchUser.all():%0A if couch_user.e... | |
9d2976200965c4ea6b324d0822f6be786a25f2ea | Add file containing filesystem utilities | refmanage/fs_utils.py | refmanage/fs_utils.py | Python | 0.000001 | @@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-%0A
| |
b674efd944bf124da60db90d90cc2da35761427d | Conform to pep8 | shinken/bin.py | shinken/bin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... | Python | 0.999996 | @@ -1388,9 +1388,8 @@
sorry%22)%0A
-%0A
|
6979bbf6547d689b1980762349a0e78c9c7c026d | Create fibonacci.py | python/fibonacci/fibonacci.py | python/fibonacci/fibonacci.py | Python | 0.000838 | @@ -0,0 +1,122 @@
+a = 0%0Ab = 1%0Ac = 0%0An = int(input(%22Nombre de termes : %22))%0A%0Afor i in range (1, n+1):%0A c = a+b%0A b = a%0A a= c%0Aprint(c)%0A
| |
fcf691454b8607fec9d7f5cba43579dc02c26c8b | Check coverage of pgi, vs gi | tests/pgi_covergage.py | tests/pgi_covergage.py | Python | 0 | @@ -0,0 +1,1723 @@
+%22%22%22%0Afind pgi coverage of all gi.repositorys.%0Ayou need to have access to both 'gi' and 'pgi' in the current python%0Aenvironment.%0A%0AIn a virtualenv this works:%0A%0A$ pip install pgi%0A$ pip install vext.gi%0A%0A$ python pgi_coverage.py%0A%22%22%22%0A%0ATYPELIB_DIR=%22/usr/lib/gireposito... | |
7c1cbc49e6cdc6ef514382eee9679f4e9719257b | add basic-calculator-ii | vol5/basic-calculator-ii/basic-calculator-ii.py | vol5/basic-calculator-ii/basic-calculator-ii.py | Python | 0.999311 | @@ -0,0 +1,1965 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: Zeyuan Shang%0A# @Date: 2015-11-18 17:22:37%0A# @Last Modified by: Zeyuan Shang%0A# @Last Modified time: 2015-11-18 17:22:44%0Aclass Solution:%0A operators = %5B'+', '-', '*', '/'%5D%0A %0A def getPriority(self, operator):%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.