commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
ce3a5186c8522cb0e8a2f3aa5e843846bb7f4e27 | Remove whitespace from the beginning and the end of the string | kumarisneha/practice_repo | techgig_strip.py | techgig_strip.py | def main():
a=raw_input()
print a.strip()
main()
| mit | Python | |
ac85219bec0eea5619ebec802e74382399b0f87c | Add a VERY simple redis returner | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/returners/redis.py | salt/returners/redis.py | '''
Return data to a redis server
This is a VERY simple example for pushing data to a redis server and is not
nessisarily intended as a usable interface.
'''
import redis
__opts__ = {
'redis.host': 'mcp',
'redis.port': 6379,
'redis.db': '0',
}
def returner(ret):
'''... | apache-2.0 | Python | |
dfdaac63df7e4d8b381215fafd1f88c2af4781f2 | Update __openerp__.py | slevenhagen/odoomrp-wip-npg,diagramsoftware/odoomrp-wip,esthermm/odoomrp-wip,oihane/odoomrp-wip,ddico/odoomrp-wip,windedge/odoomrp-wip,michaeljohn32/odoomrp-wip,agaldona/odoomrp-wip-1,maljac/odoomrp-wip,diagramsoftware/odoomrp-wip,sergiocorato/odoomrp-wip,Endika/odoomrp-wip,dvitme/odoomrp-wip,StefanRijnhart/odoomrp-wip... | sale_product_variants_types/__openerp__.py | sale_product_variants_types/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program 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... | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program 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... | agpl-3.0 | Python |
8275a7ccecfcb100b1575737944bde35f64949e9 | Add test for search in varaints query | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/graphql/product/tests/test_variant_with_filtering.py | saleor/graphql/product/tests/test_variant_with_filtering.py | from decimal import Decimal
import pytest
from ....product.models import Product, ProductVariant
from ...tests.utils import get_graphql_content
QUERY_VARIANTS_FILTER = """
query variants($filter: ProductVariantFilterInput){
productVariants(first:10, filter: $filter){
edges{
node{
... | bsd-3-clause | Python | |
96bbf25be25482a7edfd92ec9b956b0bbeab39c4 | Add a basic summary query implementation | agdsn/traffic-service-client,agdsn/traffic-service-client | src/traffic/__init__.py | src/traffic/__init__.py | from datetime import datetime
import zmq
from messages import common_pb2, replies_pb2, requests_pb2
class Connection(object):
def __init__(self, uri, context=None):
self._uri = uri
if context is None:
context = zmq.Context()
self._context = context
self._socket = self.... | bsd-3-clause | Python | |
e9f88f1c43189fe429730c488f4514bf78edea4e | Add python -m mistune cli | lepture/mistune | mistune/__main__.py | mistune/__main__.py | import sys
import argparse
from . import (
create_markdown,
__version__ as version
)
def _md(args):
if args.plugin:
plugins = args.plugin
else:
# default plugins
plugins = ['strikethrough', 'footnotes', 'table', 'speedup']
return create_markdown(
escape=args.escape,... | bsd-3-clause | Python | |
4af4d5d293d057bd12454200e7a1a72679c218a5 | Create zipatoconnection.py | johnbrannstrom/zipato-extension,johnbrannstrom/zipato-extension,johnbrannstrom/zipato-extension | src/zipatoconnection.py | src/zipatoconnection.py | import requests
class ZipatoConnection(Settings):
__init__(self, serial):
"""
Initializes a ZipatoConnection.
:param str serial: Zipato Box serial.
"""
self.serial = serial
def set_sensor_status(self, ep, apikey, status):
"""
Set status of a... | mit | Python | |
3e345bc4a17cf53c40ef51cd2ae1732744be7e60 | Add custom form for editing and updating of decks | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | cardbox/deck_forms.py | cardbox/deck_forms.py | from django.forms import ModelForm
from django.forms.widgets import Textarea, TextInput
from deck_model import Deck
class DeckForm(ModelForm):
"""The basic form for updating or editing decks"""
class Meta:
model = Deck
fields = ('title', 'description')
widgets = {
'title': ... | mit | Python | |
95d93518d664c9d8b095061bc854907c29f05623 | Add dummy keygen | ONSdigital/edcdi | tests/__init__.py | tests/__init__.py | from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, BestAvailableEncryption
import os
f4 = 65537
os.environ['EQ_PUBLIC_KEY'] = './jwt-test-keys/sr-pub... | mit | Python | |
fa8b40b8ebc088f087ff76c36068fea67dae0824 | Add management command for updating genome coordinate names using Ensembl-INSDC mapping | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/portal/management/commands/update_coordinate_names.py | rnacentral/portal/management/commands/update_coordinate_names.py | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 a... | apache-2.0 | Python | |
6418807dbba9fb946ffeb05aee525c51c2e71f75 | Fix fixture, add doc string | MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug | tests/fixtures.py | tests/fixtures.py | """Defines fixtures that can be used to streamline tests and / or define dependencies"""
from random import randint
import pytest
import hug
@pytest.fixture
def hug_api():
"""Defines a dependency for and then includes a uniquely identified hug API for a single test case"""
return hug.API('fake_api_{}'.forma... | mit | Python | |
6f9d04b3d894b4dc3178285f665342a249bbc17c | support script in python for bootstrapping erlang on a new erts | asceth/sinan,asceth/sinan | support/build.py | support/build.py | #! /bin/python
"""Support for building sinan, bootstraping it on a new version of erlang"""
import sys
import os
import commands
from optparse import OptionParser
class BuildError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
ERTS_VERSI... | mit | Python | |
47c1dfd602281c56973de0d8afe64b923eb29592 | Add unit tests for env module. | dmotles/ebcf-alexa | test/test_env.py | test/test_env.py | from _ebcf_alexa import env
from unittest.mock import patch, call
import pytest
@pytest.yield_fixture
def mock_now():
with patch.object(env, 'now') as now:
yield now
@patch('datetime.datetime')
def test_now_is_utc(fake_datetime):
assert env.now()
assert fake_datetime.now.call_args == call(tz=env... | mit | Python | |
c727cee4dc579f5fe09b54877118a681a2597c47 | add tests for log module | ungarj/mapchete,ungarj/mapchete | test/test_log.py | test/test_log.py | """Test for custom logging functions."""
import logging
from mapchete.log import user_process_logger, driver_logger
def test_user_process_logger():
logger = user_process_logger(__name__)
assert isinstance(logger, logging.Logger)
assert logger.name == "mapchete.user_process.test_log"
def test_driver_lo... | mit | Python | |
fc9e9b4b9bdee1bd1f6b112c90772702cf60ad2d | Add a unittest-based test suite for scenarios | zaneb/heat-convergence-prototype | test_converge.py | test_converge.py | #!/usr/bin/env python
import functools
import logging
import unittest
import converge
import converge.processes
from converge.framework import datastore
from converge.framework import scenario
def with_scenarios(TestCase):
loader = unittest.defaultTestLoader
def create_test_func(generic_test, params):
... | apache-2.0 | Python | |
f65c6f3939c50326eea14bd0dadc77b7c9364dd2 | Add a module to deal with credentials | sigmaris/python-gssapi,sigmaris/python-gssapi,sigmaris/python-gssapi,sigmaris/python-gssapi | gssapi/creds.py | gssapi/creds.py | from __future__ import absolute_import
from ctypes import cast, byref, c_char_p, c_void_p, string_at
from .gssapi_h import (
GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_BOTH,
GSS_S_COMPLETE,
OM_uint32, gss_cred_id_t,
gss_init_sec_context, gss_accept_sec_context, gss_d... | mit | Python | |
0c64ad7f93fc1183ac51be7f1e311659fa070594 | Add som tests for the DB module | ivoire/ReactOBus,ivoire/ReactOBus | tests/test_db.py | tests/test_db.py | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2016 Rémi Duraffort
# This file is part of ReactOBus.
#
# ReactOBus 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 License, ... | agpl-3.0 | Python | |
c88b95bd28b1ece65fc4631f73e95dac5b48f038 | Add new py-fixtures package (#14026) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-fixtures/package.py | var/spack/repos/builtin/packages/py-fixtures/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 PyFixtures(PythonPackage):
"""Fixtures, reusable state for writing clean tests and more.""... | lgpl-2.1 | Python | |
9692c1494e52238fdbc388ef5aba4ae551b46a88 | Create ohmycoins.py | Lavande/ohmycoins,Lavande/ohmycoins | ohmycoins.py | ohmycoins.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
#Put your Ether addresses here in the list
addresses = []
#Etherscan
def get_ether(address):
url = 'https://etherscan.io/address/' + address
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
... | mit | Python | |
2ad504a1a40e08aea3105642821190f9b928fab7 | create tags package | avelino/django-tags | tags/__init__.py | tags/__init__.py | VERSION = (0, 1, 0, 'dev', 1)
| mit | Python | |
a317e86e0faab308421588f649f6dd7ba65cd03b | Add rscommon/pickle_.py | rstebbing/common,rstebbing/common | rscommon/pickle_.py | rscommon/pickle_.py | ##########################################
# File: pickle_.py #
# Copyright Richard Stebbing 2014. #
# Distributed under the MIT License. #
# (See accompany file LICENSE or copy at #
# http://opensource.org/licenses/MIT) #
##########################################
# Imports
... | mit | Python | |
2a832e8a9a0881200756db5aa99650745c0ecc16 | rename to | beagleterm/beagle-term,beagleterm/beagle-term,RandomlyKnighted/beagle-term,RandomlyKnighted/beagle-term | tools/packing.py | tools/packing.py | #!/usr/bin/env python
import os
import shutil
import subprocess
from contextlib import contextmanager
@contextmanager
def pushd(path):
currentDir = os.getcwd()
os.chdir(path)
yield
os.chdir(currentDir)
def printInfo(message):
print os.path.basename(__file__) + ' >> ' + message
def installDependencies():
... | #!/usr/bin/env python
import os
import shutil
import subprocess
from contextlib import contextmanager
@contextmanager
def pushd(path):
currentDir = os.getcwd()
os.chdir(path)
yield
os.chdir(currentDir)
def printInfo(message):
print os.path.basename(__file__) + ' >> ' + message
def installDependencies():
... | bsd-3-clause | Python |
5bea29f6590adad3479a994dd141dd459350063c | add draft cryptogram analysis tool | amattheisen/crypto | cryptogram.py | cryptogram.py | #!/usr/bin/env python
"""Cryptogram.
Description:
This script statistically analyses a line of text to help solve a cryptogram
Author:
Andrew Mattheisen
Usage:
cryptogram.py <cyphertext>...
cryptogram.py (-h | --help)
cryptogram.py --version
Options:
-h --help Show this screen.
--version Show... | apache-2.0 | Python | |
0590adbbd9325c0d9a9595dfac62caae05dd43e0 | Add leetcode 061 solution | aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets | leetcode/061_rotate_list.py | leetcode/061_rotate_list.py | """ Rotate List
Given a linked list, rotate the list to the right by k places,
where k is non-negative.
Example 1:
Input: 1 -> 2 -> 3 -> 4 -> 5 -> NULL, k = 2
Output: 4 -> 5 -> 1 -> 2 -> 3 -> NULL
Explation:
rotate 1 steps to the right: 5 -> 1 -> 2 -> 3 -> 4 -> NULL
rotate 2 steps to the right: ... | mit | Python | |
8e8c14446a0089ee7fa57cfd5520c7d6d6e2711e | Add Python user customization file. | fossilet/dotfiles,fossilet/dotfiles,fossilet/dotfiles | usercustomize.py | usercustomize.py | """ Customize Python Interpreter.
Link your user customizing file to this file.
For more info see: https://docs.python.org/3/library/site.html
"Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and
non-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/site-packages
for Mac framework builds, and... | mit | Python | |
13be4749aef2415ab84ffbd090c5b24d8ed98af5 | Add test case of BloArticle class | 10nin/blo,10nin/blo | tests/TestBloArticle.py | tests/TestBloArticle.py | import unittest
from blo.BloArticle import BloArticle
class TestBloArticle(unittest.TestCase):
def setUp(self):
self.blo_article = BloArticle()
def test_failed_load_from_file(self):
file_path = ""
with self.assertRaises(FileNotFoundError):
self.blo_article.load_from_file(f... | mit | Python | |
4442fabf9292efa44a82f420e2d3e807d7d15b04 | Add more tests to cli | eiginn/passpie,eiginn/passpie,scorphus/passpie,scorphus/passpie,marcwebbie/passpie,marcwebbie/passpie | tests/test_cli.py | tests/test_cli.py | from click.testing import CliRunner
from tinydb import TinyDB, where
from tinydb.storages import MemoryStorage
import pytest
try:
import mock
except ImportError:
from unittest import mock
from passpie import cli
@pytest.fixture
def mock_db(mocker):
credentials = [
{'login': 'foo', 'name': 'bar', ... | mit | Python | |
b2e10a344a940ae2cce9656c435c7a6f4919a53b | add cli invoke tests | NLNOG/bgpfu,grizz/bgpfu,bgpfu/bgpfu | tests/test_cli.py | tests/test_cli.py |
import pytest
from click.testing import CliRunner
import bgpfu.cli
def test_cli_invoke():
runner = CliRunner()
res = runner.invoke(bgpfu.cli.cli, ['as_set'])
res = runner.invoke(bgpfu.cli.cli, ['prefixlist'])
res = runner.invoke(bgpfu.cli.cli, ['raw'])
| apache-2.0 | Python | |
c659f31cfb3eadd66838036ea285070f564fdced | Add rendering test | kmike/psd-tools,psd-tools/psd-tools,kmike/psd-tools | tests/test_rendering.py | tests/test_rendering.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pytest
from PIL.Image import Image
from psd_tools.user_api.psd_image import PSDImage, merge_layers
from tests.utils import decode_psd, full_name
CLIP_FILES = [
('clipping-mask.psd',),
('clipping-mask2.psd',)
]
@pytest.m... | mit | Python | |
436719050ada475d840004a49c693d08c3f92034 | Add a widget for line editors. | pnomolos/greatbigcrane,pnomolos/greatbigcrane | greatbigcrane/project/widgets.py | greatbigcrane/project/widgets.py | from django.forms.widgets import Textarea
from django.utils.safestring import mark_safe
class LineEditorWidget(Textarea):
class Media:
js = ('js/jquery-1.4.2.min.js' ,'js/jquery.lineeditor.js')
def render(self, name, value, attrs=None):
if isinstance(value,list):
value = "\n".join(... | apache-2.0 | Python | |
52d03e19bd61dcba56d1d7fc3944afcc6d9b6a8d | make nautilus use backspace for back | keithieopia/dotfiles,keithieopia/dotfiles | .local/share/nautilus-python/extensions/BackspaceBack.py | .local/share/nautilus-python/extensions/BackspaceBack.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# by Ricardo Lenz, 2016-jun
# riclc@hotmail.com
#
import os, gi
gi.require_version('Nautilus', '3.0')
from gi.repository import GObject, Nautilus, Gtk, Gio, GLib
def ok():
app = Gtk.Application.get_default()
app.set_accels_for_action( "win.up", ["BackSpace"] )
... | mit | Python | |
e778f67101a9ba8e38e249263d49738d3239f557 | test select prefix cursor | hardc0d3/sppy,hardc0d3/sppy,hardc0d3/sppy | test_p_cursor.py | test_p_cursor.py |
import sys
sys.path.append('./build/lib.linux-x86_64-2.7/')
from voidptr import VoidPtr as vp
import spapi as sp
env = vp("env")
ctl = vp("ctl")
db = vp("db")
o = vp("o")
t = vp("t")
print "env", sp.env(env)
print "env,ctl", sp.ctl(env,ctl)
print "ctl_set", sp.ctl_set(ctl,"sophia.path","./test_data")
print "ctl_s... | bsd-2-clause | Python | |
2a1777a74d6f2cba61485f281f0c048cbbdca727 | Add valgrind tests file. | CWSL/access-om | test_valgrind.py | test_valgrind.py |
from __future__ import print_function
import shutil
import os
from model_test_helper import ModelTestHelper
tests = {'om_360x300-valgrind' : ('om'),
'cm_360x300-valgrind' : ('cm')}
class TestValgrind(ModelTestHelper):
"""
Run the model in valgrind.
"""
def __init__(self):
super(Te... | apache-2.0 | Python | |
f9273e7b905bdc94f3e161b17225a11120810b26 | handle core serice by self-defined-class | leVirve/GooTool | google_service.py | google_service.py | import httplib2
import os
import oauth2client
from apiclient import discovery
from oauth2client import client, tools
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
class Gooooogle():
def __init__(self):
self.crede... | mit | Python | |
556530f4933b1323ef8e4414c324a0aa2d0b81bd | Add the example bundles. | juju/juju-gui-charm,juju/juju-gui-charm | tests/example.py | tests/example.py | # This file is part of the Juju GUI, which lets users view and manage Juju
# environments within a graphical interface (https://launchpad.net/juju-gui).
# Copyright (C) 2013 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public Lice... | agpl-3.0 | Python | |
1dec974693222864537b20b31ac33656bea92912 | add LogFactory | hezhiming/py3utils,hezhiming/py3utils | py3utils/_log.py | py3utils/_log.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# date: 2018/4/15
# author: he.zhiming
#
from __future__ import unicode_literals, absolute_import
import logging
import logging.config
from logging import handlers
class LogFactory:
_LOG_CONFIG_DICT = {
}
logging.config.dictConfig(_LOG_CONFIG... | mit | Python | |
6f9d02510ad861bf8ae5ad8f1ae335a4e565756d | Add initial unit tests for io module | PyCQA/isort,PyCQA/isort | tests/test_io.py | tests/test_io.py | from unittest.mock import MagicMock, patch
import pytest
from isort import io
class TestFile:
def test_read(self, tmpdir):
test_file_content = """# -*- encoding: ascii -*-
import ☺
"""
test_file = tmpdir.join("file.py")
test_file.write(test_file_content)
# able to read file eve... | mit | Python | |
d94260f0be472d2c163e9ae57aacc25a8e9f2519 | Package contrib | google-research/t5x | t5x/contrib/__init__.py | t5x/contrib/__init__.py | # Copyright 2022 The T5X 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 law or agreed to in writ... | apache-2.0 | Python | |
b0470bbde7c477e8f176fa0529a1d90eca85caba | Add survey support and use it for IPP. | benjello/openfisca-france,SophieIPP/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france,SophieIPP/openfisca-france,adrienpacifico/openfisca-france,benjello/openfisca-france,antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,adrienpacifico/openfisca-france | openfisca_france/surveys.py | openfisca_france/surveys.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | agpl-3.0 | Python | |
0f32a1e193a0064e5d5313cdc205d15cea71f1e7 | Test for a long hippo scrolling view. | sugarlabs/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,tchx84/debian-pkg-sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,sugarlabs/sugar-toolkit,samdroid-apps/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,manuq/sugar-toolkit-gtk3,tchx84/debian-pkg-... | tests/graphics/hipposcalability.py | tests/graphics/hipposcalability.py | import hippo
import gtk
import gobject
from sugar.graphics.icon import CanvasIcon
from sugar.graphics.roundbox import CanvasRoundBox
import common
test = common.Test()
canvas = hippo.Canvas()
test.pack_start(canvas)
canvas.show()
scrollbars = hippo.CanvasScrollbars()
canvas.set_root(scrollbars)
box = hippo.Canvas... | lgpl-2.1 | Python | |
f0204e3061b110028fde5312fdb7b613e361b16e | Create output.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | trendpy/output.py | trendpy/output.py | # -*- coding: utf-8 -*-
# output.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# 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 limitatio... | mit | Python | |
a78fe01101de6143885f2559a519024a86d97315 | Add new command dev_guess_downloader. | AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com | allmychanges/management/commands/dev_guess_downloader.py | allmychanges/management/commands/dev_guess_downloader.py | # coding: utf-8
from django.core.management.base import BaseCommand
from twiggy_goodies.django import LogMixin
from allmychanges.downloader import guess_downloader
class Command(LogMixin, BaseCommand):
help = u"""Command to test how downloader guesser workds for given url."""
def handle(self, *args, **optio... | bsd-2-clause | Python | |
c5dbebe13e2c1c7018a1701e3c8e37ae29f9a387 | add solution for Reverse Integer | zhyu/leetcode,zhyu/leetcode | src/reverseInteger.py | src/reverseInteger.py | class Solution:
# @return an integer
def reverse(self, x):
int_max = 2147483647
limit = int_max/10
if x > 0:
sig = 1
elif x < 0:
sig = -1
x = -x
else:
return x
y = 0
while x:
if y > limit:
... | mit | Python | |
6f3ae8a9e8a400b8882cf57fa0753c1c44b85c2a | Create pdf_all.py | moshekaplan/PDF-Tools | pdf_all.py | pdf_all.py | #!/usr/bin/env python
# encoding:UTF-8
"""
This script runs a file through all of the PDF tools
"""
import sys
import pdf_js
import pdf_links
import pdf_strings
import pdf_openaction
def run_all(fpath):
print "*"*20 + "PDF OpenAction" + "*"*20
pdf_openaction.extract_openactions(fpath)
print "*"*20 + "... | bsd-2-clause | Python | |
288a59cfeade739260a1f76cf632d735677022be | Add the start of some test for the scoring stuff. | prophile/compd,prophile/compd | src/test_scores_db.py | src/test_scores_db.py | import scores_db
import mock
import redis_client
import control
from twisted.internet import defer
def test_set_scores():
fake_connection = mock.Mock()
fake_connection.set = mock.Mock()
with mock.patch('redis_client.connection', fake_connection):
scores_db.scores.set_match_score(1, 'ABC', 12)
... | mit | Python | |
a0e4ba8dbdd14f51d17d2fb1c4e0829894d7cd10 | Add utility file for playbook | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | src/utils/playbook.py | src/utils/playbook.py | from django.conf import settings
from ansible.models import Playbook
import os
def content_loader(pk, slug):
playbook = Playbook.query_set.get(pk=pk)
playbook_dir = playbook.directory
# TODO: for now assume without validation
playbook_file = os.path.join(playbook_dir, slug + '.yml')
return playboo... | bsd-3-clause | Python | |
c517e0cb2de9cd813e4b49b6786a07e01005f0b5 | Add fully functional code, prints field and sprinkler coordinates. | mitchtz/Crop_Maximizer | Max_Crop.py | Max_Crop.py | #Find optimal position for a sprinkler in a field with randomly places crops.Takes in h,w,r, where h is height, w is width, r is the sprinker radius
#http://www.reddit.com/r/dailyprogrammer/comments/2zezvf/20150318_challenge_206_intermediate_maximizing/
import random
import math
#Creates field with random crop placem... | mit | Python | |
41bed7865c9002086f5599059700ed8599c8c7ef | Copy of existing (manual) https debug tool | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | Sketches/MPS/ProxyHTTP/https.py | Sketches/MPS/ProxyHTTP/https.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | apache-2.0 | Python | |
4fd051fd6d048e64f574097a3ca314111087ee45 | Fix up conv models to match current master. | chrinide/theanets,lmjohns3/theanets | theanets/convolution.py | theanets/convolution.py | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.'''
INPUT_NDIM = 4
'''Number of dimensions for holding input data arrays.'''
class Classifier(feedfor... | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.
A convolutional regression model takes the following inputs during training:
- ``x``: A three-dimensi... | mit | Python |
1dc795fcf3e6c09a9a77fb008ee3b5fe5c7c3719 | fix bug 1035957 - correct received_at column | Tayamarn/socorro,linearregression/socorro,cliqz/socorro,Tayamarn/socorro,m8ttyB/socorro,m8ttyB/socorro,cliqz/socorro,rhelmer/socorro,twobraids/socorro,linearregression/socorro,twobraids/socorro,lonnen/socorro,pcabido/socorro,Serg09/socorro,rhelmer/socorro,pcabido/socorro,Tchanders/socorro,cliqz/socorro,KaiRo-at/socorro... | alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py | alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py | """bug 1035957 - use literal NOW() for received_at, do not evaluate at migration time
Revision ID: 391e42da94dd
Revises: 495bf3fcdb63
Create Date: 2014-07-08 10:55:04.115932
"""
# revision identifiers, used by Alembic.
revision = '391e42da94dd'
down_revision = '495bf3fcdb63'
from alembic import op
from socorro.lib... | mpl-2.0 | Python | |
05ce8407af2075ebcc002583b4224659d19dc9db | Add unit tests for spack help command (#6779) | LLNL/spack,iulian787/spack,krafczyk/spack,mfherbst/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,EmreAtes/spack,LLNL/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,iulian787/spack,mfherbst... | lib/spack/spack/test/cmd/help.py | lib/spack/spack/test/cmd/help.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... | lgpl-2.1 | Python | |
3590a162363ff62859eccf9f7f46c74f2c5cadc4 | Create PAKvsIND.py | salekali/PAKvsIND-Sentiment-Analysis | PAKvsIND.py | PAKvsIND.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 20 01:56:57 2017
@author: Muhammad Salek Ali
"""
# 1- Importing libraries for twitter and NLP
#--------------------------------------------
import numpy as np
import tweepy
from textblob import TextBlob
# 2- Authentication
#-------------------
consumerKey= 'enter_yours... | mit | Python | |
3b82f7ada9e80eb581cf924dbf7b0490f864b264 | break at 500 | fbcom/project-euler | 012_highly_divisible_triangular_number.py | 012_highly_divisible_triangular_number.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Highly divisible triangular number" – Project Euler Problem No. 12
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=12
#
i = n = 0
while True:
i = i + 1
n = i*(i+1)/2... | mit | Python | |
a3b8fe98d82e6e82267599fdd9f8ecea684fb603 | Add import script | OpenChemistry/materialsdatabank,OpenChemistry/materialsdatabank,OpenChemistry/materialsdatabank,OpenChemistry/materialsdatabank | mdb/__init__.py | mdb/__init__.py | import sys
import click
import types
import bibtexparser
from girder_client import GirderClient
class MDBCli(GirderClient):
def __init__(self, username, password, api_url=None, api_key=None):
def _progress_bar(*args, **kwargs):
bar = click.progressbar(*args, **kwargs)
bar.bar_tem... | bsd-3-clause | Python | |
f31dd0c7f23273207eab5e30a3ea42b5edf30f2b | work in progress, script to balance PTR records | menandmice/mnm-reversezone-tools | mnm-balance-reversezones.py | mnm-balance-reversezones.py | #!/usr/bin/env python3
# Copyright (C) 2013 Men & Mice
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND MEN & ... | isc | Python | |
2187ae0b6303ae1745749b270c5c46937d8dde33 | Create mexican_wave.py | Kunalpod/codewars,Kunalpod/codewars | mexican_wave.py | mexican_wave.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Mexican Wave
#Problem level: 6 kyu
def wave(str):
li=[]
for i in range(len(str)):
x=list(str)
x[i]=x[i].upper()
li.append(''.join(x))
return [x for x in li if x!=str]
| mit | Python | |
fdc40675eabaeee191fa3a047705b677d431f58c | Create a small form class to facilitate easy use of Djangos CSRF functionality | Jonpro03/Minecrunch_Web,Jonpro03/Minecrunch_Web,Jonpro03/Minecrunch_Web | src/whitelist/util/apply_whitelist_form.py | src/whitelist/util/apply_whitelist_form.py | from django import forms
class ApplyWhitelistForm(forms.Form):
"""A small placeholder form class to allow Django's form magic to take
hold of the "apply whitelist" button.
"""
pass
| mit | Python | |
252c0916e4db033c3aee81e232a64e649f6bc926 | add a command to trigger a bulk sync | crateio/crate.pypi,crate-archive/crate-site,crate-archive/crate-site | crate_project/apps/crate/management/commands/trigger_bulk_sync.py | crate_project/apps/crate/management/commands/trigger_bulk_sync.py | from django.core.management.base import BaseCommand
from pypi.tasks import bulk_synchronize
class Command(BaseCommand):
def handle(self, *args, **options):
bulk_synchronize.delay()
print "Bulk Synchronize Triggered"
| bsd-2-clause | Python | |
457ba730a6541ab27ce8cbe06cbb6bfe246bba74 | Add a simple HTTP Basic Authentication decorator for the API | matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel | towel/api/decorators.py | towel/api/decorators.py | from functools import wraps
import httplib
from django.contrib.auth import authenticate
from django.utils.cache import patch_vary_headers
def http_basic_auth(func):
@wraps(func)
@vary_on_headers('Authorization')
def _decorator(request, *args, **kwargs):
if 'HTTP_AUTHORIZATION' in request.META:
... | bsd-3-clause | Python | |
457937561f6a581edd495d7f9559f57b94108c24 | add really basic game implementation | peterolph/hAIve,peterolph/hAIve | haive/game.py | haive/game.py |
# An interactive wrapper for the model
from haive import model
from collections import namedtuple
def tuple_from_string(string):
return tuple(int(item) for item in string.split(','))
human = 'human'
ai = 'ai'
player_types = (human, ai)
Move = namedtuple('Move', ('token','source','destination'))
class Game(obj... | mit | Python | |
c8d441fbee372abc61867d594f0645d9d79a36f0 | add raw data parser script | horizon3385/websiteClassifier,horizon3385/websiteClassifier | parseRawData/parseRawXML.py | parseRawData/parseRawXML.py | #!/usr/bin/python
import sys
import json
from bs4 import BeautifulSoup
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def extract_xml(markup):
"""
Extract `url`, `title`, 'description`, ... | mit | Python | |
e83dd0bfa4f601ed3c5ea9687d2781e83a2e6bf4 | Add logger | johnveitch/cpnest | cpnest/logger.py | cpnest/logger.py | import logging
def start_logger(output=None, verbose=0):
"""
Start an instance of Logger for logging
output : `str`
output directory (./)
verbose: `int`
Verbosity, 0=CRITICAL, 1=WARNING, 2=INFO, 3=DEBUG
fmt: `str`
format for logger (None) See logging documentation for det... | mit | Python | |
5fe88aa7d814bb630c29a7afcf511caba8c03ece | add placeholder | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | htdocs/c/c.py | htdocs/c/c.py | import os
import sys
tilecachepath, wsgi_file = os.path.split(__file__)
sys.path.insert(0, "/opt/iem/include/python/")
sys.path.insert(0, "/opt/iem/include/python/TileCache/")
from TileCache.Service import Service, wsgiHandler
cfgfiles = os.path.join(tilecachepath, "tilecache.cfg")
theService = {}
def wsgiApp(env... | mit | Python | |
4a1b7c7e1c6bd1df2d31e37a0cf97853faafb8e5 | Add BrowserScraper class | ransomwarezz/instagram-scraper | BrowserScraper.py | BrowserScraper.py | import time
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
class BrowserScraper():
def __init__(self, username, level, driver=None):
if driver is None:
self.driver = webdriver.Chrome('./chromedriver')
pass
def wait(self):
... | mit | Python | |
c313a21274f4e77d0c4baad13c5c0f5781ac13ef | Create special-binary-string.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode | Python/special-binary-string.py | Python/special-binary-string.py | # Time: f(n) = kf(n/k) + n/k * klogk <= O(logn * nlogk) <= O(n^2)
# n is the length of S, k is the max number of special strings in each depth
# Space: O(n)
class Solution(object):
def makeLargestSpecial(self, S):
"""
:type S: str
:rtype: str
"""
result = []
... | mit | Python | |
63f3e2027948d98781bdd66a0341501facb4b46c | Add test file | karlaking/rock-reconstruction | image_test.py | image_test.py | import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ... | mit | Python | |
70ba6d35682c4cad67ed3950542505557e97b86a | Create selenium-auth.py | Harinus/ZAP-Selenium-Auth | selenium-auth.py | selenium-auth.py | # The sendingRequest and responseReceived functions will be called for all requests/responses sent/received by ZAP,
# including automated tools (e.g. active scanner, fuzzer, ...)
# Note that new HttpSender scripts will initially be disabled
# Right click the script in the Scripts tree and select "enable"
# 'initia... | apache-2.0 | Python | |
a4ca12fb7f3525206a9a921ab64e31bc145cc9d3 | Create __init__.py | OdooCommunityWidgets/mass_mailing_themes_community,OdooCommunityWidgets/mass_mailing_themes_boilerplate | __init__.py | __init__.py | mit | Python | ||
102ad365089794d337820714ab281f99af0797b0 | update make_base_url | forrest-mao/python-sdk,weilaihui/tornado-qiniu,jemygraw/python-sdk,qiniu/python-sdk,blahgeek/python-sdk | qiniu/auth_token.py | qiniu/auth_token.py | # -*- coding: utf-8 -*-
import json
import base64
import time
import rpc
import config
import urllib
import auth_digest
class PutPolicy(object):
scope = None # 可以是 bucketName 或者 bucketName:key
expires = 3600 # 默认是 3600 秒
callbackUrl = None
callbackBody = None
returnUrl = None
returnBody = N... | # -*- coding: utf-8 -*-
import json
import base64
import time
import rpc
import config
import urllib
import auth_digest
class PutPolicy(object):
scope = None # 可以是 bucketName 或者 bucketName:key
expires = 3600 # 默认是 3600 秒
callbackUrl = None
callbackBody = None
returnUrl = None
returnBody = N... | mit | Python |
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d | Create __init__.py | annettechun25/cs3240-labdemo | __init__.py | __init__.py | mit | Python | ||
988598d0385ce63d951b3cc0817392cf2271575c | change encoding to utf8 | xxxspy/sae_storage_push | __init__.py | __init__.py | import sys
if not sys.getdefaultencoding()=='utf8':
reload(sys)
sys.setdefaultencoding('utf8')
| isc | Python | |
04530dd3def6f8ff158df7b607c367f5f273fd1b | add pythainlp.tools | PyThaiNLP/pythainlp | pythainlp/tools/__init__.py | pythainlp/tools/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import,unicode_literals
def test_segmenter(segmenter, test):
words = test
result = segmenter
correct = (result == words)
if not correct:
print ('expected', words)
print('got ', result)
return correct
if __name__ == "__main__... | apache-2.0 | Python | |
879032d31d8cf89df14489107015b7f29ace1490 | Solve designer door mat | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/designer-door-mat.py | python/designer-door-mat.py | # Size: 7 x 21
# ---------.|.---------
# ------.|..|..|.------
# ---.|..|..|..|..|.---
# -------WELCOME-------
# ---.|..|..|..|..|.---
# ------.|..|..|.------
# ---------.|.---------
class DoorMat:
DASH = "-"
DOT = "."
PIPE = "|"
WELCOME = "WELCOME"
def __init__(self, N, M):
self.N = N
... | mit | Python | |
0b9926313831b8fd5c2e72cfc2559f7bdd1c2855 | Add class utils | abenicho/isvr | nisl/_utils/class_helper.py | nisl/_utils/class_helper.py | from sets import Set
import inspect
def get_params(_class, _object, ignore=None):
_ignore = Set(['memory', 'memory_level', 'verbose', 'copy'])
if ignore is not None:
_ignore.update(ignore)
# params is a dictionary
params = _class.get_params(_object)
for i in _ignore:
if i in par... | bsd-3-clause | Python | |
f71d6b2fe05290ab976e3ba433185ec649a35c20 | Move get_context_from_function_and_args() to context.py | varunarya10/oslo.log,JioCloud/oslo.log,dims/oslo.log,zzicewind/oslo.log,openstack/oslo.log,magic0704/oslo.log,akash1808/oslo.log,meganjbaker/oslo.log | openstack/common/context.py | openstack/common/context.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | apache-2.0 | Python |
417e76de84f067a90fdcda93ee82d63cc7e56c7b | Add downloader.py | fsteffek/steamplog | steamplog/downloader.py | steamplog/downloader.py | from __future__ import print_function
import sys
import json
import urllib2
class Downloader(object):
'''Download data via Steam-API'''
def __init__(self, api_key):
self.API = api_key
def download_stats(self, steam_id):
'''Download owned games from Steam Web API'''
URL = ['https:/... | mit | Python | |
f9b8a92359e15883c5ee7b4dbc259001d59e379d | introduce bnip classes | Islast/BrainNetworksInPython,Islast/BrainNetworksInPython | BrainNetworksInPython/scripts/classes.py | BrainNetworksInPython/scripts/classes.py | import numpy as np
import networkx as nx
import pandas as pd
import make_graphs as mkg
import graph_measures as gm
def cascader(dict1, dict2, name):
return {key: value.update({name: dict2[key]})
for key, value in dict1.items()}
class BrainNetwork(nx.classes.graph.Graph):
def __init__(self,
... | mit | Python | |
cd9da9cf624a80acaebe92e075760ff8c2dbb7b1 | Add test_first_audit_catchup_during_ordering | evernym/plenum,evernym/zeno | plenum/test/audit_ledger/test_first_audit_catchup_during_ordering.py | plenum/test/audit_ledger/test_first_audit_catchup_during_ordering.py | import pytest
from plenum.test import waits
from plenum.common.constants import LEDGER_STATUS, DOMAIN_LEDGER_ID
from plenum.common.messages.node_messages import MessageReq, CatchupReq
from plenum.server.catchup.node_leecher_service import NodeLeecherService
from plenum.test.delayers import ppDelay, pDelay, cDelay, DEF... | apache-2.0 | Python | |
cc300b1c0f6ccc4ca50b4f4d20f5f351af698cfc | Add files via upload | bboysingle/dancespace,bboysingle/dancespace | nthprime.py | nthprime.py | #encoding=utf8
'''
Find nth prime number
'''
from math import sqrt
def prime(maxn):
n = 1
while n < maxn:
if is_prime(n):
yield n
n += 1
def is_prime(n):
if n == 1:
return False
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
... | apache-2.0 | Python | |
98d04ccc3549b0b7597b995b83d60ae570108b8a | Create Adafruit_HTU21D.py | jimfinoc/takeTempAndHumidity | Adafruit_HTU21D.py | Adafruit_HTU21D.py | #!/usr/bin/python
import time
from Adafruit_I2C import Adafruit_I2C
# ===========================================================================
# HTU21D Class
#
# Code only test with a Sparkfun HTU21D Sensor module on a Beaglebone Black.
# It has been reported that an I2C address issue was seen on a Pi.
# ========... | apache-2.0 | Python | |
3b42aa408472755ecb4c63d60f8bb14f43b4e930 | Write high-level code for vector-based algorithms (inner product, cross product and norm). | jonancm/viennagrid-python,jonancm/viennagrid-python,jonancm/viennagrid-python | viennagrid-python/viennagrid/algorithms.py | viennagrid-python/viennagrid/algorithms.py | #-*- coding: utf-8 -*-
import viennagrid_wrapper as _wrapper
_SUPPORTED_NORMS = (1, 2, 'inf')
###########################
# VECTOR-BASED ALGORITHMS #
###########################
def inner_prod(point1, point2):
# Try to get method 'inner_prod' from 'point1'. If it doesn't have the method,
# it means it's not a car... | mit | Python | |
d0b16ba083cafc4eb8da73e56a082a4959c1ac53 | Implement the training with proxy NCA loss | ronekko/deep_metric_learning | main_proxy_nca.py | main_proxy_nca.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 09 20:49:04 2017
@author: sakurai
"""
import colorama
import numpy as np
import chainer.functions as F
from sklearn.model_selection import ParameterSampler
from lib.functions.n_pair_mc_loss import n_pair_mc_loss
from lib.common.utils import LogUniformDistribution, load... | mit | Python | |
596b11351ee78d715833ef0681fdc1634a425167 | add show_flirt_references | williballenthin/viv-utils | viv_utils/scripts/show_flirt_references.py | viv_utils/scripts/show_flirt_references.py | import sys
import gzip
import logging
import argparse
import binascii
import flirt
import viv_utils
import viv_utils.flirt
import vivisect.const
logger = logging.getLogger("get_flirt_matches")
def load_flirt_signature(path):
if path.endswith(".sig"):
with open(path, "rb") as f:
sigs = flir... | apache-2.0 | Python | |
b1316b3db89fbee6e6c1ad807e2e36b8b4dd1874 | Add a script to fix garbled activities | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | Attic/act-fixup.py | Attic/act-fixup.py | from parliament.models import *
from django.db import transaction, reset_queries
if True:
with transaction.atomic():
print("Documents %d" % Document.objects.count())
for idx, doc in enumerate(Document.objects.all()):
if idx % 1000 == 0:
reset_queries()
p... | agpl-3.0 | Python | |
ad78abc4073cb26b192629aed9e9f8e3f5d9e94a | Test for GPI newline fix; for geneontology/go-site#1681 | biolink/ontobio,biolink/ontobio | tests/test_gpiwriter.py | tests/test_gpiwriter.py | import io
from ontobio.io import entitywriter, gafgpibridge
def test_header_newline():
gpi_obj = {
'id': "MGI:MGI:1918911",
'label': "0610005C13Rik", # db_object_symbol,
'full_name': "RIKEN cDNA 0610005C13 gene", # db_object_name,
'synonyms': [],
'type': ["gene"], # db_... | bsd-3-clause | Python | |
4d8dbf66bdee710e5b53863a4852e80c42a2c7a2 | Add a sqlserver test | ess/dd-agent,pfmooney/dd-agent,darron/dd-agent,ess/dd-agent,AntoCard/powerdns-recursor_check,amalakar/dd-agent,oneandoneis2/dd-agent,GabrielNicolasAvellaneda/dd-agent,AniruddhaSAtre/dd-agent,GabrielNicolasAvellaneda/dd-agent,AntoCard/powerdns-recursor_check,truthbk/dd-agent,zendesk/dd-agent,jyogi/purvar-agent,pfmooney/... | tests/test_sqlserver.py | tests/test_sqlserver.py | import unittest
import logging
from nose.plugins.attrib import attr
from checks import gethostname
from tests.common import get_check
logging.basicConfig()
"""
Run the following on your local SQL Server:
CREATE LOGIN datadog WITH PASSWORD = '340$Uuxwp7Mcxo7Khy';
CREATE USER datadog FOR LOGIN datadog;
GRANT SELECT o... | bsd-3-clause | Python | |
b70b51d1c43a344a3c408f3da30c6477b311241e | Create __init__.py | carlniger/acitool | acitool/jsondata/Mpod/__init__.py | acitool/jsondata/Mpod/__init__.py | apache-2.0 | Python | ||
9ec45d8b44a63bcd2652de30191b2bf0caf72ab8 | Add tests for backrefs | konstantinoskostis/sqlalchemy-utils,JackWink/sqlalchemy-utils,cheungpat/sqlalchemy-utils,joshfriend/sqlalchemy-utils,marrybird/sqlalchemy-utils,tonyseek/sqlalchemy-utils,rmoorman/sqlalchemy-utils,joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,spoqa/sqlalchemy-utils | tests/aggregate/test_backrefs.py | tests/aggregate/test_backrefs.py | import sqlalchemy as sa
from sqlalchemy_utils.aggregates import aggregated
from tests import TestCase
class TestAggregateValueGenerationForSimpleModelPaths(TestCase):
def create_models(self):
class Thread(self.Base):
__tablename__ = 'thread'
id = sa.Column(sa.Integer, primary_key=T... | bsd-3-clause | Python | |
f45f00401daa8446982477cd8ba26c661e577508 | Add dictionary.en.py | nlpub/hyperstar,nlpub/hyperstar,dustalov/projlearn,nlpub/hyperstar | dictionary.en.py | dictionary.en.py | #!/usr/bin/env python3
import argparse
import csv
import os
import random
from collections import defaultdict
import numpy as np
from gensim.models.word2vec import Word2Vec
try:
from sklearn.model_selection import train_test_split
except ImportError:
from sklearn.cross_validation import train_test_split
par... | mit | Python | |
8bf521bf26af93f13043ee6e0d70070d49f76f68 | Implement the cipher map problem. | edwardzhu/checkio-solution | Home/cipherMap.py | Home/cipherMap.py | import operator
def checkio(arr):
index = convertMapToTuples(arr[0])
cube = convertCubeToList(arr[1])
output = ''
dimension = len(arr[0])
for i in range(0, 4):
index.sort(key=operator.itemgetter(0, 1))
for idx in index:
output = '{0}{1}'.format(output, cube[idx[0]][idx[1... | mit | Python | |
e583d977c7089f21841890b7eb50c824db153202 | Test for unicode characters in grammars. | igordejanovic/textX,igordejanovic/textX,igordejanovic/textX | tests/functional/test_unicode.py | tests/functional/test_unicode.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from textx.metamodel import metamodel_from_str
def test_unicode_grammar_from_string():
"""
Test grammar with unicode char given in grammar string.
"""
grammar = """
First:
'first' a = Second
;
Second:
... | mit | Python | |
8117b3bee367afea107f7ef4b2003006e0ea857e | Create anteater.py | nullx31/anteater.py | anteater.py | anteater.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
###########################################
# 27.11.2012 | word scraper bot wsb.py #
# by PirateSecurity # http://piratesec.de #
###########################################
import mechanize
import cookielib
import urllib2
from bs4 import BeautifulSoup
import re
import sys
... | mit | Python | |
f2c47ccf852e1a2b2a68f4d7ac1e72409ddfad3e | Create scratch.py | dpbroman/satrain,dpbroman/satrain | scratch.py | scratch.py | import os
import urllib
DOWNLOADS_DIR = '/python-downloader/downloaded'
# For every line in the file
for url in open('urls.txt'):
# Split on the rightmost / and take everything on the right side of that
name = url.rsplit('/', 1)[-1]
# Combine the name and the downloads directory to get the local filename... | mit | Python | |
8e3b2b6103a591dae2b99d7e219722e0992dae65 | Add CatagoryMgr | vinx13/WikiCrawler | CatagoryManager.py | CatagoryManager.py | from DbHelper import DbHelper
class CatagoryManager(object):
TABLE_NAME = "cactagory"
FIELD_TITLE = "title"
FIELD_COUNT = "count"
def __init__(self):
self.db = DbHelper()
sql = "CREATE TABLE IF NOT EXISTS `" + self.TABLE_NAME + "` (" \
+ self.FIELD_TITLE + " TEXT NOT NUL... | mit | Python | |
dcc64e9fd8bb3cb407959a30a2054fc180596bae | Add Pandas integration unit tests | rwhitt2049/nimble,rwhitt2049/trouve | tests/test_pandas_integration.py | tests/test_pandas_integration.py | from unittest import TestCase
import numpy as np
import pandas as pd
import numpy.testing as npt
from nimble import Events
class TestAsPandasCondition(TestCase):
def setUp(self):
conditional_series = pd.Series([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1])
condition = (conditional_series > 0)
sel... | mit | Python | |
1696ca33e644d3cb1138d7ee4c48239b7a757cfd | Add the first script to try a led light | mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp | python_scripts/gpio_test.py | python_scripts/gpio_test.py | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
for x in range(0,10):
GPIO.output(7,True)
time.sleep(1)
GPIO.output(7,False)
time.sleep(1)
GPIO.cleanup()
| mit | Python | |
5c091ea20a531692c676f9d4e0f450c0e642f740 | Create module for uptime retrieval | HubbeKing/Hubbot_Twisted | Modules/Uptime.py | Modules/Uptime.py | from collections import OrderedDict
from ModuleInterface import ModuleInterface
from IRCResponse import IRCResponse, ResponseType
import datetime
class Module(ModuleInterface):
triggers = ["uptime"]
help = "uptime -- returns the uptime for the bot"
def onTrigger(self, Hubbot, message):
now = date... | mit | Python | |
e39270b69e1e8831c177bf4e5051726e6a678407 | Add wsgi python script [ci skip] | ecsnavarretemit/sarai-interactive-maps-backend,ecsnavarretemit/sarai-interactive-maps-backend | app/wsgi.py | app/wsgi.py | import os
import sys
root = os.path.dirname(os.path.realpath(__file__ + '/..'))
# activate the virtual env
activate_this = root + '/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
sys.path.insert(0, root)
# set the environment variable to production
os.environ['FLASK_ENV']="PRODUCTI... | mit | Python | |
655bf4b4159e70b4a99185a1735ac63c3ee951dc | Add script to filter result by result type. | symbooglix/boogie-runner,symbooglix/boogie-runner | analysis/filter-by-result-type.py | analysis/filter-by-result-type.py | #!/usr/bin/env python
import argparse
import os
import logging
import pprint
import sys
import yaml
# HACK
_file = os.path.abspath(__file__)
_dir = os.path.dirname(os.path.dirname(_file))
sys.path.insert(0, _dir)
from BoogieRunner.ResultType import ResultType
def main(args):
resultTypes = [ r.name for r in list(R... | bsd-3-clause | Python | |
983a89d7b400ec71806311cfe6a576d85dd59958 | Create distance.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | abstractions/sensor/distance/distance.py | abstractions/sensor/distance/distance.py | # This code has to be added to __init__.py in folder .../devices/sensor
class Distance():
def __family__(self):
return "Distance"
def __getMillimeter__(self):
raise NotImplementedError
@api("Distance", 0)
@request("GET", "sensor/distance/*")
@response(contentType=M_JSON)
def... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.