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 |
|---|---|---|---|---|---|---|---|---|
db00a30c62b2a2703bb4531059b4f9d10f86496a | Adjust curly parser tests to reflect changes. | vyos-legacy/vyconfd,vyos-legacy/vyconfd | tests/integration/curly_parser/curly_parser_test.py | tests/integration/curly_parser/curly_parser_test.py | #!/usr/bin/env python
#
# curly_parser_test.py: tests for vyconf.configfile.curly.Parser
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publishe... | #!/usr/bin/env python
#
# curly_parser_test.py: tests for vyconf.configfile.curly.Parser
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publishe... | lgpl-2.1 | Python |
68e58114919208b69a01880f52e8b8e2918a4edb | make failing ogr/shape comparison a todo | yiqingj/work,rouault/mapnik,rouault/mapnik,mbrukman/mapnik,mbrukman/mapnik,tomhughes/python-mapnik,mapnik/mapnik,mapnik/python-mapnik,cjmayo/mapnik,stefanklug/mapnik,kapouer/mapnik,lightmare/mapnik,naturalatlas/mapnik,jwomeara/mapnik,pnorman/mapnik,tomhughes/mapnik,qianwenming/mapnik,yiqingj/work,cjmayo/mapnik,mapycz/p... | tests/python_tests/ogr_and_shape_geometries_test.py | tests/python_tests/ogr_and_shape_geometries_test.py | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, Todo
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# TODO - fix truncation in shapefile...... | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# TODO - fix truncation in shapefile...
polys... | lgpl-2.1 | Python |
8e57bac9ca41bfcccfabc8524ddc2a8730ac4609 | Update quality_score_filter.py | amojarro/carrierseq,amojarro/carrierseq | python/quality_score_filter.py | python/quality_score_filter.py | from Bio import SeqIO
import math
from Tkinter import Tk
import sys
name = sys.argv[1]
qs = float(sys.argv[3])
output = sys.argv[2]
count = 0
for rec in SeqIO.parse(name, "fastq"):
count += 1
qual_sequences = []
cnt = 0
for rec in SeqIO.parse(name, "fastq"):
rec.letter_annotations["phred_quality"]
probs... | from Bio import SeqIO
import math
from Tkinter import Tk
import sys
name = sys.argv[1]
qs = float(sys.argv[3])
output = sys.argv[2]
count = 0
for rec in SeqIO.parse(name, "fastq"):
count += 1
print("%i reads in fastq file" % count)
qual_sequences = [] # Setup an empty list
cnt = 0
for rec in SeqIO.parse(name, "... | mit | Python |
fa2c69bf4399f3a96505fe33050433f275ff6e0b | Bump version to 0.0.3 | vivek8943/twitter-streamer,inactivist/twitter-streamer,bqevin/twitter-streamer,inactivist/twitter-streamer,bqevin/twitter-streamer,vivek8943/twitter-streamer | streamer/__init__.py | streamer/__init__.py | __version__ = "0.0.3"
| __version__ = "0.0.2"
| mit | Python |
2304dcf3ebf189d7c3b1a00211a288e359c4cbb5 | Rename signals for consistency | bow/volt | volt/signals.py | volt/signals.py | """Signals for hooks."""
# Copyright (c) 2012-2022 Wibowo Arindrarto <contact@arindrarto.dev>
# SPDX-License-Identifier: BSD-3-Clause
from typing import Any
import structlog
from blinker import signal, NamedSignal
from structlog.contextvars import bound_contextvars
log = structlog.get_logger(__name__)
post_site_l... | """Signals for hooks."""
# Copyright (c) 2012-2022 Wibowo Arindrarto <contact@arindrarto.dev>
# SPDX-License-Identifier: BSD-3-Clause
from typing import Any
import structlog
from blinker import signal, NamedSignal
from structlog.contextvars import bound_contextvars
log = structlog.get_logger(__name__)
post_site_l... | bsd-3-clause | Python |
b58dcf4ce81b234de6701468296f4185ed63a8e2 | Add filters to the admin interface | SAlkhairy/trabd,SAlkhairy/trabd,SAlkhairy/trabd,SAlkhairy/trabd | voting/admin.py | voting/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from voting.models import Position, SACYear, Nomination
def make_rejected(ModelAdmin, request, queryset):
queryset.update(is_rejected=True)
make_rejected.short_description = "رفض المرشحـ/ين المختار/ين"
class Nominat... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from voting.models import Position, SACYear, Nomination
def make_rejected(ModelAdmin, request, queryset):
queryset.update(is_rejected=True)
make_rejected.short_description = "رفض المرشحـ/ين المختار/ين"
class Nominat... | agpl-3.0 | Python |
847fc43b572384f8afcd395ada275b053e24a193 | Fix aiohttp test | 1st1/uvloop,MagicStack/uvloop,MagicStack/uvloop | tests/test_aiohttp.py | tests/test_aiohttp.py | try:
import aiohttp
import aiohttp.web
except ImportError:
skip_tests = True
else:
skip_tests = False
import asyncio
import unittest
from uvloop import _testbase as tb
class _TestAioHTTP:
def test_aiohttp_basic_1(self):
PAYLOAD = '<h1>It Works!</h1>' * 10000
async def on_reque... | try:
import aiohttp
import aiohttp.server
except ImportError:
skip_tests = True
else:
skip_tests = False
import asyncio
import unittest
from uvloop import _testbase as tb
class _TestAioHTTP:
def test_aiohttp_basic_1(self):
PAYLOAD = b'<h1>It Works!</h1>' * 10000
class HttpRequ... | apache-2.0 | Python |
8b6cbdbae4dedfbbf025a7ecb20c7d7b3959ed11 | support to overwrite position in border | w2srobinho/RbGomoku | rbgomoku/core/player.py | rbgomoku/core/player.py | from core import OverwritePositionException
from core.board import Piece
class AIPlayer:
""" Abstract AI players.
To construct an AI player:
Construct an instance (of its subclass) with the game Board
"""
def __init__(self, board, piece):
self._board = board
self.my_piece = ... | from core.board import Piece
class AIPlayer:
""" Abstract AI players.
To construct an AI player:
Construct an instance (of its subclass) with the game Board
"""
def __init__(self, board, piece):
self._board = board
self.my_piece = piece
self.opponent = Piece.WHITE if... | mit | Python |
2b7d52369206f6a6b9f0ceb4afe28e73e652e806 | Fix typo s/router/route | georgeyk/loafer | loafer/consumer.py | loafer/consumer.py | # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import asyncio
import json
from functools import partial
import logging
import boto3
import botocore.exceptions
from .conf import settings
from .exceptions import ConsumerError
logger = logging.getLogger(__name__)
class SQSConsumer(object):
def __init__(self... | # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import asyncio
import json
from functools import partial
import logging
import boto3
import botocore.exceptions
from .conf import settings
from .exceptions import ConsumerError
logger = logging.getLogger(__name__)
class SQSConsumer(object):
def __init__(self... | mit | Python |
cc78aef74876049a4548398133bad64e405351de | Remove redundant parameters from wagtailuserbar tag; trigger a DeprecationWarning if people are still passing a css path | helenwarren/pied-wagtail,serzans/wagtail,benemery/wagtail,helenwarren/pied-wagtail,mephizzle/wagtail,hamsterbacke23/wagtail,FlipperPA/wagtail,bjesus/wagtail,rsalmaso/wagtail,gogobook/wagtail,rjsproxy/wagtail,rv816/wagtail,chimeno/wagtail,iansprice/wagtail,bjesus/wagtail,timorieber/wagtail,stevenewey/wagtail,JoshBarr/wa... | wagtail/wagtailadmin/templatetags/wagtailuserbar.py | wagtail/wagtailadmin/templatetags/wagtailuserbar.py | import warnings
from django import template
from wagtail.wagtailadmin.views import userbar
from wagtail.wagtailcore.models import Page
register = template.Library()
@register.simple_tag(takes_context=True)
def wagtailuserbar(context, css_path=None):
if css_path is not None:
warnings.warn(
"P... | from django import template
from wagtail.wagtailadmin.views import userbar
from wagtail.wagtailcore.models import Page
register = template.Library()
@register.simple_tag(takes_context=True)
def wagtailuserbar(context, current_page=None, items=None):
# Find request object
request = context['request']
... | bsd-3-clause | Python |
153f7b28e5b4763dd41f95b4840dcf56d9895393 | Update bot.py | devrand/djcourse | code/bot1/bot.py | code/bot1/bot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, time, sys # pip install tweepy
import sys
sys.path.append("..")
from course_config import *
argfile = str(sys.argv[1])
# go to https://dev.twitter.com/ and register application
# you need CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, time, sys # pip install tweepy
import sys
sys.path.append("..")
from course_config import *
argfile = str(sys.argv[1])
# need CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
au... | mit | Python |
9e2bdfece7f5cd9e02b15e9fe11c432e10a12418 | update api tests | richardhsu/naarad,linkedin/naarad,richardhsu/naarad,kilink/naarad,linkedin/naarad,forever342/naarad,linkedin/naarad,linkedin/naarad,kilink/naarad,forever342/naarad,kilink/naarad,kilink/naarad,richardhsu/naarad,forever342/naarad,forever342/naarad,richardhsu/naarad | test/test_naarad_api.py | test/test_naarad_api.py | # coding=utf-8
"""
© 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License.?You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | # coding=utf-8
"""
© 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License.?You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | apache-2.0 | Python |
ee1532cc226987904666eeb0bda61445455d04e3 | Increase test timeout | panda73111/aiohttp,KeepSafe/aiohttp,singulared/aiohttp,rutsky/aiohttp,arthurdarcet/aiohttp,alex-eri/aiohttp-1,panda73111/aiohttp,z2v/aiohttp,arthurdarcet/aiohttp,moden-py/aiohttp,alex-eri/aiohttp-1,panda73111/aiohttp,moden-py/aiohttp,moden-py/aiohttp,pfreixes/aiohttp,hellysmile/aiohttp,arthurdarcet/aiohttp,juliatem/aio... | tests/test_run_app.py | tests/test_run_app.py | import ssl
from unittest import mock
from aiohttp import web
def test_run_app_http(loop, mocker):
mocker.spy(loop, 'create_server')
loop.call_later(0.05, loop.stop)
app = web.Application(loop=loop)
mocker.spy(app, 'startup')
web.run_app(app, print=lambda *args: None)
assert loop.is_closed(... | import ssl
from unittest import mock
from aiohttp import web
def test_run_app_http(loop, mocker):
mocker.spy(loop, 'create_server')
loop.call_later(0.02, loop.stop)
app = web.Application(loop=loop)
mocker.spy(app, 'startup')
web.run_app(app, print=lambda *args: None)
assert loop.is_closed(... | apache-2.0 | Python |
d8b322439a5fdaf31ec52dc7c2a2ff9e18c12316 | solve import error on install magpie | Ouranosinc/Magpie,Ouranosinc/Magpie,Ouranosinc/Magpie | magpie/__init__.py | magpie/__init__.py | # -*- coding: utf-8 -*-
import logging
import sys
LOGGER = logging.getLogger(__name__)
def includeme(config):
# import needs to be here, otherwise ImportError happens during setup.py install (modules not yet installed)
from magpie import constants
LOGGER.info("Adding MAGPIE_MODULE_DIR='{}' to path.".forma... | # -*- coding: utf-8 -*-
from magpie import constants
import logging
import sys
LOGGER = logging.getLogger(__name__)
def includeme(config):
LOGGER.info("Adding MAGPIE_MODULE_DIR='{}' to path.".format(constants.MAGPIE_MODULE_DIR))
sys.path.insert(0, constants.MAGPIE_MODULE_DIR)
# include magpie components ... | apache-2.0 | Python |
5dfcd4ea8633a6bc658cccd654fce2cc7c217269 | Add helpful message to end of installer. | tarmstrong/nbdiff,tarmstrong/nbdiff,tarmstrong/nbdiff,tarmstrong/nbdiff | nbdiff/install.py | nbdiff/install.py | from __future__ import print_function
from . import __path__ as NBDIFF_PATH
import subprocess
import re
import os
import shutil
import sys
def install():
profile_name = 'nbdiff'
create_cmd = ['ipython', 'profile', 'create', profile_name]
message = subprocess.Popen(create_cmd, stderr=subprocess.PIPE)
m... | from . import __path__ as NBDIFF_PATH
import subprocess
import re
import os
import shutil
import sys
def install():
profile_name = 'nbdiff'
create_cmd = ['ipython', 'profile', 'create', profile_name]
message = subprocess.Popen(create_cmd, stderr=subprocess.PIPE)
message_str = message.stderr.read()
... | mit | Python |
390fa07c191d79290b1ef83c268f38431f68093a | Fix import in test client. | riga/jsonrpyc | tests/clients/simple.py | tests/clients/simple.py | # -*- coding: utf-8 -*-
import os
import sys
base = os.path.dirname(os.path.abspath(__file__))
sys.path.append(base)
from base import jsonrpyc
class MyClass(object):
def one(self):
return 1
def twice(self, n):
return n * 2
def arglen(self, *args, **kwargs):
return len(args) ... | # -*- coding: utf-8 -*-
from base import jsonrpyc
class MyClass(object):
def one(self):
return 1
def twice(self, n):
return n * 2
def arglen(self, *args, **kwargs):
return len(args) + len(kwargs)
if __name__ == "__main__":
rpc = jsonrpyc.RPC(MyClass())
| mit | Python |
7c6754a439f8fa1c7ebe5c12b9c51651c02c35c4 | 修改post参数,添加全局editor配置 | SilverBlogTeam/SilverBlog,SilverBlogTeam/SilverBlog | manage/new_post.py | manage/new_post.py | import datetime
import json
import os.path
import re
import shutil
from pypinyin import lazy_pinyin
from common import file
from manage import get_excerpt
def get_name(nameinput):
name_raw = re.sub("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]+", "", nameinput)
namelist = lazy_pinyin(name_raw)
name = ... | import datetime
import json
import os.path
import re
import shutil
from pypinyin import lazy_pinyin
from common import file
from manage import get_excerpt
def get_name(nameinput):
name_raw = re.sub("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]+", "", nameinput)
namelist = lazy_pinyin(name_raw)
name = ... | bsd-3-clause | Python |
7bd2bfa8deb59c97f7630ed10fe70fd7e8bd8587 | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
73d0be7a432340b4ecd140ad1cc8792d3f049779 | Use SelfAttribute instead of explicit lambda | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | tests/factories/user.py | tests/factories/user.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
import factory
from factory.faker import Faker
from pycroft.model.user import User
from... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
import factory
from factory.faker import Faker
from pycroft.model.user import User
from... | apache-2.0 | Python |
5c1a404353a0cdcd49610a21d7d19b79898ac7e3 | make mpi example a little more verbose | JensTimmerman/radical.pilot,JensTimmerman/radical.pilot,JensTimmerman/radical.pilot,JensTimmerman/radical.pilot | tests/helloworld_mpi.py | tests/helloworld_mpi.py | #!/usr/bin/env python
# This is an example MPI4Py program that is used
# by different examples and tests.
import sys
import time
import traceback
from mpi4py import MPI
try :
print "start"
SLEEP = 10
name = MPI.Get_processor_name()
comm = MPI.COMM_WORLD
print "mpi rank %d/%d/%s" % (comm.ran... | #!/usr/bin/env python
# This is an example MPI4Py program that is used
# by different examples and tests.
from mpi4py import MPI
import time
SLEEP = 10
name = MPI.Get_processor_name()
comm = MPI.COMM_WORLD
print "mpi rank %d/%d/%s" % (comm.rank, comm.size, name)
time.sleep(SLEEP)
comm.Barrier() # wait for ... | mit | Python |
3bb6017897f9b8c859c2d3879c2e9d51b899f57c | Increase number of iterations for xor neural net | WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox | neuralnets/xor.py | neuralnets/xor.py | import numpy as np
from net import NeuralNet
net = NeuralNet(2, 1, 3, 1, 342047)
output_dot = True
inputs = np.array([[1,1],
[0,0],
[1,0],
[0,1]])
outputs = np.array([[0],
[0],
[1],
[1]])
for i in xr... | import numpy as np
from net import NeuralNet
net = NeuralNet(2, 1, 3, 1, 342047)
output_dot = True
inputs = np.array([[1,1],
[0,0],
[1,0],
[0,1]])
outputs = np.array([[0],
[0],
[1],
[1]])
for i in xr... | mit | Python |
2c37ed091baf12e53885bfa06fdb835bb8de1218 | Add Bitbucket to skipif marker reason | pjbull/cookiecutter,atlassian/cookiecutter,sp1rs/cookiecutter,0k/cookiecutter,cichm/cookiecutter,takeflight/cookiecutter,atlassian/cookiecutter,kkujawinski/cookiecutter,foodszhang/cookiecutter,christabor/cookiecutter,ramiroluz/cookiecutter,cguardia/cookiecutter,tylerdave/cookiecutter,benthomasson/cookiecutter,Springerl... | tests/skipif_markers.py | tests/skipif_markers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
skipif_markers
--------------
Contains pytest skipif markers to be used in the suite.
"""
import pytest
import os
try:
os.environ[u'TRAVIS']
except KeyError:
travis = False
else:
travis = True
try:
os.environ[u'DISABLE_NETWORK_TESTS']
except KeyErr... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
skipif_markers
--------------
Contains pytest skipif markers to be used in the suite.
"""
import pytest
import os
try:
os.environ[u'TRAVIS']
except KeyError:
travis = False
else:
travis = True
try:
os.environ[u'DISABLE_NETWORK_TESTS']
except KeyErr... | bsd-3-clause | Python |
44dac786339716ad8cc05f6790b73b5fc47be812 | Remove extra comma to avoid flake8 test failure in CircleCI | yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core | config/jinja2.py | config/jinja2.py | from django.urls import reverse
from django.utils import translation
from django.template.backends.jinja2 import Jinja2
from jinja2 import Environment
class FoodsavingJinja2(Jinja2):
app_dirname = 'templates'
def environment(**options):
env = Environment(extensions=['jinja2.ext.i18n'], **options)
env.gl... | from django.urls import reverse
from django.utils import translation
from django.template.backends.jinja2 import Jinja2
from jinja2 import Environment
class FoodsavingJinja2(Jinja2):
app_dirname = 'templates'
def environment(**options):
env = Environment(extensions=['jinja2.ext.i18n',], **options)
env.g... | agpl-3.0 | Python |
b447fa44ca1dd2e9d21af4ce61ee6092fe3c94ec | Update test_cmatrices to new interface | Radiomics/pyradiomics,Radiomics/pyradiomics,Radiomics/pyradiomics,Radiomics/pyradiomics | tests/test_cmatrices.py | tests/test_cmatrices.py | # to run this test, from directory above:
# setenv PYTHONPATH /path/to/pyradiomics/radiomics
# nosetests --nocapture -v tests/test_features.py
import logging
from nose_parameterized import parameterized
import numpy
import six
from radiomics import cMatsEnabled, getFeatureClasses
from testUtils import custom_name_fu... | # to run this test, from directory above:
# setenv PYTHONPATH /path/to/pyradiomics/radiomics
# nosetests --nocapture -v tests/test_features.py
import logging
from nose_parameterized import parameterized
import numpy
import six
from radiomics import cMatsEnabled, getFeatureClasses
from testUtils import custom_name_fu... | bsd-3-clause | Python |
3b408ed7702100b7f1755f819e05bb61b1740957 | add medialab events search- left todo: json and date | OSWeekends/EventPoints,OSWeekends/EventPoints | media_lab_prado.py | media_lab_prado.py | # http://medialab-prado.es/events/2016-12-01
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
import datetime
date = "2017-01-02"
url = "http://medialab-prado.es/events/" + date
request = urllib.request.urlopen(url)
if request.getcode() == 200:
request = request.read()
soup = BeautifulSo... | # http://medialab-prado.es/events/2016-12-01 | mit | Python |
769e6209db066b8b5908426850fd300fd29098e8 | Fix codemirror mode and language name | ryanpepper/tcl_kernel | tcl_kernel/kernel.py | tcl_kernel/kernel.py | from ipykernel.kernelbase import Kernel
try:
import Tkinter
except ImportError:
import tkinter as Tkinter
__version__ = '0.0.1'
class TclKernel(Kernel):
implementation = 'tcl_kernel'
implementation_version = __version__
language_info = {'name': 'Tcl',
'codemirror_mode': 'Tcl',... | from ipykernel.kernelbase import Kernel
try:
import Tkinter
except ImportError:
import tkinter as Tkinter
__version__ = '0.0.1'
class TclKernel(Kernel):
implementation = 'tcl_kernel'
implementation_version = __version__
language_info = {'name': 'bash',
'codemirror_mode': 'shel... | bsd-3-clause | Python |
c517eb40b73151a9b14f46f1991ab692d8b81702 | Add docstring for simulation class methods | kbsezginel/tee_mof,kbsezginel/tee_mof | teemof/simulation.py | teemof/simulation.py | # Date: August 2017
# Author: Kutay B. Sezginel
"""
Simulation class for reading and initializing Lammps simulations
"""
import pprint
from teemof.read import read_run, read_trial, read_trial_set
from teemof.parameters import k_parameters, plot_parameters
from teemof.visualize import plot_thermal_conductivity, plot_dis... | # Date: August 2017
# Author: Kutay B. Sezginel
"""
Simulation class for reading and initializing Lammps simulations
"""
import pprint
from teemof.read import read_run, read_trial, read_trial_set
from teemof.parameters import k_parameters, plot_parameters
from teemof.visualize import plot_thermal_conductivity, plot_dis... | mit | Python |
b646e4f376db710101e2c1825bd384b2727e6a79 | Disable on win32 | stoq/kiwi | tests/test_dateentry.py | tests/test_dateentry.py | import sys
import datetime
import unittest
from kiwi.ui.dateentry import DateEntry
class TestDateEntry(unittest.TestCase):
def setUp(self):
self.date = datetime.date.today()
def testGetSetDate(self):
if sys.platform == 'win32':
return
entry = DateEntry()
entry.set_... | import datetime
import unittest
from kiwi.ui.dateentry import DateEntry
class TestDateEntry(unittest.TestCase):
def setUp(self):
self.date = datetime.date.today()
def testGetSetDate(self):
entry = DateEntry()
entry.set_date(self.date)
self.assertEqual(entry.get_date(), self.da... | lgpl-2.1 | Python |
17ad68fe77b124fa760857c9e93cbd3d4f9d293e | Write XML of input file to tempdir as well | khaledhosny/psautohint,khaledhosny/psautohint | tests/test_hintfonts.py | tests/test_hintfonts.py | from __future__ import print_function, division, absolute_import
import glob
from os.path import basename
import pytest
from fontTools.misc.xmlWriter import XMLWriter
from fontTools.cffLib import CFFFontSet
from fontTools.ttLib import TTFont
from psautohint.autohint import ACOptions, hintFiles
from .differ import ma... | from __future__ import print_function, division, absolute_import
import glob
from os.path import basename
import pytest
from fontTools.misc.xmlWriter import XMLWriter
from fontTools.cffLib import CFFFontSet
from fontTools.ttLib import TTFont
from psautohint.autohint import ACOptions, hintFiles
from .differ import ma... | apache-2.0 | Python |
6e67a9e8eedd959d9d0193e746a375099e9784ef | Use bytes instead of str where appropriate for Python 3 | mwilliamson/toodlepip | toodlepip/consoles.py | toodlepip/consoles.py | class Console(object):
def __init__(self, shell, stdout):
self._shell = shell
self._stdout = stdout
def run(self, description, command, **kwargs):
return self.run_all(description, [command], **kwargs)
def run_all(self, description, commands, quiet=False, cwd=None):
... | class Console(object):
def __init__(self, shell, stdout):
self._shell = shell
self._stdout = stdout
def run(self, description, command, **kwargs):
return self.run_all(description, [command], **kwargs)
def run_all(self, description, commands, quiet=False, cwd=None):
... | bsd-2-clause | Python |
006e933a44241e30e1e54c24966d0859aa7c853d | test hub via vanilla, to check imports | cablehead/vanilla | tests/unit/test_core.py | tests/unit/test_core.py | import time
import vanilla
import vanilla.core
def test_lazy():
class C(object):
@vanilla.core.lazy
def now(self):
return time.time()
c = C()
want = c.now
time.sleep(0.01)
assert c.now == want
def test_Scheduler():
s = vanilla.core.Scheduler()
s.add(4, 'f2')... | import time
import vanilla.core
def test_lazy():
class C(object):
@vanilla.core.lazy
def now(self):
return time.time()
c = C()
want = c.now
time.sleep(0.01)
assert c.now == want
def test_Scheduler():
s = vanilla.core.Scheduler()
s.add(4, 'f2')
s.add(9, '... | mit | Python |
374e10b908fbedf73f3ad40634bb680206da0652 | Add setUp | yuma-m/pychord | test/test_quality.py | test/test_quality.py | # -*- coding: utf-8 -*-
import unittest
from pychord import QualityManager, Chord
class TestQuality(unittest.TestCase):
def setUp(self):
self.quality_manager = QualityManager()
def test_eq(self):
q1 = self.quality_manager.get_quality("m7-5")
q2 = self.quality_manager.get_quality("m7... | # -*- coding: utf-8 -*-
import unittest
from pychord import QualityManager, Chord
class TestQuality(unittest.TestCase):
def setUp(self):
self.quality_manager = QualityManager()
def test_eq(self):
q1 = self.quality_manager.get_quality("m7-5")
q2 = self.quality_manager.get_quality("m7... | mit | Python |
3707ed6b193a5eed9ec4505f6a283fdaff07ad5e | fix deprecated method | Mifiel/python-api-client | mifiel/api_auth.py | mifiel/api_auth.py | """
[ApiAuth](https://github.com/mgomes/api_auth) for python
Based on https://github.com/pd/httpie-api-auth by Kyle Hargraves
Usage:
import requests
requests.get(url, auth=ApiAuth(app_id, secret_key))
"""
import hmac, base64, hashlib, datetime
from requests.auth import AuthBase
from urllib.parse import urlparse
class... | """
[ApiAuth](https://github.com/mgomes/api_auth) for python
Based on https://github.com/pd/httpie-api-auth by Kyle Hargraves
Usage:
import requests
requests.get(url, auth=ApiAuth(app_id, secret_key))
"""
import hmac, base64, hashlib, datetime
from requests.auth import AuthBase
from urllib.parse import urlparse
class... | mit | Python |
c0894d3c14b8273364454dfa13c94311578ff698 | update for diverse usage | mykespb/pythoner,mykespb/pythoner,mykespb/pythoner | mk-1strecurring.py | mk-1strecurring.py | #!/usr/bin/env python3
# (C) Mikhail Kolodin, 2018, ver. 2018-05-31 1.1
# class ic test task: find 1st recurring character in a string
import random
import string
MINSIZE = 1 # min size of test string
MAXSIZE = 19 # its max size
TESTS = 10 # no of tests
alf = string.ascii_uppercase # test alphabe... | #!/usr/bin/env python3
# (C) Mikhail Kolodin, 2018, ver. 1.0
# class ic test task: find 1st recurring character in a string
import random
import string
MINSIZE = 1 # min size of test string
MAXSIZE = 9 # its max size
TESTS = 10 # no of tests
alf = string.ascii_uppercase # test alphabet
arr = []... | apache-2.0 | Python |
e379f35a15956204f09aa593979fe0a0186cf56e | Update the upload tool | vlegoff/cocomud | tools/upload_build.py | tools/upload_build.py | """This script upload a newly-build version of CocoMUD for Windows.
The Download wiki page on Redmine are updated.
Requirements:
This script needs 'python-redmine', which you can obtain with
pip install python-redmine
"""
import argparse
from json import dumps
import os
import re
import sys
from urllib... | """This script upload a newly-build version of CocoMUD for Windows.
The Download wiki page on Redmine are updated.
Requirements:
This script needs 'python-redmine', which you can obtain with
pip install python-redmine
"""
import argparse
from json import dumps
import os
import re
import sys
import urll... | bsd-3-clause | Python |
3d331ecdb9cb0e64050eb3e4ece27242e1714b3e | Update C_Temperature_Vertical_sections.py | Herpinemmanuel/Oceanography | Cas_1/Temperature/C_Temperature_Vertical_sections.py | Cas_1/Temperature/C_Temperature_Vertical_sections.py | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,iters='all',prefix=['T'])
Height = ds1.T.Z
print(Height)
nx = int(len(ds1.T.XC)/2)
print(nx)
ny = int(len(ds1.T.YC)/2)
print(ny)
nt = -... | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,iters='all',prefix=['T'])
Height = ds1.T.Z
print(Height)
nx = int(len(ds1.T.XC)/2)
print(nx)
ny = int(len(ds1.T.YC)/2)
print(ny)
nt = -... | mit | Python |
b2542f8c3625150f9716eb0b1fcb44ee15520ae8 | fix path to nvim files | rr-/dotfiles,rr-/dotfiles,rr-/dotfiles | mod/vim/install.py | mod/vim/install.py | import packages
import util
def run():
spell_dir = '~/.config/vim/spell/'
choices = [
'vim',
'gvim', # gvim supports for X11 clipboard, but has more dependencies
]
choice = None
while choice not in choices:
choice = input('Which package to install? (%s) ' % choices).lower... | import packages
import util
def run():
spell_dir = '~/.config/vim/spell/'
choices = [
'vim',
'gvim', # gvim supports for X11 clipboard, but has more dependencies
]
choice = None
while choice not in choices:
choice = input('Which package to install? (%s) ' % choices).lower... | mit | Python |
6d2e66ab5b9b452474701ffc5035e4a8106db637 | Add test_Record unit tests | NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script,NTUTVisualScript/Visual_Script | tests/test_Record.py | tests/test_Record.py | import unittest
import os, shutil
from GeometrA.src.Record import *
from GeometrA.src.File.WorkSpace import WorkSpace
RECORD_FILE = './tests/record.log'
class RecordTestSuite(unittest.TestCase):
@classmethod
def setUpClass(cls):
path = './tests/Project0'
if os.path.isdir(path):
s... | # import unittest
#
# import os, shutil
#
# from GeometrA.src.Record import *
# from GeometrA.src.File.WorkSpace import WorkSpace
#
# RECORD_FILE = './tests/record.log'
#
# class RecordTestSuite(unittest.TestCase):
# @classmethod
# def setUpClass(cls):
# path = './tests/Project0'
# if os.path.is... | mit | Python |
3425c2c9d19c1d0a54dafde6cc70d571421c82a9 | Fix string app import error for python 3.5 | encode/uvicorn,encode/uvicorn | tests/test_config.py | tests/test_config.py | import logging
import socket
import pytest
from uvicorn import protocols
from uvicorn.config import Config
from uvicorn.middleware.debug import DebugMiddleware
from uvicorn.middleware.wsgi import WSGIMiddleware
async def asgi_app():
pass
def wsgi_app():
pass
def test_debug_app():
config = Config(app... | import logging
import socket
import pytest
from uvicorn import protocols
from uvicorn.config import Config
from uvicorn.middleware.debug import DebugMiddleware
from uvicorn.middleware.wsgi import WSGIMiddleware
async def asgi_app():
pass
def wsgi_app():
pass
def test_debug_app():
config = Config(app... | bsd-3-clause | Python |
1df8efb63333e89777820a96d78d5a59252b303d | Rename test specific to with gpg | theherk/figgypy | tests/test_config.py | tests/test_config.py | import unittest
import figgypy.config
import sys
import os
class TestConfig(unittest.TestCase):
def test_config_load_with_gpg(self):
os.environ['FIGGY_GPG_HOME']='tests/resources/test-keys'
c = figgypy.config.Config('tests/resources/test-config.yaml')
self.assertEqual(c.db['host'], 'db.hec... | import unittest
import figgypy.config
import sys
import os
class TestConfig(unittest.TestCase):
def test_config_load(self):
os.environ['FIGGY_GPG_HOME']='tests/resources/test-keys'
c = figgypy.config.Config('tests/resources/test-config.yaml')
self.assertEqual(c.db['host'], 'db.heck.ya')
... | mit | Python |
66eddf04efd46fb3dbeae34c4d82f673a88be70f | Test the ability to add phone to the person | dizpers/python-address-book-assignment | tests/test_person.py | tests/test_person.py | from copy import copy
from unittest import TestCase
from address_book import Person
class PersonTestCase(TestCase):
def test_get_groups(self):
pass
def test_add_address(self):
basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42']
person = Pers... | from copy import copy
from unittest import TestCase
from address_book import Person
class PersonTestCase(TestCase):
def test_get_groups(self):
pass
def test_add_address(self):
basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42']
person = Pers... | mit | Python |
5017ee713fd03902aa502836654e1961fb7575f1 | test form action url | satyrius/cmsplugin-feedback,satyrius/cmsplugin-feedback | tests/test_plugin.py | tests/test_plugin.py | from bs4 import BeautifulSoup
from cms.api import add_plugin
from cms.models import Placeholder
from django.core.urlresolvers import reverse
from django.test import TestCase
from cmsplugin_feedback.cms_plugins import FeedbackPlugin, \
DEFAULT_FORM_FIELDS_ID, DEFAULT_FORM_CLASS
from cmsplugin_feedback.forms import ... | from bs4 import BeautifulSoup
from cms.api import add_plugin
from cms.models import Placeholder
from django.test import TestCase
from cmsplugin_feedback.cms_plugins import FeedbackPlugin, \
DEFAULT_FORM_FIELDS_ID, DEFAULT_FORM_CLASS
from cmsplugin_feedback.forms import FeedbackMessageForm
class FeedbackPluginTes... | mit | Python |
28f6af7f84860535a1a82750df286f78320a6856 | Fix monkeypatching | audiolabs/stft | tests/test_things.py | tests/test_things.py | from __future__ import division
import stft
import numpy
import pytest
@pytest.fixture(params=[1, 2])
def channels(request):
return request.param
@pytest.fixture(params=[0, 1, 4])
def padding(request):
return request.param
@pytest.fixture(params=[2048])
def length(request):
return request.param
@pyt... | from __future__ import division
import stft
import numpy
import pytest
@pytest.fixture(params=[1, 2])
def channels(request):
return request.param
@pytest.fixture(params=[0, 1, 4])
def padding(request):
return request.param
@pytest.fixture(params=[2048])
def length(request):
return request.param
@pyt... | mit | Python |
36200dea5889bdf4ad920adc1ab04ae3870f74ac | Edit varnet model (#5096) | Project-MONAI/MONAI,Project-MONAI/MONAI,Project-MONAI/MONAI,Project-MONAI/MONAI | tests/test_varnet.py | tests/test_varnet.py | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
3e84dcb7b449db89ca6ce2b91b34a5e8f8428b39 | Allow sub- and superscript tags | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | core/markdown.py | core/markdown.py | from markdown.extensions import nl2br, sane_lists, fenced_code
from pymdownx import magiclink
from mdx_unimoji import UnimojiExtension
import utils.markdown
markdown_extensions = [
magiclink.MagiclinkExtension(),
nl2br.Nl2BrExtension(),
utils.markdown.ExtendedLinkExtension(),
sane_lists.SaneListExtensi... | from markdown.extensions import nl2br, sane_lists, fenced_code
from pymdownx import magiclink
from mdx_unimoji import UnimojiExtension
import utils.markdown
markdown_extensions = [
magiclink.MagiclinkExtension(),
nl2br.Nl2BrExtension(),
utils.markdown.ExtendedLinkExtension(),
sane_lists.SaneListExtensi... | agpl-3.0 | Python |
b3c55b059293d664d3e029b9c3d03203ff4af5a5 | remove ws | iivvoo/resturo | resturo/tests/models.py | resturo/tests/models.py | from ..models import Organization as BaseOrganization
from ..models import Membership as BaseMembership
class Organization(BaseOrganization):
"""
"""
class Membership(BaseMembership):
""" Provide non-abstract implementation for Membership model,
define some roles
"""
ROLE_MEMBER = 1
| from ..models import Organization as BaseOrganization
from ..models import Membership as BaseMembership
class Organization(BaseOrganization):
"""
"""
class Membership(BaseMembership):
""" Provide non-abstract implementation for Membership model,
define some roles
"""
ROLE_MEMBER = 1
| isc | Python |
32dd33126c9fa0076c8d7c9e8024a709674f8614 | Bump Version 0.0.28 -> 0.0.29 | 3bot/3bot,3bot/3bot | threebot/__init__.py | threebot/__init__.py | # -*- encoding: utf-8 -*-
__version__ = '0.0.29'
| # -*- encoding: utf-8 -*-
__version__ = '0.0.28'
| bsd-3-clause | Python |
363583654998e404baba9b72860d2465bb3d339e | Remove convoluted meshgrid statement. | matthewwardrop/python-mplkit,matthewwardrop/python-mplkit,matthewwardrop/python-mplstyles,matthewwardrop/python-mplstyles | mplstyles/plots.py | mplstyles/plots.py | from matplotlib import cm
import matplotlib.pyplot as plt
from mplstyles import cmap as colormap
import numpy as np
import scipy.ndimage
def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_smoothing=0,contour_opts={},label_opts={},imshow_opts={},clegendlabels=[],label=False):
ax = pl... | from matplotlib import cm
import matplotlib.pyplot as plt
from mplstyles import cmap as colormap
import numpy as np
import scipy.ndimage
def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_smoothing=0,contour_opts={},label_opts={},imshow_opts={},clegendlabels=[],label=False):
ax = pl... | mit | Python |
7177f7e0263d8a5f2adf458f9bfe33bff12137e0 | fix syntax error | silshack/fall2013turtlehack | n_sided_polygon.py | n_sided_polygon.py | import turtle
import turtlehack
import random
# A function that draws an n-sided polygon
def n_sided_polygon(turtle, n, color="#FFFFFF", line_thickness=1):
'''
Draw an n-sided polygon
input: turtle, n, line_length
'''
# for n times:
# Draw a line, then turn 360/n degrees and draw another
# set initial paramete... | import turtle
import turtlehack
import random
# A function that draws an n-sided polygon
def n_sided_polygon(turtle, n, color="#FFFFFF", line_thickness=1):
'''
Draw an n-sided polygon
input: turtle, n, line_length
'''
# for n times:
# Draw a line, then turn 360/n degrees and draw another
# set initial paramete... | mit | Python |
458d61ffb5161394f8080cea59716b2f9cb492f3 | Add error message for not implemented error | pbutenee/ml-tutorial,pbutenee/ml-tutorial | nbgrader_config.py | nbgrader_config.py | c = get_config()
c.CourseDirectory.db_assignments = [dict(name="1", duedate="2019-12-09 17:00:00 UTC")]
c.CourseDirectory.db_students = [
dict(id="foo", first_name="foo", last_name="foo")
]
c.ClearSolutions.code_stub = {'python': '''##### Implement this part of the code #####
raise NotImplementedError("Code not imp... | c = get_config()
c.CourseDirectory.db_assignments = [dict(name="1", duedate="2019-12-09 17:00:00 UTC")]
c.CourseDirectory.db_students = [
dict(id="foo", first_name="foo", last_name="foo")
]
c.ClearSolutions.code_stub = {'python': '##### Implement this part of the code #####\nraise NotImplementedError()'}
| mit | Python |
1cae5cf5b2874eb2bafc9486d4873abfa1a58366 | Add log_to_file method | tool-labs/ToolsWeb | toolsweb/__init__.py | toolsweb/__init__.py | # -*- coding: utf-8 -*-
import flask
import jinja2
import logging
import os.path
import oursql
def connect_to_database(database, host):
default_file = os.path.expanduser('~/replica.my.cnf')
if not os.path.isfile(default_file):
raise Exception('Database access not configured for this account!')
... | # -*- coding: utf-8 -*-
import flask
import jinja2
import os.path
import oursql
def connect_to_database(database, host):
default_file = os.path.expanduser('~/replica.my.cnf')
if not os.path.isfile(default_file):
raise Exception('Database access not configured for this account!')
return oursql... | mit | Python |
9ff4fbcdf5b21d263e8b20abb0a3d0395ce28981 | Document the reason for accepting only `POST` requests on `/wiki_render`, and allow `GET` requests from `TRAC_ADMIN` for testing purposes. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | trac/wiki/web_api.py | trac/wiki/web_api.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | bsd-3-clause | Python |
bb696f7c5b97563339f04206e649b54759fc9c6b | add transform for in__id to base get method | lampwins/stackstorm-netbox | actions/lib/action.py | actions/lib/action.py |
from st2actions.runners.pythonrunner import Action
import requests
__all__ = [
'NetboxBaseAction'
]
class NetboxBaseAction(Action):
"""Base Action for all Netbox API based actions
"""
def __init__(self, config):
super(NetboxBaseAction, self).__init__(config)
def get(self, endpoint_uri... |
from st2actions.runners.pythonrunner import Action
import requests
__all__ = [
'NetboxBaseAction'
]
class NetboxBaseAction(Action):
"""Base Action for all Netbox API based actions
"""
def __init__(self, config):
super(NetboxBaseAction, self).__init__(config)
def get(self, endpoint_uri... | mit | Python |
e1074fbc814b238a8d6d878810a8ac665a169f03 | Fix template name in views | Nomadblue/django-nomad-country-blogs | nomadblog/views.py | nomadblog/views.py | from django.views.generic import ListView, DetailView
from django.shortcuts import get_object_or_404
from django.conf import settings
from nomadblog.models import Blog, Category
from nomadblog import get_post_model
DEFAULT_STATUS = getattr(settings, 'PUBLIC_STATUS', 0)
POST_MODEL = get_post_model()
class NomadBlog... | from django.views.generic import ListView, DetailView
from django.shortcuts import get_object_or_404
from django.conf import settings
from nomadblog.models import Blog, Category
from nomadblog import get_post_model
DEFAULT_STATUS = getattr(settings, 'PUBLIC_STATUS', 0)
POST_MODEL = get_post_model()
class NomadBlog... | bsd-3-clause | Python |
44161337282d14a48bde278b6e1669e8b3c94e4e | Bump version to 0.1.7 | v1k45/django-notify-x,v1k45/django-notify-x,v1k45/django-notify-x | notify/__init__.py | notify/__init__.py | __version__ = "0.1.7"
| __version__ = "0.1.6"
| mit | Python |
72a827b8cca6dc100e7f0d2d92e0c69aa67ec956 | change name and docstring | schocco/mds-web,schocco/mds-web | apps/auth/iufOAuth.py | apps/auth/iufOAuth.py | from social.backends.oauth import BaseOAuth2
# see http://psa.matiasaguirre.net/docs/backends/implementation.html
class IUFOAuth2(BaseOAuth2):
"""IUF OAuth authentication backend"""
name = 'iuf'
AUTHORIZATION_URL = 'https://iufinc.org/login/oauth/authorize'
ACCESS_TOKEN_URL = 'https://iufinc.org/login/... | from social.backends.oauth import BaseOAuth2
# see http://psa.matiasaguirre.net/docs/backends/implementation.html
class IUFOAuth2(BaseOAuth2):
"""Github OAuth authentication backend"""
name = 'github'
AUTHORIZATION_URL = 'https://iufinc.org/login/oauth/authorize'
ACCESS_TOKEN_URL = 'https://iufinc.org/... | mit | Python |
140f96ab4cddebd465ad2fdcca4560c683ca5770 | add django-markdown url for tutorials app | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | oeplatform/urls.py | oeplatform/urls.py | """oeplatform URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | """oeplatform URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | agpl-3.0 | Python |
7c77a7b14432a85447ff74e7aa017ca56c86e662 | Make api-tokens view exempt from CSRF checks | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | oidc_apis/views.py | oidc_apis/views.py | from django.http import JsonResponse
from django.views.decorators.http import require_http_methods
from oidc_provider.lib.utils.oauth2 import protected_resource_view
from django.views.decorators.csrf import csrf_exempt
from .api_tokens import get_api_tokens_by_access_token
@csrf_exempt
@require_http_methods(['GET', ... | from django.http import JsonResponse
from django.views.decorators.http import require_http_methods
from oidc_provider.lib.utils.oauth2 import protected_resource_view
from .api_tokens import get_api_tokens_by_access_token
@require_http_methods(['GET', 'POST'])
@protected_resource_view(['openid'])
def get_api_tokens_v... | mit | Python |
7e9dd7469f88d676959141534809b0bc10fc9a66 | Print newline on de-initialization. | pfalcon/picotui | picotui/context.py | picotui/context.py | from .screen import Screen
class Context:
def __init__(self, cls=True, mouse=True):
self.cls = cls
self.mouse = mouse
def __enter__(self):
Screen.init_tty()
if self.mouse:
Screen.enable_mouse()
if self.cls:
Screen.cls()
return self
... | from .screen import Screen
class Context:
def __init__(self, cls=True, mouse=True):
self.cls = cls
self.mouse = mouse
def __enter__(self):
Screen.init_tty()
if self.mouse:
Screen.enable_mouse()
if self.cls:
Screen.cls()
return self
... | mit | Python |
4aeee052bdb2e1045d72401ea9f2595e62c6f510 | Hide stdout in text client | MatthewScholefield/mycroft-simple,MatthewScholefield/mycroft-simple | mycroft/interfaces/text_interface.py | mycroft/interfaces/text_interface.py | # Copyright (c) 2017 Mycroft AI, Inc.
#
# This file is part of Mycroft Light
# (see https://github.com/MatthewScholefield/mycroft-light).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
... | # Copyright (c) 2017 Mycroft AI, Inc.
#
# This file is part of Mycroft Light
# (see https://github.com/MatthewScholefield/mycroft-light).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
... | apache-2.0 | Python |
451c821118eff98d7e92b3a3f46b1a76048abbb5 | add wiki canned response | hzsweers/androiddev_bot | androiddev_bot/config.py | androiddev_bot/config.py | import praw
# Put your vars here
suspect_title_strings = ['?', 'help', 'stuck', 'why', 'my', 'feedback']
subreddit = 'androiddev'
# Canned responses
cans = {
'questions_thread': "Removed because, per sub rules, this doesn't merit its own post. We have a questions thread every day, please use it for questions lik... | import praw
# Put your vars here
suspect_title_strings = ['?', 'help', 'stuck', 'why', 'my', 'feedback']
subreddit = 'androiddev'
# Canned responses
cans = {
'questions_thread': "Removed because, per sub rules, this doesn't merit its own post. We have a questions thread every day, please use it for questions lik... | apache-2.0 | Python |
db2f6f4c2a70875aade3741fb57d0bc1b109ce3c | Add regexp to create_user form logic | kylemh/UO_CIS322,kylemh/UO_CIS322,kylemh/UO_CIS322 | app/views/create_user.py | app/views/create_user.py | from flask import request, flash, render_template
import bcrypt
from app import app, helpers
@app.route('/create_user', methods=['GET', 'POST'])
def create_user():
if request.method == 'POST':
username = request.form.get('username', None).strip() # Aa09_.- allowed
password = request.form.get('pa... | from flask import request, flash, render_template
import bcrypt
from app import app, helpers
@app.route('/create_user', methods=['GET', 'POST'])
def create_user():
if request.method == 'POST':
username = request.form.get('username', None).strip()
password = request.form.get('password', None)
... | agpl-3.0 | Python |
8bcc09e4d3d0a14abd132e023bb4b4896aaac4f2 | make imports Python 3 friendly | nhmc/Barak | barak/absorb/__init__.py | barak/absorb/__init__.py | from .absorb import *
from .equiv_width import *
from .aod import *
| from absorb import *
from equiv_width import *
from aod import *
| bsd-3-clause | Python |
4b6bffdb048aa44b42cb80a54fca9a204ede833f | Update version to 0.0.3 | FindHotel/boto3facade,InnovativeTravel/boto3facade | boto3facade/metadata.py | boto3facade/metadata.py | # -*- coding: utf-8 -*-
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'boto3facade'
project = "boto3facade"
project_no_spaces = project.replace(' ', '')
version = '0.0.3'
description = 'A simple facade for boto3'
authors = ['Ge... | # -*- coding: utf-8 -*-
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'boto3facade'
project = "boto3facade"
project_no_spaces = project.replace(' ', '')
version = '0.0.2'
description = 'A simple facade for boto3'
authors = ['Ge... | mit | Python |
81df185279a8d46ca2e8ed9fbed4c3204522965e | Extend potential life of social media queue entries | nfletton/bvspca,nfletton/bvspca,nfletton/bvspca,nfletton/bvspca | bvspca/social/models.py | bvspca/social/models.py | import logging
from datetime import datetime, timedelta
from django.db import models
from wagtail.core.models import Page
logger = logging.getLogger('bvspca.social')
class SocialMediaPostable():
def social_media_ready_to_post(self):
raise NotImplemented()
def social_media_post_text(self):
r... | import logging
from datetime import datetime, timedelta
from django.db import models
from wagtail.core.models import Page
logger = logging.getLogger('bvspca.social')
class SocialMediaPostable():
def social_media_ready_to_post(self):
raise NotImplemented()
def social_media_post_text(self):
r... | mit | Python |
77f4b5b1bc3c30fb454212d3c4d2aa62d8c06ca8 | Update exportyaml.py | ebroecker/canmatrix,altendky/canmatrix,altendky/canmatrix,ebroecker/canmatrix | canmatrix/exportyaml.py | canmatrix/exportyaml.py | #!/usr/bin/env python
from __future__ import absolute_import
from .canmatrix import *
import codecs
import yaml
from yaml.representer import SafeRepresenter
from builtins import *
import copy
#Copyright (c) 2013, Eduard Broecker
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or witho... | #!/usr/bin/env python
from __future__ import absolute_import
from .canmatrix import *
import codecs
import yaml
from yaml.representer import SafeRepresenter
from builtins import *
import copy
#Copyright (c) 2013, Eduard Broecker
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or witho... | bsd-2-clause | Python |
1a50aaf6be0f866046d88944607802a4e8661c61 | Revert "Test jenkins failure" | ihmeuw/vivarium | ceam_tests/test_util.py | ceam_tests/test_util.py | # ~/ceam/tests/test_util.py
from unittest import TestCase
from datetime import timedelta
from unittest.mock import Mock
import numpy as np
import pandas as pd
from ceam.engine import SimulationModule
from ceam.util import from_yearly, to_yearly, rate_to_probability, probability_to_rate
class TestRateConversions(Te... | # ~/ceam/tests/test_util.py
from unittest import TestCase
from datetime import timedelta
from unittest.mock import Mock
import numpy as np
import pandas as pd
from ceam.engine import SimulationModule
from ceam.util import from_yearly, to_yearly, rate_to_probability, probability_to_rate
class TestRateConversions(Te... | bsd-3-clause | Python |
f1dd824978ad8581113a088afe1d1bdf99a00802 | Move to dev. | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | command_line/griddex.py | command_line/griddex.py | # LIBTBX_SET_DISPATCHER_NAME dev.dials.griddex
from __future__ import absolute_import, division, print_function
import libtbx.phil
import libtbx.load_env
help_message = '''
Cross reference indexing solutions.
Examples::
%s expts0.json refl0.json
''' % libtbx.env.dispatcher_name
phil_scope = libtbx.phil.parse("... | from __future__ import absolute_import, division, print_function
import libtbx.phil
import libtbx.load_env
help_message = '''
Cross reference indexing solutions.
Examples::
%s expts0.json refl0.json
''' % libtbx.env.dispatcher_name
phil_scope = libtbx.phil.parse("""
d_min = None
.type = float(value_min=0... | bsd-3-clause | Python |
9ebc7c3aee73f4a950d4975034f3c41417d59444 | clean up unused imports | stoivo/GitSavvy,divmain/GitSavvy,dvcrn/GitSavvy,ypersyntelykos/GitSavvy,dreki/GitSavvy,asfaltboy/GitSavvy,divmain/GitSavvy,asfaltboy/GitSavvy,dvcrn/GitSavvy,divmain/GitSavvy,dreki/GitSavvy,ddevlin/GitSavvy,ddevlin/GitSavvy,asfaltboy/GitSavvy,jmanuel1/GitSavvy,ralic/GitSavvy,ralic/GitSavvy,stoivo/GitSavvy,ddevlin/GitSav... | common/util/__init__.py | common/util/__init__.py | import sublime
from plistlib import readPlistFromBytes
syntax_file_map = {}
def move_cursor(view, line_no, char_no):
# Line numbers are one-based, rows are zero-based.
line_no -= 1
# Negative line index counts backwards from the last line.
if line_no < 0:
last_line, _ = view.rowcol(view.size... | import itertools
import sublime
from plistlib import readPlistFromBytes
from .parse_diff import parse_diff
syntax_file_map = {}
def move_cursor(view, line_no, char_no):
# Line numbers are one-based, rows are zero-based.
line_no -= 1
# Negative line index counts backwards from the last line.
if lin... | mit | Python |
5caf134eedc4ace933da8c2f21aacc5f5b1224ef | bump version | vmalloc/confetti | confetti/__version__.py | confetti/__version__.py | __version__ = "2.2.1"
| __version__ = "2.2.0"
| bsd-3-clause | Python |
3dae8f25cda4827397ab3812ea552ed27d37e757 | Remove contraints on dotted names | OCA/account-financial-tools,OCA/account-financial-tools | base_vat_optional_vies/models/res_partner.py | base_vat_optional_vies/models/res_partner.py | # Copyright 2015 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2019 FactorLibre - Rodrigo Bonilla
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
vies_passed ... | # Copyright 2015 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2019 FactorLibre - Rodrigo Bonilla
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
vies_passed ... | agpl-3.0 | Python |
b5b31136ff716b423d78d307e107df4b8d8cfedc | Add images field on article model abstract, is many to many | jeanmask/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,williamroot/opps | opps/core/models/article.py | opps/core/models/article.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from opps.core.models.published import Published
from opps.core.models.date import Date
from opps.core.models.channel import Channel
from o... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from opps.core.models.published import Published
from opps.core.models.date import Date
from opps.core.models.channel import Channel
from ... | mit | Python |
a25141dca6ce6f8ead88c43fa7f5726afb2a9dba | Fix currency dialog to match model changes | coinbox/coinbox-mod-currency | cbpos/mod/currency/views/dialogs/currency.py | cbpos/mod/currency/views/dialogs/currency.py | from PySide import QtGui
import cbpos
logger = cbpos.get_logger(__name__)
from cbpos.mod.currency.models import Currency
from cbpos.mod.currency.views import CurrenciesPage
class CurrencyDialog(QtGui.QWidget):
def __init__(self):
super(CurrencyDialog, self).__init__()
messa... | from PySide import QtGui
from cbpos.mod.currency.models.currency import Currency
import cbpos
class CurrencyDialog(QtGui.QWidget):
def __init__(self):
super(CurrencyDialog, self).__init__()
self.name = QtGui.QLineEdit()
self.symbol = QtGui.QLineEdit()
self.value =... | mit | Python |
0dacb5382e3099d0b9faa65e207c3be407747eeb | Use .array | toslunar/chainerrl,toslunar/chainerrl | chainerrl/optimizers/nonbias_weight_decay.py | chainerrl/optimizers/nonbias_weight_decay.py | # This caused an error in py2 because cupy expect non-unicode str
# from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() ... | # This caused an error in py2 because cupy expect non-unicode str
# from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() ... | mit | Python |
1006ac44b8ef9654976c1b57ccf20387877db1cb | Update results/title/forms100.py | moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2 | results/title/forms100.py | results/title/forms100.py | from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os.path
from laboratory.settings import FONTS_FOLDER
from directions.models import Issledovaniya
from reportlab.platypus import Paragraph, Table, TableStyle, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from rep... | from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os.path
from laboratory.settings import FONTS_FOLDER
from directions.models import Issledovaniya
from reportlab.platypus import Paragraph, Table, TableStyle, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from rep... | mit | Python |
f51369999441cb85ed730488e943580d707e8856 | use relative imports in parser/__init__.py | boakley/robotframework-lint | rflint/parser/__init__.py | rflint/parser/__init__.py | from .parser import (SuiteFolder, ResourceFile, SuiteFile, RobotFactory,
Testcase, Keyword, Row, Statement, TestcaseTable, KeywordTable)
from .tables import DefaultTable, SettingTable, UnknownTable, VariableTable, MetadataTable, RobotTable
| from parser import ResourceFile, SuiteFile, RobotFileFactory, Testcase, Keyword, Row, Statement
from tables import DefaultTable, SettingTable, UnknownTable, VariableTable, MetadataTable, RobotTable
| apache-2.0 | Python |
780f28cd91f92fea0dddee2b62bc659d244a8270 | Change create sample code to select indexes by eval set | rjegankumar/instacart_prediction_model | create_sample.py | create_sample.py | # importing modules/ libraries
import pandas as pd
import random
import numpy as np
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
s = round(3214874 * 0.1)
i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_samp... | # importing modules/ libraries
import pandas as pd
import random
import numpy as np
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
s = round(3214874 * 0.1)
i = sorted(random.sample(range(1,3214874), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_sample.csv", index = False)
# create a s... | mit | Python |
fee30c4017da4d41a9487d961ba543d2d1e20e85 | Add explicit Note join relationship on NoteContent model. (also remove extraneous comments on old date format) | icasdri/tuhi-flask | tuhi_flask/models.py | tuhi_flask/models.py | # Copyright 2015 icasdri
#
# This file is part of tuhi-flask.
#
# tuhi-flask 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.
#
#... | # Copyright 2015 icasdri
#
# This file is part of tuhi-flask.
#
# tuhi-flask 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.
#
#... | agpl-3.0 | Python |
ee76ae4f41be17a0f6a482273e99783df8212004 | Reconfigure key repeat (should change to be configurable) | haikuginger/riker | riker/worker/utils.py | riker/worker/utils.py | from logging import getLogger
import tempfile
from threading import Thread
import lirc
from django.conf import settings
from systemstate.models import RemoteButton
from systemstate.utils import push_button
LOGGER = getLogger(__name__)
LIRCRC_TEMPLATE = '''
begin
prog = {lirc_name}
button = {key_... | from logging import getLogger
import tempfile
from threading import Thread
import lirc
from django.conf import settings
from systemstate.models import RemoteButton
from systemstate.utils import push_button
LOGGER = getLogger(__name__)
LIRCRC_TEMPLATE = '''
begin
prog = {lirc_name}
button = {key_... | mit | Python |
0827911184bf43a6dd50712444d3f9385a64eb31 | support combining bigrams | enkiv2/constrained-writer | constraintWriterTool.py | constraintWriterTool.py | #!/usr/bin/env python
from autosuggest import *
import os, sys
from sys import argv, exit
def printUsage():
print("Usage: constraintWriterTool action [options]\nActions:\n\tsuggest\t\tbigramfile word\n\tsuggestPfx\tbigramfile word prefix\n\tinWhitelist\tbigramfile word\n\tinBlacklist\tbigramfile word\n\tcompile\t\tc... | #!/usr/bin/env python
from autosuggest import *
import os, sys
from sys import argv, exit
def printUsage():
print("Usage: constraintWriterTool action [options]\nActions:\n\tsuggest\t\tbigramfile word\n\tsuggestPfx\t\tbigramfile word prefix\n\tinWhitelist\tbigramfile word\n\tinBlacklist\tbigramfile word\n\tcompile\t\... | bsd-3-clause | Python |
506b4e510b60d02bf7bfeb23bf181c483ec5a458 | Reduce error message size by not printing entire traceback | JacobAMason/Boa | src/Client.py | src/Client.py | #!python
__author__ = 'JacobAMason'
import sys
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
import StringIO
class Bot(irc.IRCClient):
def _get_nickname(self):
return self.factory.nickname
nickname = property(_get_nickname)
def signedOn(self):
se... | #!python
__author__ = 'JacobAMason'
import sys
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
import StringIO
import traceback
class Bot(irc.IRCClient):
def _get_nickname(self):
return self.factory.nickname
nickname = property(_get_nickname)
def signedOn(... | mit | Python |
1f19fa52e40db1f28d620aa8bf75745e814c0f81 | Remove unused import | r-robles/rd-bot | cogs/fun.py | cogs/fun.py | import discord
from discord.ext import commands
from utils.messages import ColoredEmbed
class Fun:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def xkcd(self, ctx):
"""See the latest XKCD comic."""
async with self.bot.session.get('https://xkcd.com/info.0.json'... | import random
import discord
from discord.ext import commands
from utils.messages import ColoredEmbed
class Fun:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def xkcd(self, ctx):
"""See the latest XKCD comic."""
async with self.bot.session.get('https://xkcd.co... | mit | Python |
14eaff694912320296412f2e4ca51072c5dddf49 | add unit_testing_only decorator | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/dbaccessors.py | corehq/apps/userreports/dbaccessors.py | from corehq.apps.domain.dbaccessors import get_docs_in_domain_by_class
from corehq.apps.domain.models import Domain
from corehq.util.test_utils import unit_testing_only
def get_number_of_report_configs_by_data_source(domain, data_source_id):
"""
Return the number of report configurations that use the given da... | from django.conf import settings
from dimagi.utils.couch.database import iter_docs
from corehq.apps.domain.dbaccessors import get_docs_in_domain_by_class
from corehq.apps.domain.models import Domain
def get_number_of_report_configs_by_data_source(domain, data_source_id):
"""
Return the number of report conf... | bsd-3-clause | Python |
e595d823e303a6db0a9c7e24f6a9d1644615009c | Bump version of CaptchaService.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/internal/CaptchaService.py | module/plugins/internal/CaptchaService.py | # -*- coding: utf-8 -*-
from module.plugins.internal.Captcha import Captcha
class CaptchaService(Captcha):
__name__ = "CaptchaService"
__type__ = "captcha"
__version__ = "0.35"
__status__ = "stable"
__description__ = """Base anti-captcha service plugin"""
__license__ = "GPLv3"
... | # -*- coding: utf-8 -*-
from module.plugins.internal.Captcha import Captcha
class CaptchaService(Captcha):
__name__ = "CaptchaService"
__type__ = "captcha"
__version__ = "0.34"
__status__ = "stable"
__description__ = """Base anti-captcha service plugin"""
__license__ = "GPLv3"
... | agpl-3.0 | Python |
5efc40cd9be0c212f142d7469a9bf6f44da0827a | add story support in client with -s boolean operator | b3nab/instapy-cli,b3nab/instapy-cli | instapy_cli/__main__.py | instapy_cli/__main__.py | import sys
from platform import python_version
from instapy_cli.cli import InstapyCli as client
from optparse import OptionParser
import pkg_resources # part of setuptools
version = pkg_resources.require('instapy_cli')[0].version
def main(args=None):
print('instapy-cli ' + version + ' | python ' + python_versi... | import sys
from platform import python_version
from instapy_cli.cli import InstapyCli as client
from optparse import OptionParser
import pkg_resources # part of setuptools
version = pkg_resources.require('instapy_cli')[0].version
'''
TODO:
- use instapy_cli.media to download image link and use it for upload and conf... | mit | Python |
f26c2059ff6e2a595097ef7a03efe149f9e253eb | Add default images for podcasts if necessary | up1/blog-1,up1/blog-1,up1/blog-1 | iterator.py | iterator.py | import os, re, requests
rootdir = '_posts'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
filename = os.path.join(subdir, file)
f = open(filename, "r")
contents = f.readlines()
f.close()
# Find first image
if re.search('podcast', filename):
if re.s... | import os, re, requests
rootdir = '_posts'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
filename = os.path.join(subdir, file)
f = open(filename, "r")
contents = f.readlines()
f.close()
# Find first image
for key, line in enumerate(contents):
src = re.sear... | mit | Python |
e0f3e68435b406e3bad9b7f7e459b724ea832e9e | Disable summernote editor test from Travis | shoopio/shoop,shoopio/shoop,shoopio/shoop | shuup_tests/browser/admin/test_editor.py | shuup_tests/browser/admin/test_editor.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2018, Shuup Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import os
import pytest
from django.core.urlresolvers import reverse
from ... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2018, Shuup Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import os
import pytest
from django.core.urlresolvers import reverse
from ... | agpl-3.0 | Python |
eda2f6905a3275623525c4179358e55e472b4fd7 | Fix bug in urls.py following the sample_list template being renamed. | woodymit/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source | genome_designer/urls.py | genome_designer/urls.py | from django.conf.urls.defaults import include
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import url
urlpatterns = patterns('',
url(r'^$', 'genome_designer.main.views.home_view'),
# Project-specific views
url(r'^projects$',
'genome_designer.main.views.project_... | from django.conf.urls.defaults import include
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import url
urlpatterns = patterns('',
url(r'^$', 'genome_designer.main.views.home_view'),
# Project-specific views
url(r'^projects$',
'genome_designer.main.views.project_... | mit | Python |
50bd1ce1118ddb52a54f679fc9faee4bc3110458 | Allow the --force command line argument to accept one or more stage names' | bjpop/rubra,magosil86/rubra | rubra/cmdline_args.py | rubra/cmdline_args.py | # Process the unix command line of the pipeline.
import argparse
from version import rubra_version
def get_cmdline_args():
return parser.parse_args()
parser = argparse.ArgumentParser(
description='A bioinformatics pipeline system.')
parser.add_argument(
'--pipeline',
metavar='PIPELINE_FILE',
typ... | # Process the unix command line of the pipeline.
import argparse
from version import rubra_version
def get_cmdline_args():
return parser.parse_args()
parser = argparse.ArgumentParser(
description='A bioinformatics pipeline system.')
parser.add_argument(
'--pipeline',
metavar='PIPELINE_FILE',
typ... | mit | Python |
4009e01004ecd9b8f3d759842181b65a3893f73a | fix `TypeError: the JSON object must be str, bytes or bytearray, not NoneType` | drgarcia1986/simple-settings | simple_settings/dynamic_settings/base.py | simple_settings/dynamic_settings/base.py | # -*- coding: utf-8 -*-
import re
from copy import deepcopy
import jsonpickle
class BaseReader(object):
"""
Base class for dynamic readers
"""
_default_conf = {}
def __init__(self, conf):
self.conf = deepcopy(self._default_conf)
self.conf.update(conf)
self.key_pattern = s... | # -*- coding: utf-8 -*-
import re
from copy import deepcopy
import jsonpickle
class BaseReader(object):
"""
Base class for dynamic readers
"""
_default_conf = {}
def __init__(self, conf):
self.conf = deepcopy(self._default_conf)
self.conf.update(conf)
self.key_pattern = s... | mit | Python |
a6cb3bfeb5f7201a0e702024257df1f874a3bb70 | Bump version 15. | hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,ArchiveTeam/terroroftinytown,hugovk/terroroftinytown | terroroftinytown/client/__init__.py | terroroftinytown/client/__init__.py | VERSION = 15 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| VERSION = 14 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| mit | Python |
3f70ead379b7f586313d01d5ab617fd5368f8ce3 | Print traceback if startup fails | centrumholdings/cthulhubot | cthulhubot/management/commands/restart_masters.py | cthulhubot/management/commands/restart_masters.py | from traceback import print_exc
from django.core.management.base import BaseCommand
from cthulhubot.models import Buildmaster
class Command(BaseCommand):
help = 'Restart all Buildmaster processes'
args = ""
def handle(self, *fixture_labels, **options):
verbosity = int(options.get('verbosity', 1))... | from django.core.management.base import BaseCommand
from cthulhubot.models import Buildmaster
class Command(BaseCommand):
help = 'Restart all Buildmaster processes'
args = ""
def handle(self, *fixture_labels, **options):
verbosity = int(options.get('verbosity', 1))
commit = int(options.ge... | bsd-3-clause | Python |
4541b5edc808d77f53305eafca418d3be6715e8d | Cut 0.17.3 | pyinvoke/invocations | invocations/_version.py | invocations/_version.py | __version_info__ = (0, 17, 3)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (0, 17, 2)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
8d70bad3968cb11c929beafcef44b023822b886f | make interval adjustable in poll_request, and also remove check_response call duplication | rackspace-titan/stacktester,rackspace-titan/stacktester | stacktester/common/http.py | stacktester/common/http.py | from stacktester import exceptions
import httplib2
import os
import time
class Client(object):
USER_AGENT = 'python-nova_test_client'
def __init__(self, host='localhost', port=80, base_url=''):
#TODO: join these more robustly
self.base_url = "http://%s:%s/%s" % (host, port, base_url)
d... | from stacktester import exceptions
import httplib2
import os
import time
class Client(object):
USER_AGENT = 'python-nova_test_client'
def __init__(self, host='localhost', port=80, base_url=''):
#TODO: join these more robustly
self.base_url = "http://%s:%s/%s" % (host, port, base_url)
d... | apache-2.0 | Python |
a8fe56cd60296607f879dea86432532a5b40824a | Add a main method | richli/dame | dame/__init__.py | dame/__init__.py | from .dame import *
def main():
dame.main()
| mit | Python | |
f5e65b648d632f2e75dffe7943ed3e7105b21d7f | Remove GCS patch fixed upstream in te upstream library | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | core/polyaxon/fs/gcs.py | core/polyaxon/fs/gcs.py | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# 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/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# 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 |
cb92a3cf67557fbd4a629601490a74bdb2119935 | add print_list method to dijkstra | NWuensche/DijkstraInPython | dijkstra.py | dijkstra.py | # -*- coding: utf-8 -*-
class Dijkstra:
def __init__(self, adj, start):
self.adj = adj
self.s = start
self.dists = [0 for x in range(len(adj))]
# Liefert minimales Element > 0
def minweight(self, verts):
return min([x for x in verts if x>0])
# Baut liste der Entfernung... | # -*- coding: utf-8 -*-
class Dijkstra:
def __init__(self, adj, start):
self.adj = adj
self.s = start
self.dists = [0 for x in range(len(adj))]
# Liefert minimales Element > 0
def minweight(self, verts):
return min([x for x in verts if x>0])
# Baut liste der Entfernung... | apache-2.0 | Python |
ed42fa81e1029633f6b6f426c437df0c55262922 | Fix LabHubApp. | jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab | jupyterlab/labhubapp.py | jupyterlab/labhubapp.py | import os
import warnings
from traitlets import default
from .labapp import LabApp
try:
from jupyterhub.singleuser import SingleUserNotebookApp
except ImportError:
SingleUserLabApp = None
raise ImportError('You must have jupyterhub installed for this to work.')
else:
class SingleUserLabApp(SingleUser... | import os
from traitlets import default
from .labapp import LabApp
try:
from jupyterhub.singleuser import SingleUserNotebookApp
except ImportError:
SingleUserLabApp = None
raise ImportError('You must have jupyterhub installed for this to work.')
else:
class SingleUserLabApp(SingleUserNotebookApp, Lab... | bsd-3-clause | Python |
f4c1093616d08bd4abcb5ddc030b59d863dcec05 | Change netapi to use processmanager | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/client/netapi.py | salt/client/netapi.py | # encoding: utf-8
'''
The main entry point for salt-api
'''
# Import python libs
import logging
import multiprocessing
import signal
import os
# Import salt-api libs
import salt.loader
import salt.utils.process
logger = logging.getLogger(__name__)
class NetapiClient(object):
'''
Start each netapi module tha... | # encoding: utf-8
'''
The main entry point for salt-api
'''
# Import python libs
import logging
import multiprocessing
import signal
import os
# Import salt-api libs
import salt.loader
logger = logging.getLogger(__name__)
class NetapiClient(object):
'''
Start each netapi module that is configured to run
... | apache-2.0 | Python |
89f8d0ebe01e188b5a043dfbf891cf3a3bca0504 | Clarify that event is sent up to the master | 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.utils.event
import salt.payload
def fire_master(data, tag):
'''
Fire an event off up to the master server
CLI Example::
salt '*' event.fire_master 'stuff to be in the event' ... | '''
Fire events on the minion, events can be fired up to the master
'''
# Import salt libs
import salt.crypt
import salt.utils.event
import salt.payload
def fire_master(data, tag):
'''
Fire an event off on the master server
CLI Example::
salt '*' event.fire_master 'stuff to be in the event' 'ta... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.