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 |
|---|---|---|---|---|---|---|---|
b5d1be9069507feaeb41cfcf9cd774a244ffe49c | Add Activity model | sqlalchemy_continuum/ext/activity_stream.py | sqlalchemy_continuum/ext/activity_stream.py | import sqlalchemy as sa
from sqlalchemy_utils import generic_relationship, JSONType
class Activity(object):
@declared_attr
def actor_id(self):
return sa.Column(
sa.Integer,
sa.ForeignKey('user.id'),
index=True
)
@declared_attr
def actor(self):
... | Python | 0.000001 | |
98b738e21918d1b6c4f2193cf229c518c9913974 | add standalone affordance server script | src/python/scripts/affordanceServer.py | src/python/scripts/affordanceServer.py | from ddapp import consoleapp
from ddapp import lcmobjectcollection
from ddapp.timercallback import TimerCallback
import datetime
def main():
app = consoleapp.ConsoleApp()
meshCollection = lcmobjectcollection.LCMObjectCollection('MESH_COLLECTION_COMMAND')
affordanceCollection = lcmobjectcollection.LCMObje... | Python | 0 | |
8e4d60645fb45e37c7a947b3a86219e5fd15c194 | Add py-geeup package (#12367) | var/spack/repos/builtin/packages/py-geeup/package.py | var/spack/repos/builtin/packages/py-geeup/package.py | # Copyright 2013-2019 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 PyGeeup(PythonPackage):
"""Simple Client for Earth Engine Uploads with Selenium Support.""... | Python | 0 | |
eb4bcaf1a94963bc1af697180a31a48a84333eb6 | Add exclusive state for /* */ comments to the curly lexer. Seems to fix leaf node comments too. | libraries/vyconf/configfile/curly/lexer.py | libraries/vyconf/configfile/curly/lexer.py | # vyconf.configfile.curly.lexer: lexer for the curly config
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# 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 Found... | # vyconf.configfile.curly.lexer: lexer for the curly config
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# 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 Found... | Python | 0 |
09aada1e7b734bde947a7031f97ecce34b8c65b2 | Create magical_marvelous_tour.py | Google_Code_Jam/2014/Round_3/A/magical_marvelous_tour.py | Google_Code_Jam/2014/Round_3/A/magical_marvelous_tour.py | #!/usr/bin/python -tt
"""Solves Google Code Jam 2014 Round 3 Problem A
(https://code.google.com/codejam/contest/3024486/dashboard#s=p0)
"Magical, Marvelous Tour"
"""
import sys
def read_input():
"""Parses problem data from stdin.
Args:
None
Returns:
List of test cases, in order specifi... | Python | 0.999893 | |
c50628d1cf984be774cdf1bc6728b9c1cb3f94fa | Create Assignment2Solution.py | Assignments/Assignment2Solution.py | Assignments/Assignment2Solution.py | # Your name here
# Assignment 2: Process a folder of shapefiles
# Using the os library, find all shapefiles,and only shapefiles in a given folder and buffer them as before.
# Catch exceptions to handle invalid shapefiles.
import arcpy
import os
def main(inputfolder,prefix,outputfolder):
"""Buffer all shapefiles in... | Python | 0 | |
4f32369efb0b2cd8540cc78132cadfbed6e68ae8 | Read and write xls files | src/petlx/xls.py | src/petlx/xls.py | """
Read and write xls files, using xlrd.
"""
import os
import petl
from petlx.util import UnsatisfiedDependency
dep_message = """
The package xlrd is required. pip install xlrd.
"""
def fromxls(filename, sheetname):
"""
Extract a table from a sheet in an Excel (.xls) file.
N.B., the sheet name... | Python | 0 | |
24d742e444c84df99629d8a6aff7ca7e6c90f995 | Add adhoc script to detect jobs with stuck ActiveInvocations list. | scheduler/misc/detect_stuck_active_invs.py | scheduler/misc/detect_stuck_active_invs.py | #!/usr/bin/env python
# Copyright 2018 The LUCI Authors.
#
# 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 ... | Python | 0 | |
cf78037980a9345c12b1e2562bc4eda63cea95b3 | Add a simple regression test to go with r143260. CommandInterpreter::PreprocessCommand() should not infinite loop when a target has not been specified yet. | test/functionalities/backticks/TestBackticksWithoutATarget.py | test/functionalities/backticks/TestBackticksWithoutATarget.py | """
Test that backticks without a target should work (not infinite looping).
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class BackticksWithNoTargetTestCase(TestBase):
mydir = "functionalities/backticks"
def test_backticks_no_target(self):
"""A simple test of backticks wi... | Python | 0.000178 | |
905bccf6f66020939202a4be50cffade071881dc | Create multi_time_frame_strategy.py | vnpy/app/cta_strategy/strategies/multi_time_frame_strategy.py | vnpy/app/cta_strategy/strategies/multi_time_frame_strategy.py | from vnpy.app.cta_strategy import (
CtaTemplate,
StopOrder,
Direction,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager,
)
class MultiTimeframeStrategy(CtaTemplate):
""""""
author = '用Python的交易员'
rsi_signal = 20
rsi_window = 14 ... | Python | 0.000113 | |
28e226a47d16fb6a52c937031be19d8832e7e5c4 | Bump development version | ckeditor_filebrowser_filer/__init__.py | ckeditor_filebrowser_filer/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.2.0.b1'
| # -*- coding: utf-8 -*-
__version__ = '0.1.1'
| Python | 0 |
dc200e50020637650c8a5dfe76895b0a033a8cea | Add tests for verifying that deactivating password works | akvo/rsr/tests/models/test_login_logging.py | akvo/rsr/tests/models/test_login_logging.py | # -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from datetime import timedelta
... | Python | 0 | |
e28a6423f63a169b46ebe46e9690d3858f953909 | Add tests | apps/commons/tests/test_accepted_locales.py | apps/commons/tests/test_accepted_locales.py | import os
import shutil
from django.conf import settings
import test_utils
import manage
class AcceptedLocalesTest(test_utils.TestCase):
"""Test lazy evaluation of locale related settings.
Verify that some localization-related settings are lazily evaluated based
on the current value of the DEV variabl... | Python | 0.000001 | |
bb9fd71dc06ac39b461b4109e341fe7cd4172c76 | use self.create_socket() | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | import socket
from file_transfer_helper import exec_file_transfer_test, ReceiveFileTest
class ReceiveFileAndDisconnectTest(ReceiveFileTest):
def receive_file(self):
s = self.create_socket()
s.connect(self.address)
# disconnect
self.conn.Disconnect()
self.q.expect('dbus-sig... | import socket
from file_transfer_helper import exec_file_transfer_test, ReceiveFileTest
class ReceiveFileAndDisconnectTest(ReceiveFileTest):
def receive_file(self):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.address)
# disconnect
self.conn.Disconnect()
... | Python | 0.000001 |
5dfd7b1534e19242ab778d535e2de13b424578f7 | Add examples | example.py | example.py | #!/usr/bin/python3
#
# Copyright (c) 2016, Fabian Affolter <fabian@affolter-engineering.ch>
# Released under the MIT license. See LICENSE file for details.
#
import fixerio
# Our base currency is the Czech Koruna instead of the default (EUR).
BASE = 'CZK'
exchange = fixerio.Fixer(base=BASE)
print('Current exchange r... | Python | 0 | |
5afdd7775dd1aa232d3ca8fa2852f4a36918f224 | add management command to fix forms whose non-ascii chars are corrupted | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | # encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from django.core.management import BaseCommand
from six.moves import input
from corehq.apps.app_manager.dbaccessors import get_apps_by_id
SUSPICIOUS_STRINGS = [
international_character.encode('utf-8').decode('latin1... | Python | 0 | |
3cf56093b9d132a5089a70a12feb73c4be987da8 | Add mtnpatch.py, a script to parse and import a full monotone diff | contrib/mtnpatch.py | contrib/mtnpatch.py | #!/usr/bin/env python
import sys, os, string, getopt
mtncmd = "monotone"
def main(argv = None):
if argv is None:
argv = sys.argv
opts, list = getopt.getopt(sys.argv[1:], ':R')
if len(list) < 1:
print "You must specify a file"
return 2
reverse = False
for o, a in opts:
... | Python | 0 | |
4430b1957b642e87cd263455e371bf1d634101b0 | Add buildone command | cerbero/commands/buildone.py | cerbero/commands/buildone.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | Python | 0.000005 | |
6244e0b40d847687b7ff875a48fb08060efc97bf | Solve Within PyCharm | Newsolver.py | Newsolver.py | from __future__ import division
from pyomo.environ import *
from pyomo.opt import SolverFactory
model = AbstractModel()
model.M = Set()
model.N = Set()
model.n = Param()
model.c = Param(model.M, model.N)
model.x = Var(model.M, model.N, domain=Binary)
model.u = Var(model.M, domain=NonNegativeIntegers)... | Python | 0.000039 | |
00f766b24865e8010411105794f20bc0ef39a6dc | Add py-sphinxcontrib-devhelp package (#13278) | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/package.py | # Copyright 2013-2019 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 PySphinxcontribDevhelp(PythonPackage):
"""sphinxcontrib-devhelp is a sphinx extension whic... | Python | 0 | |
fe14781a46a60a4fdd0101468ae487a691a2154a | Add ontap_command.py Module (#44190) | lib/ansible/modules/storage/netapp/na_ontap_command.py | lib/ansible/modules/storage/netapp/na_ontap_command.py | #!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | Python | 0 | |
295afe540c24ded86353402d87c42e072f7a64fa | Initialize makePublicPrivateKeys | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | # Public Key Generator
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, os, primeNum, cryptomath
def main():
# Create a public/private keypair with 1024-bit keys:
print('Making key files...')
makeKeyFiles('al_sweigart', 1024)
print('Key files made.')
def generateKey(keySi... | Python | 0.000004 | |
3e97731449027e5ac0d3a047e1b872956feac528 | Create cracking-the-safe.py | Python/cracking-the-safe.py | Python/cracking-the-safe.py | # Time: O(k^n)
# Space: O(k^n)
# There is a box protected by a password.
# The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1.
#
# You can keep inputting the password,
# the password will automatically be matched against the last n digits entered.
#
# For example, assuming the... | Python | 0.000004 | |
9c2487ab2c3b8d12e5a5f0f179b2a1fd79496b17 | add tests | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | from portality import models
from portality import constants
from portality.bll import exceptions
from doajtest.helpers import DoajTestCase
from doajtest.fixtures import ApplicationFixtureFactory
import time
from portality.events.consumers.application_publisher_inprogress_notify import ApplicationPublisherInprogresNot... | Python | 0 | |
73ae4839941b802870eaba29b67c8b8a89e43c71 | add backend_service_migration script to call the migration handler | backend_service_migration.py | backend_service_migration.py | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0.000001 | |
a1b88f50edf9f30f3840c50067545f2d315596aa | create compare.py | part-1/compare.py | part-1/compare.py | # coding: utf8
print '''
CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison are ordered by their address.
>>> 5 < 'foo' # <type 'int'> < <type 'str'>
True
>>> 5 < (1, 2)
True
>>> 5 < {}
True
... | Python | 0.000001 | |
696960eba9da48a8eb4830f464ccacb792e0c435 | Get the list of entities found by the name given in input | sara_flexbe_states/src/sara_flexbe_states/List_Entities_By_Name.py | sara_flexbe_states/src/sara_flexbe_states/List_Entities_By_Name.py | #!/usr/bin/env python
from flexbe_core.proxy import ProxySubscriberCached
from flexbe_core import EventState, Logger
from sara_msgs.msg import Entities
from geometry_msgs.msg import Pose
from tf.transformations import euler_from_quaternion
import math
class list_found_entities(EventState):
'''
will list... | Python | 0.999836 | |
c7c4a3c68e4950049db4b113576cfa3b2f6748f5 | add test data | corehq/apps/reports/tests/data/case_list_report_data.py | corehq/apps/reports/tests/data/case_list_report_data.py | dummy_user_list = [
{
'domain': 'case-list-test',
'username': 'active-worker-1',
'password': 'Some secret Pass',
'created_by': None,
'created_via': None,
'email': 'activeworker@commcarehq.com',
'uuid': 'active1',
'is_active': True,
'doc_type': ... | Python | 0.000006 | |
3f24e7b51281031fa9713b737a9647b305105a89 | Write unittest for parse_file() in ConfigReader.py | src/unittests.py | src/unittests.py | from ConfigReader import ConfigReader as cr
import unittest
import os
class testConfigReader(unittest.TestCase):
"""Test cases for configReader"""
def setUp(self):
"""Set up some important variables"""
self.example_config_filename = 'testConfig.config'
# Set some values
... | Python | 0.000001 | |
bbd6e538ec45c3650b7b3b7d520613fb4967236a | Print 4x4 grid | python/reddit/think_python_grid.py | python/reddit/think_python_grid.py | def grid():
delimiter_row = ('{}{}'.format('+ ', '- ' * 4) * 4) + '+'
openspace_row = ('{}{}'.format('|', ' ' * 9) * 4) + '|'
for box_row in range(4 * 4):
if box_row % 4 == 0:
print(delimiter_row)
print(openspace_row)
else:
print(openspace_row)
print(d... | Python | 0.000017 | |
6e535a2d597f172d9342fb8a547335890c474b49 | Add a sample config file | src/config-sample.py | src/config-sample.py | FLASK_SECRET_KEY = 'Enter a Flask Secret Key'
# OAuth Credentials. You can find them on
# https://www.yelp.com/developers/v3/manage_app
YELP_CLIENT_ID = 'Enter Yelp Client ID'
YELP_CLIENT_SECRET = 'Enter Yelp Client Secret'
| Python | 0.000001 | |
7b545e210aa534b5d76e30769a125285cb40bfa8 | Create PrintFunctionBancorFormula.py | solidity/python/constants/PrintFunctionBancorFormula.py | solidity/python/constants/PrintFunctionBancorFormula.py | from math import factorial
MIN_PRECISION = 32
MAX_PRECISION = 127
NUM_OF_PRECISIONS = 128
NUM_OF_COEFS = 34
maxFactorial = factorial(NUM_OF_COEFS)
coefficients = [maxFactorial/factorial(i) for i in range(NUM_OF_COEFS)]
def fixedExpUnsafe(x,precision):
xi = x
res = safeMul(coefficients[0],1 << precision)
... | Python | 0.000001 | |
8b0130ccb318f7f04daf8e8fa7532c88afb9f7c2 | convert eexec doctests into eexec_test.py | Tests/misc/eexec_test.py | Tests/misc/eexec_test.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.eexec import decrypt, encrypt
def test_decrypt():
testStr = b"\0\0asdadads asds\265"
decryptedStr, R = decrypt(testStr, 12321)
assert decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\... | Python | 0.000319 | |
9ea8b1ea9eaf7906abaf9cfe73bbe19b581fa562 | Add TVA. | inspectors/tva.py | inspectors/tva.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://oig.tva.gov
# Oldest report: 1998
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
AUDIT... | Python | 0.000001 | |
6515e45e6d717ed2c84789a5d0941533465496b7 | update test | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | from builtins import zip
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def insert_missing():
# Connect to a pre-existing cluster
data = [[1, 2, 3, 1, 'a', 1, 9],
[1, 6, 4, 2, 'a', 1, 9],
[2, 3, 8, 6, 'b', 1, 9],
... | from builtins import zip
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def insert_missing():
# Connect to a pre-existing cluster
data = [[1, 2, 3, 1, 'a', 1, 9],
[1, 6, 4, 2, 'a', 1, 9],
[2, 3, 8, 6, 'b', 1, 9],
... | Python | 0.000001 |
1de77375a12e26693c89f5fe824df82719bc8632 | Add dummy directory | jacquard/directory/dummy.py | jacquard/directory/dummy.py | from .base import Directory
class DummyDirectory(Directory):
def __init__(self, users=()):
self.users = {x.id: x for x in users}
def lookup(self, user_id):
return self.users[user_id]
def all_users(self):
return self.users.values()
| Python | 0.000001 | |
90eda86a7bbd1dc28023a6c5df1f964add3ddf55 | add client test for oaipmh endpoint. | test/oaipmh_client_test.py | test/oaipmh_client_test.py | import requests
from lxml import etree
NS = "{http://www.openarchives.org/OAI/2.0/}"
JOURNAL_BASE_URL = "http://localhost:5004/oai"
ARTICLE_BASE_URL = "http://localhost:5004/oai.article"
def harvest(base_url, resToken=None):
url = base_url + "?verb=ListRecords"
if resToken is not None:
url += "&resum... | Python | 0 | |
294f8721799f6562b7d7f3f31a68f25cb24c964f | Add Spanish Código Cuenta Corriente (CCC) | stdnum/es/ccc.py | stdnum/es/ccc.py | # ccc.py - functions for handling Spanish CCC bank account code
# coding: utf-8
#
# Copyright (C) 2016 David García Garzón
# Copyright (C) 2016 Arthur de Jong
#
# 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... | Python | 0.99999 | |
cb18bcb02b86c185d946f9bf74d3e846fff7205c | fix error message | src/python/importer.py | src/python/importer.py | # Copyright (c) 2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of... | # Copyright (c) 2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of... | Python | 0.000002 |
0ba3dff1e150d534e4eda086ebbd53ec3789d82c | Add alg_balance_symbols.py | alg_max_connected_colors.py | alg_max_connected_colors.py | def max_connected_colors():
pass
def main():
# A grid of connected colors: 5 (of 2's).
grid = [[1, 1, 2, 3],
[1, 2, 3, 2],
[3, 2, 2, 2]]
if __init__ == '__main__':
main()
| Python | 0.00058 | |
ce6052ee9df9ca83ac2da691eb51a8eaea0ab603 | Comment model migration | comments/migrations/0001_initial.py | comments/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-10 22:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('blog', ... | Python | 0.000001 | |
74260fbf266628d4f8afbbab61bbd6de0ddfe7fe | Remove unused constant | dragonflow/neutron/common/constants.py | dragonflow/neutron/common/constants.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
# d... | # 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
# d... | Python | 0.000247 |
22298d91fff788c37395cdad9245b3e7ed20cfdf | Add a snippet (Python OpenCV). | python/opencv/opencv_2/images/display_image_with_matplotlib.py | python/opencv/opencv_2/images/display_image_with_matplotlib.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Display image: display an image given in arguments
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/... | Python | 0.000018 | |
ba9e4c6b003cc002e5bc7216da960e47f9fe5424 | Print information about all nitrogens. | copper_imidazole_csv_allnitrogen.py | copper_imidazole_csv_allnitrogen.py | #!/usr/bin/env python2
import orca_parser
from copper_imidazole_analysis import CopperImidazoleAnalysis
import argparse
import csv
cia = CopperImidazoleAnalysis()
parser = argparse.ArgumentParser(description="Given pathnames of ORCA output files, make a dump of all nitrogen parameters to a CSV file.")
parser.add_ar... | Python | 0 | |
eb0772fc6c30d98b83bf1c8e7d83af21066ae45b | Add peek method and implementation | data_structures/Stack/Python/Stack.py | data_structures/Stack/Python/Stack.py | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | Python | 0 |
825c4d613915d43aea2e6ee0bc5d5b49ed0a4500 | Create a simple method to segment a trip into sections | emission/analysis/classification/segmentation/section_segmentation.py | emission/analysis/classification/segmentation/section_segmentation.py | # Standard imports
import attrdict as ad
import numpy as np
import datetime as pydt
# Our imports
import emission.analysis.classification.cleaning.location_smoothing as ls
import emission.analysis.point_features as pf
import emission.storage.decorations.location_queries as lq
def segment_into_sections(trip):
poin... | Python | 0 | |
5f2cd26054adff5a1fbf9ba5d56766b972f46670 | Add a multithreaded stress tester for key generation. Hopefully provides additional confidence that that code is correct with respect to threading. | leakcheck/thread-key-gen.py | leakcheck/thread-key-gen.py | # Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
#
# Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and
# older held the GIL during these operations. Subsequent versions release it
# during them.
from threading import Thread
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, PKe... | Python | 0 | |
c87be0f98295d64addc01529999996b566c80f2c | add sent notification status | migrations/versions/00xx_add_sent_notification_status.py | migrations/versions/00xx_add_sent_notification_status.py | """empty message
Revision ID: 00xx_add_sent_notification_status
Revises: 0075_create_rates_table
Create Date: 2017-04-24 16:55:20.731069
"""
# revision identifiers, used by Alembic.
revision = '00xx_sent_notification_status'
down_revision = '0075_create_rates_table'
from alembic import op
import sqlalchemy as sa
e... | Python | 0 | |
44526603b2ab388fceb99de625f3282c4a2a8d99 | write the test with the proper constants | tests/modules/test_math.py | tests/modules/test_math.py | import math
from ..base import BaseTopazTest
class TestMath(BaseTopazTest):
def assert_float_equal(self, result, expected, eps=1e-15):
assert abs(result - expected) < eps
def test_domain_error(self, space):
space.execute("Math::DomainError")
def test_pi(self, space):
w_res = spa... | import math
from ..base import BaseTopazTest
class TestMath(BaseTopazTest):
def assert_float_equal(self, result, expected, eps=1e-15):
assert abs(result - expected) < eps
def test_domain_error(self, space):
space.execute("Math::DomainError")
def test_pi(self, space):
w_res = spa... | Python | 0 |
7597e834288c21065703bcdc86530a0ad5414a95 | backup strategy tasks | nodeconductor/backup/tasks.py | nodeconductor/backup/tasks.py | from celery import shared_task
@shared_task
def backup_task(backupable_instance):
backupable_instance.get_backup_strategy.backup()
@shared_task
def restore_task(backupable_instance):
backupable_instance.get_backup_strategy.restore()
@shared_task
def delete_task(backupable_instance):
backupable_instanc... | Python | 0.000002 | |
4820013e207947fe7ff94777cd8dcf1ed474eab1 | Add migration for account lockout fields on User | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | """Add account lockout fields to User
Revision ID: fb6a6554b21
Revises: 1f9b411bf6df
Create Date: 2015-10-29 01:07:27.930095
"""
# revision identifiers, used by Alembic.
revision = 'fb6a6554b21'
down_revision = '1f9b411bf6df'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gene... | Python | 0 | |
cee7f23df93f4a09550348e30709aa1e6e6969fc | use net ip availability api def from neutron-lib | neutron/extensions/network_ip_availability.py | neutron/extensions/network_ip_availability.py | # Copyright 2016 GoDaddy.
#
# 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,... | # Copyright 2016 GoDaddy.
#
# 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,... | Python | 0.000003 |
6fabbe85bb74788641897daf8b162eac3d47b0aa | Add script for downloading Indonesia price data | data_crunching/indonesia_timeseries/download_indonesia_prices.py | data_crunching/indonesia_timeseries/download_indonesia_prices.py | #!/usr/bin/env python2
import urllib2
import shutil
import re
import sys
import datetime
from lxml import etree
usage_str = """
This scripts downloads daily food prices from http://m.pip.kementan.org/index.php (Indonesia).
Provide date in DD/MM/YYYY format.
Example:
./download_indonesia_prices.py 15/03/2013
""... | Python | 0 | |
4fdf2c32bcd937ba2fc21dbaad8a81620c02fb17 | Fix part of #5134: Add test for core.storage.config.gae_models (#5565) | core/storage/config/gae_models_test.py | core/storage/config/gae_models_test.py | # coding: utf-8
#
# Copyright 2018 The Oppia Authors. 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 requi... | Python | 0.000001 | |
65969d0251dc5031328132cf2043f1f76ee90d72 | Include the demo as a separate file | demo.py | demo.py |
import sys, curses
from cwidgets import *
from cwidgets import _LOG
def demo(window):
# Create the root of the widget hierarchy.
root = WidgetRoot(window)
# Wrap the UI in a Viewport to avoid crashes at small resolutions.
vp = root.add(Viewport())
# Push the UI together to avoid spreading everyti... | Python | 0 | |
3968c53c4577b2efe9ef3cd2de76b688a26517d9 | Add gpio example | chapter2/gpio.py | chapter2/gpio.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.OUT)
GPIO.output(5, GPIO.HIGH)
GPIO.output(5, GPIO.LOW)
| Python | 0.000001 | |
dc0bb07da52fd11a7980b9f36c38fcdb7f9c6ba5 | Add `edit.py` to be able to edit a view asynchronously | edit.py | edit.py | # edit.py
# buffer editing for both ST2 and ST3 that "just works"
import sublime
import sublime_plugin
from collections import defaultdict
try:
sublime.edit_storage
except AttributeError:
sublime.edit_storage = {}
class EditStep:
def __init__(self, cmd, *args):
self.cmd = cmd
self.args = ... | Python | 0.000001 | |
a795d94a9c885b97ab5bffc313524ae46626d556 | Add simple function-size analysis tool. | tools/analyze_code_size.py | tools/analyze_code_size.py |
import os
import re
import sys
import optparse
MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS"
MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS"
FUNCTION_CODE_RE = re.compile(
r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))"
)
def analyze_code_size(fileobj, opts):
funcs = {}
name_re = Non... | Python | 0 | |
2ce7bcdd6606cb1590febf6430a7635462b09d74 | fix #61: prefer configuration files under script dir | lixian_config.py | lixian_config.py |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
import sys
local_path = os.path.join(sys.path[0], filename)
if os.path.exists(local_path):
return local_path
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') o... |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') or user_home
return os.path.join(lixian_home, filename)
LIXIAN_DEFAULT_CONFIG = get_config_path('.xunlei.lixian.c... | Python | 0 |
b0b304e58b964ef87c61a3b258b1b7a675e217f2 | Add a copy of our Trac integration (with example constants) to the API examples | api/examples/humbug_trac.py | api/examples/humbug_trac.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2012 Humbug, Inc.
#
# 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 ... | Python | 0 | |
2ba9fb77ddcf1a5cc8b923ab46e50c4b17c36447 | add readme update tool | hiho.py | hiho.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import codecs
import sys
import argparse
class Entry:
URL = r'http://hihocoder.com/problemset/problem/'
def __init__(self, name=None, number=0):
self.name = name
self.number = number
def parse(self, line):
m = re.match(r'\|.*... | Python | 0 | |
dfe2bd52fd2e561a79c91d4ff34fbead8a26c1c3 | Create init.py | init.py | init.py | #!/usr/bin/env python
import sys
import os
import psycopg2
def dump_table(table_name, conn):
query = "SELECT * FROM "+table_name+" LIMIT 1"
cur = conn.cursor()
cur.execute(query)
rows = cur.fetchall()
description = cur.description
columns = "'INSERT INTO "+table_name+" VALUES ('"
for desc i... | Python | 0.000001 | |
bfaeeec3f5f5582822e2918491090815a606ba44 | Add test to make sure imports and __all__ matches | test/test_api.py | test/test_api.py | # -*- coding: utf-8 -*-
import warthog.api
def test_public_exports():
exports = set([item for item in dir(warthog.api) if not item.startswith('_')])
declared = set(warthog.api.__all__)
assert exports == declared, 'Exports and __all__ members should match'
| Python | 0.000037 | |
48857638694ceca08c64d7b9c6825e2178c53279 | Add function decorator to improve functools.wraps | pylearn2/utils/doc.py | pylearn2/utils/doc.py | """
Documentation-related helper classes/functions
"""
class soft_wraps:
"""
A Python decorator which concatenates two functions' docstrings: one
function is defined at initialization and the other one is defined when
soft_wraps is called.
This helps reduce the ammount of documentation to write: ... | Python | 0.000001 | |
dfca9c3d7dbbe97516a24bea89b917f7282c7dc7 | Add problem rotate image | python/rotateImage.py | python/rotateImage.py | # https://leetcode.com/problems/rotate-image/
class Solution(object):
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
size = len(matrix)
for i in xrange(0, size/2):
for j... | Python | 0.000003 | |
cce6a4c2efe62c267b04f6ce75019d577428e2c9 | add sensu_check_dict module | library/sensu_check_dict.py | library/sensu_check_dict.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014, Blue Box Group, Inc.
# Copyright 2014, Craig Tracey <craigtracey@gmail.com>
# Copyright 2016, Paul Czarkowski <pczarkow@us.ibm.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | Python | 0.000001 | |
5dfa0e6333403c1082be0d276f9775c55ba0e74e | add settings | net1/settings.py | net1/settings.py | import astrometry.net1.secrets.django_db as secrets
#GMAPS_API_KEY = 'ABQIAAAA7dWWcc9pB-GTzZE7CvT6SRTpFHQyuc9zMeXV0wfLqFiAr83b_xQ02hHbHnV4CjuIf4L-3WI_XATmBQ'
# edge.astrometry.net
#GMAPS_API_KEY = 'ABQIAAAA7dWWcc9pB-GTzZE7CvT6SRRd6OZDG7afgOT-qBD56qXrD_4sXBRoWqZoA0bluUpwPo-gQuBqRm5Tug'
# oven.cosmo.fas.nyu.edu
GMAPS_A... | Python | 0 | |
577b84cf124a35b49311e39ab4d40ef0f8af59ed | introduce proso.analysis module | proso/analysis.py | proso/analysis.py | import json
import hashlib
import os
def get_experiment_data(name, compute_fun, cache_dir, cached=True, **kwargs):
kwargs_hash = hashlib.sha1(json.dumps(kwargs, sort_keys=True)).hexdigest()
filename = '{}/{}.json'.format(cache_dir, name);
if cached and os.path.exists(filename):
with open(filename,... | Python | 0 | |
45cb940db74d99b0dac31a2aace3d8505e4a9046 | Add empty file to contain main part of module | datac/main.py | datac/main.py | # -*- coding: utf-8 -*-
import copy
| Python | 0.000001 | |
323fb80744e63a322fe5ed70d86130aa61aa3c19 | Remove unused imports | examples/manifold/plot_swissroll.py | examples/manifold/plot_swissroll.py | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD, (C) INRIA 2011
print __doc__
import pylab as pl
#-----------... | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD, (C) INRIA 2011
print __doc__
import numpy as np
import pylab a... | Python | 0 |
e8c75e84a158876e71a926bec244af43ad93cbc4 | add imu class | imu.py | imu.py | import serial
import math
import struct
class IMU:
"""Class for working with a Microstrain IMU"""
def __init__(self):
self.IMU_PORT = '/dev/ttyS0'
self.IMU_BAUD = 115200
self.CMD_ACCEL_ANG_ORIENT = '\xC8'
self.CMD_ACCEL_ANG_ORIENT_SIZE = 67
self.IMU_COMMAND = self.CMD_ACCEL_ANG_ORIENT
self... | Python | 0.000001 | |
fb37af691d63ab8a43d50701d6b1f8ae027e2e1b | Create dfirwizard.py | dfirwizard.py | dfirwizard.py | #!/usr/bin/python
# Sample program or step 1 in becoming a DFIR Wizard!
# No license as this code is simple and free!
import sys
import pytsk3
imagefile = "Stage2.vhd"
imagehandle = pytsk3.Img_Info(imagefile)
partitionTable = pytsk3.Volume_Info(imagehandle)
for partition in partitionTable:
print partition.addr, parti... | Python | 0 | |
ac83a8bbef2c61021c39c77ef3c14675383edc62 | Fix a typo. | packs/st2/actions/lib/action.py | packs/st2/actions/lib/action.py | from st2actions.runners.pythonrunner import Action
from st2client.client import Client
from st2client.models.keyvalue import KeyValuePair # pylint: disable=no-name-in-module
from lib.utils import filter_none_values
__all__ = [
'St2BaseAction'
]
class St2BaseAction(Action):
def __init__(self, config):
... | from st2actions.runners.pythonrunner import Action
from st2client.client import Client
from st2client.models.datastore import KeyValuePair # pylint: disable=no-name-in-module
from lib.utils import filter_none_values
__all__ = [
'St2BaseAction'
]
class St2BaseAction(Action):
def __init__(self, config):
... | Python | 0.999957 |
7ff614950163b1fb6a8fe0fef5b8de9bfa3a9d85 | Add a test for the hard-coded re() partial frac form | transmutagen/tests/test_partialfrac.py | transmutagen/tests/test_partialfrac.py | from sympy import together, expand_complex, re, im, symbols
from ..partialfrac import t
def test_re_form():
theta, alpha = symbols('theta, alpha')
# Check that this doesn't change
re_form = together(expand_complex(re(alpha/(t - theta))))
assert re_form == (t*re(alpha) - re(alpha)*re(theta) -
... | Python | 0.000035 | |
352e2d053b8880e1e1a951be4338c188fee925d1 | order book testing first iteration | orderbooktest.py | orderbooktest.py | import time
try:
import ujson as json
except ImportError:
import json
from orderbook.book import Book
def dict_compare(new_dictionary, old_dictionary, price_map=False, order_map=False):
d1_keys = set(new_dictionary.keys())
d2_keys = set(old_dictionary.keys())
intersect_keys = d1_keys.intersection... | Python | 0 | |
7522ffb9f6934de02d5d326d5f798d42a2da800d | add script to find old experimental apis | pdfium/find_old_experimental.py | pdfium/find_old_experimental.py | #!/usr/bin/env python3
#
# Copyright 2019 Miklos Vajna. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""Finds my old + experimental APIs."""
import subprocess
import time
def main() -> None:
"""Commandline interface to this module."""... | Python | 0 | |
05dd8bdfeab63b3096e8f7d98032088133d1f0e5 | Add function provider to get osm data | campaign_manager/provider.py | campaign_manager/provider.py | import json
import hashlib
import os
from reporter import config
from reporter.utilities import (
split_bbox,
)
from reporter.osm import (
load_osm_document
)
from urllib.parse import quote
from reporter.queries import TAG_MAPPING, OVERPASS_QUERY_MAP
def get_osm_data(bbox, feature):
"""Get osm data.
... | Python | 0 | |
9305f158b71f65923ee37de2805324db362e0db6 | Add DRF LocalDateTimeField | arcutils/drf/serializers.py | arcutils/drf/serializers.py | from django.utils import timezone
from rest_framework import serializers
class LocalDateTimeField(serializers.DateTimeField):
"""Converts datetime to local time before serialization."""
def to_representation(self, value):
value = timezone.localtime(value)
return super().to_representation(va... | Python | 0 | |
3f9aae149dba5c9b68ff6f7fd83cadf3fd6b1d7d | Add automorphic number implementation (#7978) | maths/automorphic_number.py | maths/automorphic_number.py | """
== Automorphic Numbers ==
A number n is said to be a Automorphic number if
the square of n "ends" in the same digits as n itself.
Examples of Automorphic Numbers: 0, 1, 5, 6, 25, 76, 376, 625, 9376, 90625, ...
https://en.wikipedia.org/wiki/Automorphic_number
"""
# Author : Akshay Dubey (https://github.com/itsAksh... | Python | 0 | |
34391723f44c81ceab77fd3200ee34c9f1b2d4b2 | add plugin factory | pilot/common/pluginfactory.py | pilot/common/pluginfactory.py | #!/usr/bin/env python
# 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
#
# Authors:
# - Wen Guan, wen.guan@cern.ch, 2018
import logging
logger = lo... | Python | 0 | |
9f016a58a98ba89b9feae68dd01e752d75a628ec | Update test_client.py | tests/test_client.py | tests/test_client.py | import pytest
from mock import patch, Mock
from plaid import Client, require_access_token
def test_require_access_token_decorator():
class TestClass(object):
access_token = 'foo'
@require_access_token
def some_func(self):
return True
obj = TestClass()
obj.some_func()... | import pytest
from mock import patch, Mock
from plaid import Client, require_access_token
def test_require_access_token_decorator():
class TestClass(object):
access_token = 'foo'
@require_access_token
def some_func(self):
return True
obj = TestClass()
obj.some_func()... | Python | 0.000002 |
9346ca997d723cbfedf383eb78db2f62552f8a7c | Fix empty image list test. | tests/test_comics.py | tests/test_comics.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
import tempfile
import shutil
from itertools import islice
from unittest import TestCase
from dosagelib import scraper
class _ComicTester(TestCase):
"""Basic comic test class."""
... | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
import tempfile
import shutil
from itertools import islice
from unittest import TestCase
from dosagelib import scraper
class _ComicTester(TestCase):
"""Basic comic test class."""
... | Python | 0.000076 |
dad70b067c1afcd44a37c30d21c0e6a35e12ce68 | Add boostrap script for buildout | bootstrap.py | bootstrap.py | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | Python | 0 | |
acd33bdffb3302d2130505873a062fae39dcd976 | Add WikiText103 and WikiText2 Mocked Unit Tests (#1592) | test/datasets/test_wikitexts.py | test/datasets/test_wikitexts.py | import os
import random
import string
import zipfile
from collections import defaultdict
from unittest.mock import patch
from ..common.parameterized_utils import nested_params
from torchtext.datasets.wikitext103 import WikiText103
from torchtext.datasets.wikitext2 import WikiText2
from ..common.case_utils import Temp... | Python | 0 | |
61cd24aef4c9c8ef72527e75991c23873892ec3b | Change listener module file | platform/listener/__init__.py | platform/listener/__init__.py | '''
Module to handle data synchronization with contacts.
'''
| Python | 0.000001 | |
18378b201cae7e23889031044fa6ddbaf50946c5 | check langauge detecting for lett files where we know the expetected language from the URL | baseline/check_lett_lang.py | baseline/check_lett_lang.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
doc2lang = {}
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('referencepairs', type=argparse.FileType('r'))
parser.add_argument('-slang', help='Source language', default='en')
par... | Python | 0 | |
1bbfb6fe5080de9326bd7a35afe893bf59744bdf | add ASGI plugin/middleware tests. | honeybadger/tests/contrib/test_asgi.py | honeybadger/tests/contrib/test_asgi.py | import pprint
import unittest
from async_asgi_testclient import TestClient
import aiounittest
import mock
from honeybadger import contrib
class SomeError(Exception):
pass
def asgi_app():
"""Example ASGI App."""
async def app(scope, receive, send):
if "error" in scope["path"]:
raise Som... | Python | 0 | |
10dd7a4a70fe639b806e004bc0a0d6fb791279a3 | Add a utility script: | utils/misc/grep-svn-log.py | utils/misc/grep-svn-log.py | #!/usr/bin/env python
"""
Greps and returns the first svn log entry containing a line matching the regular
expression pattern passed as the only arg.
Example:
svn log -v | grep-svn-log.py '^ D.+why_are_you_missing.h$'
"""
import fileinput, re, sys, StringIO
# Separator string for "svn log -v" output.
separator =... | Python | 0.000301 | |
8dc7a1e239dc22dd4eb69cfe1754586e3a1690dc | Test javascript using the "js" | tests/test_run_js.py | tests/test_run_js.py | import os
from py2js import JavaScript
def f(x):
return x
def test(func, run):
func_source = str(JavaScript(func))
run_file = "/tmp/run.js"
with open(run_file, "w") as f:
f.write(func_source)
f.write("\n")
f.write(run)
r = os.system('js -f defs.js -f %s' % run_file)
as... | Python | 0 | |
bbed1fc6d144571f5cb69d1c1a54904857646d74 | Create redis-graphite.py | redis-graphite.py | redis-graphite.py | """
Redis Graphite Publisher
~~~~~~~~~~~~~~~~~~~~~~~~
Publishes stats from a redis server to a carbon server.
These stats include:
- Generic server stats (INFO command)
- Length of lists (useful for monitoring queues)
Requires redis and statsd:
https://pypi.python.org/pypi/redis
E... | Python | 0.000002 | |
dee49a5e023907d77e2598560d25480bc7f56e34 | Add k40 batch script | examples/offline_analysis/qk40calib.py | examples/offline_analysis/qk40calib.py | """
================================
K40 Calibration Batch Processing
================================
Standalone job submitter for K40 offline calibrations with KM3Pipe.
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: qk40calib.py
# Author: Tamas Gal <tgal@km3net.de>
"""
Standalone job submitter for K4... | Python | 0 | |
e44bd0b5a5db15b99a06b7561b8146554b1419d2 | Add genesisbalance class #217 | bitshares/genesisbalance.py | bitshares/genesisbalance.py | # -*- coding: utf-8 -*-
from .account import Account
from .instance import BlockchainInstance
from graphenecommon.genesisbalance import (
GenesisBalance as GrapheneGenesisBalance,
GenesisBalances as GrapheneGenesisBalances,
)
from bitsharesbase.account import Address, PublicKey
from bitsharesbase import operat... | Python | 0 | |
3dd71c02ea1fa9e39054bd82bf9e8657ec77d6b9 | Add a script to recover the chat_id | tools/get_chat_id.py | tools/get_chat_id.py | #! /usr/bin/python3
# -*- coding:utf-8 -*-
# by antoine@2ohm.fr
import sys
import time
import telepot
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
print("\tchat_id: {}".format(chat_id))
if content_type == 'text' and msg['text'] == '/start':
ans = """
Hello <b>{first_na... | Python | 0 | |
e950a53b2a392014fbfd7b9827a9f3f0b12a377b | add connector test class | connectortest.py | connectortest.py | import unittest
import threading
import re
import message
import StringIO
from connector import Connector, AppConnector
import SocketServer
from threadserver import DetailServer
from datetime import datetime
from PIL import Image
class App:
def update_msg(self, txtmsg):
print txtmsg.get_body()
ret... | Python | 0 | |
f97868b89da50532413465250d84308b84276296 | add script | scripts/getliblist.py | scripts/getliblist.py | #!/usr/bin/env python
import sys
import os
def getlibs(invcf):
rgs = {}
with open(invcf, 'r') as vcf:
for line in vcf:
if not line.startswith('#'):
chrom, pos, id, ref, alt, qual, filter, info, format, sample = line.strip().split('\t')
for rg in sample.split... | Python | 0.000001 | |
fda7d76e4b10a1b43e3612742585d9abcc7b27da | Rename tags.py to search.py | tiddlywebplugins/tank/search.py | tiddlywebplugins/tank/search.py | """
Routines associated with finding and listing tags.
An experiment for now.
"""
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.policy import PermissionsError
from tiddlywebplugins.whoosher import get_searcher, query_parse
def list_tags(environ, start_response):
"""
Plain text list of tags in a c... | Python | 0.000003 | |
eac6545d0700d2a6c3de43db5ea8d46cfea12464 | Update link.py | link.py | link.py | from module import XMPPModule
import halutils
import re, requests
class Link(XMPPModule):
def handleMessage(self, msg):
obj = re.match('.*(http[s]?://.*)+', msg['body'])
if obj:
addr = obj.group(1)
webpage = requests.get(addr).content
title = re.match('.*... | Python | 0 | |
6dae3f3199b2828cef457b06b6a2aa50ae98cb55 | Add a convenient tool for sweeping over a bunch of configs. | tools/sweep_scene.py | tools/sweep_scene.py | #!/usr/bin/env python3
import sys
import os
import argparse
import json
import subprocess
import tempfile
import statistics
def compute_stddev(values):
stdev = 0.0 if len(values) <= 1 else statistics.stdev(values)
avg = statistics.mean(values)
return avg, stdev
def run_test(sweep, config, iterations, sta... | Python | 0 | |
c29e430301dc854dc7bd83ebc2a588cea70589a6 | Fix has_perm issue in get_project_list | sentry/web/helpers.py | sentry/web/helpers.py | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponse
from django.template ... | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponse
from django.template ... | Python | 0 |
1510a0faeff91f6f6ed7a1c5929628d430cb0506 | Update file identification tools | fpr/migrations/0010_update_fido_136.py | fpr/migrations/0010_update_fido_136.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def data_migration(apps, schema_editor):
IDTool = apps.get_model('fpr', 'IDTool')
IDTool.objects.filter(description='Fido', version='1.3.5').update(version='1.3.6')
IDTool.objects.filter(description='... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.