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 |
|---|---|---|---|---|---|---|---|
b6cd59f800b254d91da76083546ab7c10689df5f | Add unit test to enforce unique file names. | tests/test_no_dup_filenames.py | tests/test_no_dup_filenames.py | Python | 0 | @@ -0,0 +1,1632 @@
+# Copyright 2014 Red Hat, Inc.%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# U... | |
e81fd02cc7431ea01416126b88a22b4bba9b755e | Test - add cmake test tool | tests/test_tools/test_cmake.py | tests/test_tools/test_cmake.py | Python | 0 | @@ -0,0 +1,2055 @@
+# Copyright 2015 0xc0170%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by appl... | |
15102368281837ace7e67ad915f2ff9c4c4a1ac3 | remove package alias tool | tools/remove_packages_alias.py | tools/remove_packages_alias.py | Python | 0.000001 | @@ -0,0 +1,504 @@
+import os%0Aimport sys%0Aimport logging%0Aimport urllib3%0A%0Afrom elasticsearch import Elasticsearch, NotFoundError%0Afrom os_package_registry import PackageRegistry%0Afrom sqlalchemy import MetaData, create_engine%0A%0Aurllib3.disable_warnings()%0Alogging.root.setLevel(logging.INFO)%0A%0A%0Aif __na... | |
d53cff101248b9c90f5d2ae3f93d0e4933d03266 | add a manifest (.cvmfspublished) abstraction class | cvmfs/manifest.py | cvmfs/manifest.py | Python | 0.000001 | @@ -0,0 +1,2603 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated by Ren%C3%A9 Meusel%0AThis file is part of the CernVM File System auxiliary tools.%0A%22%22%22%0A%0Aimport datetime%0A%0Aclass UnknownManifestField:%0A def __init__(self, key_char):%0A self.key_char = key_char%0A%0A d... | |
66fcd6ab9d8703b2588bc2605278a5e056356de5 | add top level bot class with basic outline of execution | updatebot/bot.py | updatebot/bot.py | Python | 0 | @@ -0,0 +1,3224 @@
+#%0A# Copyright (c) 2008 rPath, Inc.%0A#%0A# This program is distributed under the terms of the Common Public License,%0A# version 1.0. A copy of this license should have been distributed with this%0A# source file in a file called LICENSE. If it is not present, the license%0A# is always available at... | |
8d2510fd38d946813b96798c745772641f19a5e7 | Create 10MinEmail.py | 10MinEmail.py | 10MinEmail.py | Python | 0.000001 | @@ -0,0 +1,298 @@
+from bs4 import BeautifulSoup%0Aimport threading%0Aimport urllib%0Aweb=urllib.urlopen('http://www.my10minutemail.com/')%0Asoup=BeautifulSoup(web)%0Aprint soup.p.string%0Aprint 'Email Valid For 10 minutes'%0Araw_input()%0A#def alarm():%0A# print 'One Minute is Left'%0A#t = threading.Timer(60.0, ala... | |
198dc11cadc1a20f95dccd5bb4897fa2947ff810 | Add Affichage.py | Affichage.py | Affichage.py | Python | 0.000001 | @@ -0,0 +1,74 @@
+class Affichage:%0A%0A def affichage_jeux(self):%0A return 0%0A %0A
| |
abe6ead4f93f98406fe197b6884e51015c200ca1 | Add a test for query_result_to_dict | test/test_searchentities.py | test/test_searchentities.py | Python | 0.999999 | @@ -0,0 +1,761 @@
+import unittest%0A%0Afrom . import models%0Afrom sir.schema.searchentities import SearchEntity as E, SearchField as F%0A%0A%0Aclass QueryResultToDictTest(unittest.TestCase):%0A def setUp(self):%0A self.entity = E(models.B, %5B%0A F(%22id%22, %22id%22),%0A F(%22c_bar%22... | |
a8fa0d01256d82378fc0e39f6d691d5435fbbd21 | Remove some Python 2 work-around code | tests/plots/test_ctables.py | tests/plots/test_ctables.py | # Copyright (c) 2015,2016,2017,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the `ctables` module."""
import os.path
import tempfile
try:
buffer_args = {'bufsize': 0}
from StringIO import StringIO
except ImportError:
b... | Python | 0.00013 | @@ -185,16 +185,40 @@
le.%22%22%22%0A%0A
+from io import StringIO%0A
import o
@@ -243,163 +243,8 @@
file
-%0Atry:%0A buffer_args = %7B'bufsize': 0%7D%0A from StringIO import StringIO%0Aexcept ImportError:%0A buffer_args = %7B'buffering': 1%7D%0A from io import StringIO
%0A%0Aim
@@ -851,46 +851,25 @@
al... |
c1bbbd7ac51a25919512722d633f0d8c2d1009e2 | Create unit tests directory | tests/test_lazy_toeplitz.py | tests/test_lazy_toeplitz.py | Python | 0 | @@ -0,0 +1,1699 @@
+from scipy.linalg import toeplitz%0Aimport numpy as np%0Afrom cooltools.snipping import LazyToeplitz%0A%0A%0An = 100%0Am = 150%0Ac = np.arange(1, n+1)%0Ar = np.r_%5B1,np.arange(-2, -m, -1)%5D%0A%0AL = LazyToeplitz(c, r)%0AT = toeplitz(c, r)%0A%0A%0Adef test_symmetric():%0A for si in %5B%0A ... | |
c3026f4c6e5edff30347f544746781c7214c2c2e | Add root test file. | test_SM2SM.py | test_SM2SM.py | Python | 0 | @@ -0,0 +1,1838 @@
+'''%0ACreated on 2015-01-20%0A%0A@author: levi%0A'''%0A'''%0ACreated on 2015-01-19%0A%0A@author: levi%0A'''%0Aimport unittest%0A%0Afrom patterns.HSM2SM_matchLHS import HSM2SM_matchLHS%0Afrom patterns.HSM2SM_rewriter import HSM2SM_rewriter%0A%0Afrom PyRamify import PyRamify%0A%0Afrom t_core.messages ... | |
3c7c81fa65206ea70cbff8394efe35749dc9dddd | add bitquant.py driver | web/bitquant.py | web/bitquant.py | Python | 0.000001 | @@ -0,0 +1,218 @@
+from flask import Flask, request%0Aapp = Flask(__name__, static_url_path='', static_folder='bitquant')%0A%0A@app.route(%22/%22)%0Adef root():%0A return app.send_static_file('index.html')%0A%0Aif __name__ == %22__main__%22:%0A app.run()%0A
| |
58d3df14b1b60da772f59933345a2dfdf2cadec2 | Add python solution for day 17 | day17/solution.py | day17/solution.py | Python | 0.000262 | @@ -0,0 +1,568 @@
+import itertools%0A%0Adata = open(%22data%22, %22r%22).read()%0A%0Acontainers = map(int, data.split(%22%5Cn%22))%0A%0Apart1 = %5B%5D%0AminLength = None%0Afor length in range(len(containers)):%0A%09combinations = itertools.combinations(containers, length)%0A%09combinations = filter(lambda containers: ... | |
88cfd7529c6c08e24b20576c1e40f41f3156a47e | add tandem sam scores script | bin/tandem_sam_scores.py | bin/tandem_sam_scores.py | Python | 0 | @@ -0,0 +1,1300 @@
+%22%22%22%0Atandem_sam_scores.py%0A%0AFor each alignment, compare the %22target%22 simulated alignment score to the%0Aactual score obtained by the aligner. When the read is simulated, we borrow%0Athe target score and the pattern of mismatches and gaps from an input%0Aalignment. But because the new... | |
b4c21650cfd92d722a0ac20ea51d90f15adca44e | add permissions classes for Group API | bioshareX/permissions.py | bioshareX/permissions.py | Python | 0 | @@ -0,0 +1,1728 @@
+from django.http.response import Http404%0Afrom rest_framework.permissions import DjangoModelPermissions, SAFE_METHODS%0Afrom django.contrib.auth.models import Group%0A%0A%0Aclass ViewObjectPermissions(DjangoModelPermissions):%0A def has_object_permission(self, request, view, obj):%0A if h... | |
6e1d1da7983da2ca43a1185adc2ddb2e2e1b7333 | Add basic cycles exercices | chapter02/cicles.py | chapter02/cicles.py | Python | 0.000013 | @@ -0,0 +1,1220 @@
+#!/usr/bin/env python%0A%0Aprint %22Escribir un ciclo definido para imprimir por pantalla todos los numeros entre 10 y 20.%22%0Aprint %5Bx for x in range(10, 20)%5D%0A%0Aprint %22Escribir un ciclo definido que salude por pantalla a sus cinco mejores amigos/as.%22%0Aprint %5Bamigo for amigo in %5B'Lo... | |
08c189a643f0b76ad28f9c0e0bc376a0ae202343 | Create nesting.py | codility/nesting.py | codility/nesting.py | Python | 0.000002 | @@ -0,0 +1,232 @@
+%22%22%22%0Ahttps://codility.com/programmers/task/nesting/%0A%22%22%22%0A%0A%0Adef solution(S):%0A balance = 0%0A%0A for char in S:%0A balance += (1 if char == '(' else -1)%0A%0A if balance %3C 0:%0A return 0%0A%0A return int(balance == 0)%0A
| |
631aa503d1457f823cacd0642a1554ce8f31c1f9 | add jm server | python/jm_server.py | python/jm_server.py | Python | 0 | @@ -0,0 +1,957 @@
+#!/usr/bin/python%0A#%0A# jm_server.py%0A#%0A# Author: Zex %3Ctop_zlynch@yahoo.com%3E%0A#%0A%0Aimport dbus %0Aimport dbus.service%0Afrom basic import * %0A%0Aclass JuiceMachine(dbus.service.FallbackObject):%0A %22%22%22%0A JuiceMachine server%0A %22%22%22%0A def __init__(self):%0A%0A ... | |
59a108840f0fb07f60f20bc9ff59a0d194cb0ee3 | enable import as module | __init__.py | __init__.py | Python | 0.000001 | @@ -0,0 +1,218 @@
+%22%22%22%0A.. module:: lmtscripts%0A :platform: Unix%0A :synopsis: useful scripts for EHT observations at LMT%0A%0A.. moduleauthor:: Lindy Blackburn %3Clindylam@gmail.com%3E%0A.. moduleauthor:: Katie Bouman %3Cklbouman@gmail.com%3E%0A%0A%22%22%22%0A
| |
88b6549b74dd767733cd823de410e00067a79756 | add test auto updater | auto_update_tests.py | auto_update_tests.py | Python | 0 | @@ -0,0 +1,676 @@
+#!/usr/bin/env python%0A%0Aimport os, sys, subprocess, difflib%0A%0Aprint '%5B processing and updating testcases... %5D%5Cn'%0A%0Afor asm in sorted(os.listdir('test')):%0A if asm.endswith('.asm.js'):%0A print '..', asm%0A wasm = asm.replace('.asm.js', '.wast')%0A actual, err = subprocess.Po... | |
322dd59f362a1862c739c5c63cd180bce8655a6d | Test to add data | AddDataTest.py | AddDataTest.py | Python | 0 | @@ -0,0 +1,278 @@
+__author__ = 'chuqiao'%0Aimport script%0Ascript.addDataToSolrFromUrl(%22http://www.elixir-europe.org:8080/events%22, %22http://www.elixir-europe.org:8080/events%22);%0Ascript.addDataToSolrFromUrl(%22http://localhost/ep/events?state=published&field_type_tid=All%22, %22http://localhost/ep/events%22);%0... | |
be9cf41600b2a00494ca34e3b828e7a43d8ae457 | Create testing.py | bcn/utils/testing.py | bcn/utils/testing.py | Python | 0.000001 | @@ -0,0 +1,624 @@
+%22%22%22Utility functions for unittests.%0A%0ANotes%0A-----%0ADefines a function that compares the hash of outputs with the expected output, given a particular seed.%0A%22%22%22%0Afrom __future__ import division, absolute_import%0A%0Aimport hashlib%0A%0Adef assert_consistency(X, true_md5):%0A '''... | |
1fbb3bb85c5f5ad8422fb0058091d67beeeec06c | Allow for setting a "BOTO_CONFIG" environment variable which can be set to the location of a configuration file to be loaded in addition to all the standard boto config paths. | boto/pyami/config.py | boto/pyami/config.py | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | Python | 0 | @@ -1382,16 +1382,126 @@
h = None
+%0Aif 'BOTO_CONFIG' in os.environ:%0A BotoConfigLocations.append(os.path.expanduser(os.environ%5B'BOTO_CONFIG'%5D))
%0A%0Aclass
|
41904abd0778719a1586b404c1ca56eb3205f998 | Include undg/myip to this repo bin. | bin/myip.py | bin/myip.py | Python | 0 | @@ -0,0 +1,2239 @@
+#!/usr/bin/python3%0A%0Adef extIp(site): # GETING PUBLIC IP%0A import urllib.request%0A from re import findall%0A%0A ipMask = '%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D'%0A if site == 'dyndns':%0A url = 'http://checkip.dyndns.org'%0A regexp = '%3Cbody... | |
c5a7e6dc9a98f056a31552e7ace4d150b13b998f | Create markdown.py | markdown.py | markdown.py | Python | 0.000002 | @@ -0,0 +1,1007 @@
+import os%0Aimport sys%0Aimport markdown%0A%0Afrom cactus.utils import fileList%0A%0A%0Atemplate = %22%22%22%0A%25s%0A%0A%7B%25%25 extends %22%25s%22 %25%25%7D%0A%7B%25%25 block %25s %25%25%7D%0A%0A%25s%0A%0A%7B%25%25 endblock %25%25%7D%0A%22%22%22%0A%0Atitle_template = %22%22%22%0A%7B%25%25 block t... | |
5492e1b318ff0af3f1e2b1ed0217ed2744b50b68 | Add first structure for issue 107 (automatic configuration doc generation) | server/src/configuration_doc.py | server/src/configuration_doc.py | Python | 0 | @@ -0,0 +1,2407 @@
+from collections import namedtuple%0A%0ANO_DEFAULT = object()%0AANY_TYPE = object()%0A%0A_Argument = namedtuple('Argument', 'category type default message')%0A%0A_sorted_variables = %5B%5D%0A%0A%0A######################################%0A# %0A# CORE%0A#%0A%0ACORE = 'core'%0A%0AWEBLAB_CORE_SERVER_S... | |
411f855daa9f06868aa597f84c0b739429d705f4 | Create bot_read.py | bot_read.py | bot_read.py | Python | 0.000001 | @@ -0,0 +1,450 @@
+#!/usr/bin/python%0Aimport praw%0A%0Auser_agent = (%22PyFor Eng bot 0.1%22)%0Ar = praw.Reddit(user_agent=user_agent)%0A%0Asubreddit = r.get_subreddit('python')%0A%0Afor submission in subreddit.get_hot(limit=5):%0A print submission.title%0A print submission.selftext%0A print submission.score%... | |
b62b37db1141221ae735b531bdb46264aadbe2e7 | add make_requests client in python | make_requests.py | make_requests.py | Python | 0.000001 | @@ -0,0 +1,611 @@
+import os%0Aimport sys%0Aimport time%0A%0A%0Adef main(timeout_secs, server_port, iteration_count, file_name):%0A for i in range(iteration_count):%0A start_time_secs = time.time()%0A cmd = 'nc localhost %25d %3C file_list_with_time.txt' %25 server_port%0A rc = os.system(cmd)%0A... | |
5794a2d8d2b59a6a37b5af4e8c1adba276c325c4 | Create TagAnalysis.py | TagAnalysis.py | TagAnalysis.py | Python | 0 | @@ -0,0 +1,28 @@
+# Analysis of question tags%0A
| |
a6a9bb5a365aef9798091335c81b1b793578ed1f | Initialize car classifier | car_classifier.py | car_classifier.py | Python | 0.001911 | @@ -0,0 +1,769 @@
+class CarClassifier(object):%0A %22%22%22 Classifier for car object%0A Attributes:%0A car_img_dir: path to car images%0A not_car_img_dir: path to not car images%0A sample_size: number of images to be used to train classifier%0A %22%22%22%0A def __init__(self, car_img_... | |
1732fe53dc228da64f3536ce2c76b420d8b100dc | Create the animation.py module. | ch17/animation.py | ch17/animation.py | Python | 0 | @@ -0,0 +1,176 @@
+# animation.py%0A# Animation%0A%22%22%22%0AThis is an example of animation using pygame.%0AAn example from Chapter 17 of%0A'Invent Your Own Games With Python' by Al Sweigart%0A%0AA.C. LoGreco%0A%22%22%22%0A
| |
248a756cd6ff44eca6e08b3e976bc2ae027accd4 | Add memory ok check | chassis_memory.py | chassis_memory.py | Python | 0.000001 | @@ -0,0 +1,728 @@
+import re%0Aimport subprocess%0A%0Afrom maas_common import status_err, status_ok, metric_bool%0A%0AOKAY = re.compile('(?:Health%7CStatus)%5Cs+:%5Cs+(%5Cw+)')%0A%0A%0Adef chassis_memory_report():%0A %22%22%22Return the report as a string.%22%22%22%0A return subprocess.check_output(%5B'omreport',... | |
260e2b6d4820ce008d751bc21289ece997247d05 | add source | sqlalchemy_fulltext/__init__.py | sqlalchemy_fulltext/__init__.py | Python | 0 | @@ -0,0 +1,2455 @@
+# -*- coding: utf-8 -*-s%0Aimport re%0A%0Afrom sqlalchemy import event%0Afrom sqlalchemy.schema import DDL%0Afrom sqlalchemy.orm.mapper import Mapper%0Afrom sqlalchemy.ext.compiler import compiles%0Afrom sqlalchemy.ext.declarative import declared_attr%0Afrom sqlalchemy.sql.expression import ClauseEl... | |
eb1ba44a9c00303bbf8ff20b4b489a6058a4ab1d | Fix Buffer.__len__ | neovim/buffer.py | neovim/buffer.py | from util import RemoteMap
class Buffer(object):
def __len__(self):
return self._vim.get_buffer_count()
def __getitem__(self, idx):
if not isinstance(idx, slice):
return self.get_line(idx)
include_end = False
start = idx.start
end = idx.stop
if start... | Python | 0.000133 | @@ -90,29 +90,18 @@
elf.
-_vim.get_buffer_count
+get_length
()%0A%0A
|
257a328745b9622713afa218940d2cd820987e93 | Add a super simple color correction client example | examples/color-correction-ui.py | examples/color-correction-ui.py | Python | 0 | @@ -0,0 +1,997 @@
+#!/usr/bin/env python%0A#%0A# Simple example color correction UI.%0A# Talks to an fcserver running on localhost.%0A#%0A# Micah Elizabeth Scott%0A# This example code is released into the public domain.%0A#%0A%0Aimport Tkinter as tk%0Aimport socket%0Aimport json%0Aimport struct%0A%0As = socket.socket()... | |
2359d7f6140b7b8292c3d9043064a9ee195ecebb | add module for storing repeated constants | code/constants.py | code/constants.py | Python | 0.000001 | @@ -0,0 +1,164 @@
+%22%22%22Module for constants and conversion factors.%22%22%22%0A%0A__author__ = 'Salman Hashmi, Ryan Keenan'%0A__license__ = 'BSD License'%0A%0A%0ATO_DEG = 180./np.pi%0ATO_RAD = np.pi/180.%0A
| |
f40fb7a27934bbd2e6fe758b33d9dcc567858c8e | make sure to download MTL file from amazon (done by @drewbo) | landsat/downloader.py | landsat/downloader.py | # Landsat Util
# License: CC0 1.0 Universal
from os.path import join, exists, getsize
from homura import download as fetch
import requests
from utils import check_create_folder
from mixins import VerbosityMixin
import settings
class RemoteFileDoesntExist(Exception):
pass
class IncorrectSceneId(Exception):
... | Python | 0 | @@ -1244,16 +1244,189 @@
try:%0A
+ # Always grab MTL.txt if bands are specified%0A bands_plus = bands%0A bands_plus.append('MTL')%0A
@@ -1458,24 +1458,29 @@
and in bands
+_plus
:%0A
@@ -2458,30 +2458,125 @@
... |
07da1b8a2d0a8c8e28db3c9bed9de1d9f9a7ad6f | Add base solver class | base_solver.py | base_solver.py | Python | 0 | @@ -0,0 +1,572 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Afrom datetime import datetime%0A%0Aclass BaseSolver(object):%0A task = None%0A%0A best_solution = None%0A best_distance = float('inf')%0A search_time = None%0A%0A def __init__(self, task):%0A self.task = task%0A%0A def run(self):... | |
ff76d47f210e97f3ac4ba58a2c3eecb045b28cde | Create RateLimit.py | Cogs/RateLimit.py | Cogs/RateLimit.py | Python | 0.000001 | @@ -0,0 +1,1357 @@
+import asyncio%0Aimport discord%0Aimport os%0Afrom datetime import datetime%0Afrom discord.ext import commands%0A%0A# This is the RateLimit module. It keeps users from being able to spam commands%0A%0Aclass RateLimit:%0A%0A%09# Init with the bot reference, and a reference to the settings var%0A%... | |
d2b7f191519835a3a8f0e8a32fb52c7b354b0e33 | Add Slurp command | Commands/Slurp.py | Commands/Slurp.py | Python | 0.000005 | @@ -0,0 +1,2090 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Aug 31, 2015%0A%0A@author: Tyranic-Moron%0A%22%22%22%0A%0Afrom IRCMessage import IRCMessage%0Afrom IRCResponse import IRCResponse, ResponseType%0Afrom CommandInterface import CommandInterface%0A%0Afrom Utils import WebUtils%0A%0Afrom bs4 import Beauti... | |
96f6a2c5813ae605a48995f6c6fb89234b2eba07 | remove risky username logic | dj/scripts/post_vimeo.py | dj/scripts/post_vimeo.py | #!/usr/bin/python
# posts to vimeo
import vimeo_uploader as uploader
import os
# import pw
from process import process
from main.models import Show, Location, Episode, Raw_File, Cut_List
class post(process):
ready_state = 4
def process_ep(self, ep):
if self.options.verbose: print ep.id, ep.name
if n... | Python | 0.997312 | @@ -4352,16 +4352,39 @@
st_user
+%0A #
if clien
|
8b6020384e20305411d2bbb587a2504ef302a17c | Create calculatepi.py | calculatepi.py | calculatepi.py | Python | 0.000002 | @@ -0,0 +1,93 @@
+%22%22%22%0Acalculatepi.py%0AAuthor: %3Cyour name here%3E%0ACredit: %3Clist sources used, if any%3E%0AAssignment:%0A%0A
| |
0bc5b307d5121a3cacac159fa27ab42f97e208aa | Add database module | rabbithole/db.py | rabbithole/db.py | Python | 0.000001 | @@ -0,0 +1,687 @@
+# -*- coding: utf-8 -*-%0A%0Aimport logging%0A%0Afrom sqlalchemy import (%0A create_engine,%0A text,%0A)%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Aclass Database(object):%0A %22%22%22Database writer.%0A%0A :param url: Database connection string%0A :type url: str%0A%0A %22%22... | |
b62ed7a60349536457b03a407e99bae3e3ff56e8 | install issue | erpnext/setup/install.py | erpnext/setup/install.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color... | Python | 0.000001 | @@ -1031,79 +1031,120 @@
in
-frappe.db.sql_list(%22%22%22select name from %60tabDocType%60 where issingle=1%22%22%22
+('Accounts Settings', 'Print Settings', 'HR Settings', 'Buying Settings',%0A%09%09'Selling Settings', 'Stock Settings'
):%0A%09
@@ -1439,16 +1439,59 @@
%09%09%09%09pass
+%0A%09%09%09except frappe.V... |
43e823ad9ea7c44b49c883e8633dc488dff0d2ca | Add end_time for indexing. | events/search_indexes.py | events/search_indexes.py | from haystack import indexes
from .models import Event
from django.utils.translation import get_language
from django.utils.html import strip_tags
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
autosuggest = indexes.EdgeNgramField(model_attr=... | Python | 0 | @@ -320,16 +320,72 @@
='name')
+%0A end_time = indexes.DateField(model_attr='end_time')
%0A%0A de
|
a85e444e9411f9f768db7c3e1b589b737c01b0a0 | add mnist examples | TensorFlow/ex3/test_mnist.py | TensorFlow/ex3/test_mnist.py | Python | 0 | @@ -0,0 +1,1263 @@
+#!/usr/bin/env python%0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0Aimport gzip%0Aimport os%0Aimport tempfile%0A%0Aimport numpy%0Afrom six.moves import urllib%0Afrom six.moves import xrange # pylint: disable=redefined-builtin... | |
523ef51278c964718da68bb789e78e6c8f5f8766 | Add the init method to the notification model. | model/notification.py | model/notification.py | Python | 0 | @@ -0,0 +1,169 @@
+def NotificationModel(Query):%0A def __init__(self, db):%0A self.db = db%0A self.table_name = %22notification%22%0A super(NotificationModel, self).__init__()
| |
c68c5bf488cb7224d675bec333c6b7a4992574ed | Add a simple APL exception class | apl_exception.py | apl_exception.py | Python | 0.000007 | @@ -0,0 +1,227 @@
+%22%22%22%0A A simple APL exception class%0A%22%22%22%0A%0Aclass APL_Exception (BaseException):%0A %22%22%22%0A APL Exception Class%0A %22%22%22%0A def __init__ (self,message,line=None):%0A self.message = message%0A self.line = line%0A%0A# EOF%0A
| |
e68590e9e05ab54b91ad3d03e372fbf8b341c3b9 | Use a logger thread to prevent stdout races. | gtest-parallel.py | gtest-parallel.py | #!/usr/bin/env python2
import Queue
import optparse
import subprocess
import sys
import threading
parser = optparse.OptionParser(
usage = 'usage: %prog [options] executable [executable ...]')
parser.add_option('-w', '--workers', type='int', default=16,
help='number of workers to spawn')
parser.a... | Python | 0 | @@ -645,16 +645,36 @@
xit(1)%0A%0A
+log = Queue.Queue()%0A
tests =
@@ -1856,30 +1856,32 @@
break%0A%0A
-print
+log.put(
str(job_id)
@@ -1898,24 +1898,25 @@
ine.rstrip()
+)
%0A%0A code = s
@@ -1927,22 +1927,24 @@
ait()%0A
-print
+log.put(
str(job_
@@ -1970,16 +1970,17 @@
tr(code)
+)
%0A%0Adef wo
@@... |
e093ce0730fa3071484fed251535fea62e0430d6 | add logger view | View/LoggerView.py | View/LoggerView.py | Python | 0 | @@ -0,0 +1,2083 @@
+# Under MIT License, see LICENSE.txt%0A%0Afrom PyQt4.QtGui import QWidget%0Afrom PyQt4.QtCore import QTimer%0Afrom PyQt4.QtGui import QListWidget%0Afrom PyQt4.QtGui import QHBoxLayout%0Afrom PyQt4.QtGui import QVBoxLayout%0Afrom PyQt4.QtGui import QPushButton%0Afrom Model.DataInModel import DataInMo... | |
b2f07c815c66be310ee1c126ba743bb786d79a08 | Create problem2.py | W2/PS2/problem2.py | W2/PS2/problem2.py | Python | 0.000024 | @@ -0,0 +1,1053 @@
+'''%0APROBLEM 2: PAYING DEBT OFF IN A YEAR (15.0/15.0 points)%0ANow write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is ... | |
61b7ee073efcd698329bec69a9eb682a1bc032d3 | Add py_trace_event to DEPS. | telemetry/telemetry/util/trace.py | telemetry/telemetry/util/trace.py | Python | 0.000008 | @@ -0,0 +1,362 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Afrom telemetry.core import util%0A%0A%0Autil.AddDirToPythonPath(util.GetChromiumSrcDir(),%0A 'third_party',... | |
c3789b5f8a8c90902693194cf257b6c9e4ac7783 | Add solution to 119. | 119/119.py | 119/119.py | Python | 0.000083 | @@ -0,0 +1,1333 @@
+%22%22%22%0AThe number 512 is interesting because it is equal to the sum of its digits%0Araised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number%0Awith this property is 614656 = 284.%0A%0AWe shall define an to be the nth term of this sequence and insist that a number%0Amust co... | |
2c155d4fe286f685bca696c60730bd2fca2151f1 | Add new package: sysbench (#18310) | var/spack/repos/builtin/packages/sysbench/package.py | var/spack/repos/builtin/packages/sysbench/package.py | Python | 0 | @@ -0,0 +1,937 @@
+# 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 Sysbench(AutotoolsPackage):%0A %22%22%22Scriptable datab... | |
34a9969495f1b1c9452bff54cb03148e68fde303 | Create Insertion_sort_with_binary_search.py | C02-Getting-Started/exercise_code/Insertion_sort_with_binary_search.py | C02-Getting-Started/exercise_code/Insertion_sort_with_binary_search.py | Python | 0.000002 | @@ -0,0 +1,1780 @@
+# Exercise 2.3-6 in book%0A# Standalone Python version 2.7 code%0Aimport os%0Aimport re%0Aimport math%0Aimport time%0Afrom random import randint%0A%0Adef insertion_sort(array):%0A%09for j, v in enumerate(array):%0A%09%09key = v%0A%09%09i = j - 1%0A%09%09while i %3E -1 and array%5Bi%5D %3E key:%0A%09... | |
274e7a93bac93461f07dd43f3f84f1f00e229ffd | Add migration script hr_family -> hr_employee_relative | hr_employee_relative/migrations/12.0.1.0.0/post-migration.py | hr_employee_relative/migrations/12.0.1.0.0/post-migration.py | Python | 0 | @@ -0,0 +1,1961 @@
+# Copyright 2019 Creu Blanca%0A# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).%0A%0Afrom openupgradelib import openupgrade%0A%0A%0A@openupgrade.migrate()%0Adef migrate(env, version):%0A cr = env.cr%0A columns = 'fam_spouse, fam_spouse_employer, fam_spouse_tel, fam_father,'... | |
5f9bb1a027664a0107a213b5dfa82c22d75c1196 | handle relative paths | pls-files.py | pls-files.py | #!/usr/bin/env python
from ConfigParser import SafeConfigParser
from contextlib import closing
from os.path import basename, dirname, join
import sys
from urllib2 import urlopen
def generic_open(arg):
try:
return urlopen(arg), None
except ValueError:
return open(arg, "r"), dirname(arg)
def pla... | Python | 0.000003 | @@ -131,16 +131,36 @@
me, join
+, normpath, realpath
%0Aimport
@@ -281,16 +281,54 @@
eError:%0A
+ arg = normpath(realpath(arg))%0A
|
061ba14918eb6598031c9ad8a1c3f8e9c0f0a34b | Create LeetCode-LowestCommonAncestor2.py | LeetCode-LowestCommonAncestor2.py | LeetCode-LowestCommonAncestor2.py | Python | 0.000004 | @@ -0,0 +1,941 @@
+%22%22%22%0AGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.%0ANotice it is binary tree, not BST%0A%22%22%22%0A%0Aclass TreeNode(object):%0A def __init__(self, x):%0A self.val = x%0A self.left = None%0A self.right = None%0A ... | |
63208828762d01122054d122c8d305fa8930f9bd | Make service postage nullable | migrations/versions/0258_service_postage_nullable.py | migrations/versions/0258_service_postage_nullable.py | Python | 0.999996 | @@ -0,0 +1,874 @@
+%22%22%22%0A%0ARevision ID: 0258_service_postage_nullable%0ARevises: 0257_letter_branding_migration%0ACreate Date: 2019-02-12 11:52:53.139383%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0Arevision = '0258_service_postage_nullable'%0Adown_revision = '0257_letter_branding_mi... | |
bc1fe15c77b8eedb40993e5ea24fa4d7340ff646 | Fix bug 17 (#4254) | PaddleRec/multi-task/MMoE/args.py | PaddleRec/multi-task/MMoE/args.py | Python | 0 | @@ -0,0 +1,1393 @@
+# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LIC... | |
0179d4d84987da76c517de4e01100f0e1d2049ea | Add unit tests for pacman list packages | tests/unit/modules/pacman_test.py | tests/unit/modules/pacman_test.py | Python | 0 | @@ -0,0 +1,2165 @@
+# -*- coding: utf-8 -*-%0A'''%0A :codeauthor: :email:%60Eric Vz %3Ceric@base10.org%3E%60%0A'''%0A%0A# Import Python Libs%0Afrom __future__ import absolute_import%0A%0A# Import Salt Testing Libs%0Afrom salttesting import TestCase, skipIf%0Afrom salttesting.mock import (%0A MagicMock,%0A patc... | |
f2d4ddba7c594ec93f0ede0be1fc515b0c7c2d7b | Remove HInput and Isolate joystick related code because son path isues with pygame | HJoystick.py | HJoystick.py | Python | 0 | @@ -0,0 +1,1157 @@
+#from direct.showbase import DirectObject%0Aimport pygame #pygame must be in the Main.py directory%0A#THIS FILE MUST BE IN THE MAIN.PY DIRECTORY BECAUSE SON PATH ISSUES%0A%0A%0Aclass HJoystickSensor():%0A def __init__(self,joystickId=0):%0A #print os.getcwd()%0A pygame.init()%0A ... | |
fe63d6e1e822f7cb60d1c0bdaa08eb53d3849783 | Add script to extract artist names from MusicBrainz database | benchmark/datasets/musicbrainz/extract-from-dbdump.py | benchmark/datasets/musicbrainz/extract-from-dbdump.py | Python | 0 | @@ -0,0 +1,391 @@
+#!/usr/bin/env python%0A%22%22%22%0AScript to extract the artist names from a MusicBrainz database dump.%0A%0AUsage:%0A ./extract-from-dbdump.py %3Cdump_dir%3E/artist %3Coutfile%3E%0A%22%22%22%0A%0Aimport pandas as pd%0Aimport sys%0A%0A__author__ = %22Uwe L. Korn%22%0A__license__ = %22MIT%22%0A%0A... | |
842092122b14343c9b1c2e2a4e0dd67dd8bdf767 | build SlideEvaluation objects from existing data | promort/slides_manager/migrations/0014_auto_20171201_1119.py | promort/slides_manager/migrations/0014_auto_20171201_1119.py | Python | 0 | @@ -0,0 +1,1162 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.5 on 2017-12-01 11:19%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef populate_slide_evaluations(apps, schema_editor):%0A SlideEvaluation = apps.get_model('slides_manager', 'SlideEvaluation')%0A Sl... | |
116f41481062e6d9f15c7a81c2e5268aa1b706c7 | add sources script | admin/scripts/addListOfSources.py | admin/scripts/addListOfSources.py | Python | 0.000001 | @@ -0,0 +1,2757 @@
+from collections import defaultdict%0Aimport re%0Aimport sys%0Aimport time%0A%0Asys.path.append('../..')%0Afrom crawler.crawler import crawl, itemFactory%0Afrom engine.data.database.databaseConnection import commit, rollback%0Afrom engine.data.database.sourceTable import addSource, sourceExists, url... | |
3a235e25ac3f5d76eb4030e01afbe7b716ec6d91 | Add py solution for 331. Verify Preorder Serialization of a Binary Tree | py/verify-preorder-serialization-of-a-binary-tree.py | py/verify-preorder-serialization-of-a-binary-tree.py | Python | 0.005023 | @@ -0,0 +1,571 @@
+class Solution(object):%0A def isValidSerialization(self, preorder):%0A %22%22%22%0A :type preorder: str%0A :rtype: bool%0A %22%22%22%0A def get_tree(nodes, offset):%0A if nodes%5Boffset%5D == '#':%0A return offset + 1%0A else... | |
d733d3359038e6b249a6bd878ba0d6c3224b5e9a | fix flake8 errors | run_tests.py | run_tests.py | #!/usr/bin/env python
import sys
import shutil
import tempfile
try:
import django
except ImportError:
print("Error: missing test dependency:")
print(" django library is needed to run test suite")
print(" you can install it with 'pip install django'")
print(" or use tox to automatically handle t... | Python | 0.000001 | @@ -2852,16 +2852,17 @@
%5D %3E= (1,
+
7):%0A
@@ -3440,24 +3440,25 @@
r(settings)%0A
+%0A
clas
|
f6dce9177421f61c7a773e1bbe53588eb54defc9 | Create score.py | Samples/AzureML/score.py | Samples/AzureML/score.py | Python | 0.000008 | @@ -0,0 +1,1210 @@
+#example: scikit-learn and Swagger%0Aimport json%0Aimport numpy as np%0Aimport pandas as pd%0Aimport azureml.train.automl%0Afrom sklearn.externals import joblib%0Afrom sklearn.linear_model import Ridge%0Afrom azureml.core.model import Model%0A%0Afrom inference_schema.schema_decorators import input_s... | |
4f45932c2a3519b6ccbdee20fb4beaafe1774bb2 | Refactor for spaceapi, closes #135 | plugins/status.py | plugins/status.py | from irc3.plugins.command import command
from bytebot_config import BYTEBOT_PLUGIN_CONFIG
from irc3 import asyncio
import json
import aiohttp
@command(permission="view")
@asyncio.coroutine
def status(bot, mask, target, args):
"""Returns the door status of the hackerspace rooms
%%status
"""
try:
... | Python | 0 | @@ -990,33 +990,63 @@
except Exception
-:
+ as e:%0A bot.log.error(e)
%0A bot.pri
@@ -2136,17 +2136,47 @@
xception
-:
+ as e:%0A bot.log.error(e)
%0A
|
f1599a7b3f342a86cf7eb7201593b8515d5f13ad | Add views for handling 400 & 500 errors | arcutils/views.py | arcutils/views.py | Python | 0 | @@ -0,0 +1,1872 @@
+import logging%0A%0Afrom django.http import HttpResponseBadRequest, HttpResponseServerError%0Afrom django.template import loader%0Afrom django.views.decorators.csrf import requires_csrf_token%0A%0A%0Alog = logging.getLogger(__name__)%0A%0A%0A@requires_csrf_token%0Adef bad_request(request, exception=... | |
7aee25badd2085d63012c83f6be8082d93427754 | Add files via upload | polyregreesion.py | polyregreesion.py | Python | 0 | @@ -0,0 +1,1650 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Sun Jul 31 10:03:15 2016%0A%0A@author:Viky%0ACode for polynomial regression%0A%22%22%22%0A%0A#importing necessary packages%0Aimport numpy as np %0Aimport tensorflow as tf%0Aimport matplotlib.pyplot as plt%0A%0A%0A#input data:%0Ax_input=np.linspace(0,3... | |
6f4d5917abdbae1fe731e7a1786d8589d2b31ac0 | Fix #160 -- Add missing migration | machina/apps/forum/migrations/0011_auto_20190627_2132.py | machina/apps/forum/migrations/0011_auto_20190627_2132.py | Python | 0 | @@ -0,0 +1,717 @@
+# Generated by Django 2.2.2 on 2019-06-28 02:32%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('forum', '0010_auto_20181103_1401'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A m... | |
4c601ce9b91a0bef7082e3d8a5c1b95dc512d829 | add csl_util | User_Crawler/util_csl.py | User_Crawler/util_csl.py | Python | 0.000006 | @@ -0,0 +1,1697 @@
+# -*- coding: utf-8 -*-%0A%0Afrom types import *%0Aimport pandas as pd%0A%0AUSER_ATTR_LIST = %5B'./data/cross-site-linking/user_type.csv',%0A './data/graph/CC.csv',%0A './data/graph/degree.csv',%0A './data/graph/pagerank.csv'%0A %5D... | |
bcee6173027c48bfb25a65d3e97660f2e2a0852b | Add a python script to generate test methods | gentest.py | gentest.py | Python | 0.000017 | @@ -0,0 +1,750 @@
+from itertools import product%0Aimport json%0Aimport numpy%0A%0Acube = numpy.array(range(1, 9)).reshape(2, 2, 2)%0A%0Apcube = %5B%0A cube%5B0 ,0 ,0 %5D,%0A cube%5B0 ,0 ,0:2%5D,%0A cube%5B0 ,0:2,0:1%5D,%0A cube%5B0 ,0:2,0:2%5D,%0A cube%5B0:2,0:1,0:1%5D,%0A cube%5B0:2,0:1,0:2%5... | |
052392da7980c4f4e2e86cd8eb65da5b91d3547b | Solve Code Fights different symbols naive problem | CodeFights/differentSymbolsNaive.py | CodeFights/differentSymbolsNaive.py | Python | 0.001563 | @@ -0,0 +1,625 @@
+#!/usr/local/bin/python%0A# Code Fights Different Symbols Naive Problem%0A%0Afrom collections import Counter%0A%0A%0Adef differentSymbolsNaive(s):%0A return len(Counter(s))%0A%0A%0Adef main():%0A tests = %5B%0A %5B%22cabca%22, 3%5D,%0A %5B%22aba%22, 2%5D%0A %5D%0A%0A for t i... | |
f625f46e89c8e95677492cfb03ee113a3f6c7bb3 | Add utils.py | src/utils.py | src/utils.py | Python | 0.000004 | @@ -0,0 +1,1516 @@
+%22%22%22%0AThe MIT License (MIT)%0A%0ACopyright (c) 2017 Stefan Graupner%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without restriction, including without lim... | |
3dcbde095cc8372f321a6691f57b190704dd5457 | version 1 to simulate lighting project | graph_proj/graph_proj.py | graph_proj/graph_proj.py | Python | 0 | @@ -0,0 +1,1329 @@
+import networkx as nx%0Aimport random%0A%0A# Generate small-world network by watts-strogatz method%0Anodenum = 150%0Aneighk = 10%0Ap = 0.2%0A%0AG = nx.watts_strogatz_graph(nodenum, neighk, p)%0A%0A# random seed point%0A# first start with green point, then blue point%0Agreen_collect = set()%0Ablue_co... | |
05c588866cc66bff33cb77fe35434f850ddd07f0 | Handle values larger than 2**63-1 in numeric crash address conversion (#119) | server/crashmanager/migrations/0009_copy_crashaddress.py | server/crashmanager/migrations/0009_copy_crashaddress.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
from django.db import models, migrations
from django.conf import settings
def create_migration_tool(apps, schema_editor):
CrashEntry = apps.get_model("crashmanager", "CrashEntry")
for entry in CrashEntry.objects.f... | Python | 0 | @@ -593,16 +593,391 @@
ss, 16)%0A
+ %0A # Crash addresses are typically unsigned, but our database%0A # can only store signed 64 bit integers. Convert to signed%0A # if the value exceeds maximum value for signed 64 bit.%0A if (entry.crashAddres... |
4c381da905d81bde6ed28407f8e4cd3bcbd6d8be | Add cart forms | apps/cart/forms.py | apps/cart/forms.py | Python | 0.000001 | @@ -0,0 +1,373 @@
+from django import forms%0A%0A%0APRODUCT_QUANTITY_CHOICES = %5B(i, str(i)) for i in range(1, 21)%5D%0A%0A%0Aclass CartAddProductForm(forms.Form):%0A quantity = forms.TypedChoiceField(choices=PRODUCT_QUANTITY_CHOICES,%0A coerce=int)%0A update = forms.BooleanF... | |
55ee723c6a95046d59efedb47f276262835892af | reverse string | learning/test/reverse_string.py | learning/test/reverse_string.py | Python | 0.999999 | @@ -0,0 +1,190 @@
+__author__ = 'root'%0Adef reverse(text):%0A reverse_text = %22%22%0A for char in range(len(text)):%0A reverse_text = text%5Bchar%5D + reverse_text%0A return reverse_text%0A%0Aprint reverse(%22abcd%22)
| |
1bb2a9213dad8bde8a05da63438dbcdd0d8d09c6 | add example for asynchronous execution, little simpler than multiprocessing, uses a decorator to simplify it further | examples/async.py | examples/async.py | Python | 0 | @@ -0,0 +1,2483 @@
+#!/usr/bin/env python2.7%0A%22%22%22Example of asynchronously running %22show version%22.%0A%0Aasync(): decorator to make further functions asynchronous%0Acommand_runner(): creates a connection and runs an arbitrary command%0Amain(): entry point, runs the command_runner%0A%22%22%22%0Aimport netmiko%... | |
d159b32d51339915ef633f3c6d33ce5eeafa78d6 | Add py solution for 396. Rotate Function | py/rotate-function.py | py/rotate-function.py | Python | 0.998434 | @@ -0,0 +1,472 @@
+class Solution(object):%0A def maxRotateFunction(self, A):%0A %22%22%22%0A :type A: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A lA = len(A)%0A if not lA:%0A return 0%0A subsum = 0%0A F = 0%0A for i in xrange(1, lA):%0A ... | |
70ff0faa7da6066bb75ddb871f67aa749f5bdc4e | Add custom field rendering tests | django_admin_bootstrapped/tests.py | django_admin_bootstrapped/tests.py | Python | 0 | @@ -0,0 +1,1744 @@
+from __future__ import absolute_import%0A%0Afrom django.test import TestCase%0Afrom django.contrib.admin.widgets import AdminDateWidget%0Afrom django.template import Template, Context%0Afrom django import forms%0A%0Atry:%0A from bootstrap3 import renderers%0Aexcept ImportError:%0A # nothing to... | |
84e14782f353ef1d0dec20ed1da31cfb1da413a4 | Add diary example. | examples/diary.py | examples/diary.py | Python | 0 | @@ -0,0 +1,1652 @@
+#!/usr/bin/env python%0A%0Afrom collections import OrderedDict%0Aimport datetime%0Aimport sys%0A%0Afrom walrus import *%0A%0Adatabase = Database(host='localhost', port=6379, db=0)%0A%0Aclass Entry(Model):%0A database = database%0A namespace = 'diary'%0A%0A content = TextField(fts=True)%0A ... | |
736c4ba9a865143cf697121229b9c5016a2fbce1 | Add retries for GET calls which return 502 or 504 errors. | qds_sdk/connection.py | qds_sdk/connection.py | import sys
import requests
import logging
import ssl
import json
import pkg_resources
from requests.adapters import HTTPAdapter
try:
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
from urllib3.poolmanager import PoolManager
from qds_sdk.retry import retry
from qds_sdk.exceptio... | Python | 0 | @@ -4964,17 +4964,27 @@
(449, 50
-3
+2, 503, 504
):%0A
|
51eb0cd7b7e0101843dbff9b4ddd4fe0d32af2c6 | Add tasks for installing JCC and PyLucene. | buedafab/tasks.py | buedafab/tasks.py | """Relatively self-contained, simple Fabric commands."""
from fabric.api import require, env, local, warn, settings, cd
import os
from buedafab.operations import run, exists, conditional_rm, sed, sudo
from buedafab import environments, deploy, utils
def setup():
"""A shortcut to bootstrap or update a virtualenv w... | Python | 0 | @@ -4170,12 +4170,480 @@
ef-client')%0A
+%0Adef install_jcc(**kwargs):%0A try:%0A import jcc%0A except ImportError:%0A run('git clone git://gist.github.com/729451.git build-jcc')%0A run('build-jcc/install_jcc.sh')%0A run('rm -rf build-jcc')%0A%0Adef install_pylucene(**kwargs):%0A t... |
eca8accb984c252f36289cd7bbab8ab23c198317 | Create problem3.py | W2/L4/problem3.py | W2/L4/problem3.py | Python | 0.000022 | @@ -0,0 +1,87 @@
+#L4 PROBLEM 3 %0A%0Adef square(x):%0A '''%0A x: int or float.%0A '''%0A return x ** 2%0A
| |
3332370d70ad30856c9517e51eedc454500f8bf8 | Add forwarding script for build-bisect.py. | build/build-bisect.py | build/build-bisect.py | Python | 0.000002 | @@ -0,0 +1,324 @@
+#!/usr/bin/python%0A# Copyright (c) 2010 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Aimport sys%0A%0Aprint %22This script has been moved to tools/bisect-builds.py.%22%0Aprint %22Please update... | |
35e720cf7b9cbae4e077d0699dd321f741180787 | Create cached_test.py | cached/cached_test.py | cached/cached_test.py | Python | 0.000003 | @@ -0,0 +1,167 @@
+from cached import cached%0A%0A%0Aclass Double:%0A def __init__(self, x):%0A self._x = x%0A %0A @cached(%22_double_x%22)%0A def value(self):%0A return self._x * 2%0A
| |
ee7c257b62bff832b899f54fd7bf39ae47db05b7 | Add tool to get new url | get_new_url.py | get_new_url.py | Python | 0 | @@ -0,0 +1,385 @@
+import sys%0A%0Aimport polycules%0A%0A%0Aif len(sys.argv) != 2:%0A print('Expected ID, got too little or too much')%0A%0Aold_id = sys.argv%5B1%5D%0A%0Adb = polycules.connect_db()%0Aresult = db.execute('select hash from polycules where id = ?', %5B%0A old_id,%0A%5D).fetchone()%0A%0Aif result is ... | |
a994df7e8961e0d82a37ed268dba55c021c7ccd1 | Move order - here till i get the order_desc stuff working. | objects/OrderExtra/Move.py | objects/OrderExtra/Move.py | Python | 0 | @@ -0,0 +1,507 @@
+%0Afrom xstruct import pack%0Afrom objects import Order%0A%0Aclass Move(Order):%0A%09%22%22%22%5C%0A%09Move to a place in space.%0A%09%22%22%22%0A%09subtype = 1%0A%09substruct = %22qqq%22%0A%0A%09def __init__(self, sequence, %5C%0A%09%09%09%09%09id,%09type, slot, turns, resources, %5C%0A%09%09%09%09%... | |
fb2d69698326506214f4fbb2c158d1193a138f04 | Update sqlserver.py to default to integrated security if no username/password | checks.d/sqlserver.py | checks.d/sqlserver.py | '''
Check the performance counters from SQL Server
'''
from checks import AgentCheck
ALL_INSTANCES = 'ALL'
VALID_METRIC_TYPES = ('gauge', 'rate', 'histogram')
class SQLServer(AgentCheck):
METRICS = [
('sqlserver.buffer.cache_hit_ratio', 'gauge', 'Buffer cache hit ratio'),
('sqlserver.buffer.page_l... | Python | 0 | @@ -2206,16 +2206,109 @@
ssword)%0A
+ if not username and not password:%0A conn_str += 'Integrated Security=SSPI;'
%0A
|
c310b7230d24a782c1f3773d2a3095de46530513 | Update ssnc.py to support Tencent-Nintendo Switch (#718) | cogs/ssnc.py | cogs/ssnc.py | # ISC License
#
# Copyright (c) 2019, Valentijn "noirscape" V.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AN... | Python | 0 | @@ -1802,16 +1802,17 @@
%5BKJW%5D%5BJW
+C
%5D%5B0-9%5D%7B7
@@ -1816,32 +1816,93 @@
%5D%7B7%7D%22, serial):%0A
+ # Region %22C%22 is Tencent-Nintendo Switch. Mariko.%0A
|
b8764629331caeeb37a4845480ed884841719525 | scale phage counts to percent so match bacteria counts | code/percent_phage_counts.py | code/percent_phage_counts.py | Python | 0.000001 | @@ -0,0 +1,1127 @@
+%22%22%22%0AThe phage counts per metagenome are normalized based on the number of %0Areads that hit. I want to scale that to a percent, so that it matches%0Athe bacterial data. If there was a single phage present it would get %0A100%25 of the reads%0A%22%22%22%0A%0A%0Aimport os%0Aimport sys%0A%0A%0A... | |
d2a84fb3a8165c9526aa5c96f308dda3b92a2c2c | add new decision module | code/decision.py | code/decision.py | Python | 0 | @@ -0,0 +1,571 @@
+%22%22%22%0AModule for rover decision-handling.%0A%0AUsed to build a decision tree for determining throttle, brake and%0Asteer commands based on the output of the perception_step() function%0Ain the perception module.%0A%0A%22%22%22%0A%0A__author__ = 'Salman Hashmi'%0A__license__ = 'BSD License'%0A%0... | |
3896ddcf660e168afaa80a0be9d7b40b6dd15967 | Add script to clean source code of compiled files. | sansview/clean.py | sansview/clean.py | Python | 0 | @@ -0,0 +1,284 @@
+%22%22%22%0D%0A Remove all compiled code.%0D%0A%22%22%22%0D%0Aimport os%0D%0A%0D%0Afiledirs = %5B'.', 'perspectives', 'perspectives/fitting'%5D%0D%0A%0D%0Afor d in filedirs:%0D%0A files = os.listdir(d)%0D%0A for f in files:%0D%0A if f.find('.pyc')%3E0:%0D%0A print %22Remove... | |
ec736876e11a5aa4f52c63a91b05fc342e298051 | Add config.sample.py. | config.sample.py | config.sample.py | Python | 0 | @@ -0,0 +1,507 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AFile: config.sample.py%0AAuthor: huxuan %3Ci@huxuan.org%3E%0ADescription: Configuration file for app.%0A%22%22%22%0A%0A# Debug or not%0ADEBUG = True%0A%0A# Make jsonfiy encode in utf-8.%0AJSON_AS_ASCII = False%0A%0A# Secret key.%0ASECRET_K... | |
ec9d97f7017939651fc78605fc81a2f030f88b5f | Add exceptions file | brew/exceptions.py | brew/exceptions.py | Python | 0.000001 | @@ -0,0 +1,486 @@
+# -*- coding: utf-8 -*-%0A%0A__all__ = %5B%0A u'BrewdayException',%0A u'DataLoaderException',%0A u'GrainException',%0A u'HopException',%0A u'StyleException',%0A u'YeastException',%0A%5D%0A%0A%0Aclass BrewdayException(Exception):%0A pass%0A%0A%0Aclass DataLoaderException(BrewdayEx... | |
c6eabd93a8ebfe82e2ee3a1118588158c530f8dd | Remove print() in executable | supernova/executable.py | supernova/executable.py | #!/usr/bin/env python
#
# Copyright 2014 Major Hayden
#
# 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 appli... | Python | 0.001291 | @@ -1103,22 +1103,28 @@
ion
-%25s%22 %25
+%7B0%7D%22.format(
version)
%0A
@@ -1119,16 +1119,17 @@
version)
+)
%0A ctx
@@ -1332,18 +1332,18 @@
ader = '
---
+__
%25s ' %25
@@ -1347,43 +1347,59 @@
%25 c
-olors.gwrap(nova_env)%0A print
+lick.style(nova_env, fg='green')%0A click.echo
(env
@... |
2dd55385c3c8209217bde19c5a8d30ad929ce084 | Create employee.py | scheduler/employee.py | scheduler/employee.py | Python | 0.000053 | @@ -0,0 +1,1045 @@
+# -*- coding: utf-8 -*-%0A%0A# employee.py%0A#%0A# Created by Thomas Nelson %3Ctn90ca@gmail.com%3E%0A#%0A# Created..........2015-03-12%0A# Modified.........2015-03-12%0A%0A%0Aclass Employee (object):%0A%09%22%22%22This class will represent an employee and there available time slots%0A%09for each wor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.