commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
eeea573c3ecf6aa2baacdda61c0f9a248a28780f
add missing migration
ynr/apps/uk_results/migrations/0034_auto_20180130_1243.py
ynr/apps/uk_results/migrations/0034_auto_20180130_1243.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2018-01-30 12:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('uk_results', '0033_auto_20170506_2042'), ] operations = [ migrations.AlterM...
Python
0.000258
59f0a18b5232e866f84fdaf6688ced5a1b4a9c44
Add fedora.tg.widgets module containing a few proof-of-concept Fedora TurboGears widgets
fedora/tg/widgets.py
fedora/tg/widgets.py
# Proof-of-concept Fedora TurboGears widgets # Authors: Luke Macken <lmacken@redhat.com> import re import urllib2 import feedparser import simplejson from bugzilla import Bugzilla from turbogears.widgets import Widget class FedoraPeopleWidget(Widget): template = """ <table xmlns:py="http://purl.org/kid/ns...
Python
0
046922c6b842e5ba78fc44848ddf24e6434dd799
Add related options to floating ip config options
nova/conf/floating_ips.py
nova/conf/floating_ips.py
# Copyright 2016 Huawei Technology corp. # All Rights Reserved. # # 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 r...
# needs:fix_opt_description # Copyright 2016 Huawei Technology corp. # All Rights Reserved. # # 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/license...
Python
0.000011
efee783cb87fe2015ab719699e80a661aa3b4d4b
Create main.py
main.py
main.py
import os import cv2 import FocusStack """ Focus stack driver program This program looks for a series of files of type .jpg, .jpeg, or .png in a subdirectory "input" and then merges them together using the FocusStack module. The output is put in the file merged.png Author: Charles McGuinnes...
Python
0.000001
3e0ababfeb0e22d33853d4bad68a29a0249e1a60
Add script demonstrating thread deadlock
other/iterate_deadlock.py
other/iterate_deadlock.py
""" Demonstrates deadlock related to attribute iteration. """ from threading import Thread import h5py FNAME = "deadlock.hdf5" def make_file(): with h5py.File(FNAME,'w') as f: for idx in xrange(1000): f.attrs['%d'%idx] = 1 def list_attributes(): with h5py.File(FNAME, 'r') as f: ...
Python
0
b1517f63c3aa549170d77c6fb3546901fdbe744b
Remove the hard-coded extra 'cv' and 'program' fields
candidates/migrations/0017_remove_cv_and_program_fields.py
candidates/migrations/0017_remove_cv_and_program_fields.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('candidates', '0016_migrate_data_to_extra_fields'), ] operations = [ migrations.RemoveField( model_name='personex...
Python
0.000636
5789cc585a69f3c73e63a36d99c02b119f593bc9
Create accelerometer.py
gadgets/navigators/accelerometer.py
gadgets/navigators/accelerometer.py
from spi.rpi_spi import rpi_spi_dev from spi.adc.MCP3208 import MCP3208 class ACCEL_GY61(): # use chip ADXL335 def __init__(self,device=0,x_channel=0,y_channel=1,z_channel=2): self.spi = rpi_spi_dev(device).spi self.mcp = None if self.spi is not None: self.mcp = MCP3208(self.spi) self.vrx_channel = x_cha...
Python
0.000074
c0da1aecb6e663d9586238e9d8f2b7a8abb40cf7
Add transform module to place ongoing built in transformmers
hug/transform.py
hug/transform.py
"""hug/transform.py Defines Hug's built-in output transforming functions Copyright (C) 2015 Timothy Edmund Crosley 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...
Python
0
c99b6a0ec139deaabb0276ccb04492d70ed48562
add actual code
cnxupgrade/upgrades/dump_upgrade.py
cnxupgrade/upgrades/dump_upgrade.py
# -*- coding: utf-8 -*- # ### # Copyright (c) 2013, Rice University # This software is subject to the provisions of the GNU Affero General # Public License version 3 (AGPLv3). # See LICENCE.txt for details. # ### import sys import psycopg2 from psycopg2.extras import DictCursor from cnxarchive.database import (get_co...
Python
0.000134
e8e65c78ddbb7f3d9b0667aba8626073ce9208f6
Add applicationserver back
davan/http/applicationserver.py
davan/http/applicationserver.py
""" @author: davandev """ #!/bin/env python import logging import os import time import datetime #import datetime.datetime.strptime #import datetime.datetime from BaseHTTPServer import BaseHTTPRequestHandler from SocketServer import ThreadingMixIn import socket import BaseHTTPServer import httplib import cgi import arg...
Python
0.000001
3ed52b0a51ccb18b053ca69984d8072e1ffdec25
Add 328
Ninja/Leetcode/328_Odd_Even_Linked_List.py
Ninja/Leetcode/328_Odd_Even_Linked_List.py
""" Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity. Example 1: Input: 1->2->3->4->...
Python
0.998625
732852ae19d3e7edbbfda9394808ca245456a69b
complete re and datetime sample
08.StandardLibrary.py
08.StandardLibrary.py
#-*- encoding: utf-8 -*- ''' Python Standard Library See Also: http://docs.python.org/3/library/index.html ''' import re ''' re See Also: http://docs.python.org/3/library/re.html ''' ''' m = re.search('H(.*?)o', 'I Say: Hello World Hello World Hello World') if m: print(m.group(0)) # Hello print(...
Python
0
bbd43a3af7fdd5eacea13fae9c1670aa5436e7bc
add data not sufficient exception that shall be raised when data provided to a feature is not sufficient
features/exception_data_not_suffient.py
features/exception_data_not_suffient.py
"""This exception shall be raised in case the data provided to a feature is not sufficient""" class DataNotSufficientError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
Python
0
e41d4fa8a61126495dc5cc42575fa5ce5b89f1b7
add spiel on whitespace
1_start/whitespace.py
1_start/whitespace.py
# FUN WITH WHITESPACE IN PYTHON # Whitespace is critical in Python. Unlike some other scripting languages, # which use characters to tell the interpreter where functions and loops # end, Python uses structured indentation for new lines, making "blocks" of # code. my_string = 'New York' print "Start spreading the ne...
Python
0.99847
acf7e2a9eeedfef28f892d4633b9bbeae479390a
Set conditional to be against result of get_realm, not input.
zerver/management/commands/soft_activate_deactivate_users.py
zerver/management/commands/soft_activate_deactivate_users.py
from __future__ import absolute_import from __future__ import print_function from django.db import connection from django.conf import settings from django.utils.timezone import now as timezone_now from typing import Any, List, Dict from argparse import ArgumentParser from six.moves import map import sys from zerver....
from __future__ import absolute_import from __future__ import print_function from django.db import connection from django.conf import settings from django.utils.timezone import now as timezone_now from typing import Any, List, Dict from argparse import ArgumentParser from six.moves import map import sys from zerver....
Python
0
9cd43d615a0a95b7eb752c428a5cb5e05555fe20
Change filename for unittest
videolectures-dl.py
videolectures-dl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # works under both python2 and python3 # ------ # License: MIT # Copyright (c) 2011 Kohei Ozaki (eowenr atmark gmail dot com) import re, os, sys import subprocess, time class VideoInfoExtractor: _VALIDATE_URL = r'^http://videolectures.net' _VIDEO_PAGE = r...
Python
0.000001
9760f81ce6cc7783f8fb097931e98f8234307a00
add nilearn interface for correlations
src/nibetaseries/interfaces/nilearn.py
src/nibetaseries/interfaces/nilearn.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.nilearn import NilearnBaseInterface from nipype.interfaces.base import ( BaseInterfaceInputSpec, TraitedSpec, File, SimpleInterf...
Python
0
eea6c7477d348e0a12fed89a7d38763c42621977
Fix an unicode error on Windows platform.
pelican/contents.py
pelican/contents.py
# -*- coding: utf-8 -*- from pelican.utils import slugify, truncate_html_words from pelican.log import * from pelican.settings import _DEFAULT_CONFIG from os import getenv from sys import platform, stdin class Page(object): """Represents a page Given a content, and metadata, create an adequate object. :pa...
# -*- coding: utf-8 -*- from pelican.utils import slugify, truncate_html_words from pelican.log import * from pelican.settings import _DEFAULT_CONFIG from os import getenv class Page(object): """Represents a page Given a content, and metadata, create an adequate object. :param content: the string to parse...
Python
0.000002
8490a4e9d0df61755684d3f643a70bea8349d649
add zabbix_group module
lib/ansible/modules/extras/monitoring/zabbix_group.py
lib/ansible/modules/extras/monitoring/zabbix_group.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013-2014, Epic Games, Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (...
Python
0.000001
eee7862cead703d11405276c1a399466c9f102c5
add shell.py
scripts/opencontrail-kubelet/opencontrail_kubelet/shell.py
scripts/opencontrail-kubelet/opencontrail_kubelet/shell.py
# # Copyright (c) 2015 Juniper Networks, Inc. # import subprocess import logging class Shell: # Run a shell command. Log the command run and its output. @staticmethod def run(str): logging.debug('sh: %s' % str) cmd = subprocess.check_output(str, shell=True) logging.debug('output: %...
Python
0.000003
73369f23bd008331884d5644ba9923aae4809756
add offline db comparison tool
scripts/DEV/postgresql/compare_counts.py
scripts/DEV/postgresql/compare_counts.py
import psycopg2 oldpg = psycopg2.connect(database='postgis', host='localhost', port=5555, user='mesonet') cursor = oldpg.cursor() dbs = [] cursor.execute("""SELECT datname FROM pg_database WHERE datistemplate = false ORDER by datname""") for row in cursor: dbs.append(row[0]) for db in dbs: if db <= 'cscap': ...
Python
0
b61a423497c21fa4df818c8b5e5eaea788eb84ea
add ia_cdx_checker
scripts/ia_cdx_checker/ia_cdx_checker.py
scripts/ia_cdx_checker/ia_cdx_checker.py
#!/usr/bin/env python """ $ python ia_cdx_checker.py elxn42-tweets-urls-fixed-uniq-no-count.txt | cat > elx42_urls_in_ia.txt """ from __future__ import print_function import sys import json import fileinput import io from urllib2 import Request, urlopen, URLError, HTTPError for line in fileinput.input(): elx42_u...
Python
0.000216
f468ddbcf6bc752a3a7af877f5453271f7f2ea45
add model processor script
scripts/process_model.py
scripts/process_model.py
#!/usr/bin/python import struct import argparse import sys import os.path def process_mtl(filename): materials = [] file = open(filename) for line in file: tokens = line.split() if(len(tokens) == 0): continue ident = tokens.pop(0) if(ident == 'newmtl'): m = {} m['name'] = tokens[0] m['outer'] =...
Python
0
22ba7e7bfce711257f055733ecd260b8e61ced91
Add example script to parse CapnProto traces
src/Backends/SynchroTraceGen/scripts/stgen_capnp_parser.py
src/Backends/SynchroTraceGen/scripts/stgen_capnp_parser.py
#!/bin/python """ This script demonstrates parsing a CapnProto SynchroTrace event trace. The 'STEventTrace.capnp' file must exist in the sys.path. Add its directory to the PYTHONPATH environmental variable or copy it to the current working directory. The pycapnp library is required: See http://jparyani.github.io/pycap...
Python
0
a1d2023aa6e8baa89747497e69a0a79fe1a27bdd
Drop ProjectPlan table
migrations/versions/36d7c98ddfee_drop_projectplan_table.py
migrations/versions/36d7c98ddfee_drop_projectplan_table.py
"""Drop ProjectPlan table Revision ID: 36d7c98ddfee Revises: 12569fada93 Create Date: 2014-10-14 11:25:48.151275 """ # revision identifiers, used by Alembic. revision = '36d7c98ddfee' down_revision = '12569fada93' from alembic import op def upgrade(): ### commands auto generated by Alembic - please adjust! ##...
Python
0
730b208b490290c84bde8aa017a8f556d457d729
add list to integer
resource-4/combinatorics/digits/list-to-integer.py
resource-4/combinatorics/digits/list-to-integer.py
def listToInt(listt,base=2): return reduce(lambda x,y:base*x+y,reversed(listt), 0)
Python
0.002321
61e16d12bcd945b44896e87bcb21ce750cd507e5
Add `bindings` module
bindings.py
bindings.py
''' Bindings to the `tee` and `splice` system calls ''' import os import ctypes import ctypes.util #pylint: disable=C0103,R0903,R0913 __all__ = ['tee', 'splice'] _c_loff_t = ctypes.c_uint64 _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True) class Tee(object): '''Binding to `tee`''' def __...
Python
0.000005
5e3bc841800bb4e92df5871d97559810d67d7660
Create __init__.py
cmd/__init__.py
cmd/__init__.py
__version__ = '0.0.0'
Python
0.000429
2acb5d6da30c9b25eb05ca7a0da77bdaa45499a5
Create cod_variable.py
cod_variable.py
cod_variable.py
def encode_single_vb(n): byts = [] while True: byts.append(n % 128) if n < 128: break n //= 128 byts = byts[::-1] byts[-1] += 128 return [bin(n)[2:] for n in byts] def encode_vb(numbers): bytestream = [] for n in numbers: bytestream.extend(encode...
Python
0.000085
c6a928255c2a64b6f14d5b5ddda7b16d93302c5f
Create boatrace.py
boatrace.py
boatrace.py
""" spaceshooter.py Author: will laycock Credit: me Assignment: Write and submit a program that implements the spacewar game: https://github.com/HHS-IntroProgramming/Spacewar """ from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame from math import sin, cos SCREEN_WIDTH = 640 SCREEN_HEIG...
Python
0.000003
624c133ba1afdb904e31742ac5f00a76859ab5b7
Write some docs for the response object
buffer/response.py
buffer/response.py
class ResponseObject(dict): ''' Simple data structure that convert any dict to an empty object where all the atributes are the keys of the dict, but also preserve a dict behavior e.g: obj = ResponseObject({'a':'b'}) obj.key = 'value' obj.a => 'b' obj => {'a': 'b', 'key'...
class ResponseObject(dict): def __init__(self, *args, **kwargs): super(ResponseObject, self).__init__(*args, **kwargs) self.__dict__ = self._check_for_inception(self) def _check_for_inception(self, root_dict): for key in root_dict: if type(root_dict[key]) == dict: root_dict[key] = Re...
Python
0.000018
d22242bda1a15cf59e395177c44b6d2701a5e246
add code to replicate issue #376
tests_on_large_datasets/redd_house3_f1_score.py
tests_on_large_datasets/redd_house3_f1_score.py
from __future__ import print_function, division from nilmtk import DataSet, HDFDataStore from nilmtk.disaggregate import fhmm_exact from nilmtk.metrics import f1_score from os.path import join import matplotlib.pyplot as plt """ This file replicates issue #376 (which should now be fixed) https://github.com/nilmtk/nilm...
Python
0
80bf877306a78a63cf7752975f980a2d435f7d5e
Add standard services and lazy service wrapper
polyaxon/libs/services.py
polyaxon/libs/services.py
import inspect import itertools import logging from django.utils.functional import empty, LazyObject from libs.imports import import_string logger = logging.getLogger(__name__) class InvalidService(Exception): pass class Service(object): __all__ = () def validate(self): """Validate the sett...
Python
0
e204dd02b44066b28d09c0143cdeec557ff420fd
add a module for effects that can be applied to waveforms
potty_oh/effects.py
potty_oh/effects.py
# Copyright 2016 Curtis Sand # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
Python
0
b9a8d24048a5c5b83a996f9fb1b2b07857a56db0
unwind the changes to tracker main
heron/tracker/src/python/main.py
heron/tracker/src/python/main.py
import os import sys import tornado.httpserver import tornado.ioloop import tornado.web from tornado.escape import json_encode, utf8 from tornado.options import define, options from heron.tracker.src.python import handlers from heron.tracker.src.python import log from heron.tracker.src.python.log import Log as LOG fro...
import os import sys import tornado.httpserver import tornado.ioloop import tornado.web from tornado.escape import json_encode, utf8 from tornado.options import define, options from heron.tracker.src.python import handlers from heron.tracker.src.python import log from heron.tracker.src.python.log import Log as LOG fro...
Python
0.000001
3a6d41d8123b27ca5b22f7d7630e40faef3595c1
Add a top-level script that replaces the top-level makefile.
examples/run.py
examples/run.py
#!/usr/bin/python # # Copyright 2010, The Native Client SDK Authors. All Rights Reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. # """Build and run the SDK examples. This script tries to find an installed version of the Chrome Browser that can run the SD...
Python
0.000154
451e8f3ea4765051088ea1c84f81e32691591d89
Create __init__.py
core/__init__.py
core/__init__.py
#!/usr/bin/env python
Python
0.000429
65aa1424f7ea8e184180d93e790b1ece6705775d
fix missing coma
addons/purchase_requisition/__openerp__.py
addons/purchase_requisition/__openerp__.py
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
Python
0.000012
72738366fa074b457021faab0c21c3b89070b5ad
Add first revision of Nautilus extension.
nautilus/wizbit-extension.py
nautilus/wizbit-extension.py
from urlparse import urlparse from os.path import exists, split, isdir import nautilus from lxml import etree WIZ_CONTROLLED = "wiz-controlled" WIZ_CONFLICT = "wiz-conflict" YES = "Yes" NO = "No" class WizbitExtension(nautilus.ColumnProvider, nautilus.InfoProvider): def __init__(self): pass def get...
Python
0
2a9858381a78bd9ff9ff459a23f73630237e6669
send vm
weibo_data_input.py
weibo_data_input.py
__author__ = 'heipiao' # -*- coding: utf-8 -*- from weibo import APIClient import urllib2 import urllib #APP_KEY和APP_SECRET,需要新建一个微博应用才能得到 APP_KEY = '3722673574' APP_SECRET = '7a6de53498caf87e655a98fa2f8912bf' #管理中心---应用信息---高级信息,将"授权回调页"的值改成https://api.weibo.com/oauth2/default.html CALLBACK_URL = 'https://api.weibo.c...
Python
0
7b899fbcf7a661758ab2a9cdca7ade6c461c8e65
add c model
transiNXOR_modeling/caffe2_tensor_to_c_array.py
transiNXOR_modeling/caffe2_tensor_to_c_array.py
import sys sys.path.append('../') import caffe2_paths from caffe2.python import workspace from pinn import exporter from scipy.io import savemat import numpy as np import pickle model_name = 'bise_h216_0' init_net = exporter.load_init_net('./transiXOR_Models/'+model_name+'_init') print(type(init_net)) with open("c_mo...
Python
0.000001
7be9e42f6c870004a5aa9b123b9f28c8f95f5b88
Add Parser to analyse the results of the network tester.
webrtc/tools/network_tester/parse_packet_log.py
webrtc/tools/network_tester/parse_packet_log.py
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing proje...
Python
0
e8b681e3de2a3e0c507410c0b854d1afd6bd3417
Adding triples transpose.
trunk/python/archive/generate_source_triples.py
trunk/python/archive/generate_source_triples.py
import fileinput import string import sys import os # BGP #fortran_compiler = '/bgsys/drivers/ppcfloor/comm/bin/mpixlf77_r' #fortran_opt_flags = '-O5 -qhot -qprefetch -qcache=auto -qalign=4k -qunroll=yes -qmaxmem=-1 -qalias=noaryovrlp:nopteovrlp -qnoextname -qnosmp -qreport=hotlist -c' #src_dir = '/gpfs/home/jhammond/...
Python
0.999998
f3cab8d72b9a070305f4f2c44922e381ea091205
add context manager example
examples/context_manager.py
examples/context_manager.py
# -*- coding: utf-8 -*- import riprova # Store number of function calls for error simulation calls = 0 # Register retriable operation with custom evaluator def mul2(x): global calls if calls < 4: calls += 1 raise RuntimeError('simulated call error') return x * 2 # Run task via context...
Python
0.000063
24cf3c2676e4ea7342e95e6a37857c6fa687865e
Remove managers for article obj.
src/submission/migrations/0058_auto_20210812_1254.py
src/submission/migrations/0058_auto_20210812_1254.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-08-12 12:54 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('submission', '0057_merge_20210811_1506'), ] operations = [ migrations.AlterModelMa...
Python
0
9687ca646dd7ae5a7ff31e5b8657fb1ab88a0f5e
add buildbot
buildbot.py
buildbot.py
#!/usr/bin/env python # encoding: utf-8 import sys import json import subprocess project_name = 'bourne' def run_command(args): print("Running: {}".format(args)) # sys.stdout.flush() # subprocess.check_call(args) def get_tool_options(properties): options = [] if 'tool_options' in properties: ...
Python
0.000001
0f6866a91e4d8af2faedf2af277ad0df573536aa
Set win_delay_load_hook to false
binding.gyp
binding.gyp
{ 'target_defaults': { 'win_delay_load_hook': 'false', 'conditions': [ ['OS=="win"', { 'msvs_disabled_warnings': [ 4530, # C++ exception handler used, but unwind semantics are not enabled 4506, # no definition for inline function ], }], ], }, 'targets'...
{ 'target_defaults': { 'conditions': [ ['OS=="win"', { 'msvs_disabled_warnings': [ 4530, # C++ exception handler used, but unwind semantics are not enabled 4506, # no definition for inline function ], }], ], }, 'targets': [ { 'target_name': 'runa...
Python
0.999875
0d6da71cb759c3819133baa3d7c043fb92df425e
Create weibo.py
2/weibo.py
2/weibo.py
from bs4 import BeautifulSoup import json import ConfigParser import urllib2 from util import get_content link_id = 18 cf = ConfigParser.ConfigParser() cf.read("config.ini") weiyinUrl = 'http://wb.weiyin.cc/Book/BookView/W440164363452#' + str(link_id) content = urllib2.urlopen(weiyinUrl) html = content.read() sou...
Python
0.000001
666caee40af2dccc30e78d52f8de962110408146
Add fan device
xknx/devices/fan.py
xknx/devices/fan.py
""" Module for managing a fan via KNX. It provides functionality for * setting fan to specific speed * reading the current speed from KNX bus. """ import asyncio from .device import Device from .remote_value_scaling import RemoteValueScaling class Fan(Device): """Class for managing a fan.""" # pylint: disab...
Python
0
539a579b380362b398b41c13f335c89af2946e84
Add verify_server test without pristine header.
tests/gold_tests/tls/tls_verify_not_pristine.test.py
tests/gold_tests/tls/tls_verify_not_pristine.test.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");...
Python
0
eefa144b7a01f6beee1fcba30af32a967598d44f
add tests
tests/test_tabela_fipe.py
tests/test_tabela_fipe.py
# -*- coding: utf-8 -*- # # Copyright 2015 Alexandre Villela (SleX) <https://github.com/sxslex/sxtools/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the ...
Python
0
a467cf8e92a783112bcecc82acf7b33c31282c49
Bump to 3.2.0.rc2
cms/__init__.py
cms/__init__.py
# -*- coding: utf-8 -*- __version__ = '3.2.0.rc2' default_app_config = 'cms.apps.CMSConfig'
# -*- coding: utf-8 -*- __version__ = '3.2.0.dev4' default_app_config = 'cms.apps.CMSConfig'
Python
0.000003
de0f37bd38cba571d3a1a28f2e66d33e82ffd63c
Add pushover plugin from scottwallacesh. pull:10
flexget/plugins/output/pushover.py
flexget/plugins/output/pushover.py
import logging from flexget.plugin import register_plugin from flexget.utils.template import RenderError log = logging.getLogger("pushover") __version__ = 0.1 client_headers = {"User-Agent": "FlexGet Pushover plugin/%s" % str(__version__)} pushover_url = "https://api.pushover.net/1/messages.json" class Out...
Python
0.000004
68a7f9faf1933bb224113d9fa5d0ddd362b2e5ea
Add script to generate the site documentation containing the sizes of the binary shellcodes.
SizeDocGenerator.py
SizeDocGenerator.py
import os, re; # I got the actual size of the binary code wrong on the site once - this script should help prevent that. dsDoc_by_sArch = {"w32": "x86", "w64": "x64", "win": "x86+x64"}; with open("build_info.txt", "rb") as oFile: iBuildNumber = int(re.search(r"build number\: (\d+)", oFile.read(), re.M).group(1)...
Python
0
d59b7d8ea46d86169ffc9423de0a88b9c7c64774
Create BalanceData.py
Scikit/BalanceData.py
Scikit/BalanceData.py
#Copyright (c) 2016 Vidhya, Nandini import os import numpy as np import operator from constants import * FIX_DEV = 0.00000001 rootdir = os.getcwd() newdir = os.path.join(rootdir,'featurefiles') def LoadData(): data_file = open(os.path.join(newdir,'out_2.txt'),'r') unprocessed_data = data_file.readlines() ...
Python
0.000001
45b77de143a6ffcc46091d7879da4fa3009bc3e0
add jm client
python/jm_client.py
python/jm_client.py
#!/usr/bin/python # # jm_client.py # # Author: Zex <top_zlynch@yahoo.com> # import dbus import dbus.service import dbus.mainloop.glib import gobject from basic import * def start_request(): """ Start sending requests to server """ connection = dbus.SessionBus() obj = connection.get_object( ...
Python
0
4ea6def1bdeb332b1f530f359a333e4f95078b2b
Update docstrings and link to docs
homeassistant/components/updater.py
homeassistant/components/updater.py
""" homeassistant.components.updater ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Component that checks for available updates. For more details about this platform, please refer to the documentation at at https://home-assistant.io/components/updater/ """ import logging import requests from homeassistant.const import __version__...
""" homeassistant.components.sensor.updater ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sensor that checks for available updates. For more details about this platform, please refer to the documentation at at https://home-assistant.io/components/sensor.updater/ """ import logging import requests from homeassistant.const imp...
Python
0
3c65f2c4d7e40d55f5afae22c7912bba7d3eef7b
add french version
pytimeago/french.py
pytimeago/french.py
# -*- coding: utf-8 -*- # pytimeago -- library for rendering time deltas # Copyright (C) 2006 Adomas Paltanavicius # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 ...
Python
0.000008
01653b1130934b809816f7a5ad3c4b8c73d8d411
Add a tool to fix (some) errors reported by gn gen --check.
tools/gn_check_autofix.py
tools/gn_check_autofix.py
#!/usr/bin/env python # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All ...
Python
0.000082
7084442bb78098f05acbe3243231243543061bf6
Create gloabl_moran.py
gloabl_moran.py
gloabl_moran.py
import arcpy arcpy.env.workspace = r"C:\Users\allenje4\Desktop\GGRC32 Lab 4 Files\GGRC32 Lab 4 Files\Local Statistics Data" m = arcpy.SpatialAutocorrelation_stats("pop_sci.shp", "PDens2011","NO_REPORT", "CONTIGUITY_EDGES_CORNERS", "#",)
Python
0.000006
bbc208548f0dd381f3045d24db3c21c4c8ee004e
Test all sensors at once
grovepi/scan.py
grovepi/scan.py
import time import grove_i2c_temp_hum_mini # temp + humidity import hp206c # altitude + temp + pressure import grovepi # used by air sensor and dust sensor import atexit # used for the dust sensor import json # Initialize the sensors t= grove_i2c_temp_hum_mini.th02() h= hp206c.hp206c() grovepi.dust_sensor_en() air_se...
Python
0
c834082c59abe6ae6d2e065e1a5afac2d399a612
Add unittests for the bridgedb.crypto module.
lib/bridgedb/test/test_crypto.py
lib/bridgedb/test/test_crypto.py
# -*- coding: utf-8 -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> # please also see AUTHORS file # :copyright: (c) 2013, Isis Lovecruft # (c) 2007-2013, The Tor Project, Inc. # (c) 2007-201...
Python
0
ac0d713e48689c0bf9100d33069409cadf808f57
Add unit tests to engine.parser
senlin/tests/unit/engine/test_engine_parser.py
senlin/tests/unit/engine/test_engine_parser.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed unde...
Python
0
8373de2daf5c44c069b9312ad3a3b21e2f5c21e3
Implement channel mode +l
txircd/modules/cmode_l.py
txircd/modules/cmode_l.py
from twisted.words.protocols import irc from txircd.modbase import Mode class LimitMode(Mode): def checkSet(self, user, target, param): intParam = int(param) if str(intParam) != param: return False return (intParam >= 0) def commandPermission(self, user, cmd, data): if cmd != "JOIN": return data ta...
Python
0
a24844a20634354167511163870438c36581c656
Add py-hpack (#19189)
var/spack/repos/builtin/packages/py-hpack/package.py
var/spack/repos/builtin/packages/py-hpack/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyHpack(PythonPackage): """Pure-Python HPACK header compression""" homepage = "https:...
Python
0
5ed57df8d1e3b85bc27d5a834c9ec35b18055ba9
Create codility.py
codility.py
codility.py
#lesson 1 def solution(N): bstr = dectoBin(N) arr = [] cnt = 0 for b in bstr: if b == '0': cnt = cnt + 1 if b != '0': arr.append(cnt) cnt = 0 return getMax(arr) def dectoBin(N): bstr = "" while N > 0: bstr = str(N % 2) + bstr ...
Python
0.000003
955bca3beb7808636a586bed43c37e5f74fba17f
Add Weather class (use forecastio, geopy) - forecase(current/daily)
kino/functions/weather.py
kino/functions/weather.py
# -*- coding: utf-8 -*- import datetime import forecastio from geopy.geocoders import GoogleV3 from kino.template import MsgTemplate from slack.slackbot import SlackerAdapter from utils.config import Config class Weather(object): def __init__(self): self.config = Config() self.slackbot = Slacker...
Python
0
1005f983774392306ca10e5fb12b59eeb63a88c4
add remote file inclusion exploit
framework/Exploits/OSVDB_82707_D.py
framework/Exploits/OSVDB_82707_D.py
# Copyright 2013 University of Maryland. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE.TXT file. import framework import time import selenium.common.exceptions class Exploit (framework.Exploit): attributes = {'Name' ...
Python
0.000001
2c1b393c347ffcf24d9584be800378a1b77fa86d
add example to test error handling
flexx/ui/examples/errors.py
flexx/ui/examples/errors.py
""" App that can be used to generate errors on the Python and JS side. These errors should show tracebacks in the correct manner (and not crash the app as in #164). To test thoroughly, you should probably also set the foo and bar properties from the Python and JS console. """ from flexx import app, event, ui class ...
Python
0
331308eedd37628f5419001fc48fc5a328c1bab9
Add test_jsc
unnaturalcode/test_jsc.py
unnaturalcode/test_jsc.py
#!/usr/bin/python # Copyright 2017 Dhvani Patel # # This file is part of UnnaturalCode. # # UnnaturalCode is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
Python
0.00001
a6495a05d4652beeefca9e383f5dd7b8fc4246d7
Create simple_fun_91:unique_digit_products.py
Solutions/simple_fun_91:unique_digit_products.py
Solutions/simple_fun_91:unique_digit_products.py
from operator import mul def unique_digit_products(a): return len({reduce(mul, map(int, str(x))) for x in a})
Python
0.999972
371545ecae0296f9274319c971be1378c3dafbbe
Add migration
services/migrations/0036_auto_20150327_1434.py
services/migrations/0036_auto_20150327_1434.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('services', '0035_auto_20150325_1637'), ] operations = [ migrations.AddField( model_name='jiraupdaterecord', ...
Python
0.000002
7d061e698788a60f0e3b59559961408015d891ed
Add first iteration of message_producer
utils/message_producer.py
utils/message_producer.py
import argparse import pika def send_message(queue, body=None): """ Sends a message to the specified queue with specified body if applicable. :param queue: Name of queue. :type queue: str :param body: Content of message body in the form "{'key': 'value'}". :type body: str """ connecti...
Python
0.000051
49614576524e74cb2e8eaa6656c1e86bf546c8e6
Create keystone_test.py
keystone_test.py
keystone_test.py
import keystoneclient.v2_0.client as ksclient import novaclient.v1_1.client as nvclient from novaclient import client as novaclient import glanceclient import os def get_keystone_creds(): d = {} d['username'] = 'admin' d['password'] = 'password' d['auth_url'] = 'http://10.0.2.15:5000/v2.0/' d['tena...
Python
0.000005
6789f2ea1862f4c30e8d60bd0b47640b7e5835c1
Add script to count labels in a data set
count_labels.py
count_labels.py
"""Count HEEM labels in data set. Usage: python count_labels.py <dir with train and test files> """ import codecs from glob import glob import numpy as np import argparse from collections import Counter def load_data(data_file): data = [ln.rsplit(None, 1) for ln in open(data_file)] X_data, Y_data = zip(*dat...
Python
0
f1e08341a6b9f8bf137c1642debe3d3eda4b2cdf
Add utility to load env from config file
gidget/util/load_path_config.py
gidget/util/load_path_config.py
#!/usr/bin/env python import os from os.path import join as pthJoin from ConfigParser import SafeConfigParser import sys from pipeline_util import expandPath as pthExpanded COMMANDS_DIR = 'commands' # mini spec that maps from config lines to gidget env var names # [ (section, [ (option_name, env_name) ] ) ] optionM...
Python
0.000001
2c4a2368d2dc1c6ee910358fedd6e85cdf4f043a
Add test from jasmine-core
test/jasmine_core_test.py
test/jasmine_core_test.py
from pytest import raises import pytest import subprocess from jasmine_core import Core import os import pkg_resources notwin32 = pytest.mark.skipif("sys.platform == 'win32'") @notwin32 def test_js_files(): files = [ 'jasmine.js', 'jasmine-html.js', 'json2.js', 'boot.js' ] ...
Python
0
7b5b4fdf8d5801d6e87d1b39f46a5f868aa07110
Add test
tests/cupy_tests/test_typing.py
tests/cupy_tests/test_typing.py
import cupy class TestClassGetItem: def test_class_getitem(self): from typing import Any cupy.ndarray[Any, Any]
Python
0.000005
a9609a500a65cc0efb787f5d90e164bd6fa48c1a
Print the left view of a BST
leftViewofBST.py
leftViewofBST.py
class BST: def __init__(self,val): self.left = None self.right = None self.data = val def insertToBst(root,value): if root is None: root = value else: if value.data < root.data: if root.left is None: root.left = value else: ...
Python
0.999984
08e7103766ce684e849f23fac77792876fded586
fix helper to use the actual lines form ceph.conf
tests/functional/tests/mon/test_initial_members.py
tests/functional/tests/mon/test_initial_members.py
import pytest uses_mon_initial_members = pytest.mark.skipif( 'mon_initial_members' not in pytest.config.slaveinput['node_config']['components'], reason="only run in monitors configured with initial_members" ) class TestMon(object): def get_line_from_config(self, string, conf_path): with open(c...
import pytest uses_mon_initial_members = pytest.mark.skipif( 'mon_initial_members' not in pytest.config.slaveinput['node_config']['components'], reason="only run in monitors configured with initial_members" ) class TestMon(object): def get_line_from_config(self, string, conf_path): with open(c...
Python
0
5fad9d4fb60eb29d04d8d6a7fd967aad67ca28e2
Create __init__.py
pagination_bootstrap/__init__.py
pagination_bootstrap/__init__.py
Python
0.000429
379d2953c90610a48eb80d1cabedb63b8f948813
Use `for_app` helper
thefuck/rules/fab_command_not_found.py
thefuck/rules/fab_command_not_found.py
from thefuck.utils import eager, get_closest, for_app @for_app('fab') def match(command): return 'Warning: Command(s) not found:' in command.stderr # We need different behavior then in get_all_matched_commands. @eager def _get_between(content, start, end=None): should_yield = False for line in content.s...
from thefuck.utils import eager, get_closest def match(command): return (command.script_parts[0] == 'fab' and 'Warning: Command(s) not found:' in command.stderr) # We need different behavior then in get_all_matched_commands. @eager def _get_between(content, start, end=None): should_yield = False...
Python
0.000036
df777bf0771fdd8aadfbb26fe13b51692f4c161d
Add autogen package (#3542)
var/spack/repos/builtin/packages/autogen/package.py
var/spack/repos/builtin/packages/autogen/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
cbbf9f34d08897358023078d81be3fa798601b02
add the repl.py
repl.py
repl.py
#!/usr/bin/env python3 """Run Django shell with imported modules""" if __name__ == "__main__": import os if not os.environ.get("PYTHONSTARTUP"): from subprocess import check_call import sys base_dir = os.path.dirname(os.path.abspath(__file__)) sys.exit( check_call(...
Python
0
21799cbe81c57f80f66cb5a90992d6ff66c31e2d
Create new package. (#5919)
var/spack/repos/builtin/packages/r-hmisc/package.py
var/spack/repos/builtin/packages/r-hmisc/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
cf7c33e3b3d733f24376badac70392ecb5f5a323
add more tests
tests/test_build_definitions.py
tests/test_build_definitions.py
from vdist.builder import Build from vdist.source import git, directory, git_directory def test_build_projectroot_from_uri(): build = Build( name='my build', app='myapp', version='1.0', source=git( uri='https://github.com/objectified/vdist', branch='release-...
Python
0
e19097216c090c0e3f4b68c743d6427f012ab69e
Add migration for legislator change
txlege84/legislators/migrations/0004_auto_20141201_1604.py
txlege84/legislators/migrations/0004_auto_20141201_1604.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('legislators', '0003_auto_20141120_1731'), ] operations = [ migrations.AlterField( model_name='legislator', ...
Python
0
01327c49590641c8fe918d91a7877aa67fd56e88
Add lc0172_factorial_trailing_zeroes.py
lc0172_factorial_trailing_zeroes.py
lc0172_factorial_trailing_zeroes.py
"""Leetcode 172. Factorial Trailing Zeroes Easy URL: https://leetcode.com/problems/factorial-trailing-zeroes/ Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: 5 Output: 1 Explanation: 5! = 120, one trailing zero. N...
Python
0.000087
6a9b224834d1a523b03ce1e7c6ff4fa3ccea2583
Add tests for parse_utils.extract_tables.
tests/test_parse_utils.py
tests/test_parse_utils.py
from pgcli.packages.parseutils import extract_tables def test_simple_select_single_table(): tables = extract_tables('select * from abc') assert tables == ['abc'] def test_simple_select_multiple_tables(): tables = extract_tables('select * from abc, def') assert tables == ['abc', 'def'] def test_simple...
Python
0
897843932937faa841220cde90bdc89603d95615
Solve hackerrank linked list problem
hackerrank/linked-list/dedup.py
hackerrank/linked-list/dedup.py
# https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem def RemoveDuplicates(head): if head is None: return None curr = head while curr.next is not None: currentData = curr.data next = curr.next; nextData = next.data ...
Python
0.005101
7a25a38d7b53da6aadf5b0d45aa9aefdb639ae81
Add python sample library
test.py
test.py
from datetime import datetime from time import mktime from wsgiref.handlers import format_date_time from requests.auth import AuthBase from base64 import b64encode from urllib import urlencode from urlparse import urlparse, parse_qs, ParseResult import re import requests import hashlib import hmac public_token = "Ch7/...
Python
0.000001
b3a20379162a068cc8f9a0f314a21a46ec40e4c6
Add simple unit test for snapshot iteration class
test.py
test.py
#!/usr/bin/env python import unittest from fix_time_machine_backup import SnapshotList class TestSnapshotList(unittest.TestCase): def setUp(self): self.snapshot_list = SnapshotList([ 'auto-20160820.2103-2m', 'auto-20160821.0003-2m', 'auto-20160821.1503-2m', ...
Python
0
aaea97c5cab778174b45cb2557d819deb769a45e
Create instagram_checker.py
instagram_checker.py
instagram_checker.py
import requests, argparse, sys class checker: def __init__(self): #Declare some variables self.headers = {'User-agent': 'Mozilla/5.0'} self.loginurl = 'https://www.instagram.com/accounts/login/ajax/' self.url = 'https://www.instagram.com/' #Start a session and update heade...
Python
0.000035
20600b8cac9488ff416397de374c2d3dacf4afe4
add tests and netcdf-cxx4
var/spack/repos/builtin/packages/dealii/package.py
var/spack/repos/builtin/packages/dealii/package.py
from spack import * import shutil class Dealii(Package): """C++ software library providing well-documented tools to build finite element codes for a broad variety of PDEs.""" homepage = "https://www.dealii.org" url = "https://github.com/dealii/dealii/releases/download/v8.4.0/dealii-8.4.0.tar.gz" ...
from spack import * class Dealii(Package): """C++ software library providing well-documented tools to build finite element codes for a broad variety of PDEs.""" homepage = "https://www.dealii.org" url = "https://github.com/dealii/dealii/releases/download/v8.4.0/dealii-8.4.0.tar.gz" version('8.4.0...
Python
0
16aa4a292fafa2a74f668a56c5cf1a66f923df24
Make src.cm.tools a package
src/cm/tools/__init__.py
src/cm/tools/__init__.py
"""@package cm.tools @date Jun 6, 2014 @author Zosia Sobocińska """
Python
0.000437
519d6052e3bf16c8028d39eab374cd2aa17ffd4e
add position field to user committee
application/migrations/0014_usercommittee_position.py
application/migrations/0014_usercommittee_position.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('application', '0013_auto_20150313_2126'), ] operations = [ migrations.AddField( model_name='usercommittee', ...
Python
0
557b0f30e0180a526433b65915d2a137144f2f05
add test_logger.py
tests/unit/test_logger.py
tests/unit/test_logger.py
# Tai Sakuma <tai.sakuma@gmail.com> import logging import alphatwirl ##__________________________________________________________________|| def test_logger_exist(): assert 'alphatwirl' in logging.Logger.manager.loggerDict def test_len_handlers(): logger = logging.getLogger('alphatwirl') assert len(logger...
Python
0.000007
59b00a4f5cc5aa5139492660206c99185df24f7b
create unittest for area serializer for #191
popit/tests/test_area_api.py
popit/tests/test_area_api.py
from rest_framework.test import APITestCase from rest_framework import status from rest_framework.authtoken.models import Token from popit.models import * class AreaAPITestCase(APITestCase): fixtures = [ "api_request_test_data.yaml" ] def test_create_area_serializer(self): pass def test_fetch_ar...
Python
0
a8274a5d5e4ec68f3ee594ffa741e90f11cf24db
Add tool to regenerate JSON files from P4 progs
tools/update_test_bmv2_jsons.py
tools/update_test_bmv2_jsons.py
#!/usr/bin/env python2 import argparse import fnmatch import os import subprocess import sys def find_files(root): files = [] for path_prefix, _, filenames in os.walk(root, followlinks=False): for filename in fnmatch.filter(filenames, '*.p4'): path = os.path.join(path_prefix, filename) ...
Python
0.000001
f1d3717b45650244d9a4f44caf6f610636bb72ee
Add other_data_collections/2015ApJ...812...60B/biteau.py
other_data_collections/2015ApJ...812...60B/biteau.py
other_data_collections/2015ApJ...812...60B/biteau.py
""" Script to check and ingest Biteau & Williams (2015) data for gamma-cat. """ from astropy.table import Table class Biteau: def __init__(self): filename = 'other_data_collections/2015ApJ...812...60B/BiteauWilliams2015_AllData_ASDC_v2016_12_20.ecsv' self.table = Table.read(filename, format='ascii...
Python
0