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 |
|---|---|---|---|---|---|---|---|---|
2155febf0919ee1cc2caa2766bdf7b4b5a2e1fef | Remove prints | asascience-open/ooi-ui,oceanzus/ooi-ui,dlangston/ooi-ui,lukecampbell/ooi-ui,maka-io/ooi-ui,Bobfrat/ooi-ui,DanielJMaher/ooi-ui,dlangston/ooi-ui,asascience-open/ooi-ui,oceanzus/ooi-ui,lukecampbell/ooi-ui,FBRTMaka/ooi-ui,dlangston/ooi-ui,Bobfrat/ooi-ui,asascience-open/ooi-ui,maka-io/ooi-ui,FBRTMaka/ooi-ui,ssontag55/ooi-ui... | ooiui/core/routes/science.py | ooiui/core/routes/science.py | #!/usr/bin/env python
'''
ooiui.core.routes.science
Defines the application routes
'''
from ooiui.core.app.science import app
from flask import request, render_template, Response
from ooiui.config import TABLEDAP, SERVICES_URL, DEBUG, ERDDAP_URL
from ooiui.core.interface import tabledap as tabled
from ooiui.core.inte... | #!/usr/bin/env python
'''
ooiui.core.routes.science
Defines the application routes
'''
from ooiui.core.app.science import app
from flask import request, render_template, Response
from ooiui.config import TABLEDAP, SERVICES_URL, DEBUG, ERDDAP_URL
from ooiui.core.interface import tabledap as tabled
from ooiui.core.inte... | mit | Python |
43711dc356fa9ed8db0f6d4aefee1069d4a09481 | Add debug lines | ajnelson/dfxmlfs,ajnelson/dfxmlfs | testdata/nps-2009-ntfs1/ntfs-gen2/test_reads.py | testdata/nps-2009-ntfs1/ntfs-gen2/test_reads.py |
#Run in Python 2 or Python 3.
import logging
import os
import hashlib
import sys
_logger = logging.getLogger(os.path.basename(__file__))
import Objects
def main():
hash_mismatches = 0
for (event, obj) in Objects.iterparse(args.xmlfile):
if not isinstance(obj, Objects.FileObject):
contin... |
#Run in Python 2 or Python 3.
import logging
import os
import hashlib
import sys
_logger = logging.getLogger(os.path.basename(__file__))
import Objects
def main():
hash_mismatches = 0
for (event, obj) in Objects.iterparse(args.xmlfile):
if not isinstance(obj, Objects.FileObject):
contin... | lgpl-2.1 | Python |
f66c959a0e614a2db0570ca0378a6b47881a5682 | Increment version to 0.3.4 | dgwartney-io/import-io-api-python,dgwartney-io/import-io-api-python | importio2/version.py | importio2/version.py | #
# Copyright 2016 Import.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | #
# Copyright 2016 Import.io
#
# 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 |
f0871086222be67ba4add4574cf03d3cb9d39d63 | Add test for run-together interpolated expressions. | jonathanverner/circular,jonathanverner/circular,jonathanverner/circular | tests/circular/template/test_interpolatedstr.py | tests/circular/template/test_interpolatedstr.py | from src.circular.template.interpolatedstr import InterpolatedStr
from src.circular.template.context import Context
from tests.utils import TObserver
def test_string_interp():
ctx = Context()
ctx.name = "James"
s = InterpolatedStr("My name is {{ surname }}, {{name}} {{ surname}}.")
s.bind_ctx(ctx)
... | from src.circular.template.interpolatedstr import InterpolatedStr
from src.circular.template.context import Context
from tests.utils import TObserver
def test_string_interp():
ctx = Context()
ctx.name = "James"
s = InterpolatedStr("My name is {{ surname }}, {{name}} {{ surname}}.")
s.bind_ctx(ctx)
... | mit | Python |
60b4d721b56245b36790c0f11f8517a511cecfac | fix venv cache | throwable-one/teamcity-messages | tests/integration-tests/virtual_environments.py | tests/integration-tests/virtual_environments.py | import os
import shutil
import subprocess
import sys
import tempfile
import virtualenv
_windows = os.name == 'nt'
class VirtualEnvDescription:
def __init__(self, home_dir, bin_dir, python, pip):
self.home = home_dir
self.bin = bin_dir
self.python = python
self.pip = pip
def pre... | import os
import shutil
import subprocess
import sys
import tempfile
import virtualenv
_windows = os.name == 'nt'
class VirtualEnvDescription:
def __init__(self, home_dir, bin_dir, python, pip):
self.home = home_dir
self.bin = bin_dir
self.python = python
self.pip = pip
def pre... | apache-2.0 | Python |
f9575d58e6bad20baf41c1b80b5bbd5c5ee7a6c8 | use session bus to get authorization | boyjimeking/paintown,Sevalecan/paintown,Sevalecan/paintown,boyjimeking/paintown,Sevalecan/paintown,Sevalecan/paintown,Sevalecan/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,boyjimeking/paintown | installer/policykit.py | installer/policykit.py | import dbus
import os
## highly inspired from this code
## https://fedorahosted.org/python-slip/browser/slip/dbus/polkit.py
#
#stuff = {"0": ("org.freedesktop.PolicyKit", "/", "org.freedesktop.PolicyKit"),
# "1": ("org.freedesktop.PolicyKit1", "/org/freedesktop/PolicyKit1/Authority", "org.freedesktop.PolicyKit... | import dbus
import os
# highly inspired from this code
# https://fedorahosted.org/python-slip/browser/slip/dbus/polkit.py
stuff = {"0": ("org.freedesktop.PolicyKit", "/", "org.freedesktop.PolicyKit"),
"1": ("org.freedesktop.PolicyKit1", "/org/freedesktop/PolicyKit1/Authority", "org.freedesktop.PolicyKit1.Aut... | bsd-3-clause | Python |
02b3212f2655af6f5181433a28e1d6db379de1b9 | make Perceptron algorithm object oriented. Use it to classify iris dataset | taspinar/siml | siml/perceptron.py | siml/perceptron.py | import random
import numpy as np
import load_data as ld
from evaluators import *
class Perceptron():
"""
Class for performing Perceptron.
X is the input array with n rows (no_examples) and m columns (no_features)
Y is a vector containing elements which indicate the class
(1 for positive cla... | import random
import numpy as np
def generate_data(no_points):
X = np.zeros(shape=(no_points, 2))
Y = np.zeros(shape=no_points)
for ii in range(no_points):
X[ii][0] = random.randint(1,9)+0.5
X[ii][1] = random.randint(1,9)+0.5
Y[ii] = 1 if X[ii][0]+X[ii][1] >= 12 else -1
return X... | mit | Python |
7ce48df1dc525b214a5993853d313d7e1ab6050d | Use json module instead of django.utils.simplejson for Django 1.5 | wyg3958/django-cms,cyberintruder/django-cms,josjevv/django-cms,jproffitt/django-cms,webu/django-cms,mkoistinen/django-cms,czpython/django-cms,ojii/django-cms,memnonila/django-cms,Jaccorot/django-cms,11craft/django-cms,mkoistinen/django-cms,isotoma/django-cms,jsma/django-cms,bittner/django-cms,jproffitt/django-cms,intgr... | cms/templatetags/cms_js_tags.py | cms/templatetags/cms_js_tags.py | # -*- coding: utf-8 -*-
from distutils.version import LooseVersion
from classytags.core import Tag, Options
import django
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.text import javascript_quote
DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion... | # -*- coding: utf-8 -*-
from classytags.core import Tag, Options
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import simplejson
from django.utils.text import javascript_quote
register = template.Library()
@register.filter
def js(value):
return simplejson... | bsd-3-clause | Python |
27c451c8490e0f70ceb96327bc6d2aeb29605a40 | Add TODO to comment in registration helper to reduce risk of task being forgotten | uktrade/directory-ui-supplier,uktrade/directory-ui-supplier,uktrade/directory-ui-supplier | ui/helpers.py | ui/helpers.py | def get_referrer_from_request(request):
# TODO: determine what source led the user to the export directory
# if navigating internally then return None (ticket ED-138)
return 'aaa'
| def get_referrer_from_request(request):
# determine what source led the user to the export directory
# if navigating internally then return None
return 'aaa'
| mit | Python |
0ac5088e4c06c18de5f8dc5dfaa60d408b0c97bb | Load live_settings.py if present. | Wilfred/simpla-vortaro,Wilfred/simpla-vortaro | settings.py | settings.py | import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Vilfredo Hjuz', 'yowilfred@gmail.com'),
)
MANAGERS = ADMINS
PROJECT_DIR = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_DIR, 'word_db'),
'USER': '',... | import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Vilfredo Hjuz', 'yowilfred@gmail.com'),
)
MANAGERS = ADMINS
PROJECT_DIR = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_DIR, 'word_db'),
'USER': '',... | agpl-3.0 | Python |
a4097d117e1285f76c814406d745997564b0ff05 | Combine logging config into basicConfig | inactivist/twitter-streamer,inactivist/twitter-streamer | streamer/utils.py | streamer/utils.py | """
Some of this code was extracted from other sources. Copyright information
may be found at the links provided.
"""
def resolve(obj, attrspec):
"""
Resolve elements from an object.
Works with objects and dicts.
From: http://stackoverflow.com/a/9101577/1309774
"""
for attr in attrspec.split("... | """
Some of this code was extracted from other sources. Copyright information
may be found at the links provided.
"""
def resolve(obj, attrspec):
"""
Resolve elements from an object.
Works with objects and dicts.
From: http://stackoverflow.com/a/9101577/1309774
"""
for attr in attrspec.split("... | mit | Python |
aae16bd3e0fb8492e5e5859b3f558794336d5edb | Make BaseCollector decide the HTTP method based on data variable | gamnor/olhoneles,gamnor/olhoneles,gamnor/olhoneles,olhoneles/olhoneles,olhoneles/olhoneles,olhoneles/olhoneles | collector/sources/basesource.py | collector/sources/basesource.py | import os
import time
from datetime import datetime
from logging import exception
import urllib
from urllib2 import urlopen, Request, URLError, HTTPError
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy import and_
appdir = os.path.abspath(os.... | import os
import time
from datetime import datetime
from logging import exception
import urllib
from urllib2 import urlopen, Request, URLError, HTTPError
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy import and_
appdir = os.path.abspath(os.... | agpl-3.0 | Python |
4d0b4578870c8e16ac8ae1d4313958670897688e | Update np utils | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | core/polyaxon/utils/np_utils.py | core/polyaxon/utils/np_utils.py | #!/usr/bin/python
#
# Copyright 2018-2020 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-2020 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 |
8d514f2cd85aa950381d4fd014fc6d8c303c2069 | add varbase.estimate_achievable_tmid_precision | lgbouma/astrobase,waqasbhatti/astrobase,waqasbhatti/astrobase,waqasbhatti/astrobase,lgbouma/astrobase,lgbouma/astrobase | astrobase/varbase/__init__.py | astrobase/varbase/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''varbase.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jan 2016
Contains functions to deal with light curve variability, fitting functions,
masking signals, autocorrelation, etc.
CURRENT SUBMODULES:
varbase.autocorr: calculating the autocorrelation function of lig... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''varbase.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jan 2016
Contains functions to deal with light curve variability, fitting functions,
masking signals, autocorrelation, etc.
CURRENT SUBMODULES:
varbase.autocorr: calculating the autocorrelation function of lig... | mit | Python |
5d66caf443b9a234eb4ddc57c77a546cebc7fe24 | Refactor contract generator management command | onyb/ethane,onyb/ethane,onyb/ethane,onyb/ethane | tokens/management/commands/generate_contract.py | tokens/management/commands/generate_contract.py | import os
from django.core.management.base import BaseCommand, CommandError
from jinja2 import Template
from settings import CONTRACTS_DIR
from ...models import Token
class Command(BaseCommand):
help = 'Generate Solidity contracts for a Token in the database'
def add_arguments(self, parser):
parser... | import os
from django.core.management.base import BaseCommand, CommandError
from jinja2 import Template
from settings import CONTRACTS_DIR
from ...models import Token
class Command(BaseCommand):
help = 'Generate Solidity contracts for a Token in the database'
def add_arguments(self, parser):
parser... | apache-2.0 | Python |
f88111b870ab11cc7232aa705b91cfc236dcb289 | add Parser to package init | instagrambot/instapro | instabot/__init__.py | instabot/__init__.py | from .user import User
from .api import API
from .bot import Bot
from .parser import Parser
assert User # silence pyflakes
assert API # silence pyflakes
assert Bot # silence pyflakes
assert Parser
| from .user import User
from .api import API
from .bot import Bot
assert User # silence pyflakes
assert API # silence pyflakes
assert Bot # silence pyflakes
| apache-2.0 | Python |
b695a1e20cd1456c03af1905271b08d2004bcd22 | change word controller | kymy86/ms-services-app,kymy86/ms-services-app | client.py | client.py |
#!/usr/local/bin/python3
import os
from pathlib import Path
from classes.webcamclient import WebcamClient
from classes.audioclient import AudioClient
def on_success(res):
"""print thread success result"""
print(res)
def on_failure(res):
""" print thread failure result"""
print(res)
HANDLERS = {'on... |
#!/usr/local/bin/python3
import os
from pathlib import Path
from classes.webcamclient import WebcamClient
from classes.audioclient import AudioClient
def on_success(res):
"""print thread success result"""
print(res)
def on_failure(res):
""" print thread failure result"""
print(res)
HANDLERS = {'on... | mit | Python |
055c0404b9fed815e2fe4de2daae27672da7bc2c | Update sphinx documentation for model.source | JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder | clowder/clowder/model/source.py | clowder/clowder/model/source.py | # -*- coding: utf-8 -*-
"""Representation of clowder.yaml source
.. codeauthor:: Joe Decapo <joe@polka.cat>
"""
class Source(object):
"""clowder.yaml source class"""
def __init__(self, source):
self.name = source['name']
self.url = source['url']
def get_url_prefix(self):
"""Ret... | """Representation of clowder.yaml source"""
class Source(object):
"""clowder.yaml source class"""
def __init__(self, source):
self.name = source['name']
self.url = source['url']
def get_url_prefix(self):
"""Return full remote url prefix for project"""
source_url_prefix =... | mit | Python |
1a50302463044d8ae7ba0e4cdbcbce518ee33514 | Update oauth.py | SimonWang2014/DockerConsoleApp,SimonWang2014/DockerConsoleApp,liuhong1happy/DockerConsoleApp,liuhong1happy/DockerConsoleApp,SimonWang2014/DockerConsoleApp,SimonWang2014/DockerConsoleApp,liuhong1happy/DockerConsoleApp | util/oauth.py | util/oauth.py | from tornado.auth import OAuth2Mixin,_auth_return_future
import settings
class GitLabOAuth2Mixin(OAuth2Mixin):
_OAUTH_SETTINGS_KEY = 'GITLAB_OAUTH'
_OAUTH_AUTHORIZE_URL = settings[self._OAUTH_SETTINGS_KEY]['authorize_url']
_OAUTH_ACCESS_TOKEN_URL = settings[self._OAUTH_SETTINGS_KEY]['access_token_url']
... | from tornado.auth import OAuth2Mixin,_auth_return_future
import settings
class GitLabOAuth2Mixin(OAuth2Mixin):
_OAUTH_SETTINGS_KEY = 'GITLAB_OAUTH'
_OAUTH_AUTHORIZE_URL = settings[self._OAUTH_SETTINGS_KEY].authorize_url
_OAUTH_ACCESS_TOKEN_URL = settings[self._OAUTH_SETTINGS_KEY].access_token_url
_OAUT... | apache-2.0 | Python |
793c477f4e365d47d9245f43e9d49fccce303d2a | Use a OneToMany field for the activity joiner. | AeroNotix/django-timetracker,AeroNotix/django-timetracker,AeroNotix/django-timetracker | vcs/models.py | vcs/models.py | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | bsd-3-clause | Python |
4de16fe02088e7933baee1de01e5e1e6ee8cad95 | use fav class test push | youqingkui/zhihufav | test/note_test.py | test/note_test.py | #!/usr/bin/env python
#coding=utf-8
from lib.fav import Fav
fav = Fav('https://api.zhihu.com/answers/83464968')
fav.get_content()
| #!/usr/bin/env python
#coding=utf-8
import requests
import os
import hashlib
import binascii
from lib.Evernote import EvernoteMethod
import evernote.edam.type.ttypes as Types
from bs4 import BeautifulSoup
import HTMLParser
h = HTMLParser.HTMLParser()
dev_token = os.environ.get('DeveloperToken')
noteStore = Evernote... | mit | Python |
5a12255e0af4666a5a197bad94e2cbfe4229a310 | Change obj to self in selfparams | jhamrick/gaussian_processes,jhamrick/gaussian_processes | src/kernels/util.py | src/kernels/util.py | import numba
def selfparams(f):
def wrapped_func(self, x1, x2):
return f(x1.astype('f8', copy=False),
x2.astype('f8', copy=False),
*self.params)
wrapped_func.__name__ = f.__name__
wrapped_func.__doc__ = f.__doc__
return wrapped_func
def lazyjit(*args, **kwar... | import numba
def selfparams(f):
def wrapped_func(obj, x1, x2):
return f(x1.astype('f8', copy=False),
x2.astype('f8', copy=False),
*obj.params)
wrapped_func.__name__ = f.__name__
wrapped_func.__doc__ = f.__doc__
return wrapped_func
def lazyjit(*args, **kwargs... | mit | Python |
ed822647209a5dec694dac3086d3c23b7ffc7a35 | update config | foremap/IoT_demo | config.py | config.py | APP_KEY = "ooooooo"
SECRET_KEY = "xxxxxxxxx" | APP_KEY = "WTMpWBYjN4DUgKqycABcdECD"
SECRET_KEY = "f10f8ffe9e6332b1964e52b0408cb27e" | apache-2.0 | Python |
2b21d1409d6d0f9b58b8306bd7f95f503600e15d | Fix prefixes, move some dirs around, nobody has /home/jochem :) | jkossen/showoff,jkossen/showoff,jkossen/showoff | config.py | config.py | DEBUG = True
TITLE = 'Photo albums'
FRONTEND_HOST = '127.0.0.1'
FRONTEND_PORT = 5050
FRONTEND_BASEURL = 'http://showoff'
FRONTEND_PREFIX = '/showoff'
FRONTEND_FCGI_SOCKET = '/var/lib/showoff/frontend.sock'
ADMIN_HOST = '127.0.0.1'
ADMIN_PORT = 5051
ADMIN_BASEURL = 'http://showoff'
ADMIN_PREFIX = '/showoff_admin'
ADMIN_... | DEBUG = True
TITLE = 'Photo albums'
FRONTEND_HOST = '192.168.1.3'
FRONTEND_PORT = 5050
FRONTEND_BASEURL = 'http://showoff'
FRONTEND_PREFIX = 'showoff/'
FRONTEND_FCGI_SOCKET = '/var/lib/showoff/frontend.sock'
ADMIN_HOST = '192.168.1.3'
ADMIN_PORT = 5051
ADMIN_BASEURL = 'http://showoff'
ADMIN_PREFIX = 'showoff_admin/'
AD... | bsd-2-clause | Python |
31be604e9b5c45d909388eefa82aea1999b02be5 | Add license and documentation | steveblamey/uzerp-locust | config.py | config.py | # App host
APP_HOST = 'https://demo.uzerp.com'
# App login details
APP_USERNAME = 'admin'
APP_PASSWORD = 'admin'
# Collect the response time for each request and save to a CSV file
COLLECT_STATS = True
# Filename for the csv
STATS_FILE = 'stats.csv'
| # App host
APP_HOST = 'https://demo.uzerp.com'
# App login details
APP_USERNAME = 'admin'
APP_PASSWORD = 'admin'
# Collect the request time for each request and save to a CSV file
COLLECT_STATS = True
STATS_FILE = 'stats.csv'
| mit | Python |
4d69119d3471683728a31feedc0e65b38fc15b88 | Update config.py | steinwurf/bourne,steinwurf/bourne | config.py | config.py | #!/usr/bin/env python
# encoding: utf-8
import traceback
import sys
try:
input = raw_input
except NameError:
pass
project_name = 'bourne'
project_dependencies = \
[
'waf-tools',
'gtest',
]
# Importing a dynamically generated module
# Python recipe from http://code.activestate.com/rec... | #!/usr/bin/env python
# encoding: utf-8
import traceback
import sys
from six.moves import input
project_name = 'bourne'
project_dependencies = \
[
'waf-tools',
'gtest',
]
# Importing a dynamically generated module
# Python recipe from http://code.activestate.com/recipes/82234
def importCode(... | bsd-3-clause | Python |
693e8782797aab25ce54b923a0caf05789752e59 | Change config options here to Channel from Global. | reticulatingspline/UrbanDictionary | config.py | config.py | ###
# Copyright (c) 2012-2013, spline
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('UrbanDictionary')
def configure(advanced):
# This will be called by s... | ###
# Copyright (c) 2012-2013, spline
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('UrbanDictionary')
def configure(advanced):
# This will be called by s... | mit | Python |
22fd70192440ec2bc84785e86d9e4b7aa4533f5b | Bump up the HSTS time again, but without subdomains | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | config.py | config.py | import glob
import os
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from foauth.providers import OAuthMeta
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] =... | import glob
import os
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from foauth.providers import OAuthMeta
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] =... | bsd-3-clause | Python |
31e063413eabc7931a7d88d3f5501e48cbfcf879 | make requests_rate and requests_burst configurable in the calibre UI | cfairbanks/calibre-comicvine | config.py | config.py | """
Configuration for the Comicvine metadata source
"""
import time
from PyQt5.Qt import QWidget, QGridLayout, QLabel, QLineEdit
from calibre.utils.config import JSONConfig
from calibre_plugins.comicvine import pycomicvine
PREFS = JSONConfig('plugins/comicvine')
PREFS.defaults['api_key'] = ''
PREFS.defaults['worker_... | """
Configuration for the Comicvine metadata source
"""
import time
from PyQt5.Qt import QWidget, QGridLayout, QLabel, QLineEdit
from calibre.utils.config import JSONConfig
from calibre_plugins.comicvine import pycomicvine
PREFS = JSONConfig('plugins/comicvine')
PREFS.defaults['api_key'] = ''
PREFS.defaults['worker_... | mit | Python |
a73467be24c43aecc3ebe7e8a3bdec7c0978f443 | remove $(MSBuildThisFileDirectory, which make problem with OmniSharp Server | yjpark/silp_plugins | csproj.py | csproj.py | # -*- coding: utf8 -*-
import silp
import os
import sys
def compile_include(folder):
lines = []
root = os.path.abspath(folder)
silp.term.info('Adding files to compile include: %s' % root)
files = [os.path.join(dirpath, f)
for dirpath, dirnames, files in os.walk(root)
for f i... | # -*- coding: utf8 -*-
import silp
import os
import sys
def compile_include(folder):
lines = []
root = os.path.abspath(folder)
silp.term.info('Adding files to compile include: %s' % root)
files = [os.path.join(dirpath, f)
for dirpath, dirnames, files in os.walk(root)
for f i... | mit | Python |
934088d8044afc06b583012f3ce5d4aeeed83d83 | Bump version to 1.0.1-machtfit-61 | machtfit/django-oscar,machtfit/django-oscar,machtfit/django-oscar | src/oscar/__init__.py | src/oscar/__init__.py | import os
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 0, 1, 'machtfit', 61)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
return '{}.{}.{}-{}-{}'.format(*VERSION)
# Cheeky setting that allows each template to be acces... | import os
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 0, 1, 'machtfit', 60)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
return '{}.{}.{}-{}-{}'.format(*VERSION)
# Cheeky setting that allows each template to be acces... | bsd-3-clause | Python |
e39abca9a3587145603286d5709a86920106c6b2 | rename test funcs | Nimdraug/taters,Nimdraug/taters | deploy.py | deploy.py | import os.path
import StringIO
def debug_dest( files ):
for f in files:
print f.name
print '-' * len( f.name )
print f.read()
print
def test_splitter( files ):
for f in files:
if f.name.endswith( '.txt' ):
yield uppercase( f )
else:
yield... | import os.path
import StringIO
def a( files ):
for f in files:
print f.name
print '-' * len( f.name )
print f.read()
print
def b( files ):
for f in files:
if f.name.endswith( '.txt' ):
yield uppercase( f )
else:
yield f
def uppercase( f ... | mit | Python |
e47593b2f3f91d98bcd75df61ee8b222a05ce0d4 | Update to support IPython 1.0.0. | lebedov/duster | duster.py | duster.py | #!/usr/bin/env python
"""
IPython extension to reset namespace and reload several modules automatically
"""
import importlib
import IPython
# Modules to reload; each element contains the module and the name to which
# it should be imported (or '' if it should be imported as-is):
modules = [('numpy', 'np'),
... | #!/usr/bin/env python
"""
IPython extension to reset namespace and reload several modules automatically
"""
import importlib
import IPython
# Modules to reload; each element contains the module and the name to which
# it should be imported (or '' if it should be imported as-is):
modules = [('numpy', 'np'),
... | bsd-3-clause | Python |
02882d32e0f45c1ee0af8f3ddaa52b9f45afb4cb | define error class init method | sbraden/circle-craters,sbraden/circle-craters | errors.py | errors.py | # -*- coding: utf-8 -*-
class CircleCraterError(Exception):
def __init__(self, message_str = ''):
self.message = message_str
| # -*- coding: utf-8 -*-
class CircleCraterError(Exception):
def __init__(self, message_str = ''):
message = message_str
| bsd-3-clause | Python |
7769d2cce32bf9ee96e3da988303b62ff221799c | fix fileid: remove NSURLBookmarkCreationPreferFileIDResolution usage | albertz/music-player,albertz/music-player,albertz/music-player,albertz/music-player,albertz/music-player,albertz/music-player | fileid.py | fileid.py | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2013, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
# Get some native file-id handle which is persistent from file-moves.
import os, sys
imp... | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2013, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
# Get some native file-id handle which is persistent from file-moves.
import os, sys
imp... | bsd-2-clause | Python |
a016b6e6675eca317509f81768ea4fb612aae236 | add support for the new testimage class | denny820909/builder,denny820909/builder,denny820909/builder,denny820909/builder | lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py | lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py | '''
Created on Jan 10, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''
from buildbot.steps.shell import S... | '''
Created on Jan 10, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''
from buildbot.steps.shell import S... | mit | Python |
7841ec5366f9a0f809290e6f7a7166fc72c09637 | Improve shipping zone filters performance | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/graphql/shipping/filters.py | saleor/graphql/shipping/filters.py | import django_filters
from ...shipping.models import ShippingZone
from ..channel.types import Channel
from ..core.filters import GlobalIDMultipleChoiceFilter
from ..core.types import FilterInputObjectType
from ..utils import resolve_global_ids_to_primary_keys
def filter_channels(qs, _, values):
if values:
... | import django_filters
from ...shipping.models import ShippingZone
from ..channel.types import Channel
from ..core.filters import GlobalIDMultipleChoiceFilter
from ..core.types import FilterInputObjectType
from ..utils import resolve_global_ids_to_primary_keys
from ..utils.filters import filter_fields_containing_value
... | bsd-3-clause | Python |
610823bcfedda0e0c928736659fa8bd4b5751c53 | Update rcomponents command for ComponentKit changes | zats/chisel,facebook/chisel,dopcn/chisel,dopcn/chisel,facebook/chisel,facebook/chisel,dopcn/chisel | commands/FBComponentCommands.py | commands/FBComponentCommands.py | #!/usr/bin/python
import os
import lldb
import fblldbbase as fb
def lldbcommands():
return [
FBComponentsDebugCommand(),
FBComponentsPrintCommand(),
FBComponentsReflowCommand(),
]
class FBComponentsDebugCommand(fb.FBCommand):
def name(self):
return 'dcomponents'
def description(self):
... | #!/usr/bin/python
import os
import lldb
import fblldbbase as fb
def lldbcommands():
return [
FBComponentsDebugCommand(),
FBComponentsPrintCommand(),
FBComponentsReflowCommand(),
]
class FBComponentsDebugCommand(fb.FBCommand):
def name(self):
return 'dcomponents'
def description(self):
... | mit | Python |
5440bad75b92434963413b0ca257ac21cf2352c1 | set http error on code < 600 | vgavro/flask-vgavro-utils,vgavro/flask-vgavro-utils | flask_vgavro_utils/exceptions.py | flask_vgavro_utils/exceptions.py | class ImproperlyConfigured(Exception):
pass
class ApiError(Exception):
status_code = 400
def __init__(self, message, code=None, data=None, **kwargs):
self.message = message
if code:
self.code = code
if code < 600:
self.status_code = code
els... | class ImproperlyConfigured(Exception):
pass
class ApiError(Exception):
status_code = 400
def __init__(self, message, code=None, data=None, **kwargs):
self.message = message
self.code = code or self.status_code
self.data = data or {}
self.data.update(kwargs)
super()... | bsd-2-clause | Python |
f4c6363896a3712eb34677b4032d96d3dab00d0b | add diagonal_movement to __all__ | brean/python-pathfinding | pathfinding/core/__init__.py | pathfinding/core/__init__.py | __all__ = ['diagonal_movement', 'grid', 'heuristic', 'node', 'util']
| __all__ = ['grid', 'heuristic', 'node', 'util']
| mit | Python |
0fe7d0f091630edf065094dbd5f826fc116a2fcb | update bot nick | ArchStrike/archstrike-installer | asinstaller/config.py | asinstaller/config.py | import os
import logging
usr_cfg = {}
pacmanconf = "/etc/pacman.conf"
archstrike_mirrorlist = "/etc/pacman.d/archstrike-mirrorlist"
LOG_FILE = '/tmp/archstrike-installer.log'
CONFIG_FILE = '/tmp/as-config.json'
IRC_SERVER = 'irc.freenode.net'
IRC_PORT = 6697
IRC_BOT_NICK = 'xorbot'
COLORS = {
'HEADER': '\033[95m'... | import os
import logging
usr_cfg = {}
pacmanconf = "/etc/pacman.conf"
archstrike_mirrorlist = "/etc/pacman.d/archstrike-mirrorlist"
LOG_FILE = '/tmp/archstrike-installer.log'
CONFIG_FILE = '/tmp/as-config.json'
IRC_SERVER = 'irc.freenode.net'
IRC_PORT = 6697
IRC_BOT_NICK = 'dontlookatme'
COLORS = {
'HEADER': '\03... | mit | Python |
15c9de192a9ff4aa941b6140b793dc82405c25bc | Add virtual bank barcode to the email | HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum | project/velkoja/holvichecker.py | project/velkoja/holvichecker.py | from decimal import Decimal
from django.utils import timezone
from django.conf import settings
from holviapp.utils import list_invoices
from holviapi.utils import barcode as bank_barcode
from .models import NotificationSent
from django.core.mail import EmailMessage
from django.template import Context
from django.templa... | from django.utils import timezone
from django.conf import settings
from holviapp.utils import list_invoices, get_invoice
from holviapi.utils import barcode
from .models import NotificationSent
from django.core.mail import EmailMessage
from django.template import Context
from django.template.loader import get_template
... | mit | Python |
c8658d42c40608d89c653caef9aa03a74a8097d9 | Bump version to 0.12.0 | clb6/jarvis-cli | jarvis_cli/__init__.py | jarvis_cli/__init__.py |
__version__ = '0.12.0'
EVENT_CATEGORIES_TO_DEFAULTS = {
"consumed": 100,
"produced": 100,
"experienced": 100,
"interacted": 80,
"formulated": 80,
"completed": 50,
"detected": 10,
"measured": 5
}
EVENT_CATEGORIES = list(EVENT_CATEGORIES_TO_DEFAUL... |
__version__ = '0.11.0'
EVENT_CATEGORIES_TO_DEFAULTS = {
"consumed": 100,
"produced": 100,
"experienced": 100,
"interacted": 80,
"formulated": 80,
"completed": 50,
"detected": 10,
"measured": 5
}
EVENT_CATEGORIES = list(EVENT_CATEGORIES_TO_DEFAUL... | apache-2.0 | Python |
efe5e87a893940d66a76dea63bd1aca7145f83c8 | correct typo in Windows Com port check | imrehg/labhardware,imrehg/labhardware | projects/powermon/powermeter.py | projects/powermon/powermeter.py | #!/usr/bin/env python
import serial
import os
class PowerMeter():
""" Newport Optical Power Meter 1830-C """
def __init__(self):
if os.name == "posix":
portbase = '/dev/ttyUSB'
else:
portbase = 'COM'
for i in xrange(10):
try:
self.s... | #!/usr/bin/env python
import serial
import os
class PowerMeter():
""" Newport Optical Power Meter 1830-C """
def __init__(self):
if os.name == "posix":
portbase = '/dev/ttyUSB'
else:
portbase == 'COM'
for i in xrange(10):
try:
self.... | mit | Python |
5dc79d8821a083c9d1a3b4e75c402848fe765964 | Tweak regular expression for detecting determiners | jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint | proselint/checks/mau_a_vs_an.py | proselint/checks/mau_a_vs_an.py | # -*- coding: utf-8 -*-
"""MAU100: a vs. an
---
layout: post
error_code: MAU101
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: a vs. an
date: 2014-06-10 12:31:19
categories: writing
---
The first line is always wrong.
"""
import re
from nltk.corpus import cmudict
... | # -*- coding: utf-8 -*-
"""MAU100: a vs. an
---
layout: post
error_code: MAU101
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: a vs. an
date: 2014-06-10 12:31:19
categories: writing
---
The first line is always wrong.
"""
import re
from nltk.corpus import cmudict
... | bsd-3-clause | Python |
a097db79752c88051d3706e50f637a7932e97f01 | remove unused import | x89/botologist,anlutro/botologist,x89/ircbot,x89/botologist,moopie/botologist | ircbot/__init__.py | ircbot/__init__.py | import sys
import os.path
import configparser
import argparse
from ircbot.bot import run_bot
def main():
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
storage_path = os.path.join(root_dir, 'storage')
options = ('server', 'nick', 'port', 'channel',)
deets = dict.fromkeys(options)
deets.... | import sys
import os.path
import configparser
import argparse
import pprint
from ircbot.bot import run_bot
def main():
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
storage_path = os.path.join(root_dir, 'storage')
options = ('server', 'nick', 'port', 'channel',)
deets = dict.fromkeys(o... | mit | Python |
36f021ea358770b30ad4831482bda98e2a903b53 | make directory when writing output file | stevenvanrossem/son-cli,stevenvanrossem/son-cli,stevenvanrossem/son-cli,stevenvanrossem/son-cli,stevenvanrossem/son-cli | src/son/profile/helper.py | src/son/profile/helper.py | # Copyright (c) 2015 SONATA-NFV, Paderborn University
# 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 req... | # Copyright (c) 2015 SONATA-NFV, Paderborn University
# 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 req... | apache-2.0 | Python |
a7d04387315af55dd1afdccbae60a335a4a0de21 | add plot_latent to sparse_gplvm | gusmaogabriels/GPy,ysekky/GPy,strongh/GPy,buntyke/GPy,maaskola/GPy,Dapid/GPy,PredictiveScienceLab/GPy,esiivola/GPYgradients,maaskola/GPy,ptonner/GPy,avehtari/GPy,SheffieldML/GPy,buntyke/GPy,gusmaogabriels/GPy,beckdaniel/GPy,mikecroucher/GPy,TianpeiLuke/GPy,PredictiveScienceLab/GPy,esiivola/GPYgradients,mikecroucher/GPy... | GPy/models/sparse_gplvm.py | GPy/models/sparse_gplvm.py | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import pylab as pb
import sys, pdb
from GPy.models.sparse_gp_regression import SparseGPRegression
from GPy.models.gplvm import GPLVM
# from .. import kern
# from ..core import model
# fr... | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import pylab as pb
import sys, pdb
from GPy.models.sparse_gp_regression import SparseGPRegression
from GPy.models.gplvm import GPLVM
# from .. import kern
# from ..core import model
# fr... | bsd-3-clause | Python |
e62081b9c48717d84b8890bc66bc9e0e83a60be9 | Revise to use range() for python3 | bowen0701/algorithms_data_structures | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | bsd-2-clause | Python |
0b7d69869009888c26d1fdf3dee8a4f858fa70a3 | Set wrapping to soft on textareas | BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit | diary/forms.py | diary/forms.py | from django import forms
import cube.diary.models
class DiaryIdeaForm(forms.ModelForm):
class Meta(object):
model = cube.diary.models.DiaryIdea
class EventForm(forms.ModelForm):
class Meta(object):
model = cube.diary.models.Event
# Ensure soft wrapping is set for textareas:
wid... | from django import forms
import cube.diary.models
class DiaryIdeaForm(forms.ModelForm):
class Meta(object):
model = cube.diary.models.DiaryIdea
class EventForm(forms.ModelForm):
class Meta(object):
model = cube.diary.models.Event
class ShowingForm(forms.ModelForm):
class Meta(object):
... | agpl-3.0 | Python |
dff4ee756c8c4937523c84935b82d5b51e2f60c6 | Add register_subcommands | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/g1/devtools/buildtools/g1/devtools/buildtools/__init__.py | py/g1/devtools/buildtools/g1/devtools/buildtools/__init__.py | __all__ = [
'read_package_config',
'register_subcommands',
]
import collections
import shlex
import subprocess
def register_subcommands(command, *subcommands):
"""Make sub-commands as a required step of ``command``."""
command.sub_commands[0:0] = [(subcommand.__name__, None)
... | __all__ = [
'read_package_config',
]
import collections
import shlex
import subprocess
PackageConfig = collections.namedtuple(
'PackageConfig',
'include_dirs library_dirs libraries extra_compile_args',
)
def read_package_config(packages):
cmd = ['pkg-config', '--cflags', '--libs']
cmd.extend(pac... | mit | Python |
1b2464215472ac8a6ac6cd7dd4b922a103b601fe | Remove pdb statement and add xfail to new test | DrMarcII/selenium,asashour/selenium,asolntsev/selenium,twalpole/selenium,GorK-ChO/selenium,Tom-Trumper/selenium,xsyntrex/selenium,gurayinan/selenium,kalyanjvn1/selenium,Jarob22/selenium,dibagga/selenium,DrMarcII/selenium,jsakamoto/selenium,davehunt/selenium,Dude-X/selenium,asashour/selenium,juangj/selenium,HtmlUnit/sel... | py/test/selenium/webdriver/common/takes_screenshots_tests.py | py/test/selenium/webdriver/common/takes_screenshots_tests.py | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 | Python |
6018abc4a1c2dfa139bb104ae6db69fef5994ff6 | Add try/except to catch if no extensions are parsed. | obsidianforensics/hindsight,obsidianforensics/hindsight | plugins/chrome_extensions.py | plugins/chrome_extensions.py | ###################################################################################################
#
# chrome_extensions.py
# Adds the name and description of each Chrome extension found in a URLItem to the Interpretation field
#
# Plugin Author: Ryan Benson (ryan@obsidianforensics.com)
#
###########################... | ###################################################################################################
#
# chrome_extensions.py
# Adds the name and description of each Chrome extension found in a URLItem to the Interpretation field
#
# Plugin Author: Ryan Benson (ryan@obsidianforensics.com)
#
###########################... | apache-2.0 | Python |
1f10dd1313720bb3b9114bb6f38a68bab6ede8a1 | Fix ranker file | mkpaszkiewicz/vse | vse/ranker.py | vse/ranker.py | import math
import heapq
from abc import ABCMeta, abstractmethod
from vse.utils import normalize
__all__ = ['Ranker',
'SimpleRanker',
'WeightingRanker'
]
def tfidf(hist, freq_hist):
"""Term frequency - inverse document frequency scoring."""
return [n * -log(n_freq) for n, n_f... | import math
import heapq
from abc import ABCMeta, abstractmethod
from vse.utils import normalize
__all__ = ['Ranker',
'SimpleRanker',
'TFIDFRanker'
]
class Ranker(metaclass=ABCMeta):
def __init__(self, hist_comparator):
self.hist_comparator = hist_comparator
@abstrac... | mit | Python |
5f4466333d8f7498c8ca6158d06403c727991323 | Add timeout parameter to Hive impyla connect function - Override default timeout that caused errors (now 15 minute timeout) | davidottogonzalez/Audience-Studio-Query-Builder,davidottogonzalez/ATP,davidottogonzalez/ATP,davidottogonzalez/ATP,davidottogonzalez/Audience-Studio-Query-Builder,davidottogonzalez/Audience-Studio-Query-Builder,davidottogonzalez/ATP,davidottogonzalez/Audience-Studio-Query-Builder | atp_classes/HiveDB.py | atp_classes/HiveDB.py | from impala.dbapi import connect
import atp_classes, re
class HiveDB:
def __init__(self, host=None, port=None, username=None, password=None, database=None, auth_mech=None):
config = atp_classes.Config()
self.host = host or config.get_config()['database']['bigData']['host']
self.port = por... | from impala.dbapi import connect
import atp_classes, re
class HiveDB:
def __init__(self, host=None, port=None, username=None, password=None, database=None, auth_mech=None):
config = atp_classes.Config()
self.host = host or config.get_config()['database']['bigData']['host']
self.port = por... | mit | Python |
a559ed4d3b4f8b7c8a6142a8ac5f9d151d1cfe39 | fix ffdec import | beetbox/audioread | audioread/__init__.py | audioread/__init__.py | # This file is part of audioread.
# Copyright 2011, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, co... | # This file is part of audioread.
# Copyright 2011, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, co... | mit | Python |
1b23ca7327d5414233222fdb26c1c1e88d0137a6 | Tidy imports and opening the tmpfile | takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web | takeyourmeds/telephony/views.py | takeyourmeds/telephony/views.py | import os
from django.http import HttpResponse
def info(request, uuid):
"""
Return the Twillio ML that we generated when the user called /call
"""
with open(os.path.join('/tmp', '%s.xml' % uuid)) as f:
data = f.read()
return HttpResponse(data, content_type='text/xml')
| import os
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from . import actions
def info(request, uuid):
"""
Return the Twillio ML that we generated when the user
called /call
"""
data = open(os.path.join("/tmp", uuid + ".xml")).read()
re... | mit | Python |
9409eddf28324de1fe0ff0f2344acf859ed619d2 | Update __init__.py | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/stock/__init__.py | erpnext/stock/__init__.py | from __future__ import unicode_literals
import frappe
install_docs = [
{"doctype":"Role", "role_name":"Stock Manager", "name":"Stock Manager"},
{"doctype":"Role", "role_name":"Item Manager", "name":"Item Manager"},
{"doctype":"Role", "role_name":"Stock User", "name":"Stock User"},
{"doctype":"Role", "role_name":"Q... | from __future__ import unicode_literals
import frappe
install_docs = [
{"doctype":"Role", "role_name":"Stock Manager", "name":"Stock Manager"},
{"doctype":"Role", "role_name":"Item Manager", "name":"Item Manager"},
{"doctype":"Role", "role_name":"Stock User", "name":"Stock User"},
{"doctype":"Role", "role_name":"Q... | agpl-3.0 | Python |
d44caa281b61c5369a0c2232b16286c9e1ad2465 | Fix ordering of merged PlatformPhysicsOperation | fieldOfView/Cura,ynotstartups/Wanhao,fieldOfView/Cura,ynotstartups/Wanhao,Curahelper/Cura,Curahelper/Cura | cura/PlatformPhysicsOperation.py | cura/PlatformPhysicsOperation.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Operations.Operation import Operation
from UM.Operations.GroupedOperation import GroupedOperation
from UM.Scene.SceneNode import SceneNode
## A specialised operation designed specifically to modify the previous op... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Operations.Operation import Operation
from UM.Operations.GroupedOperation import GroupedOperation
from UM.Scene.SceneNode import SceneNode
## A specialised operation designed specifically to modify the previous op... | agpl-3.0 | Python |
44c08215ba792f2182472d83116766f4a4542b62 | add Maximum, Minimum, MaxPooling1D keras2 layers (#389) | yangw1234/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL | python/dllib/src/bigdl/dllib/keras/base.py | python/dllib/src/bigdl/dllib/keras/base.py | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | apache-2.0 | Python |
c9dedfa900b1b45e117cfa503c8f5b264b455b2d | add note | ludios/Monoclock,ludios/Monoclock | test_monoclock.py | test_monoclock.py | import unittest
import monoclock
import time
# TODO: somehow test the SystemError("clock_gettime failed") branch
class MonoclockTests(unittest.TestCase):
def test_nano_count_isCorrectType(self):
val1 = monoclock.nano_count()
# In reality it is really always a long, I think.
self.assert_(isinstance(val1, (int... | import unittest
import monoclock
import time
# TODO: somehow test the SystemError("clock_gettime failed") branch
class MonoclockTests(unittest.TestCase):
def test_nano_count_isCorrectType(self):
val1 = monoclock.nano_count()
self.assert_(isinstance(val1, (int, long)))
def test_nano_count_getsBigger(self):
... | mit | Python |
392404c88aa3700ecf4a88838b4e7ac34b557797 | add options path to the init file | mfuentesg/SyncSettings,adnedelcu/SyncSettings | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
import sys, os, json
sys.path.append(os.path.abspath('..'))
from sync_settings import gistapi, logger, helper
try:
optionsPath = os.path.abspath('tests/options.json')
with open(optionsPath, 'r') as f:
Opts = json.loads(f.read())
except Exception as e:
Opts = {}
print ('\033[91m'+'S... | # -*- coding: utf-8 -*-
import sys, os, json
sys.path.append(os.path.abspath('..'))
from sync_settings import gistapi, logger, helper
try:
with open(os.path.abspath('tests/options.json'), 'r') as f:
Opts = json.loads(f.read())
except Exception as e:
Opts = {}
print ('\033[91m'+'Sync Settings: options.json f... | mit | Python |
98ebb1b6397cf01be86a180dca26b5ceaee715ea | Enable post method on get-sentiment api | harigov/newsalyzer,harigov/newsalyzer,harigov/newsalyzer | web/server.py | web/server.py | import os
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, jsonify, make_response
import json
from google.cloud import language
from decorators import Monitor
from blob_storage import BlobStorage
from logger import Logger
app = Flask(__name__)
app.config['DEBUG']=True
#... | import os
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, jsonify, make_response
import json
from google.cloud import language
from decorators import Monitor
from blob_storage import BlobStorage
from logger import Logger
app = Flask(__name__)
app.config['DEBUG']=True
#... | mit | Python |
cc01bfd70fcbd11701648e15426188d1c34cf50f | Test whether file is ready | quasiben/bokeh,phobson/bokeh,Karel-van-de-Plassche/bokeh,aiguofer/bokeh,rs2/bokeh,ptitjano/bokeh,timsnyder/bokeh,DuCorey/bokeh,Karel-van-de-Plassche/bokeh,ptitjano/bokeh,percyfal/bokeh,rs2/bokeh,phobson/bokeh,aavanian/bokeh,DuCorey/bokeh,clairetang6/bokeh,percyfal/bokeh,KasperPRasmussen/bokeh,DuCorey/bokeh,azjps/bokeh,... | tests/conftest.py | tests/conftest.py | from __future__ import print_function
import os
import boto
import pytest
from boto.s3.key import Key as S3Key
from boto.exception import NoAuthHandlerFound
from os.path import join, isfile
s3_bucket = "bokeh-travis"
s3 = "https://s3.amazonaws.com/%s" % s3_bucket
build_id = os.environ.get("TRAVIS_BUILD_ID")
# Can we ... | from __future__ import print_function
import os
import boto
import pytest
from boto.s3.key import Key as S3Key
from boto.exception import NoAuthHandlerFound
from os.path import join
s3_bucket = "bokeh-travis"
s3 = "https://s3.amazonaws.com/%s" % s3_bucket
build_id = os.environ.get("TRAVIS_BUILD_ID")
def pytest_sess... | bsd-3-clause | Python |
77f40c48d344cb6ef1ee39769a131ba7e7433e04 | test string substitution for templates | mwielgoszewski/doorman,mwielgoszewski/doorman,mwielgoszewski/doorman,mwielgoszewski/doorman | tests/conftest.py | tests/conftest.py | # -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""
import pytest
from webtest import TestApp
from doorman.application import create_app
from doorman.database import db as _db
from doorman.models import Rule
from doorman.settings import TestConfig
from .factories import NodeFactory, RuleFactory
... | # -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""
import pytest
from webtest import TestApp
from doorman.application import create_app
from doorman.database import db as _db
from doorman.models import Rule
from doorman.settings import TestConfig
from .factories import NodeFactory, RuleFactory
... | mit | Python |
1c12843b251184d3e683d9cebf9948565bbfe518 | Disable autouse for set_up so that help tests don't generate unnecessary files. | bilderbuchi/ofStateManager | tests/conftest.py | tests/conftest.py | # pylint: disable=C0111
import pytest
import os
import tarfile
BASEDIR = os.path.dirname(__file__)
@pytest.fixture(autouse=False)
def set_up(tmpdir):
# print BASEDIR
tmpdir.chdir()
tar = tarfile.open(os.path.join(BASEDIR, "MockRepos.tar.gz"))
tar.extractall()
tar.close()
os.chdir('MockRepos')
print('In directo... | # pylint: disable=C0111
import pytest
import os
import tarfile
BASEDIR = os.path.dirname(__file__)
@pytest.fixture(autouse=True)
def set_up(tmpdir):
# print BASEDIR
tmpdir.chdir()
tar = tarfile.open(os.path.join(BASEDIR, "MockRepos.tar.gz"))
tar.extractall()
tar.close()
os.chdir('MockRepos')
print('In director... | mit | Python |
7b0633bd3f28ad85de87b6cec787bce29fa6963f | Fix gui tests | DIYBookScanner/spreads,adongy/spreads,miloh/spreads,miloh/spreads,nafraf/spreads,DIYBookScanner/spreads,gareth8118/spreads,miloh/spreads,nafraf/spreads,gareth8118/spreads,adongy/spreads,nafraf/spreads,DIYBookScanner/spreads,gareth8118/spreads,adongy/spreads | tests/gui_test.py | tests/gui_test.py | import mock
import pytest
@pytest.yield_fixture
def mock_msgbox():
with mock.patch('spreadsplug.gui.gui.QtGui.QMessageBox') as msgbox:
msgbox.exec_.return_value = True
yield msgbox
@pytest.fixture
def wizard(config):
import spreadsplug.gui.gui as gui
wizard = gui.SpreadsWizard(config)
... | import mock
import pytest
@pytest.yield_fixture
def mock_msgbox():
with mock.patch('spreadsplug.gui.gui.QtGui.QMessageBox') as msgbox:
msgbox.exec_.return_value = True
yield msgbox
@pytest.fixture
def wizard(config):
import spreadsplug.gui.gui as gui
wizard = gui.SpreadsWizard(config)
... | agpl-3.0 | Python |
a219e0bc1a6b8a3428a8ba9d7d61d396a6b295d1 | Correct indentations | abicky/crfsuite,ExpResults/partial-crfsuite,ExpResults/partial-crfsuite,abicky/crfsuite,abicky/crfsuite,ExpResults/partial-crfsuite,ExpResults/partial-crfsuite,abicky/crfsuite,abicky/crfsuite,abicky/crfsuite,abicky/crfsuite,ExpResults/partial-crfsuite,ExpResults/partial-crfsuite | swig/python/sample_train.py | swig/python/sample_train.py | #!/usr/bin/env python
import crfsuite
import sys
# Inherit crfsuite.Trainer to implement message() function, which receives
# progress messages from a training process.
class Trainer(crfsuite.Trainer):
def message(self, s):
# Simply output the progress messages to STDOUT.
sys.stdout.write(s)
def ... | #!/usr/bin/env python
import crfsuite
import sys
# Inherit crfsuite.Trainer to implement message() function, which receives
# progress messages from a training process.
class Trainer(crfsuite.Trainer):
def message(self, s):
# Simply output the progress messages to STDOUT.
sys.stdout.write(s)
def ... | bsd-3-clause | Python |
9a24c071a0f00c1f8f382037408b2a3776010125 | Make annotate_ionisation_stages more general. | ezekial4/atomic_neu,ezekial4/atomic_neu | atomic/abundance.py | atomic/abundance.py | import numpy as np
class FractionalAbundance(object):
def __init__(self, atomic_data, y, temperature, density):
self.atomic_data = atomic_data
self.y = y
self.temperature = temperature
self.density = density
def mean_charge(self):
"""
Compute the mean charge:
... | import numpy as np
class FractionalAbundance(object):
def __init__(self, atomic_data, y, temperature, density):
self.atomic_data = atomic_data
self.y = y
self.temperature = temperature
self.density = density
def mean_charge(self):
"""
Compute the mean charge:
... | mit | Python |
377c942f7effac1d6be1d3a9f41ce0074c015e7d | Add zip_files, change remove_files arguments | hans-t/autos | autos/utils/file.py | autos/utils/file.py | __all__ = ['merge_files', 'remove_file', 'remove_files']
import os
import glob
import zipfile
try:
import zlib
except:
DEFAULT_ZIP_MODE = zipfile.ZIP_STORED
else:
DEFAULT_ZIP_MODE = zipfile.ZIP_DEFLATED
def merge_files(dst, src_glob, nbytes=1 << 30):
"""Merge src files to dst. Only works on Linux.
... | __all__ = ['merge_files', 'remove_file', 'remove_files']
import os
import glob
def merge_files(dst, src_glob, nbytes=1 << 30):
"""Merge src files to dst. Only works on Linux.
:type dst: str
:param dst: Destination path
:type src_glob: str
:param src_glob: Source glob pattern.
:type nbytes:... | mit | Python |
b7b0724b7f663a8a0d0e5c46d66f42726d700f45 | Add back 1.0.X compatibility for Router URL resolution. | simonw/djng | djng/router.py | djng/router.py | from django.conf.urls.defaults import patterns
from django.core import urlresolvers
class Router(object):
"""
Convenient wrapper around Django's urlresolvers, allowing them to be used
from normal application code.
from django.http import HttpResponse
from django_openid.request_factory import Requ... | from django.conf.urls.defaults import patterns
from django.core import urlresolvers
class Router(object):
"""
Convenient wrapper around Django's urlresolvers, allowing them to be used
from normal application code.
from django.http import HttpResponse
from django_openid.request_factory import Requ... | bsd-2-clause | Python |
e945df9e670b6a107a1fd06383b2f37febd0c82a | remove unnecessary test case due to c+p fail | matejcik/urllib3,luca3m/urllib3,sornars/urllib3,msabramo/urllib3,haikuginger/urllib3,mikelambert/urllib3,Geoion/urllib3,sileht/urllib3,boyxuper/urllib3,Disassem/urllib3,gardner/urllib3,Lukasa/urllib3,luca3m/urllib3,matejcik/urllib3,Lukasa/urllib3,Geoion/urllib3,Disassem/urllib3,haikuginger/urllib3,boyxuper/urllib3,silv... | test/with_dummyserver/test_https.py | test/with_dummyserver/test_https.py | import logging
import sys
import unittest
from dummyserver.testcase import HTTPSDummyServerTestCase
from dummyserver.server import DEFAULT_CA, DEFAULT_CA_BAD
from urllib3 import HTTPSConnectionPool
from urllib3.connectionpool import VerifiedHTTPSConnection
from urllib3.exceptions import SSLError
log = logging.getLo... | import logging
import sys
import unittest
from dummyserver.testcase import HTTPSDummyServerTestCase
from dummyserver.server import DEFAULT_CA, DEFAULT_CA_BAD
from urllib3 import HTTPSConnectionPool
from urllib3.connectionpool import VerifiedHTTPSConnection
from urllib3.exceptions import SSLError
log = logging.getLo... | mit | Python |
9e03d88d5a0188f5029fa99e2ce9999f0cf1b367 | Work work | nikolajlauridsen/WordSearch | wordsearch.py | wordsearch.py | import requests
import bs4
import re
import os
def parse_site(url, selection):
res = requests.get('http://' + url)
site = bs4.BeautifulSoup(res.text, 'html.parser')
content = site.select(selection)
elements = []
if type(content) == list:
for item in content:
elements.append(ite... | import requests
import bs4
import re
def parse_ordnet(link):
res = requests.get('http://www.' + link)
ordnet = bs4.BeautifulSoup(res.text, 'html.parser')
definition = ordnet.select('.definition')
try:
print(definition.text)
except AttributeError:
print(definition[0].text)
def pa... | mit | Python |
a03a5e456d0ba0bd5cb26453d095bd56e7776fbc | Fix typo 'range_rool' in range_tool.py (#8492) | timsnyder/bokeh,bokeh/bokeh,ericmjl/bokeh,stonebig/bokeh,timsnyder/bokeh,ericmjl/bokeh,stonebig/bokeh,bokeh/bokeh,stonebig/bokeh,bokeh/bokeh,timsnyder/bokeh,ericmjl/bokeh,timsnyder/bokeh,ericmjl/bokeh,stonebig/bokeh,ericmjl/bokeh,bokeh/bokeh,timsnyder/bokeh,bokeh/bokeh | examples/plotting/file/range_tool.py | examples/plotting/file/range_tool.py | import numpy as np
from bokeh.io import show
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, RangeTool
from bokeh.plotting import figure
from bokeh.sampledata.stocks import AAPL
dates = np.array(AAPL['date'], dtype=np.datetime64)
source = ColumnDataSource(data=dict(date=dates, close=AAPL['... | import numpy as np
from bokeh.io import show
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, RangeTool
from bokeh.plotting import figure
from bokeh.sampledata.stocks import AAPL
dates = np.array(AAPL['date'], dtype=np.datetime64)
source = ColumnDataSource(data=dict(date=dates, close=AAPL['... | bsd-3-clause | Python |
864b0627fecf4c69a87457561ee0538186977da0 | Add import for __init__.py in clustering module | studiawan/pygraphc | pygraphc/clustering/__init__.py | pygraphc/clustering/__init__.py | from pygraphc.clustering.ClusterDistance import *
from pygraphc.clustering.ClusterEvaluation import *
from pygraphc.clustering.ClusterUtility import *
from pygraphc.clustering.ConnectedComponents import *
from pygraphc.clustering.KCliquePercolation import *
from pygraphc.clustering.MaxCliquesPercolation import *
impor... | mit | Python | |
972fe4ca186d0c53eef78e7ace5c14110a3ae1d3 | Check patric file size | nmih/ssbio,SBRG/ssbio,nmih/ssbio,SBRG/ssbio | ssbio/databases/patric.py | ssbio/databases/patric.py | import ftplib
import os.path as op
import logging
import os
log = logging.getLogger(__name__)
def download_genome_sequence(patric_id, seqtype, outdir='', outfile='', force_rerun=False):
"""Download the entire set of DNA or protein sequences from protein-encoding genes in a genome from NCBI.
Saves a FASTA fil... | import ftplib
import os.path as op
import logging
log = logging.getLogger(__name__)
def download_genome_sequence(patric_id, seqtype, outdir='', outfile='', force_rerun=False):
"""Download the entire set of DNA or protein sequences from protein-encoding genes in a genome from NCBI.
Saves a FASTA file in the o... | mit | Python |
513852e5735e1aab5b68680d9557e65a0ebd9233 | Revert change in custommer list, because staff can be also a customer. | UITools/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,mociepka/saleor,mociepka/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor | tests/dashboard/test_permissions.py | tests/dashboard/test_permissions.py | from __future__ import unicode_literals
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.test.client import Client
from saleor.userprofile.models import User
from saleor.core.permissions import get_permissions
from saleor.dashboard.groups.f... | from __future__ import unicode_literals
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.test.client import Client
from saleor.userprofile.models import User
from saleor.core.permissions import get_permissions
from saleor.dashboard.groups.f... | bsd-3-clause | Python |
499d25b96d3526f405720d60978247831e0df603 | Add the FifoQueue parameter to sqs.Queues | remind101/stacker_blueprints,remind101/stacker_blueprints | stacker_blueprints/sqs.py | stacker_blueprints/sqs.py | from stacker.blueprints.base import Blueprint
from troposphere import (
sqs,
Ref,
GetAtt,
Output,
)
from . import util
def validate_queue(queue):
sqs_queue_properties = [
"DelaySeconds",
"FifoQueue",
"MaximumMessageSize",
"MessageRetentionPeriod",
"Receive... | from stacker.blueprints.base import Blueprint
from troposphere import (
sqs,
Ref,
GetAtt,
Output,
)
from . import util
def validate_queue(queue):
sqs_queue_properties = [
"DelaySeconds",
"MaximumMessageSize",
"MessageRetentionPeriod",
"ReceiveMessageWaitTimeSecond... | bsd-2-clause | Python |
ec4cd535000c08c1b447ce8de4084899a4a6fe0f | Rewrite tests: use unittest | lord63/wonderful_bing | test.py | test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from subprocess import call
from wonderful_bing.wonderful_bing import WonderfulBing
class WonderfulBingTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.abspath(os.path.dirname(__file__))
self.di... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import unittest
from subprocess import Popen
from subprocess import call
from wonderful_bing.wonderful_bing import WonderfulBing
current_directory = os.path.abspath(os.path.dirname(__file__))
directory_with_slash = current_directory + '/'
def test_i... | mit | Python |
b62be6eed1da77704a0891d6d3e15cea3f7b4161 | change from float to int | mlyons-tcc/test | test.py | test.py | __author__ = 'mike.lyons'
print "Hello World!"
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = int(x)
y = int(y)
except ValueError:
x = 0
y = 0
print x+y
print x/2
print y**2
| __author__ = 'mike.lyons'
print "Hello World!"
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = float(x)
y = float(y)
except ValueError:
x = 0.0
y = 0.0
print x+y
print x/2
print y**2
| apache-2.0 | Python |
c88f7e5f8dcf205da369a69ecb7658fff647966f | Move apiKey out of test files. | cgie/Weather,reticulatingspline/Weather,GLolol/Supybot-Weather | test.py | test.py | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
#
#
###
from supybot.test import *
import os
class WeatherTestCase(PluginTestCase):
plugins = ('Weather',)
def setUp(self):
PluginTestCase.setUp(self)
apiKey = os.environ.get('apiKey')
conf.supybot.plugins.Weather.apiKey.set... | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
#
#
###
from supybot.test import *
class WeatherTestCase(PluginTestCase):
plugins = ('Weather',)
def setUp(self):
PluginTestCase.setUp(self)
conf.supybot.plugins.Weather.apiKey.setValue('fc7cb609a45365fa')
def testWeather(self)... | mit | Python |
05d921873543507816a7531fbe2b6f856347c471 | fix variable name in test.py | douglasbagnall/py_bh_tsne,douglasbagnall/py_bh_tsne | test.py | test.py | #!/usr/bin/python
import gzip, cPickle
import numpy as np
import matplotlib.pyplot as plt
import sys
import argparse
from fasttsne import fast_tsne
def load_mnist(fn="mnist.pkl.gz"):
f = gzip.open(fn, "rb")
train, val, test = cPickle.load(f)
f.close()
return train, val, test
def main():
parser... | #!/usr/bin/python
import gzip, cPickle
import numpy as np
import matplotlib.pyplot as plt
import sys
import argparse
from fasttsne import fast_tsne
def load_mnist(fn="mnist.pkl.gz"):
f = gzip.open(fn, "rb")
train, val, test = cPickle.load(f)
f.close()
return train, val, test
def main():
parser... | bsd-3-clause | Python |
bdc85771091654b4045d80cad2e3103a97a71c19 | add experiment described in the paper | likang7/vppca | test.py | test.py | from vppca import VPPCA
from utils.hinton import hinton
import matplotlib.pylab as plt
import numpy as np
def simulate():
N = 50
P = 10
K = 4
s = np.random.normal(0, 1, size=(N, K))
alpha = np.random.gamma(1, 1, size=(K))
A = np.empty((P, K))
for k in xrange(K):
A[:, k] = np.random.multivariate_normal(np.one... | from vppca import VPPCA
from utils.hinton import hinton
import matplotlib.pylab as plt
import numpy as np
def simulate():
N = 50
P = 10
K = 4
s = np.random.normal(0, 1, size=(N, K))
alpha = np.random.gamma(1, 1, size=(K))
A = np.empty((P, K))
for k in xrange(K):
A[:, k] = np.random.multivariate_normal(np.one... | mit | Python |
9ff4530fa7c6435818ad3a0b55f464e34a42e548 | delete keras from installations | arogozhnikov/einops | test.py | test.py | """
Usage: python test.py
1. Installs part of dependencies (make sure `which pip` points to correct location)
2. Installs current version of einops in editable mode
3. Runs tests
"""
import os
from subprocess import Popen, PIPE
from pathlib import Path
__author__ = 'Alex Rogozhnikov'
def run(cmd, **env):
# keep... | """
Usage: python test.py
1. Installs part of dependencies (make sure `which pip` points to correct location)
2. Installs current version of einops in editable mode
3. Runs tests
"""
import os
from subprocess import Popen, PIPE
from pathlib import Path
__author__ = 'Alex Rogozhnikov'
def run(cmd, **env):
# keep... | mit | Python |
97e048d0a743808ab0ec62b39306940b59dd3c8a | Throw an error if bluetooth is not supported on the py3 installation | ABorgna/BluePoV-PC,ABorgna/BluePoV-PC,ABorgna/BluePoV-PC | test.py | test.py | import bluePoV
import pygame
x,y = (480,64)
MAC = "00:00:00:00:00:00"
pygame.init()
pygame.display.set_mode((x,y))
s = pygame.display.get_surface()
driver = bluePoV.Driver([x,y],depth=1,asServer=True)
#driver.connect(MAC)
s.fill([0,255,0])
driver.blit(s)
pygame.display.flip()
input("Press any key... ")
| import bluePoV
import pygame
x,y = (480,64)
MAC = "00:00:00:00:00:00"
pygame.init()
pygame.display.set_mode((x,y))
s = pygame.display.get_surface()
driver = bluePoV.Driver([x,y],1)
#driver.connect(MAC)
s.fill([0,255,0])
driver.blit(s)
pygame.display.flip()
input("Press any key... ")
| mit | Python |
e4717e8017b9a476db1ed016c19d883cd786c7ce | Add test for cypress defaults | CodeForPhilly/chime,CodeForPhilly/chime,CodeForPhilly/chime | tests/penn_chime/test_parameters.py | tests/penn_chime/test_parameters.py | """Test Parameters."""
from penn_chime.parameters import Parameters
def test_cypress_defaults():
"""Ensure the cypress defaults have been updated."""
# TODO how to make this work when the module is installed?
_ = Parameters.create({"PARAMETERS": "./defaults/cypress.cfg"}, [])
def test_cli_defaults():
... | """"""
from penn_chime.parameters import Parameters
def test_cli_defaults():
"""Ensure if the cli defaults have been updated."""
# TODO how to make this work when the module is installed?
_ = Parameters.create({'PARAMETERS': './defaults/cli.cfg'}, [])
def test_webapp_defaults():
"""Ensure the webapp... | mit | Python |
2cd5a3345675e427a2dc69a910af38f120539a25 | remove print statement | lenck/vlb,lenck/vlb,lenck/vlb | python/dset/hpatches_dataset.py | python/dset/hpatches_dataset.py | from dset.dataset import SequenceDataset
import urllib
import tarfile
import os
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
class HPatches_Dataset(SequenceDataset):
def __init__(self,root_dir = './datasets/', download_flag = False):... | from dset.dataset import SequenceDataset
import urllib
import tarfile
import os
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
class HPatches_Dataset(SequenceDataset):
def __init__(self,root_dir = './datasets/', download_flag = False):... | bsd-2-clause | Python |
c902d03a0fdb69485f1aa270175c427fb2806cd0 | add mocked test for sync | larssono/synapsePythonClient,thomasyu888/synapsePythonClient,zimingd/synapsePythonClient | tests/unit/unit_test_commandline.py | tests/unit/unit_test_commandline.py | """Test the Synapse command line client.
"""
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import str
import six
import filecmp
import os
import re
import sys
import uuid
impor... | """Test the Synapse command line client.
"""
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import str
import six
import filecmp
import os
import re
import sys
import uuid
impor... | apache-2.0 | Python |
cc7fc4ef66dadb8a1f8e9f91052ed97a192f9041 | Add pathology migration script | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/radar/models/pathology.py | radar/radar/models/pathology.py | from collections import OrderedDict
from sqlalchemy import Column, Integer, ForeignKey, Date, String, Index
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common import MetaModelMixin, uuid_pk_column, patient_id_column, patient_relationship
PATHOLOGY_KIDNEY_TYPES = OrderedDict... | from collections import OrderedDict
from sqlalchemy import Column, Integer, ForeignKey, Date, String, Index
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common import MetaModelMixin, uuid_pk_column, patient_id_column, patient_relationship
PATHOLOGY_KIDNEY_TYPES = OrderedDict... | agpl-3.0 | Python |
07a3f56c22dcd9fd39395d4fb0ca4739d2e7d9a8 | use items() | ArabellaTech/django-basic-email | basic_email/send.py | basic_email/send.py | # -*- coding: utf-8 -*-
import logging
import cssutils
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.conf import settings
from premailer import Premailer
cssutils.log.setLevel(logging.CRITICAL)
def send_email(t... | # -*- coding: utf-8 -*-
import logging
import cssutils
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.conf import settings
from premailer import Premailer
cssutils.log.setLevel(logging.CRITICAL)
def send_email(t... | bsd-3-clause | Python |
eca0f0738a771ac5efc6c5105eed0463ee96638f | move scale reading to own function. | ultimateboy/beanbot | beanbot/__init__.py | beanbot/__init__.py | import usb.core
import usb.util
import xmpp
try:
from local_settings import *
except ImportError:
raise Exception("You need a local_settings.py file!")
def read_scale_weight():
# find the USB device
device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
try:
if device.is_kernel_... | import usb.core
import usb.util
import xmpp
try:
from local_settings import *
except ImportError:
raise Exception("You need a local_settings.py file!")
def send_jabber_message(messagebody):
client = xmpp.Client(JABBER_SERVER)
client.connect(server=(JABBER_SERVER, JABBER_PORT))
client.auth(JABBER_U... | unlicense | Python |
341614123e46eb390055e82b794ca35fb835536b | fix queryset for parent field | avigmati/djcat,avigmati/djcat | djcat/admin.py | djcat/admin.py | from django import forms
from django.utils.html import format_html
from mptt.admin import MPTTModelAdmin
class CategoryForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(CategoryForm, self).__init__(*args, **kwargs)
self.fields['parent'].queryset = self.Meta.model.objects.filter(i... | from django import forms
from django.utils.html import format_html
from mptt.admin import MPTTModelAdmin
class CategoryForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(CategoryForm, self).__init__(*args, **kwargs)
class Meta:
exclude = ['is_root', 'is_endpoint']
def cle... | bsd-3-clause | Python |
1989ee3867962e90c2cb6aee261e2ecc58d0a8a8 | Fix test_juliainfo_without_pycall for Julia 0.6 | JuliaLang/pyjulia,JuliaPy/pyjulia,JuliaPy/pyjulia | test/test_juliainfo.py | test/test_juliainfo.py | import os
import subprocess
from julia.core import juliainfo, _enviorn
def check_core_juliainfo(jlinfo):
assert os.path.exists(jlinfo.JULIA_HOME)
assert os.path.exists(jlinfo.libjulia_path)
assert os.path.exists(jlinfo.image_file)
def test_juliainfo_normal():
jlinfo = juliainfo(os.getenv("JULIA_EXE... | import os
import subprocess
from julia.core import juliainfo, _enviorn
def check_core_juliainfo(jlinfo):
assert os.path.exists(jlinfo.JULIA_HOME)
assert os.path.exists(jlinfo.libjulia_path)
assert os.path.exists(jlinfo.image_file)
def test_juliainfo_normal():
jlinfo = juliainfo(os.getenv("JULIA_EXE... | mit | Python |
21f1607e8f30ab2f1a1cfe1feee2bd9487c7fd35 | add tests functions | swt30/beets,andremiller/beets,shamangeorge/beets,shamangeorge/beets,ruippeixotog/beets,LordSputnik/beets,multikatt/beets,jmwatte/beets,marcuskrahl/beets,shanemikel/beets,tima/beets,parapente/beets,kareemallen/beets,gabrielaraujof/beets,jmwatte/beets,drm00/beets,arabenjamin/beets,ibmibmibm/beets,madmouser1/beets,untitak... | test/test_lastgenre.py | test/test_lastgenre.py | # This file is part of beets.
# Copyright 2014, Fabrice Laporte.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... | # This file is part of beets.
# Copyright 2014, Fabrice Laporte.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... | mit | Python |
caad556a03fa9227f3ebe1553f90dcf6ec2c9260 | Update PocketFFT archive to point to Github. | google/jax,google/jax,google/jax,google/jax | third_party/pocketfft/workspace.bzl | third_party/pocketfft/workspace.bzl | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
f3084e3f449331dca77181eff77aa15502a24a46 | Fix tests (thanks a lot, git!) | jimporter/doppel,jimporter/doppel | test/unit/test_copy.py | test/unit/test_copy.py | import os
import unittest
import shutil
from doppel import copy, makedirs, mkdir
this_dir = os.path.abspath(os.path.dirname(__file__))
test_data_dir = os.path.join(this_dir, '..', 'data')
test_stage_dir = os.path.join(this_dir, '..', 'stage')
class TestCopy(unittest.TestCase):
def setUp(self):
self.stag... | import os
import unittest
import shutil
from doppel import copy
this_dir = os.path.abspath(os.path.dirname(__file__))
test_data_dir = os.path.join(this_dir, '..', 'data')
test_stage_dir = os.path.join(this_dir, '..', 'stage')
class TestCopy(unittest.TestCase):
def setUp(self):
self.stage = os.path.join(... | bsd-3-clause | Python |
19441cdf7d1a6706589a34adfba1fc42e7e37a11 | make download-hadoop.py Python 2/3 compatible | adotmob/flintrock,adotmob/flintrock | flintrock/scripts/download-hadoop.py | flintrock/scripts/download-hadoop.py | """
Download Hadoop from the best available Apache mirror.
"""
from __future__ import print_function
import json
import os
import sys
import subprocess
if sys.version_info < (3, 0):
from urllib import urlretrieve
from urllib2 import urlopen
else:
from urllib.request import urlopen, urlretrieve
if __nam... | """
Download Hadoop from the best available Apache mirror.
Python 2
"""
from __future__ import print_function
import os
import sys
import subprocess
import urllib
import urllib2
import json
hadoop_version = sys.argv[1]
apache_mirror_url = "http://www.apache.org/dyn/closer.lua/hadoop/common/hadoop-{v}/hadoop-{v}.tar... | apache-2.0 | Python |
dcc4b643fcf425adf814ef75374ec957d38cc87b | save immediate | joequant/sptrader,joequant/sptrader,joequant/sptrader,joequant/sptrader,joequant/sptrader | strategy/immediate.py | strategy/immediate.py | """Implements ImmediateStrategy"""
import spstrategy
# Create a Strategy
class ImmediateStrategy(spstrategy.SharpPointStrategy):
"""Immediate strategy automatically executes an order"""
params = (
('qty', 1),
('delay', 5),
('order', "B")
)
headers = [
{'headerName': "O... | """Implements ImmediateStrategy"""
import spstrategy
# Create a Strategy
class ImmediateStrategy(spstrategy.SharpPointStrategy):
"""Immediate strategy automatically executes an order"""
params = (
('qty', 1),
('delay', 5),
('order', "B")
)
headers = [
{'headerName': "O... | bsd-2-clause | Python |
a5848e586f46105694ad44f5e16960345cf184ac | remove support for disqus | arjunkrishnababu96/jekpost | jekpost/jekpost.py | jekpost/jekpost.py | #!/usr/bin/env python3
import argparse
import datetime
import os
def generate_post_file(title, location):
title_line = "title: {}".format(title)
filename = make_filename(title, get_date_formatted(datetime.date.today()))
os.chdir(location) # switch to destination directory
with open(filename, mode='x... | #!/usr/bin/env python3
import argparse
import datetime
import os
def generate_post_file(title, location, disqus_name=None):
title_line = "title: {}".format(title)
filename = make_filename(title, get_date_formatted(datetime.date.today()))
os.chdir(location) # switch to destination directory
with open... | mit | Python |
6ca6855fd82b99084158c222e1600e6c6a8e64db | convert post title in filename to lowercase | arjunkrishnababu96/jekpost | jekpost/jekpost.py | jekpost/jekpost.py | #!/usr/bin/env python3
import argparse
import datetime
import os
def generate_post_file(title, location):
title_line = "title: {}".format(title)
filename = make_filename(title, get_date_formatted(datetime.date.today()))
os.chdir(location) # switch to destination directory
with open(filename, mode='x... | #!/usr/bin/env python3
import argparse
import datetime
import os
def generate_post_file(title, location):
title_line = "title: {}".format(title)
filename = make_filename(title, get_date_formatted(datetime.date.today()))
os.chdir(location) # switch to destination directory
with open(filename, mode='x... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.