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
b08626abbde2d5e1f8fae872b395448072ad13bf
Fix build
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
test_utilities/src/setup.py
test_utilities/src/setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2013 DataONE # # Licensed under the Apache Lice...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2013 DataONE # # Licensed under the Apache Lice...
apache-2.0
Python
d4de9a357c25a001b459289fe6c95d1a13561f4a
Move fabfile logic
spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc
fabfile/init.py
fabfile/init.py
#def dev(): # # Allow this to persist, since we aren't as rigorous about keeping state clean # if not file_exists('.denv'): # local('virtualenv .denv') # # with virtualenv(DEV_ENV_DIR): # local('pip install -r requirements.txt')
from fabric.api import task, local, run, lcd, cd, env from os.path import exists as file_exists from fabtools.python import virtualenv from os import path PWD = path.dirname(__file__) VENV_DIR = path.join(PWD, '.env') #def dev(): # # Allow this to persist, since we aren't as rigorous about keeping state clean # ...
mit
Python
71d5290d3af33e0100db8961949d164121540acd
move coverage cutoff to 19.5x
ernfrid/oneoffs,ernfrid/oneoffs,ernfrid/oneoffs,ernfrid/oneoffs
fail_samples.py
fail_samples.py
#!/usr/bin/env python import sys def main(): header = None num_failed = 0 for line in sys.stdin: if header is None: header = line.rstrip().split('\t') sys.stdout.write('\t'.join(header + ['Failure_Reason'])) sys.stdout.write('\n') else: field...
#!/usr/bin/env python import sys def main(): header = None num_failed = 0 for line in sys.stdin: if header is None: header = line.rstrip().split('\t') sys.stdout.write('\t'.join(header + ['Failure_Reason'])) sys.stdout.write('\n') else: field...
mit
Python
6bf4fdbd3961e7509fd3666fbeaa77bcb76aa235
Remove excess whitespace
capshaw/jellyfish,capshaw/jellyfish
entries.py
entries.py
import config import database from flask import (request, render_template, session, Blueprint, jsonify, g) from models import Entry from util import * # API for user-specific entry access. entries_api = Blueprint('entries_api', __name__) @entries_api.route('/entries', methods=['GET']) @login_required def get_entries...
import config import database from flask import (request, render_template, session, Blueprint, jsonify, g) from models import Entry from util import * # API for user-specific entry access. entries_api = Blueprint('entries_api', __name__) @entries_api.route('/entries', methods=['GET']) @login_required def get_entries...
mit
Python
c952f6f2f3f2c5b8406ef6a021631d62bc189c4e
Fix error when plugin menu has no position defined, add position to extract plugin.
SmartJog/webengine,SmartJog/webengine
utils/__init__.py
utils/__init__.py
import os from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings def get_valid_plugins(): """ Returns a list of valid webengine plugins. Returns: [('name', <module 'webengine.name'>), ...] """ try: webengine = __import__('webengine') exce...
import os from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings def get_valid_plugins(): """ Returns a list of valid webengine plugins. Returns: [('name', <module 'webengine.name'>), ...] """ try: webengine = __import__('webengine') exce...
lgpl-2.1
Python
78ca2b084e244ac10511f2fac4ab0f35d70c3d7f
move checks to validate()
Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort
conanfile.py
conanfile.py
# -*- coding: utf-8 -*- # Copyright (c) 2018-2021 Morwenn # SPDX-License-Identifier: MIT from conans import CMake, ConanFile class CppSortConan(ConanFile): name = "cpp-sort" version = "1.9.0" description = "Additional sorting algorithms & related tools" topics = "conan", "cpp-sort", "sorting", "algo...
# -*- coding: utf-8 -*- # Copyright (c) 2018-2021 Morwenn # SPDX-License-Identifier: MIT from conans import CMake, ConanFile class CppSortConan(ConanFile): name = "cpp-sort" version = "1.9.0" description = "Additional sorting algorithms & related tools" topics = "conan", "cpp-sort", "sorting", "algo...
mit
Python
1f409a2732886b6a77d348529e07e9f90fbfd8ba
Revert back to older Catch2, part 2
acgetchell/causal-sets-explorer,acgetchell/causal-sets-explorer
conanfile.py
conanfile.py
from conans import ConanFile, CMake class CausalSetsExplorer(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "boost/1.67.0@conan/stable", "catch2/2.2.2@bincrafters/stable" generators = "cmake" default_options = "Boost:header_only=True" def build(self): cmake = CMak...
from conans import ConanFile, CMake class CausalSetsExplorer(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "boost/1.67.0@conan/stable", "catch2/2.3.0@bincrafters/stable" generators = "cmake" default_options = "Boost:header_only=True" def build(self): cmake = CMak...
bsd-3-clause
Python
499f5ff77ba2d7b1ccfcc6d9f039720c161f1416
Test wrapper
andycasey/sick
sick/tests/test_utils.py
sick/tests/test_utils.py
# coding: utf-8 """ Test sick utilities """ from __future__ import print_function import sick.utils as utils def test_latexify(): input_labels = ("teff", "jitter.blue", "v.blue", "normalise.red.a1") output_labels = ['$T_{\\rm eff}$ [K]', '$ln(f_{blue})$', '$V_{rad,{blue}}$ [km/s]', '$r_a1$'] assert uti...
# coding: utf-8 """ Test sick utilities """ from __future__ import print_function import sick.utils as utils def test_latexify(): input_labels = ("teff", "jitter.blue", "v.blue", "normalise.red.a1") output_labels = ['$T_{\\rm eff}$ [K]', '$ln(f_{blue})$', '$V_{rad,{blue}}$ [km/s]', '$r_a1$'] assert uti...
mit
Python
03ef2063c5f3ceefd20f11c6f9091b88b3d3ca54
Remove unexpected successes
freakboy3742/voc,freakboy3742/voc,cflee/voc,cflee/voc
tests/builtins/test_dict.py
tests/builtins/test_dict.py
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class DictTests(TranspileTestCase): pass class BuiltinDictFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): functions = ["dict"] not_implemented = [ 'test_bytearray', ]
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class DictTests(TranspileTestCase): pass class BuiltinDictFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): functions = ["dict"] not_implemented = [ 'test_bytearray', 'test_list', 'test_str', ]
bsd-3-clause
Python
02dc23c5b32940e5d70ba372a9494d48170b6ecc
check __init__.py does not exist
RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu
tests/cli/test_rasa_init.py
tests/cli/test_rasa_init.py
import os from pathlib import Path from typing import Callable from _pytest.pytester import RunResult def test_init_using_init_dir_option(run_with_stdin: Callable[..., RunResult]): os.makedirs("./workspace") run_with_stdin( "init", "--quiet", "--init-dir", "./workspace", stdin=b"N" ) # avoid trai...
import os from pathlib import Path from typing import Callable from _pytest.pytester import RunResult def test_init_using_init_dir_option(run_with_stdin: Callable[..., RunResult]): os.makedirs("./workspace") run_with_stdin( "init", "--quiet", "--init-dir", "./workspace", stdin=b"N" ) # avoid trai...
apache-2.0
Python
742948d53affcfb262acd94d28aefbc9e196c489
Bump version.
akszydelko/django-track-history,akszydelko/django-track-history
track_history/__init__.py
track_history/__init__.py
__version__ = '0.1.2'
__version__ = '0.1.1'
bsd-3-clause
Python
d9c6471ea77e7085980c650c38802128a4d1cf03
Use fallback parameter of RawConfigParser.get.
synicalsyntax/zulip,rht/zulip,zulip/zulip,andersk/zulip,kou/zulip,showell/zulip,eeshangarg/zulip,shubhamdhama/zulip,kou/zulip,brainwane/zulip,showell/zulip,kou/zulip,andersk/zulip,kou/zulip,punchagan/zulip,eeshangarg/zulip,brainwane/zulip,zulip/zulip,rht/zulip,kou/zulip,zulip/zulip,punchagan/zulip,rht/zulip,punchagan/z...
zproject/config.py
zproject/config.py
import os from typing import Optional, overload import configparser DEPLOY_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) config_file = configparser.RawConfigParser() config_file.read("/etc/zulip/zulip.conf") # Whether this instance of Zulip is running in a production environment. PRODUCTION = c...
import os from typing import Optional, overload import configparser DEPLOY_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) config_file = configparser.RawConfigParser() config_file.read("/etc/zulip/zulip.conf") # Whether this instance of Zulip is running in a production environment. PRODUCTION = c...
apache-2.0
Python
2ef7683f9d4e0e16142a9ef196aa4048de5bd1ae
Update recalboxFiles.py
nadenislamarre/recalbox-configgen,recalbox/recalbox-configgen,digitalLumberjack/recalbox-configgen
configgen/recalboxFiles.py
configgen/recalboxFiles.py
#!/usr/bin/env python HOME = '/recalbox/share/system' CONF = HOME + '/configs' esInputs = HOME + '/.emulationstation/es_input.cfg' esSettings = HOME + '/.emulationstation/es_settings.cfg' recalboxConf = HOME + '/recalbox.conf' retroarchRoot = CONF + '/retroarch' retroarchCustom = retroarchRoot + '/retroarchcustom.cfg...
#!/usr/bin/env python esInputs = '/recalbox/share/system/.emulationstation/es_input.cfg' esSettings = '/recalbox/share/system/.emulationstation/es_settings.cfg' recalboxConf = '/recalbox/share/system/recalbox.conf' retroarchRoot = '/recalbox/share/system/configs/retroarch' retroarchCustom = retroarchRoot + '/retroarc...
mit
Python
4a6a51b9f38a22189732bdc2064401d25a5b518c
Remove dupe route.
unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac
edtrac_project/urls.py
edtrac_project/urls.py
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin from rapidsms_httprouter.urls import urlpatterns as router_urls from rapidsms_xforms.urls import urlpatterns as xform_urls from education.urls import urlpatterns as edtrac_urls from contact.urls import urlpatterns ...
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin from rapidsms_httprouter.urls import urlpatterns as router_urls from rapidsms_xforms.urls import urlpatterns as xform_urls from education.urls import urlpatterns as edtrac_urls from contact.urls import urlpatterns ...
bsd-3-clause
Python
e470058c0eca574a3bbbac7456070799fca449b8
Add initial solution
CubicComet/exercism-python-solutions
etl/etl.py
etl/etl.py
def transform(scrabble): return {ch.lower(): v for (v, chs) in scrabble.items() for ch in chs}
def transform(): pass
agpl-3.0
Python
31ee04b2eed6881a4f6642495545868f7c167a20
Use ascii in logging message
MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,agdsn/sipa,MarauderXtreme/sipa
sipa/blueprints/hooks.py
sipa/blueprints/hooks.py
import logging from flask import current_app, request, abort from flask.blueprints import Blueprint from sipa.utils.git_utils import update_repo logger = logging.getLogger(__name__) bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks') @bp_hooks.route('/update-content', methods=['POST']) def content_hook(...
import logging from flask import current_app, request, abort from flask.blueprints import Blueprint from sipa.utils.git_utils import update_repo logger = logging.getLogger(__name__) bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks') @bp_hooks.route('/update-content', methods=['POST']) def content_hook(...
mit
Python
ee63ff4e6ec6cbccdae4cb3c1e1a1a4a340f4864
Add initial solution
CubicComet/exercism-python-solutions
etl/etl.py
etl/etl.py
def transform(scrabble): return {ch.lower(): v for (v, chs) in scrabble.items() for ch in chs}
def transform(): pass
agpl-3.0
Python
f9572782112b23b38c39bf02126f018c83d3324d
Make solution more efficient
CubicComet/exercism-python-solutions
pythagorean-triplet/pythagorean_triplet.py
pythagorean-triplet/pythagorean_triplet.py
import math def primitive_triplets(b): if b % 4 != 0: raise ValueError("Argument must be a multiple of 4") return set(filter(are_coprime, _triplets(b))) def triplets_in_range(lower, upper): in_range = lambda x: lower <= min(x) and max(x) <= upper base_triplets = [] for i in range(4, uppe...
import math def primitive_triplets(b): if b % 4 != 0: raise ValueError("Argument must be a multiple of 4") return set(filter(are_coprime, _triplets(b))) def triplets_in_range(lower, upper): in_range = lambda x: lower <= min(x) and max(x) <= upper base_triplets = [] for i in range(4, uppe...
agpl-3.0
Python
0ca84db48fb0af6352a0ada32808deeace0e657e
update the config to reflect name change
ceph/ceph-installer,ceph/ceph-installer,ceph/ceph-installer,ceph/mariner-installer
config/config.py
config/config.py
from ceph_installer import hooks # Server Specific Configurations server = { 'port': '8080', 'host': '0.0.0.0' } # Pecan Application Configurations app = { 'root': 'ceph_installer.controllers.root.RootController', 'modules': ['ceph_installer'], 'debug': False, 'hooks': [hooks.SystemCheckHook()...
from mariner import hooks # Server Specific Configurations server = { 'port': '8080', 'host': '0.0.0.0' } # Pecan Application Configurations app = { 'root': 'mariner.controllers.root.RootController', 'modules': ['mariner'], 'debug': False, 'hooks': [hooks.SystemCheckHook()] } logging = { ...
mit
Python
acfec8404ec311b644821277d705754295b1ac70
Fix migration
binoculars/osf.io,binoculars/osf.io,saradbowman/osf.io,felliott/osf.io,cslzchen/osf.io,baylee-d/osf.io,erinspace/osf.io,cslzchen/osf.io,mfraezz/osf.io,laurenrevere/osf.io,binoculars/osf.io,icereval/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,aaxelb/osf.io,crcresearch/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,bayl...
osf/migrations/0060_add_nodelog_should_hide_nid_index.py
osf/migrations/0060_add_nodelog_should_hide_nid_index.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-09 22:12 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): atomic = False # CREATE INDEX CONCURRENTLY cannot be run in a txn dependencies = [ ('osf', '0059_merge_20170914_11...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-09 22:12 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0059_merge_20170914_1100'), ] operations = [ migrations.RunSQL([ ...
apache-2.0
Python
4c707e2262afbe7516b6000288555871ed389173
add a mon_initial_members test
ceph/ceph-docker,rootfs/ceph-docker,mkkie/ceph-docker,osixia/ceph-docker,mkkie/ceph-docker,cdxvirt/ceph-docker,rootfs/ceph-docker,ceph/ceph-docker,AcalephStorage/ceph-docker,cdxvirt/ceph-docker,osixia/ceph-docker,JrCs/ceph-docker,JrCs/ceph-docker,osixia/ceph-docker,AcalephStorage/ceph-docker,JrCs/ceph-docker,AcalephSto...
tests/base/test_ceph_conf.py
tests/base/test_ceph_conf.py
class TestAllContainers(object): def test_ceph_fsid_exists(self, mon_containers, client): result = client.run(mon_containers, 'grep fsid /etc/ceph/ceph.conf').split() assert len(result) == 3 def test_initial_members_is_defined(self, mon_containers, client): result = client.run(mon_co...
class TestAllContainers(object): def test_ceph_fsid_exists(self, mon_containers, client): result = client.run(mon_containers, 'grep fsid /etc/ceph/ceph.conf').split() assert len(result) == 3 assert result[-1] != '='
apache-2.0
Python
f6f85db9ddb646848a547910114061df40274f0e
Update bluetooth_ping_test.py
daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop
tests/bluetooth_ping_test.py
tests/bluetooth_ping_test.py
#!/usr/bin/env python import os import subprocess as subp from subprocess import * from avocado import Test #I have used my Samsung Galaxy S7 Edge as target device class BluetoothDeviceTest(Test): def test(): targetDeviceMac = '8C:1A:BF:0D:31:A9' bluetoothChannel = '2' port = 1 print("Blu...
#!/usr/bin/env python import os import subprocess as subp from subprocess import * from avocado import Test #I have used my Samsung Galaxy S7 Edge as target device class WifiScanAP(Test): def test(): targetDeviceMac = '8C:1A:BF:0D:31:A9' bluetoothChannel = '2' port = 1 print("Bluetooth pi...
mit
Python
6544716280b4a128c37db7da6fbb9fe47ccc5657
Fix test.
RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu
tests/core/cli/test_utils.py
tests/core/cli/test_utils.py
import sys import tempfile import pytest from rasa.cli.utils import ( parse_last_positional_argument_as_model_path, get_validated_path, ) @pytest.mark.parametrize( "argv", [ ["rasa", "run"], ["rasa", "run", "core"], ["rasa", "interactive", "nlu", "--param", "xy"], ], ) de...
import sys import tempfile import pytest from rasa.cli.utils import ( parse_last_positional_argument_as_model_path, get_validated_path, ) @pytest.mark.parametrize( "argv", [ ["rasa", "run"], ["rasa", "run", "core"], ["rasa", "test", "nlu", "--param", "xy"], ], ) def test_...
apache-2.0
Python
e929c0e73bc58da30141b1fa7f5a17f8a5b02ddd
add __name__...
Yokan-Study/study,Yokan-Study/study,Yokan-Study/study
2018/04.10/python/jya_Gapi_class.py
2018/04.10/python/jya_Gapi_class.py
import requests, base64 import config id = config.GAPI_CONFIG['client_id'] secret = config.GAPI_CONFIG['client_secret'] type = config.GAPI_CONFIG['grant_type'] class GapiClass: def __init__(self, host='https://gapi.gabia.com'): self.__host = host self.__headers = self.__encoded_token() def __...
import requests, base64 import config id = config.GAPI_CONFIG['client_id'] secret = config.GAPI_CONFIG['client_secret'] type = config.GAPI_CONFIG['grant_type'] class GapiClass: def __init__(self, host='https://gapi.gabia.com'): self.__host = host self.__headers = self.__encoded_token() def __...
mit
Python
5a74533c88c3f0ec6a92eda1a21422a56dc2ea3f
convert fastq: use Biopython's conversion!
almlab/SmileTrain,almlab/SmileTrain
convert_fastq.py
convert_fastq.py
#!/usr/bin/env python ''' Converts a fastq file from Illumina 1.3-1.7 format to a format that will work with this pipeline, specifically: * an @ line that matches 1.4-1.7 format @stuff:with:colons#BARCODE/1 (or /2) * quality line using Illumina 1.8 (base 33) quality scores ''' import argparse, sys from Bio im...
#!/usr/bin/env python ''' Converts a fastq file from Illumina 1.3-1.7 format to a format that will work with this pipeline, specifically: * an unchanged @ line that matches 1.4-1.7 format @stuff:with:colons#BARCODE/1 (or /2) * sequence line * a line with just + * quality line using Illumina 1.8 (base 3...
mit
Python
890344a739efeef03e573cc89c2fc014bebe52ba
Remove if true
idiotic/idiotic,umbc-hackafe/idiotic
idiotic/util/blocks/teapot.py
idiotic/util/blocks/teapot.py
import requests from idiotic import block from idiotic import resource from idiotic import node import asyncio import aiohttp import time class TeapotBlock(block.Block): def __init__(self, name, config): self.name = name self.config = {"address": "https://api.particle.io", "...
import requests from idiotic import block from idiotic import resource from idiotic import node import asyncio import aiohttp import time class TeapotBlock(block.Block): def __init__(self, name, config): self.name = name self.config = {"address": "https://api.particle.io", "...
mit
Python
39947186fea04f66c239150d0e0757f3844d020c
Update read.py
hanbing718/OMOOC2py,hanbing718/OMOOC2py
_src/om2py0w/0wex1/read.py
_src/om2py0w/0wex1/read.py
# -*- coding: utf-8 -*- import os ls =os.linesep #get filename fname = raw_input('input a file name to save filenames:%s' % ls) # print"\nEnter lines *'.'by itself to quit).\n" #loop until user terminates input while True: entry=raw_input('>') if entry=='EXIT': break elif entry=='READ': fob...
# -*- coding: utf-8 -*- import os ls =os.linesep #get filename fname = raw_input('input a file name to save filenames:%s' % ls) # print"\nEnter lines *'.'by itself to quit).\n" #loop until user terminates input while True: entry=raw_input('>') if entry=='EXIT': break elif entry=='READ': f...
mit
Python
25e9769e8d80015f71479eb3e290942cd8e59c4b
Make addons installable
OCA/connector,OCA/connector
component/__manifest__.py
component/__manifest__.py
# -*- coding: utf-8 -*- # Copyright 2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Components', 'version': '11.0.1.0.0', 'author': 'Camptocamp,' 'Odoo Community Association (OCA)', 'website': 'https://www.camptocamp.com', 'license': 'AGPL-3', 'category'...
# -*- coding: utf-8 -*- # Copyright 2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Components', 'version': '10.0.1.0.0', 'author': 'Camptocamp,' 'Odoo Community Association (OCA)', 'website': 'https://www.camptocamp.com', 'license': 'AGPL-3', 'category'...
agpl-3.0
Python
71155eca0a4afe2327e1ed17a7ea101375bf6999
make example more interesting
ibab/python-mle
example.py
example.py
from numpy.random import normal from numpy import linspace, array, append import matplotlib.pyplot as plt from scipy.stats import norm from time import clock from pandas import DataFrame from mle import Normal, var, par, Mix2 x = var("x") mu1 = par("mu1") sigma1 = par("sigma1") mu2 = par("mu2") sigma2 = par("sigma2")...
from numpy.random import normal from numpy import linspace, array, append import matplotlib.pyplot as plt from scipy.stats import norm from time import clock from pandas import DataFrame from mle import Normal, var, par, Mix2 x = var("x") mu1 = par("mu1") sigma1 = par("sigma1") model = Normal(x, mu1, sigma1) N = in...
mit
Python
9d83f0377abb2e16c60d475c60be112961d0c785
remove unused code
uber/pyro,uber/pyro,uber/pyro
tests/params/test_module.py
tests/params/test_module.py
import pytest import torch from torch.autograd import Variable import torch.nn as nn import pyro import pyro.distributions as dist import pyro.optim class outest(nn.Module): def __init__(self): super(outest, self).__init__() self.l0 = outer() self.l1 = nn.Linear(2, 2) self.l2 = i...
import pytest import torch from torch.autograd import Variable import torch.nn as nn import pyro import pyro.distributions as dist import pyro.optim class outest(nn.Module): def __init__(self): super(outest, self).__init__() self.l0 = outer() self.l1 = nn.Linear(2, 2) self.l2 = i...
apache-2.0
Python
dd81e8a7fa1f44b38d7ffd1b6c2c83bd2d65ea51
Fix Time subformat handling
poliastro/poliastro
src/poliastro/plotting/util.py
src/poliastro/plotting/util.py
import numpy as np # Inspired by https://astronomiac.com/color-of-each-planet-in-the-solarsystem/ BODY_COLORS = { "Sun": "#ffcc00", "Mercury": "#8c8680", "Venus": "#e6db67", "Earth": "#2a7bd1", "Moon": "#999999", "Mars": "#cc653f", "Jupiter": "#bf8f5c", "Saturn": "#decf83", "Uranus"...
import numpy as np # Inspired by https://astronomiac.com/color-of-each-planet-in-the-solarsystem/ BODY_COLORS = { "Sun": "#ffcc00", "Mercury": "#8c8680", "Venus": "#e6db67", "Earth": "#2a7bd1", "Moon": "#999999", "Mars": "#cc653f", "Jupiter": "#bf8f5c", "Saturn": "#decf83", "Uranus"...
mit
Python
f44de42b85783506894e9eaec8c0c6b7454bb549
check netns fd leaks
roolebo/pyroute2,drzaeus77/pyroute2,drzaeus77/pyroute2,roolebo/pyroute2
tests/general/test_stress.py
tests/general/test_stress.py
from pyroute2 import IPRoute from pyroute2 import IPDB from pyroute2 import NetNS RESPAWNS = 1200 class TestRespawn(object): def test_respawn_iproute_sync(self): for _ in range(RESPAWNS): with IPRoute() as i: i.bind() i.link_lookup(ifname='lo') def test_r...
from pyroute2 import IPRoute from pyroute2 import IPDB RESPAWNS = 1200 class TestRespawn(object): def test_respawn_iproute_sync(self): for _ in range(RESPAWNS): with IPRoute() as i: i.bind() i.link_lookup(ifname='lo') def test_respawn_iproute_async(self):...
apache-2.0
Python
67069b89e958ef77c5a0a6865e826ed8c7152c7c
Add `-v` to Docker integration test commands.
Fizzadar/pyinfra,Fizzadar/pyinfra
tests/int/test_int_docker.py
tests/int/test_int_docker.py
import pytest @pytest.mark.int def test_int_docker_install_package_ubuntu(helpers): helpers.run( 'pyinfra -v @docker/ubuntu:18.04 apt.packages iftop sudo=true update=true', expected_lines=['is in beta'], ) @pytest.mark.int def test_int_docker_apk_on_alpine(helpers): helpers.run( ...
import pytest @pytest.mark.int def test_int_docker_install_package_ubuntu(helpers): helpers.run( 'pyinfra @docker/ubuntu:18.04 apt.packages iftop sudo=true update=true', expected_lines=['is in beta'], ) @pytest.mark.int def test_int_docker_apk_on_alpine(helpers): helpers.run( 'py...
mit
Python
ee5c83750092292c9f8a5203c011e857527ac877
Improve associated linked list tests
jay-tyler/data-structures,jonathanstallings/data-structures
test_linked_list.py
test_linked_list.py
from __future__ import unicode_literals import pytest import linked_list as ll @pytest.fixture def base_llist(): return ll.LinkedList([1, 2, 3]) def test_construct_from_iterable_valid(base_llist): expected_output = "(1, 2, 3)" assert base_llist.display() == expected_output def test_construct_from_nest...
from __future__ import unicode_literals import pytest import linked_list as ll @pytest.fixture def base_llist(): return ll.LinkedList([1, 2, 3]) def test_construct_from_iterable_valid(base_llist): expected_output = "(1, 2, 3)" assert base_llist.display() == expected_output def test_construct_from_nest...
mit
Python
f6ccea97727f3d003b61ed59d6bb0da9589b4200
save SQL query on meetup_count
DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls,patjouk/djangogirls
core/context_processors.py
core/context_processors.py
from django.db.models import Sum from .models import Event, Postmortem from jobs.models import Meetup def statistics(request): future_events = Event.objects.future() past_events = Event.objects.past() countries = Event.objects.values('country').distinct() attendees = Postmortem.objects.all().aggregat...
from django.db.models import Sum from .models import Event, Postmortem from jobs.models import Meetup def statistics(request): future_events = Event.objects.future() past_events = Event.objects.past() countries = Event.objects.values('country').distinct() attendees = Postmortem.objects.all().aggregat...
bsd-3-clause
Python
3aae511fa6d0f232fc56f1f69dce487da6da2dad
add numpy/networkx imports to util
mschubert/python-obo
obo/util.py
obo/util.py
import numpy as np import networkx as nx def getAllSuccessors(G, nodeId): successors = dfs_successors(G, source=nodeId).values() return set(it.chain.from_iterable(it.repeat(x,1) if isinstance(x,str) else x for x in successors)) def getAllPredecessors(G, nodeId): return getAllSuccessors(G.reverse()...
def getAllSuccessors(G, nodeId): successors = dfs_successors(G, source=nodeId).values() return set(it.chain.from_iterable(it.repeat(x,1) if isinstance(x,str) else x for x in successors)) def getAllPredecessors(G, nodeId): return getAllSuccessors(G.reverse(), nodeId) def coarsenIdentifiers(G, nodes...
mit
Python
b1b4e32d0b18f0578340383ab19f4bf68ae36807
Update __init__.py
edx/edx-enterprise,edx/edx-enterprise,edx/edx-enterprise
enterprise/__init__.py
enterprise/__init__.py
""" Your project description goes here. """ from __future__ import absolute_import, unicode_literals __version__ = "0.53.10" default_app_config = "enterprise.apps.EnterpriseConfig" # pylint: disable=invalid-name
""" Your project description goes here. """ from __future__ import absolute_import, unicode_literals __version__ = "0.53.9" default_app_config = "enterprise.apps.EnterpriseConfig" # pylint: disable=invalid-name
agpl-3.0
Python
c4eb464e9cbf75ada7163e1d1e2655b289f45f44
Bump 4.0.0
erkghlerngm44/r-anime-soulmate-finder
soulmate_finder/const.py
soulmate_finder/const.py
VERSION = "4.0.0" HEADERS = ["reddit", "mal", "affinity", "shared"] LOGGING_FORMAT = "%(message)s" REGEX = "myanimelist\.net/(?:profile|animelist)/([a-z0-9_-]+)" ROUND_AFFINITIES_TO = 2 WAIT_BETWEEN_REQUESTS = 2 RETRY_AFTER_FAILED_REQUEST = 5 class PUSHSHIFT_ENDPOINTS: # noqa: E302 COMMENT_IDS = "https://api...
VERSION = "3.0.0" HEADERS = ["reddit", "mal", "affinity", "shared"] LOGGING_FORMAT = "%(message)s" REGEX = "myanimelist\.net/(?:profile|animelist)/([a-z0-9_-]+)" ROUND_AFFINITIES_TO = 2 WAIT_BETWEEN_REQUESTS = 2 RETRY_AFTER_FAILED_REQUEST = 5 class PUSHSHIFT_ENDPOINTS: # noqa: E302 COMMENT_IDS = "https://api...
mit
Python
3f26d3c53f4bff36ec05da7a51a026b7d3ba5517
Remove unnecessary testing code from atbash
CameronLonsdale/lantern
tests/modules/test_atbash.py
tests/modules/test_atbash.py
"""Tests for the Caeser module""" from lantern.modules import atbash def test_decrypt(): """Test decryption""" assert atbash.decrypt("uozt{Yzybolm}") == "flag{Babylon}" def test_encrypt(): """Test encryption""" assert ''.join(atbash.encrypt("flag{Babylon}")) == "uozt{Yzybolm}"
"""Tests for the Caeser module""" import pycipher from lantern.modules import atbash def _test_atbash(plaintext, *fitness_functions, top_n=1): ciphertext = pycipher.Atbash().encipher(plaintext, keep_punct=True) decryption = atbash.decrypt(ciphertext) assert decryption == plaintext.upper() def test_de...
mit
Python
fe12738ea3c108c9558d49e1721e656eee062f18
Add tmux
spanners/dotfiles
fabfile.py
fabfile.py
from fabric.api import local vim_bundles = [ { 'git': 'git://github.com/altercation/vim-colors-solarized.git', 'path': '~/.vim/bundle/vim-colors-solarized' }, { 'git': 'git://github.com/mileszs/ack.vim.git', 'path': '~/.vim/bundle/ack.vim' }, { 'git': 'git://...
from fabric.api import local vim_bundles = [ { 'git': 'git://github.com/altercation/vim-colors-solarized.git', 'path': '~/.vim/bundle/vim-colors-solarized' }, { 'git': 'git://github.com/mileszs/ack.vim.git', 'path': '~/.vim/bundle/ack.vim' }, { 'git': 'git://...
unlicense
Python
51c2c52067f3d58b022a7aeda3ca05c9de6fbf34
Update analyses command
PsyBorgs/redditanalyser,PsyBorgs/redditanalyser
fabfile.py
fabfile.py
# -*- coding: utf-8 -*- import os import sys from contextlib import contextmanager from fabric.api import local, lcd, prefix, env BASE_DIR = os.path.join(os.path.dirname(__file__)) ENV_DIR = os.path.join(BASE_DIR, 'env') LIB_DIR = os.path.join(BASE_DIR, 'lib') @contextmanager def virtualenv(): if sys.platform ...
# -*- coding: utf-8 -*- import os import sys from contextlib import contextmanager from fabric.api import local, lcd, prefix, env BASE_DIR = os.path.join(os.path.dirname(__file__)) ENV_DIR = os.path.join(BASE_DIR, 'env') LIB_DIR = os.path.join(BASE_DIR, 'lib') @contextmanager def virtualenv(): if sys.platform ...
mit
Python
cf7c62dfb7f06fdf28a44e9f53308306b8a021cb
Update provaclient.py
MDSLab/python-iotronicclient
iotronicclient/provaclient.py
iotronicclient/provaclient.py
from iotronicclient import client kwargs={'os_username': 'admin', 'os_user_domain_name': '', 'os_cacert': None, 'os_tenant_name': 'admin', 'os_user_domain_id': 'default', 'os_iotronic_api_version': None, 'os_password': '<PASSWORD>', 'os_cert': None, 'os_project_id': '', 'retry_interval': 2, 'os_tenant_id': '', 'os_pro...
from iotronicclient import client kwargs={'os_username': 'admin', 'os_user_domain_name': '', 'os_cacert': None, 'os_tenant_name': 'admin', 'os_user_domain_id': 'default', 'os_iotronic_api_version': None, 'os_password': '0penstack!', 'os_cert': None, 'os_project_id': '', 'retry_interval': 2, 'os_tenant_id': '', 'os_pro...
apache-2.0
Python
0f89d5a7cd11dbb06e48adab1f39391e6e3cd3bc
Update __init__.py
patrick-kidger/equinox
equinox/nn/__init__.py
equinox/nn/__init__.py
from .composed import MLP, Sequential from .conv import Conv1d, Conv2d, Conv3d, Conv from .dropout import Dropout from .linear import Identity, Linear from .rnn import GRUCell, LSTMCell
from .composed import MLP, Sequential from .dropout import Dropout from .linear import Identity, Linear from .rnn import GRUCell, LSTMCell from .conv import Conv1d, Conv2d, Conv3d, Conv
apache-2.0
Python
2c7065f82a242e6f05eaefda4ec902ddf9d90037
Update test for Stan 2.29
stan-dev/pystan,stan-dev/pystan
tests/test_stanc_warnings.py
tests/test_stanc_warnings.py
"""Test that stanc warnings are visible.""" import contextlib import io import stan def test_stanc_no_warning() -> None: """No warnings.""" program_code = "parameters {real y;} model {y ~ normal(0,1);}" buffer = io.StringIO() with contextlib.redirect_stderr(buffer): stan.build(program_code=pr...
"""Test that stanc warnings are visible.""" import contextlib import io import stan def test_stanc_no_warning() -> None: """No warnings.""" program_code = "parameters {real y;} model {y ~ normal(0,1);}" buffer = io.StringIO() with contextlib.redirect_stderr(buffer): stan.build(program_code=pr...
isc
Python
41fdbaee815a0fafcecddb8874ef47617cd111e6
update is a task.
YorickPeterse/yorickpeterse.com,YorickPeterse/yorickpeterse.com
fabfile.py
fabfile.py
from fabric.api import * from fabric_modules import common from fabric_modules import runit env.hosts = ['yorickpeterse@stewie.yorickpeterse.com'] env.deployment_dir = '/home/yorickpeterse/domains/yorickpeterse.com' env.repository = 'git://github.com/YorickPeterse/yorickpeterse.com.git' env.config_fil...
from fabric.api import * from fabric_modules import common from fabric_modules import runit env.hosts = ['yorickpeterse@stewie.yorickpeterse.com'] env.deployment_dir = '/home/yorickpeterse/domains/yorickpeterse.com' env.repository = 'git://github.com/YorickPeterse/yorickpeterse.com.git' env.config_fil...
mpl-2.0
Python
142ecb37a1801a70540905345a04707620ec7c4d
unify local & remote functions
kelvan/freieit,kelvan/freieit
fabfile.py
fabfile.py
#!/usr/bin/env python from fabric.api import * from contextlib import contextmanager as _contextmanager from sys import executable as sys_executable @_contextmanager def virtualenv(): with env.cd(env.directory): with prefix(env.activate): yield def prep(): if env.host_string == 'localhos...
from fabric.api import * #from fabric.contrib import django #django.project('freieit') #from freieit.models import ExpertProfile def production(): env.hosts = ['freie.it'] env.directory = 'freieit' env.user = 'kelvan' env.deploy_user = 'kelvan' env.activate = '. /home/kelvan/.virtualenvs/freieit/b...
agpl-3.0
Python
4c0411b20a0dd45ae6a8ba6c84c3e43dad7de23b
Add fab cloc command to count lines of source code
ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai
fabfile.py
fabfile.py
import sys from pathlib import Path from fabric.api import local, task, lcd, env from fabric.contrib.console import confirm from fabric.utils import abort src_p = Path(env.real_fabfile).parent / 'src' @task def start_db(): if sys.platform.startswith('darwin'): # Mac OSX local('postgres -D /usr/lo...
import sys from pathlib import Path from fabric.api import local, task, lcd, env from fabric.contrib.console import confirm from fabric.utils import abort src_p = Path(env.real_fabfile).parent / 'src' @task def start_db(): if sys.platform.startswith('darwin'): # Mac OSX local('postgres -D /usr/lo...
mit
Python
f668956fd37fa2fa0a0c82a8241671bf3cc306cb
Fix string using py3 only feature.
DigitalGlobe/gbdxtools,DigitalGlobe/gbdxtools
tests/unit/moto_test_data.py
tests/unit/moto_test_data.py
""" These functions are written assuming the under a moto call stack. TODO add check is a fake bucket? """ import boto3 def pre_load_s3_data(bucket_name, prefix, region='us-east-1'): s3 = boto3.client('s3', region_name=region) res = s3.create_bucket(Bucket=bucket_name) default_kwargs = {"Body": b"Fake da...
""" These functions are written assuming the under a moto call stack. TODO add check is a fake bucket? """ import boto3 def pre_load_s3_data(bucket_name, prefix, region='us-east-1'): s3 = boto3.client('s3', region_name=region) res = s3.create_bucket(Bucket=bucket_name) default_kwargs = {"Body": b"Fake da...
mit
Python
3389fd6e2f6e96e2708fd25fff7a01a751fcd0ef
add option to split groups into individual CpGs
mateidavid/nanopolish,mateidavid/nanopolish,jts/nanopolish,jts/nanopolish,mateidavid/nanopolish,jts/nanopolish,mateidavid/nanopolish,mateidavid/nanopolish,jts/nanopolish,jts/nanopolish
scripts/calculate_methylation_frequency.py
scripts/calculate_methylation_frequency.py
#! /usr/bin/env python import math import sys import csv import argparse from collections import namedtuple def make_key(c, s, e): return c + ":" + str(s) + ":" + str(e) class SiteStats: def __init__(self, g_size, g_seq): self.num_reads = 0 self.posterior_methylated = 0 self.called_si...
#! /usr/bin/env python import math import sys import csv import argparse from collections import namedtuple class SiteStats: def __init__(self, g_size, g_seq): self.num_reads = 0 self.posterior_methylated = 0 self.called_sites = 0 self.called_sites_methylated = 0 self.group...
mit
Python
373d121d7ad5fb5ec60e1e0dc5247c55eb11a984
Improve NoMatchingOverload exception details
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
thinglang/compiler/errors.py
thinglang/compiler/errors.py
from thinglang.utils.exception_utils import ThinglangException class TargetNotCallable(ThinglangException): """ An attempt was made to call a target which is not a method, or is not callable. For example, attempting to call a class member """ class CapturedVoidMethod(ThinglangException): """ ...
from thinglang.utils.exception_utils import ThinglangException class TargetNotCallable(ThinglangException): """ An attempt was made to call a target which is not a method, or is not callable. For example, attempting to call a class member """ class CapturedVoidMethod(ThinglangException): """ ...
mit
Python
6f7fdda3bb61bda4baefaf7e882eeecea7c6c6f1
Undo breaking filter changes
kpj/SDEMotif,kpj/SDEMotif
filters.py
filters.py
""" General data filters. An entry is filtered if a filter returns True """ import numpy as np def filter_steady_state(ss, filter_mask=None, min_thres=1e-10, min_inc=1): """ Discard steady states which are trivial (~= `min_thres`) or diverge (differences increase by at least `min_inc`) """ fss = np.copy(...
""" General data filters. An entry is filtered if a filter returns True """ import numpy as np def filter_steady_state(ss, filter_mask=None, min_thres=1e-10, min_inc=1e-1): """ Discard steady states which are trivial (~= `min_thres`) or diverge (differences increase by at least `min_inc`) """ fss = np.co...
mit
Python
03b685055037283279394d940602520c5ff7a817
Fix indentation problem and line length (PEP8)
treyhunner/django-email-log,treyhunner/django-email-log
email_log/models.py
email_log/models.py
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @python_2_unicode_compatible class Email(models.Model): """Model to store outgoing email information""" from_email = mod...
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @python_2_unicode_compatible class Email(models.Model): """Model to store outgoing email information""" from_email = mod...
mit
Python
9cbb73371db450599b7a3a964ab43f2f717b8bb7
Remove application flag, not an application
OCA/connector,OCA/connector
connector/__manifest__.py
connector/__manifest__.py
# -*- coding: utf-8 -*- # Copyright 2013-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector', 'version': '10.0.1.0.0', 'author': 'Camptocamp,Openerp Connector Core Editors,' 'Odoo Community Association (OCA)', 'website': 'http://odoo-connector.com',...
# -*- coding: utf-8 -*- # Copyright 2013-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector', 'version': '10.0.1.0.0', 'author': 'Camptocamp,Openerp Connector Core Editors,' 'Odoo Community Association (OCA)', 'website': 'http://odoo-connector.com',...
agpl-3.0
Python
1c7b36d61cc157671d1cdafdf65d9838f5f284bc
Use a better name
louisswarren/hieretikz
constructive_hierarchy.py
constructive_hierarchy.py
'''Reason about a directed graph in which the (non-)existance of some edges must be inferred by the disconnectedness of certain vertices. Collect (truthy) evidence for boolean function return values.''' def transitive_closure_dict(vertices, edges): '''Find the transitive closure of a dict mapping vertices to their...
'''Reason about a directed graph in which the (non-)existance of some edges must be inferred by the disconnectedness of certain vertices. Collect (truthy) evidence for boolean function return values.''' def transitive_closure_dict(vertices, edges): '''Find the transitive closure of a dict mapping vertices to their...
mit
Python
aa645ca9d561060851ca7f98fd6c12e108fe7674
sort plugins alphabetically to avoid random ordering
kbase/assembly,kbase/assembly,kbase/assembly,kbase/assembly
tools/update_plugin_json.py
tools/update_plugin_json.py
#! /usr/bin/env python from ConfigParser import SafeConfigParser import os import json import re PLUGIN_DIR = '../lib/assembly/plugins/' OUT_JSON = 'ar_modules.json' plugin_configs = [p for p in sorted(os.listdir(PLUGIN_DIR)) if re.search('-plugin', p)] plugins_data = [] for plugin_config in plugi...
#! /usr/bin/env python from ConfigParser import SafeConfigParser import os import json import re PLUGIN_DIR = '../lib/assembly/plugins/' OUT_JSON = 'ar_modules.json' plugin_configs = [p for p in os.listdir(PLUGIN_DIR) if re.search('-plugin', p)] plugins_data = [] for plugin_config in plugin_confi...
mit
Python
15dfbaa2bf818365fc34bcea1b54b4d976e6ae1b
Rename test case
tamland/pykka,jodal/pykka,tempbottle/pykka
tests/proxy_test.py
tests/proxy_test.py
import unittest from pykka import Actor class ProxyDirTest(unittest.TestCase): def setUp(self): class ActorWithAttributesAndCallables(Actor): foo = 'bar' def __init__(self): super(ActorWithAttributesAndCallables, self).__init__() self.baz = 'quox' ...
import unittest from pykka import Actor class ActorProxyTest(unittest.TestCase): def setUp(self): class ActorWithAttributesAndCallables(Actor): foo = 'bar' def __init__(self): super(ActorWithAttributesAndCallables, self).__init__() self.baz = 'quox' ...
apache-2.0
Python
3b4ff9b3883f1f7d197a7a3624cfd45c8b6b0380
Remove redirect to my_rsr from index view
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
akvo/rsr/views/__init__.py
akvo/rsr/views/__init__.py
# -*- coding: utf-8 -*- """Akvo RSR 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 django.core.urlresolvers import...
# -*- coding: utf-8 -*- """Akvo RSR 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 django.core.urlresolvers import...
agpl-3.0
Python
87a26508b63a33ec0b5296fb70c02d83c68982f3
Update Azure login to use OpenID Connect (#220)
alerta/python-alerta,alerta/python-alerta-client,alerta/python-alerta-client
alertaclient/auth/azure.py
alertaclient/auth/azure.py
import webbrowser from uuid import uuid4 from alertaclient.auth.token import TokenHandler def login(client, azure_tenant, client_id): xsrf_token = str(uuid4()) redirect_uri = 'http://localhost:9004' url = ( 'https://login.microsoftonline.com/{azure_tenant}/oauth2/v2.0/authorize?' 'respon...
import webbrowser from uuid import uuid4 from alertaclient.auth.token import TokenHandler def login(client, azure_tenant, client_id): xsrf_token = str(uuid4()) redirect_uri = 'http://localhost:9004' url = ( 'https://login.microsoftonline.com/{azure_tenant}/oauth2/authorize?' 'response_ty...
apache-2.0
Python
ad6bb5b787b4b959ff24c71122fc6f4d1a7e7ff9
Add top-level cli debugging and verbosity options
open2c/cooltools
cooltools/cli/__init__.py
cooltools/cli/__init__.py
# -*- coding: utf-8 -*- from __future__ import division, print_function import click import sys from .. import __version__ # Monkey patch click.core._verify_python3_env = lambda: None CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.version_option(version=__version__) @click.group(context_...
# -*- coding: utf-8 -*- from __future__ import division, print_function import click from .. import __version__ # Monkey patch click.core._verify_python3_env = lambda: None CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.version_option(version=__version__) @click.group(context_settings=CO...
mit
Python
efab6ea568c11411d901249d7660765cd987b532
Extend example to include non-ASCII characters
Schevo/kiwi,Schevo/kiwi,Schevo/kiwi
examples/completion.py
examples/completion.py
# encoding: iso-8859-1 import gtk from kiwi.ui.widgets.entry import Entry def on_entry_activate(entry): print 'You selected:', entry.get_text().encode('latin1') gtk.main_quit() entry = Entry() entry.connect('activate', on_entry_activate) entry.set_completion_strings(['Belo Horizonte', ...
import gtk from kiwi.ui.widgets.entry import Entry entry = Entry() entry.set_completion_strings(['apa', 'apapa', 'apbla', 'apppa', 'aaspa']) win = gtk.Window() win.connect('delete-event', gtk.main_quit) win.add(entry) win.show_all() gtk.main()
lgpl-2.1
Python
7bc02817110ced216a0981560b2713d990c1edb2
use unicode to write .gitignore
divmain/GitSavvy,divmain/GitSavvy,divmain/GitSavvy
core/git_mixins/ignore.py
core/git_mixins/ignore.py
import os from ...common import util linesep = None class IgnoreMixin(): def add_ignore(self, path_or_pattern): """ Add the provided relative path or pattern to the repo's `.gitignore` file. """ global linesep if not linesep: # Use native line ending on Wind...
import os from ...common import util linesep = None class IgnoreMixin(): def add_ignore(self, path_or_pattern): """ Add the provided relative path or pattern to the repo's `.gitignore` file. """ global linesep if not linesep: # Use native line ending on Wind...
mit
Python
8cbec046ce96b5e54d53d5fba95aa32ce8c3c983
test Converter
BrianHicks/perch,BrianHicks/perch
tests/test_bases.py
tests/test_bases.py
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from StringIO import StringIO except ImportError: from io import StringIO import pytest from perch.bases import StdIOHandler, Converter @pytest.fixture def stubbedio(): class Stubbed(StdIOHandler): name = 'test' input_tags = ['a', 'b'] ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from perch.bases import StdIOHandler, Converter @pytest.fixture def stubbedio(): class Stubbed(StdIOHandler): name = 'test' input_tags = ['a', 'b'] def process(self, infile): yield {'msg': 'a'} yield {'msg...
bsd-3-clause
Python
c06c23c6815e3e844526459ffb5835a8a9c24069
support translating the "verify number" message
dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttar...
corehq/apps/sms/verify.py
corehq/apps/sms/verify.py
from django.utils import translation from django.utils.translation import ugettext as _, ugettext_noop from corehq.apps.sms.api import send_sms, send_sms_to_verified_number from corehq.apps.sms.mixin import VerifiedNumber, MobileBackend from corehq.apps.users.models import CommCareUser from corehq.apps.sms import util ...
from corehq.apps.sms.api import send_sms, send_sms_to_verified_number from corehq.apps.sms.mixin import VerifiedNumber, CommCareMobileContactMixin, MobileBackend from corehq.apps.users.models import CommCareUser from corehq.apps.sms import util OUTGOING = "Welcome to CommCareHQ! Is this phone used by %(name)s? If yes,...
bsd-3-clause
Python
0f46811c306444713926c36d9645bb190fae49f8
Update examples
sonusz/PhasorToolBox
examples/freq_meter.py
examples/freq_meter.py
#!/usr/bin/env python3 """ This is an real-time frequency meter of two PMUs. This code connects to two PMUs, plot the frequency of the past 300 time-stamps and update the plot in real-time. """ from phasortoolbox import PDC,Client import matplotlib.pyplot as plt import numpy as np import gc import logging logging.bas...
#!/usr/bin/env python3 from phasortoolbox import PDC,Client import matplotlib.pyplot as plt import numpy as np import gc import logging logging.basicConfig(level=logging.DEBUG) class FreqMeter(object): def __init__(self): x = np.linspace(-10.0, 0.0, num=300, endpoint=False) y = [60.0]*300 ...
mit
Python
886ca062f18c6884b4d07897c4d9c7ecf0e3f05b
change recommendation view to use its own serializer
lucashanke/houseofdota,lucashanke/houseofdota,lucashanke/houseofdota
app/api/statistics_view.py
app/api/statistics_view.py
from rest_framework.response import Response from rest_framework.decorators import api_view from app.services.statistics_service import StatisticsService from app.serializers.statistics_serializer import * from app.repositories.patch_repository import PatchRepository @api_view() def heroes_statistics(request): bu...
from rest_framework.response import Response from rest_framework.decorators import api_view from app.services.statistics_service import StatisticsService from app.serializers.statistics_serializer import * from app.repositories.patch_repository import PatchRepository @api_view() def heroes_statistics(request): bu...
mit
Python
44dcd58c18ffa2cfcf6014bac6a800cd6b23c2ec
Add trailing / in paver help when linking to the admin page
bdaroz/the-blue-alliance,tsteward/the-blue-alliance,tsteward/the-blue-alliance,verycumbersome/the-blue-alliance,phil-lopreiato/the-blue-alliance,tsteward/the-blue-alliance,the-blue-alliance/the-blue-alliance,bdaroz/the-blue-alliance,synth3tk/the-blue-alliance,nwalters512/the-blue-alliance,bvisness/the-blue-alliance,syn...
pavement.py
pavement.py
# Easy paver commands for less command typing and more coding. # Visit http://paver.github.com/paver/ to get started. - @brandondean Sept. 30 import subprocess import json import time from paver.easy import * path = path("./") @task def javascript(): """Combine Compress Javascript""" print("Combining and Comp...
# Easy paver commands for less command typing and more coding. # Visit http://paver.github.com/paver/ to get started. - @brandondean Sept. 30 import subprocess import json import time from paver.easy import * path = path("./") @task def javascript(): """Combine Compress Javascript""" print("Combining and Comp...
mit
Python
e19abf3d9cee76b125f81fafbe38f29b4c976ecb
Simplify get_complete_position.
autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L...
rplugin/python3/deoplete/sources/LanguageClientSource.py
rplugin/python3/deoplete/sources/LanguageClientSource.py
import re import sys from os import path from typing import Dict from .base import Base LanguageClientPath = path.dirname(path.dirname(path.dirname( path.realpath(__file__)))) # TODO: use relative path. sys.path.append(LanguageClientPath) from LanguageClient import ( LanguageClient, CompletionItemKind, lo...
import re import sys from os import path from typing import Dict from .base import Base LanguageClientPath = path.dirname(path.dirname(path.dirname( path.realpath(__file__)))) # TODO: use relative path. sys.path.append(LanguageClientPath) from LanguageClient import ( LanguageClient, CompletionItemKind, lo...
mit
Python
d02104cc4ed014335c303fcd87c921ab934e6b91
Use PatchMixin in the logic test too.
NYCPython/wheretomeetup
tests/test_logic.py
tests/test_logic.py
from unittest import TestCase import meetups import mock from meetups import logic from tests.utils import PatchMixin class TestUserSync(TestCase, PatchMixin): def setUp(self): self.meetup = self.patch("meetups.logic.meetup") self.user = mock.NonCallableMock() def test_refreshes_if_needed(s...
from unittest import TestCase import meetups import mock from meetups import logic class TestUserSync(TestCase): def setUp(self): self.user = mock.NonCallableMock() meetup_patch = mock.patch("meetups.logic.meetup") self.meetup = meetup_patch.start() self.addCleanup(meetup_patch....
bsd-3-clause
Python
0a4fb2f49b07ac0d85c7f58bc0836e40e252555d
update documentation
andrewlehmann/autoweather
tests/test_mongo.py
tests/test_mongo.py
import unittest from .context import mongo class Test(unittest.TestCase): def test_testConnection(self): connection_info = ['ds159507.mlab.com', 59507] client = mongo.pymongo.MongoClient(*connection_info) self.assertEqual(client, mongo.connection()) def test_insert(self): # add extr...
import unittest from .context import mongo class Test(unittest.TestCase): def test_testConnection(self): connection_info = ['ds159507.mlab.com', 59507] client = mongo.pymongo.MongoClient(*connection_info) self.assertEqual(client, mongo.connection()) def test_insert(self): # add extr...
mit
Python
02294373de57aa9b485e33f6490df24ff964d2e2
add test for non-interactive publish
eyeye/yotta,autopulated/yotta,eyeye/yotta,BlackstoneEngineering/yotta,BlackstoneEngineering/yotta,autopulated/yotta,stevenewey/yotta,stevenewey/yotta,ARMmbed/yotta,ARMmbed/yotta
yotta/test/cli/publish.py
yotta/test/cli/publish.py
#!/usr/bin/env python # Copyright 2014-2015 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , import unittest import os import subprocess from collections import namedtuple import tempfile # internal modules: from yotta.lib.fsutils import m...
#!/usr/bin/env python # Copyright 2014-2015 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , import unittest import os import subprocess from collections import namedtuple import tempfile # internal modules: from yotta.lib.fsutils import m...
apache-2.0
Python
4ae19cc2e3398cde6c0ffd8ddfded911f0449379
Add parser tests
DanielOaks/girc,DanielOaks/girc
tests/test_parse.py
tests/test_parse.py
import unittest import parser_tests.data from girc.ircreactor.envelope import RFC1459Message from girc.utils import NickMask, validate_hostname class ParserTestCase(unittest.TestCase): def test_msg_split(self): for data in parser_tests.data.msg_split['tests']: input_txt = data['input'] ...
isc
Python
8ba1ad94698db70c14d12fc3518efe19fbcd2a2f
update pub2fanfou.py
ifduyue/urlfetch
examples/pub2fanfou.py
examples/pub2fanfou.py
#coding: utf8 import urlfetch import re def pub2fanfou(username, password, status): #获取表单token response = urlfetch.fetch("http://m.fanfou.com/") token = re.search('''name="token".*?value="(.*?)"''', response.body).group(1) #登录 response = urlfetch.fetch( "http://m.fanfou.com/", ...
#coding: utf8 import urlfetch import re def pub2fanfou(username, password, status): #获取表单token response = urlfetch.fetch( "http://m.fanfou.com/" ) token = re.search('''name="token".*?value="(.*?)"''', response.body).group(1) #登录 response = urlfetch.fetch( "http://m.fanfou....
bsd-2-clause
Python
602cfca53f0dd95409f3a54e09274d2c7e4e85d3
add stdout to basic logger
meyersj/geotweet,meyersj/geotweet,meyersj/geotweet
geotweet/log.py
geotweet/log.py
import logging from logging.handlers import TimedRotatingFileHandler import os import sys LOG_NAME = 'geotweet' LOG_FILE = os.getenv('GEOTWEET_LOG', '/tmp/geotweet.log') LOG_LEVEL = logging.DEBUG TWITTER_LOG_NAME = 'twitter-stream' def get_logger(): logformat = '%(levelname)s %(pathname)s %(asctime)s: %(message...
import logging from logging.handlers import TimedRotatingFileHandler import os LOG_NAME = 'geotweet' LOG_FILE = os.getenv('GEOTWEET_LOG', '/tmp/geotweet.log') LOG_LEVEL = logging.DEBUG TWITTER_LOG_NAME = 'twitter-stream' def get_logger(): logger = logging.getLogger(LOG_NAME) logger.setLevel(LOG_LEVEL) f...
mit
Python
0c8f9b684b4cbb1f800b497d40696234a7fb951c
Tidy package init docs
orome/crypto-enigma-py
crypto_enigma/__init__.py
crypto_enigma/__init__.py
#!/usr/bin/env python # encoding: utf8 """An Enigma machine simulator with rich textual display functionality for Python 2.7. Currently support is only provided for those `machine models`_ in most widespread general use during the war years: the `I`_, `M3`_, and `M4`_. Limitations ~~~~~~~~~~~ Note that the correct ...
#!/usr/bin/env python # encoding: utf8 """An Enigma machine simulator with rich textual display functionality. Limitations ~~~~~~~~~~~ Note that the correct display of some characters used to represent components (thin Naval rotors) assumes support for Unicode, while some aspects of the display of machine state depe...
bsd-3-clause
Python
934e34c15e6d98c70b371ea3a5ad4ffe9fa24f41
Fix tests; add test for any_of type
STANAPO/hug,jean/hug,timothycrosley/hug,gbn972/hug,alisaifee/hug,STANAPO/hug,origingod/hug,giserh/hug,MuhammadAlkarouri/hug,shaunstanislaus/hug,MuhammadAlkarouri/hug,philiptzou/hug,alisaifee/hug,janusnic/hug,janusnic/hug,giserh/hug,philiptzou/hug,jean/hug,yasoob/hug,yasoob/hug,origingod/hug,shaunstanislaus/hug,Muhammad...
tests/test_types.py
tests/test_types.py
"""tests/test_types.py. Tests the type validators included with hug Copyright (C) 2015 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including witho...
"""tests/test_types.py. Tests the type validators included with hug Copyright (C) 2015 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including witho...
mit
Python
4a3d5aec903b770947a2773cf2285fd9c1652f19
Add logging to server object.
sunfall/giles
giles/server.py
giles/server.py
# Giles: server.py # Copyright 2012 Phil Bordelon # # 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 # License, or (at your option) any later version. # This progr...
# Giles: server.py # Copyright 2012 Phil Bordelon # # 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 # License, or (at your option) any later version. # This progr...
agpl-3.0
Python
4ee4ab219dab1fb54e4613b4abfb037dc4e12342
Refactor generate command to smaller parts
MeirKriheli/statirator,MeirKriheli/statirator,MeirKriheli/statirator
statirator/core/management/commands/generate.py
statirator/core/management/commands/generate.py
from __future__ import print_function import logging from django.core.management import call_command from django.core.management.base import BaseCommand from statirator.core.utils import find_readers class Command(BaseCommand): help = "Walk the resources, builds the db, and generates the static site" def h...
from __future__ import print_function import logging from django.core.management import call_command from django.core.management.base import BaseCommand from statirator.core.utils import find_readers class Command(BaseCommand): help = "Walk the resources, builds the db, and generates the static site" def h...
mit
Python
77a5512520db82c8fadca2768ee6b97c78f07223
fix typo.
abadger/Bento,abadger/Bento,abadger/Bento,cournape/Bento,cournape/Bento,cournape/Bento,abadger/Bento,cournape/Bento
tests/test_utils.py
tests/test_utils.py
import os import unittest import tempfile import shutil from os.path import \ join from nose.tools import \ assert_equal from toydist.core.utils import \ validate_glob_pattern, expand_glob, subst_vars class TestParseGlob(unittest.TestCase): def test_invalid(self): # Test we raise a ValueError...
import os import unittest import tempfile import shutil from os.path import \ join from nose.tools import \ assert_equal from toydist.core.utils import \ validate_glob_pattern, expand_glob, subst_vars class TestParseGlob(unittest.TestCase): def test_invalid(self): # Test we raise a ValueError...
bsd-3-clause
Python
b25164e69d255beae1a76a9e1f7168a436a81f38
Test isexecutable check in utils.Shell
silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock
tests/test_utils.py
tests/test_utils.py
import helper from rock import utils from rock.exceptions import ConfigError class UtilsTestCase(helper.unittest.TestCase): def test_shell(self): utils.Shell.run = lambda self: self s = utils.Shell() self.assertTrue(isinstance(s.__enter__(), utils.Shell)) s.write('ok') s._...
import helper from rock import utils class UtilsTestCase(helper.unittest.TestCase): def test_shell(self): utils.Shell.run = lambda self: self s = utils.Shell() self.assertTrue(isinstance(s.__enter__(), utils.Shell)) s.write('ok') s.__exit__(None, None, None) self.a...
mit
Python
3df61460d6097cbf3c65a67745b45ac5c163bc4d
change typo iso_string_to_datetime to iso_string_to_date
qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq
custom/m4change/fields.py
custom/m4change/fields.py
import datetime from corehq.util.dates import iso_string_to_date from dimagi.utils.dates import DateSpan import json from django.utils.translation import ugettext as _, ugettext_noop from corehq.apps.reports.dont_use.fields import ReportField class DateRangeField(ReportField): name = ugettext_noop("Date Range") ...
import datetime from corehq.util.dates import iso_string_to_datetime from dimagi.utils.dates import DateSpan import json from django.utils.translation import ugettext as _, ugettext_noop from corehq.apps.reports.dont_use.fields import ReportField class DateRangeField(ReportField): name = ugettext_noop("Date Range...
bsd-3-clause
Python
352065f4f68855a23ce319ffa0d984db83214900
Complete ord diff sol
bowen0701/algorithms_data_structures
lc0389_find_the_difference.py
lc0389_find_the_difference.py
"""Leetcode 389. Find the Difference Easy URL: https://leetcode.com/problems/find-the-difference/ Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: I...
"""Leetcode 389. Find the Difference Easy URL: https://leetcode.com/problems/find-the-difference/ Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: I...
bsd-2-clause
Python
91569dbe0525f529fe63be65bee79abd5084f59a
include the license in the distribution
slideinc/sendmsg,slideinc/sendmsg
pavement.py
pavement.py
import errno import os from setuptools import Extension from paver.easy import * from paver.path import path from paver.setuputils import setup setup( name="sendmsg", description="send file descriptors over AF_UNIX sockets via sendmsg(2)", version="1.0", ext_modules=[Extension( 'sendmsg', ...
import errno import os from setuptools import Extension from paver.easy import * from paver.path import path from paver.setuputils import setup setup( name="sendmsg", description="send file descriptors over AF_UNIX sockets via sendmsg(2)", version="1.0", ext_modules=[Extension( 'sendmsg', ...
bsd-3-clause
Python
3b92da71b700c0474b5041a8ed7b37cc73baf891
Make EMPTY test less interactive
infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore
tests/text/EMPTY.py
tests/text/EMPTY.py
#!/usr/bin/env python '''Test that an empty document doesn't break. Press ESC to exit the test. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: STYLE.py 1754 2008-02-10 13:26:52Z Alex.Holkner $' __noninteractive = True import unittest from pyglet import app from pyglet import gl from pyglet import grap...
#!/usr/bin/env python '''Test that an empty document doesn't break. Press ESC to exit the test. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: STYLE.py 1754 2008-02-10 13:26:52Z Alex.Holkner $' __noninteractive = True import unittest from pyglet import app from pyglet import gl from pyglet import grap...
bsd-3-clause
Python
f9bea0f4f327992acac24de522a670b424fb0342
Update token view corresponding to constant change
WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos
lexos/views/tokenizer_view.py
lexos/views/tokenizer_view.py
from flask import session, Blueprint, render_template from lexos.helpers import constants as constants from lexos.managers import session_manager from lexos.models.filemanager_model import FileManagerModel from lexos.models.tokenizer_model import TokenizerModel from lexos.views.base_view import detect_active_docs # t...
from flask import session, Blueprint, render_template from lexos.helpers import constants as constants from lexos.managers import session_manager from lexos.models.filemanager_model import FileManagerModel from lexos.models.tokenizer_model import TokenizerModel from lexos.views.base_view import detect_active_docs # t...
mit
Python
c32bc823728f7dcad241b2f6b5a194c7cf636f29
Fix not working docs show view. Document show view wasn't updated when the logic refactor was made.
MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging
app/soc/views/docs/show.py
app/soc/views/docs/show.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange 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...
#!/usr/bin/python2.5 # # Copyright 2008 the Melange 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...
apache-2.0
Python
6bc0922bd20e0065d9d05293abda8ae7652415b5
add a way to compress a specified group with synccompress. close #8
pdr/django-pipeline,leonardoo/django-pipeline,almost/django-pipeline,fabiosantoscode/django-pipeline,floppym/django-pipeline,lydell/django-pipeline,mgorny/django-pipeline,pombredanne/django-pipeline-1,lexqt/django-pipeline,adamcharnock/django-pipeline,mweibel/django-pipeline,Kobold/django-pipeline,Tekco/django-pipeline...
pipeline/management/commands/synccompress.py
pipeline/management/commands/synccompress.py
from optparse import make_option from django.core.management.base import BaseCommand class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--force', action='store_true', default=False, help='Force update of all files, even if the source fil...
from optparse import make_option from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): option_list = NoArgsCommand.option_list + ( make_option('--force', action='store_true', default=False, help='Force update of all files, even if the sour...
mit
Python
6fe7ca7931c69602aa9e3d5cdac39b7e2cfd3925
Rename parser_describe to parser_document
afrantzis/pixel-format-guide
pfg/main.py
pfg/main.py
import sys import argparse from . import commands def print_indented(indent, s): print(" " * indent + s) def print_memory(text, memory): header_byte = (" "*8).join([str(i) for i in range(0, len(memory))]) header_ml = "M L " * len(memory) memory_str = " ".join(memory) print(text + header_byte...
import sys import argparse from . import commands def print_indented(indent, s): print(" " * indent + s) def print_memory(text, memory): header_byte = (" "*8).join([str(i) for i in range(0, len(memory))]) header_ml = "M L " * len(memory) memory_str = " ".join(memory) print(text + header_byte...
lgpl-2.1
Python
c343edc0c5d5687abd1737e4f3fa8917acbeccd1
remove not implemented yaourt option
n0n0x/fabtools-python,bitmonk/fabtools,sociateru/fabtools,ahnjungho/fabtools,wagigi/fabtools-python,ronnix/fabtools,badele/fabtools,pombredanne/fabtools,hagai26/fabtools,davidcaste/fabtools,fabtools/fabtools,AMOSoft/fabtools,prologic/fabtools
fabtools/arch.py
fabtools/arch.py
""" Archlinux packages ================== This module provides tools to manage Archlinux packages and repositories. """ from __future__ import with_statement from fabric.api import hide, run, settings from fabtools.utils import run_as_root MANAGER = 'LC_ALL=C pacman' def update_index(quiet=True): """ Up...
""" Archlinux packages =============== This module provides tools to manage Archlinux packages and repositories. """ from __future__ import with_statement from fabric.api import hide, run, settings from fabtools.utils import run_as_root MANAGER = 'LC_ALL=C pacman' def update_index(quiet=True, yaourt=False): ...
bsd-2-clause
Python
fbc222b734a09ebec21e8dbfa46b9a3f66ef1fe8
Add font-awesome as dependency
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
apps/txtrender/widgets.py
apps/txtrender/widgets.py
""" Custom forms widget for the text rendering app. Use http://markitup.jaysalvat.com/home/ for the client-side editing front end. """ from django import forms from django.contrib.admin.widgets import AdminTextareaWidget class MarkupEditorTextarea(forms.Textarea): """ MarkitUp editor widget. """ SET...
""" Custom forms widget for the text rendering app. Use http://markitup.jaysalvat.com/home/ for the client-side editing front end. """ from django import forms from django.contrib.admin.widgets import AdminTextareaWidget class MarkupEditorTextarea(forms.Textarea): """ MarkitUp editor widget. """ SET...
agpl-3.0
Python
ca2f8080fdf4ac2ef13857b4a3b4eb2dacc568c4
fix bugs where geocoding tasks all shared a name...
lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django
src/lib/tasks.py
src/lib/tasks.py
from celery import shared_task from . import geo from events.models import Event from groups.models import SupportGroup __all__ = ['geocode_event', 'geocode_support_group'] def geocode_element(item): """Geocode an item in the background :param item: :return: """ # geocoding only if got at leas...
from celery import shared_task from . import geo from events.models import Event from groups.models import SupportGroup __all__ = ['geocode_event', 'geocode_support_group'] def geocode_element(item): """Geocode an item in the background :param item: :return: """ # geocoding only if got at leas...
agpl-3.0
Python
d293638938478c11090e511a894c8a4dea20cc9e
make conf file
epheo/octojobs
octojobs.py
octojobs.py
#!/usr/bin/python import tweepy import sys from textwrap import TextWrapper from datetime import datetime from elasticsearch import Elasticsearch import json from configuration import * es = Elasticsearch() class StreamListener(tweepy.StreamListener): def on_status(self, status): if status.author.scre...
#!/usr/bin/python import tweepy import sys from textwrap import TextWrapper from datetime import datetime from elasticsearch import Elasticsearch import json consumer_key="K5EDWoWu4k9qKyJo8DB7Ll17M" consumer_secret="DtLYzFSRI7BueM6Dj6cgSfWaF4xZIVNzgku2ZH5D4KjTGwBm1o" access_token="2821986487-eV8AA7sQE8EJejsDWNIYWUR...
apache-2.0
Python
1d5e48ba6589c90e6c06cf4597a155c58e96d9e1
Update oneguess.py
boss2608-cmis/boss2608-cmis-cs2
oneguess.py
oneguess.py
import random def numberRange(number1,number2): return random.randint(number1,number2) def PlayerResult(result,PlayersGuess): if result > PlayersGuess: sub = abs(PlayersGuess - result) return "That is over by {}".format(sub) else: add = abs(PlayersGuess + result) return "Tha...
import random minino = raw_input("What is the minimum number? ") maxino = raw_input("What is the maximum number? ") print "I'm thinking of a number from", minino, "to", maxino PlayerGuess = raw_input("What do you think it is? ")
cc0-1.0
Python
420afed508f606a4df7fa577d12b0c4b0d4c90a5
Rename start to initial_state. Add start_thread parameter.
dacut/FailoverSample
failover/background.py
failover/background.py
#!/usr/bin/env python from __future__ import absolute_import, print_function from logging import getLogger from .units import ok from .validation import validate_duration from threading import Condition, Thread log = getLogger("failover.background") class Background(Thread): """ Background(task, interval, sta...
#!/usr/bin/env python from __future__ import absolute_import, print_function from logging import getLogger from .units import ok from .validation import validate_duration from threading import Condition, Thread log = getLogger("failover.background") class Background(Thread): """ Background(task, interval, sta...
bsd-2-clause
Python
ce2da156a0363f10d516ea5e5eb865c407f5b669
Bump ver
bwhicks/PlinyProject,bwhicks/PlinyProject,bwhicks/PlinyProject,bwhicks/PlinyProject
plinyproj/__version__.py
plinyproj/__version__.py
__version_info__ = (0, 6, 0) __version__ = '.'.join([str(i) for i in __version_info__])
__version_info__ = (0, 5, 6) __version__ = '.'.join([str(i) for i in __version_info__])
mit
Python
fc14e41432fece7d724aef73dd8ad7fef5e85c9a
Add IdentityEncoder to top-level exports
JohnVinyard/featureflow,JohnVinyard/featureflow
flow/__init__.py
flow/__init__.py
from model import BaseModel from feature import Feature,JSONFeature,TextFeature,CompressedFeature,PickleFeature from extractor import Node,Graph,Aggregator,NotEnoughData from bytestream import ByteStream,ByteStreamFeature from data import \ IdProvider,UuidProvider,UserSpecifiedIdProvider,KeyBuilder\ ,StringDelimite...
from model import BaseModel from feature import Feature,JSONFeature,TextFeature,CompressedFeature,PickleFeature from extractor import Node,Graph,Aggregator,NotEnoughData from bytestream import ByteStream,ByteStreamFeature from data import \ IdProvider,UuidProvider,UserSpecifiedIdProvider,KeyBuilder\ ,StringDelimite...
mit
Python
f914e6df124032307716f4d4f949e73a64ec88ac
fix some issues in the event module
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/modules/event.py
salt/modules/event.py
''' Fire events on the minion, events can be fired up to the master ''' # Import Salt libs import salt.crypt import salt.payload # Import third party libs import zmq def fire_master(data, tag): ''' Fire an event off on the master server ''' serial = salt.payload.Serial(__opts__) context = zmq.Cont...
''' Fire events on the minion, events can be fired up to the master ''' # Import Salt libs import salt.crypt import salt.payload def fire_master(data, tag): ''' Fire an event off on the master server ''' serial = salt.payload.Serial(__opts__) context = zmq.Context() socket = context.socket(zmq....
apache-2.0
Python
a7033e939c6e870e1993dd66aef6c3c315ec4359
Use ConfigHandler throughout File
neoliberal/css-updater
css_updater/git/manager.py
css_updater/git/manager.py
"""manages github repos""" import os import tempfile import pygit2 as git from .webhook.handler import Handler from .config_handler import ConfigHandler class Manager(object): """handles git repos""" def __init__(self: Manager, handler: Handler) -> None: self.webhook_handler: Handler = handler ...
"""manages github repos""" import os import tempfile from typing import Any, Dict import pygit2 as git from .webhook.handler import Handler class Manager(object): """handles git repos""" def __init__(self: Manager, handler: Handler) -> None: self.webhook_handler: Handler = handler self.temp...
mit
Python
ff4477c870b9c618b7432047071792c3a8055eb7
Add nicer drink order logging
umbc-hackafe/htcpcp,umbc-hackafe/htcpcp,umbc-hackafe/htcpcp,umbc-hackafe/htcpcp
coffeeraspi/messages.py
coffeeraspi/messages.py
class DrinkOrder(): def __init__(self, mug_size, add_ins, name=None): self.mug_size = mug_size self.add_ins = add_ins self.name = name @classmethod def deserialize(cls, data): return DrinkOrder(data['mug_size'], data['add_ins'], data.get('name...
class DrinkOrder(): def __init__(self, mug_size, add_ins, name=None): self.mug_size = mug_size self.add_ins = add_ins self.name = name @classmethod def deserialize(cls, data): return DrinkOrder(data['mug_size'], data['add_ins'], data.get('name...
apache-2.0
Python
056bb4adada68d96f127a7610289d874ebe0cf1b
Add test cases for module post_manager, refactor part of class PostManager and update TODO list.
boluny/cray,boluny/cray
cray_test.py
cray_test.py
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig, testgenerator, testpostmanager if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.ap...
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.append(testpage.get_test_suites())...
mit
Python
ea96ed757e3709fbf8a7c12640e40ed3392d90fb
Fix build failure for mac/ubuntu, which relies on an old version for keras-preprocessing.
DavidNorman/tensorflow,gautam1858/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,davidzchen/tensorflow,aldian/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,annarev/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,ten...
tensorflow/python/keras/preprocessing/__init__.py
tensorflow/python/keras/preprocessing/__init__.py
# Copyright 2016 The TensorFlow 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 required by applica...
# Copyright 2016 The TensorFlow 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 required by applica...
apache-2.0
Python