commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
95e9fd8e8bc568b4446b708248dedfc0a739e85c
inthe_am/taskmanager/features/environment.py
inthe_am/taskmanager/features/environment.py
import os from urlparse import urljoin from django.conf import settings from splinter.browser import Browser from inthe_am.taskmanager import models TEST_COUNTERS = {} def before_all(context): context.browser = Browser('phantomjs') def after_all(context): context.browser.quit() context.browser = No...
import os from urlparse import urljoin from django.conf import settings from splinter.browser import Browser from inthe_am.taskmanager import models TEST_COUNTERS = {} def before_all(context): context.browser = Browser('phantomjs') def after_all(context): context.browser.quit() context.browser = No...
Set window size to something a little bigger.
Set window size to something a little bigger.
Python
agpl-3.0
coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am
5f799aa16b2bfd35fc68073e73b85cf9ad75ba47
tests/__init__.py
tests/__init__.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Use symbolic constant rather than literal value
Use symbolic constant rather than literal value
Python
apache-2.0
google/oauth2client,clancychilds/oauth2client,clancychilds/oauth2client,jonparrott/oauth2client,google/oauth2client,googleapis/oauth2client,googleapis/oauth2client,jonparrott/oauth2client
6be8907881870fd6dd5e5629b7cbc9fe491c35dd
Class_Pattern.py
Class_Pattern.py
class Pattern(object): def __init__(self, pattern): self.consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'] self.vowels = ['a','e','i','o','u'] self.pattern = pattern for letter in self.pattern: if letter != 'C' an...
import random class Pattern(object): def __init__(self, pattern): self.consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'] self.vowels = ['a','e','i','o','u'] self.pattern_dict = {'C': self.consonants, 'V': self.vowels} self.pattern = ...
Add create_word function in pattern class
Add create_word function in pattern class
Python
mit
achyutreddy24/WordGen
3aaf18dc43ee81bf2669eb597444d713d1577ebe
Motor/src/main/python/vehicles.py
Motor/src/main/python/vehicles.py
from Adafruit_MotorHAT import Adafruit_MotorHAT class Vehicle: def __init__(self, motor_hat=Adafruit_MotorHAT()): self.motor_hat = motor_hat self.motors = [] def release(self): self.motor_hat.getMotor(1).run(Adafruit_MotorHAT.RELEASE) self.motor_hat.getMotor(2).run(Adafruit_Mo...
from Adafruit_MotorHAT import Adafruit_MotorHAT class Vehicle: def __init__(self, motor_hat=Adafruit_MotorHAT()): self.motor_hat = motor_hat self.motors = [] def release(self): self.motor_hat.getMotor(1).run(Adafruit_MotorHAT.RELEASE) self.motor_hat.getMotor(2).run(Adafruit_Mo...
Update motor API with new data model
Update motor API with new data model
Python
mit
misalcedo/RapBot,misalcedo/RapBot,misalcedo/RapBot,misalcedo/RapBot
1fb46372db32fdb2606c560a1bbec168628039a7
lucid/modelzoo/other_models/CLIPx4.py
lucid/modelzoo/other_models/CLIPx4.py
# Copyright 2018 The Lucid Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# Copyright 2018 The Lucid Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Update CLIP model URL to modelzoo bucket
Update CLIP model URL to modelzoo bucket
Python
apache-2.0
tensorflow/lucid,tensorflow/lucid,tensorflow/lucid,tensorflow/lucid
b3838e3ad3c8c9575c18ae9770504405fd3f5006
saltcloud/mapper.py
saltcloud/mapper.py
''' Read in a vm map file. The map file contains a mapping of profiles to names allowing for individual vms to be created in a more stateful way ''' # Import python libs import os import copy # Import salt libs import saltcloud.cloud import salt.client # Import third party libs import yaml class Map(object): '...
''' Read in a vm map file. The map file contains a mapping of profiles to names allowing for individual vms to be created in a more stateful way ''' # Import python libs import os import copy import multiprocessing # Import salt libs import saltcloud.cloud import salt.client # Import third party libs import yaml c...
Add parallel capability for running the map
Add parallel capability for running the map
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
7211ecb704a52f7dfe0984b1bb70305367f5104c
tools/gyp_dart.py
tools/gyp_dart.py
#!/usr/bin/env python # Copyright (c) 2012 The Dart Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Invoke gyp to generate build files for building the Dart VM. """ import os import subprocess import sys def execute(args): pro...
#!/usr/bin/env python # Copyright (c) 2012 The Dart Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Invoke gyp to generate build files for building the Dart VM. """ import os import subprocess import sys SCRIPT_DIR = os.path.dir...
Make tools/gypdart independent of the directory from which it is called.
Make tools/gypdart independent of the directory from which it is called. This enables more independence in the way you can structure your checkout using gclient. BUG= R=ahe@google.com Review URL: https://codereview.chromium.org//1023893003 git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@44640 260f80e4-7a28-392...
Python
bsd-3-clause
dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk...
68b2135eebe6e1475748ea34aeeb360ef7c79748
ibis/__init__.py
ibis/__init__.py
# -------------------------------------------------------------------------------------------------- # Ibis: a lightweight template engine. # # How it works: A lexer transforms a template string into a sequence of tokens. A parser takes this # sequence and compiles it into a tree of nodes. Each node has a .render() met...
from . import filters from . import nodes from . import loaders from . import errors from . import compiler from .template import Template # Library version. __version__ = "2.0.0-alpha.1" # Assign a template-loading callable here to enable the {% include %} and {% extends %} tags. # The callable should accept one ...
Remove header comment, duplicated in docs
Remove header comment, duplicated in docs
Python
unlicense
dmulholland/ibis
2e6ad775b7876c0fa827481211be4d000a03aa48
scripts/check_deployment.py
scripts/check_deployment.py
import os import pytest import requests @pytest.fixture def url(): return os.getenv("SITE", "http://localhost:5000") def test_post_images(expect, url): params = {"template_key": "iw", "text_lines": ["test", "deployment"]} response = requests.post(f"{url}/images", json=params) expect(response.status...
import os import pytest import requests @pytest.fixture def url(): return os.getenv("SITE", "http://localhost:5000") def test_get_templates(expect, url): response = requests.get(f"{url}/templates") expect(response.status_code) == 200 def test_post_images(expect, url): params = {"template_key": "i...
Check slower endpoints during promotion
Check slower endpoints during promotion
Python
mit
jacebrowning/memegen,jacebrowning/memegen
5d35b947719106b7af67e4da92eaa4db0e5a6948
doc/examples/plot_tutorial_example.py
doc/examples/plot_tutorial_example.py
#!/usr/bin/env python """ ================ Tutorial example ================ Here's a line plot: """ import numpy as np import matplotlib.pyplot as plt 'normal string' x = np.linspace(0, 2*np.pi) plt.plot(x, np.sin(x)) """ .. image:: PLOT2RST.current_figure Here's an image plot: """ # code comment plt.figure() plt...
#!/usr/bin/env python """ ================ Tutorial example ================ Here's a line plot: """ import numpy as np import matplotlib.pyplot as plt 'normal string' x = np.linspace(0, 2*np.pi) plt.plot(x, np.sin(x)) def dummy(): """Dummy docstring""" pass """ .. image:: PLOT2RST.current_figure Here's a...
Make plot2rst example more strict.
DOC: Make plot2rst example more strict.
Python
bsd-3-clause
matteoicardi/mpltools,tonysyu/mpltools
61595ed284a132c3c32975a6bfe7642c51c45c7b
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """Exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an interface to sty...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """Exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an interface to sty...
Add some more output examples
Add some more output examples
Python
mit
jackbrewer/SublimeLinter-contrib-stylint
352c59a8f6ea12cef30b84c5778bc8991c53af4b
models.py
models.py
import mongoengine as me from datetime import datetime from config import DATABASE_NAME # Connect to the Mongo database me.connect(DATABASE_NAME) class Page(me.Document): """Represents a page.""" title = me.StringField(required=True) author = me.StringField(required=True) body = me.StringField() ...
import mongoengine as me from datetime import datetime from config import DATABASE_NAME # Connect to the Mongo database me.connect(DATABASE_NAME) class Page(me.Document): """Represents a page. This is an example of defining a fixed schema with validation. """ title = me.StringField(required=True) ...
Add more validation. Add to docstrings.
Add more validation. Add to docstrings.
Python
mit
CodeSelfStudy/flask_mongoengine_example,CodeSelfStudy/flask_mongoengine_example
13fc59baa49d4f49d4e6ad9e0766ae2aede2fc25
proselint/command_line.py
proselint/command_line.py
#!/usr/bin/python # -*- coding: utf-8 -*- """Command line utility for proselint.""" import click import os import imp def log_error(line, column, error_code, msg): """Print a message to the command line.""" click.echo(str(line) + ":" + str(column) + " \t" + error_code + ": " + ...
#!/usr/bin/python # -*- coding: utf-8 -*- """Command line utility for proselint.""" import click import os import imp def log_error(line, column, error_code, msg): """Print a message to the command line.""" click.echo(str(line) + ":" + str(column) + " \t" + error_code + ": " + ...
Raise an error if no file is specified
Raise an error if no file is specified
Python
bsd-3-clause
jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint
cd590194c4a3d3455cf05bd922352ead2729982d
src/encoded/views/__init__.py
src/encoded/views/__init__.py
from pyramid.view import view_config from random import randint from ..contentbase import ( Root, location_root, ) def includeme(config): # Random processid so etags are invalidated after restart. config.registry['encoded.processid'] = randint(0, 2 ** 32) config.add_route('schema', '/profiles/{ite...
from pyramid.httpexceptions import HTTPNotFound from pyramid.view import view_config from random import randint from ..contentbase import ( Root, location_root, ) def includeme(config): # Random processid so etags are invalidated after restart. config.registry['encoded.processid'] = randint(0, 2 ** 32...
Raise not Found on schema item_type error.
Raise not Found on schema item_type error.
Python
mit
hms-dbmi/fourfront,philiptzou/clincoded,4dn-dcic/fourfront,ClinGen/clincoded,ENCODE-DCC/encoded,ClinGen/clincoded,kidaa/encoded,T2DREAM/t2dream-portal,philiptzou/clincoded,hms-dbmi/fourfront,ClinGen/clincoded,philiptzou/clincoded,ENCODE-DCC/snovault,ENCODE-DCC/encoded,ClinGen/clincoded,ENCODE-DCC/encoded,ENCODE-DCC/sno...
96b06d80f6108997fab44ac1e6042fcae93cc82a
server.py
server.py
# coding: utf-8 import json import tornado.ioloop import tornado.web import Adafruit_BMP.BMP085 as BMP085 class SensorAccess(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self): self.write(json.dumps(self.read_sensor())) self.finish() def read_sensor(self): pass ...
# coding: utf-8 import json import tornado.ioloop import tornado.web import Adafruit_BMP.BMP085 as BMP085 class SensorAccess(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self): self.write(json.dumps(self.read_sensor())) self.finish() def read_sensor(self): pass ...
Fix typo; Fix request never finish
Fix typo; Fix request never finish
Python
bsd-2-clause
JokerQyou/pitools
2231c0384e56af56285999bc0bf7a096d3dd1cb9
pyuploadcare/dj/models.py
pyuploadcare/dj/models.py
from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCare file id/URI with cached data" def get_internal_ty...
from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.exceptions import InvalidRequestError from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCar...
Add handling of InvalidRequestError in ``to_python`
Add handling of InvalidRequestError in ``to_python`
Python
mit
uploadcare/pyuploadcare
862fa3a737ef944899958551c66bcf6ad8fb4c86
packages/nuget.py
packages/nuget.py
class NuGetPackage(GitHubTarballPackage): def __init__(self): GitHubTarballPackage.__init__(self, 'mono', 'nuget', '2.8.1', '7b20cd5408852e725bd14a13855bd238506c6a19', configure = '') def build(self): self.sh ('%{make}') def install(self): self.sh ('%{makeinstall} PREFIX=%{prefix}') NuGetPackag...
class NuGetPackage(GitHubTarballPackage): def __init__(self): GitHubTarballPackage.__init__(self, 'mono', 'nuget', '2.8.1', '7b20cd5408852e725bd14a13855bd238506c6a19', configure = '') def build(self): self.sh ('%{make} PREFIX=%{prefix}') def install(self): self.sh ('%{makeinstall} PREFIX=%{prefi...
Set PREFIX in make as well as makeinstall
Set PREFIX in make as well as makeinstall
Python
mit
BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild
0e2bfd59ca9db6568bac40504977d80b8ad84aba
helga_prod_fixer.py
helga_prod_fixer.py
import random from helga.plugins import command RESPONSES = [ 'There is no hope for {thing}, {nick}', 'It looks ok to me...', 'Did you power cycle {thing}? Are any of the lights blinking?', 'I\'ll take {thing} to the Genius Bar after work', 'Can we look at this tomorrow? I have Com Truise tickets...
import random from helga.plugins import command RESPONSES = [ 'There is no hope for {thing}, {nick}', 'It looks ok to me...', 'Did you power cycle {thing}? Are any of the lights blinking?', 'I\'ll take {thing} to the Genius Bar after work', 'Can we look at this tomorrow? I have Com Truise tickets...
Reboot and IE6 compatibility fixer messages
Reboot and IE6 compatibility fixer messages
Python
mit
shaunduncan/helga-prod-fixer
981d0473a24d52fb19e8da1a2af18c9f8823dd29
heufybot/factory.py
heufybot/factory.py
from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory from heufybot.connection import HeufyBotConnection class HeufyBotFactory(ReconnectingClientFactory): protocol = HeufyBotConnection def __init__(self, bot): self.bot = bot self.currentlyDisconnecting = [] def b...
from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory from heufybot.connection import HeufyBotConnection class HeufyBotFactory(ReconnectingClientFactory): protocol = HeufyBotConnection def __init__(self, bot): self.bot = bot self.currentlyDisconnecting = [] def b...
Add an action for server disconnects
Add an action for server disconnects
Python
mit
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
441f950efac0197e73fa46cf423793f28402f532
yaml_storage.py
yaml_storage.py
import yaml import sys from tinydb.storages import Storage class YAMLStorage(Storage): def __init__(self, filename): # (1) self.filename = filename def read(self): with open(self.filename) as handle: try: data = yaml.safe_load(handle.read()) # (2) ...
import yaml import sys from tinydb.database import Document from tinydb.storages import Storage, touch def represent_doc(dumper, data): # Represent `Document` objects as their dict's string representation # which PyYAML understands return dumper.represent_data(dict(data)) yaml.add_representer(Document, re...
Fix YAMLStorage as per TinyDB doc changes
Fix YAMLStorage as per TinyDB doc changes
Python
mit
msembinelli/mpm
d7bf66d84aee271cbcd99cd91eaedea8942d5a93
exponent/auth/service.py
exponent/auth/service.py
from exponent.auth import common from twisted.cred import checkers, portal from twisted.internet import defer from twisted.protocols import amp from zope import interface def _getUserByIdentifier(rootStore, userIdentifier): """ Gets a user by uid. """ user = common.User.findUnique(rootStore, userIdent...
from twisted.cred import checkers, portal from twisted.protocols import amp from zope import interface class AuthenticationLocator(amp.CommandLocator): """ A base class for responder locators that allow users to authenticate. """ credentialInterfaces = [] def __init__(self, store): """ ...
Remove get user by id nonsense, now exponent.auth.name
Remove get user by id nonsense, now exponent.auth.name
Python
isc
lvh/exponent
965a70bc4e8732fe02e83b9074698732253d5289
environ.py
environ.py
#!/usr/bin/env python # Copyright (c) 2012 Citrix Systems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; version 2.1 only. with the special # exception on linking described in fi...
#!/usr/bin/env python # Copyright (c) 2012 Citrix Systems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; version 2.1 only. with the special # exception on linking described in fi...
Use env variable to indicate installer
Use env variable to indicate installer
Python
bsd-2-clause
xenserver/python-libs,xenserver/python-libs
ce993da55a2fdcaeaf935703f0b895cae075a870
example.py
example.py
#!/usr/bin/python from ADIF_log import ADIF_log import datetime import os # Create a new log... log = ADIF_log('Py-ADIF Example') entry = log.newEntry() # New entry from K6BSD to WD1CKS entry['OPerator'] = 'K6BSD' entry['Call'] = 'WD1CKS' entry['QSO_Date']=datetime.datetime.now().strftime('%Y%m%d') entry['baNd']='20...
#!/usr/bin/python from ADIF_log import ADIF_log import datetime import os # Create a new log... log = ADIF_log('Py-ADIF Example') entry = log.newEntry() # New entry from K6BSD to WD1CKS entry['OPerator'] = 'K6BSD' entry['Call'] = 'WD1CKS' entry['QSO_Date']=datetime.datetime.now().strftime('%Y%m%d') entry['baNd']='20...
Add a unicode value in a comment_intl value.
Add a unicode value in a comment_intl value.
Python
bsd-2-clause
K6BSD/Py-ADIF
e386b013b4c0124c623bd99dcb1a1d01b6e6bd86
supriya/__init__.py
supriya/__init__.py
# -*- encoding: utf -*- import pyximport pyximport.install() from supriya.tools import * # noqa from supriya.tools.bindingtools import bind # noqa from supriya.tools.nonrealtimetools import Session # noqa from supriya.tools.servertools import ( # noqa AddAction, Buffer, BufferGroup, Bus, BusGroup, Group, Serv...
# -*- encoding: utf -*- import pyximport pyximport.install() from supriya.tools import * # noqa from supriya.tools.bindingtools import bind # noqa from supriya.tools.nonrealtimetools import Session # noqa from supriya.tools.servertools import ( # noqa AddAction, Buffer, BufferGroup, Bus, BusGr...
Add play, render and Say to toplevel namespace.
Add play, render and Say to toplevel namespace.
Python
mit
Pulgama/supriya,Pulgama/supriya,Pulgama/supriya,josiah-wolf-oberholtzer/supriya,Pulgama/supriya
6a5ffc12a16c0795716d1a316f051541e674fd75
irrigator_pro/notifications/models.py
irrigator_pro/notifications/models.py
from django.db import models from django.contrib.auth.models import User from common.models import Audit, Comment from farms.models import CropSeason, Field ######################################################## ### NotificationsRule ### ### Connect notification info with a Field, CropSeason ###################...
from django.db import models from django.contrib.auth.models import User from common.models import Audit, Comment from farms.models import CropSeason, Field ######################################################## ### NotificationsRule ### ### Connect notification info with a Field, CropSeason ###################...
Change order of notification types so that email is shown first and becomes the default
Change order of notification types so that email is shown first and becomes the default
Python
mit
warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro
2b479927ee33181c57081df941bfdf347cd45423
test/test_serenata_de_amor.py
test/test_serenata_de_amor.py
from unittest import TestCase class TestSerenataDeAmor(TestCase): def test_it_works(self): self.assertEqual(4, 2 + 2) self.assertNotEqual(5, 2 + 2)
import glob import subprocess from unittest import TestCase class TestSerenataDeAmor(TestCase): def setUp(self): self.notebook_files = glob.glob('develop/*.ipynb') def test_html_versions_present(self): """There is a *.html version of every Jupyter notebook.""" expected = [filename.re...
Verify existence of *.html and *.py versions for every notebook
Verify existence of *.html and *.py versions for every notebook
Python
mit
marcusrehm/serenata-de-amor,datasciencebr/serenata-de-amor,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/serenata-de-amor
16594fca785e0f726b9bcc3ca3c0a45d2ac758dc
get_study_attachments.py
get_study_attachments.py
import sys import boto3 BUCKET_NAME = 'mitLookit' def get_all_study_attachments(study_uuid): s3 = boto3.resource('s3') bucket = s3.Bucket(BUCKET_NAME) return bucket.objects.filter(Prefix=f'videoStream_{study_uuid}') if __name__ == '__main__': study_uuid = sys.argv[1] get_study_keys(study_uuid)
import sys import boto3 import botocore BUCKET_NAME = 'mitLookit' def get_all_study_attachments(study_uuid): """ Get all video responses to a study by fetching all objects in the bucket with key name videoStream_<study_uuid> """ s3 = boto3.resource('s3') bucket = s3.Bucket(BUCKET_NAME) ret...
Add function that gets presigned url for video.
Add function that gets presigned url for video.
Python
apache-2.0
pattisdr/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,CenterForOpenScience/lookit-api
47bf4aa44342acc030d5cc2047d571b93b4f8de3
ts3npl.py
ts3npl.py
from irc3.plugins.command import command from irc3.plugins.cron import cron import irc3 from teamspeak_web_utils import nplstatus @irc3.plugin class TS3NPL(object): def __init__(self, bot): self.bot = bot self.npl_status = None self.target_channel = '#teamspeak' @cron('* * * * *') ...
from irc3.plugins.command import command from irc3.plugins.cron import cron import irc3 from teamspeak_web_utils import nplstatus @irc3.plugin class TS3NPL(object): def __init__(self, bot): self.bot = bot self.npl_status = None config = bot.config.get('ts3npl', {}) self.target_cha...
Use config instead of hardcoding target channel
Use config instead of hardcoding target channel
Python
mit
Thor77/TeamspeakIRC
d9e922075a322cef75b7b75e62abdd539212bebd
twitter/util.py
twitter/util.py
""" Internal utility functions. `htmlentitydecode` came from here: http://wiki.python.org/moin/EscapingHtml """ import re import sys try: from html.entities import name2codepoint except ImportError: from htmlentitydefs import name2codepoint def htmlentitydecode(s): return re.sub( '&(%s);' % ...
""" Internal utility functions. `htmlentitydecode` came from here: http://wiki.python.org/moin/EscapingHtml """ import re import sys try: from html.entities import name2codepoint unichr = chr except ImportError: from htmlentitydefs import name2codepoint def htmlentitydecode(s): return re.sub( ...
Set unichr = chr for Python 3.
Set unichr = chr for Python 3.
Python
mit
sixohsix/twitter,miragshin/twitter,Adai0808/twitter,adonoho/twitter,hugovk/twitter,jessamynsmith/twitter,tytek2012/twitter
b917a5ba927a09de7e916978e3689a23ccd035ac
count_word_api/helpers/text.py
count_word_api/helpers/text.py
from bs4 import BeautifulSoup def html_to_text(html_text): """Receive pure html and convert to text without tags""" soup = BeautifulSoup(html_text, "html.parser") clean_html = ' '.join(soup.find_all(text=True)) return clean_html def remove_punctuation(text): translate_table = {ord(c): "" ...
from bs4 import BeautifulSoup def html_to_text(html_text): """Receive pure html and convert to text without tags""" soup = BeautifulSoup(html_text, "html.parser") clean_html = ' '.join(soup.find_all(text=True)) return clean_html def remove_punctuation(text): """Receive text and remove punctuatio...
Add missing docstring on remove_punctuation
Add missing docstring on remove_punctuation
Python
mit
rafaelhenrique/count_word_api
a09822a4a8422493c5cb98eb9518ab0112c565d7
techism2/service.py
techism2/service.py
from techism2.models import Event from datetime import datetime def get_tags(): # TODO: cache, use django cache which uses GAE memcache dict_list = Event.objects.values('tags') tags = dict() for dictionary in dict_list: for tag_list in dictionary.itervalues(): if tag_list: ...
from techism2.models import Event from datetime import datetime from django.core.cache import cache tags_cache_key = "tags" def get_tags(): # Note: no synchronization, propably not possible on GAE tags = cache.get(tags_cache_key) if tags: return tags else: tags = __fetch_tags() ...
Use Memcache to cache tags
Use Memcache to cache tags
Python
apache-2.0
gimler/techism2,gimler/techism2
523ac69174cf3a02c3054dfbe04dc461cc8d60ff
src/ggrc_basic_permissions/migrations/versions/20150805105543_99925466d6e_add_roles_order_column.py
src/ggrc_basic_permissions/migrations/versions/20150805105543_99925466d6e_add_roles_order_column.py
"""Add roles order column Revision ID: 99925466d6e Revises: 401fb7f0184b Create Date: 2015-08-05 10:55:43.992382 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '99925466d6e' down_revision = '401fb7f0184b' def upgrade(): op.add_column("roles", sa.Column("r...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Add roles order column Revision ID: 99925466d6e Revises: 401fb7f0184b Create...
Add headers to migrations in ggrc_basic_permissions
Add headers to migrations in ggrc_basic_permissions
Python
apache-2.0
plamut/ggrc-core,prasannav7/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,j...
07ba597a106e60a77ec28debd093079daa55df8f
node.py
node.py
class Node(object): def __init__(self): # Node(s) from which this Node receives values self.inbound_nodes = inbound_nodes # Node(s) to which this Node passes values self.outbound_nodes = [] # For each inbound Node here, add this Node as an outbound to that Node. for n in self.inbound_nodes: ...
class Node(object): def __init__(self): # Node(s) from which this Node receives values self.inbound_nodes = inbound_nodes # Node(s) to which this Node passes values self.outbound_nodes = [] # For each inbound Node here, add this Node as an outbound to that Node. for n in self.inbound_nodes: ...
Add value property to class Node
Add value property to class Node value is the calculated output of a Node.
Python
mit
YabinHu/miniflow
b0c93651c6d0d48394041ea61dea3774f6e017af
ircnotifier/redis2irc.py
ircnotifier/redis2irc.py
#!/usr/bin/env python import asyncio import asyncio_redis import asyncio_redis.encoders import json import irc3 import traceback __version__ = '3.0alpha' class Redis2Irc(irc3.IrcBot): def __init__(self, conf, **kwargs): """ :type conf: dict """ super(Redis2Irc, self).__init__(**...
#!/usr/bin/env python import asyncio import asyncio_redis import asyncio_redis.encoders import json import irc3 import traceback __version__ = '3.0alpha' class Redis2Irc(irc3.IrcBot): def __init__(self, conf, **kwargs): """ :type conf: dict """ super(Redis2Irc, self).__init__(**...
Join channels where the bot isn't already on
Join channels where the bot isn't already on
Python
apache-2.0
wikimedia/operations-software-ircyall,yuvipanda/ircnotifier
c170e8a73bea60bba9fdf9a004f922dfeb6c5715
Tools/compiler/doc/astdocgen.py
Tools/compiler/doc/astdocgen.py
# Lame substitute for a fine script to generate the table from ast.txt from compiler import astgen AST_DEF = '../compiler/ast.txt' def sort(l): l = l[:] l.sort(lambda a, b: cmp(a.name, b.name)) return l def main(): nodes = astgen.parse_spec(AST_DEF) print "\\begin{longtableiii}{lll}{class}{Node ...
# Lame substitute for a fine script to generate the table from ast.txt from compiler import astgen AST_DEF = '../compiler/ast.txt' def sort(l): l = l[:] l.sort(lambda a, b: cmp(a.name, b.name)) return l def main(): nodes = astgen.parse_spec(AST_DEF) print "\\begin{longtableiii}{lll}{class}{Node ...
Change the generated markup so that attribute names are properly marked.
Change the generated markup so that attribute names are properly marked.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
d47d6bd812a6f335bc369cccc0539585ff7aeff3
endless_pagination/loaders.py
endless_pagination/loaders.py
"""Django Endless Pagination object loaders.""" from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module def load_object(path): """Return the Python object represented by dotted *path*.""" i = path.rfind('.') module_...
"""Django Endless Pagination object loaders.""" from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from importlib import import_module def load_object(path): """Return the Python object represented by dotted *path*.""" i = path.rfind('.') module_name, object_...
Use importlib instead of django.utils.importlib
Use importlib instead of django.utils.importlib django.utils.importlib is deprecated, and removed in Django 1.9
Python
mit
catalpainternational/django-endless-pagination,catalpainternational/django-endless-pagination,catalpainternational/django-endless-pagination,catalpainternational/django-endless-pagination
70f568a97f87f039fe06d74e1cf46040e0b6b817
tests/test_etcd3.py
tests/test_etcd3.py
""" test_etcd3 ---------------------------------- Tests for `etcd3` module. """ import pytest import etcd3 class TestEtcd3(object): @classmethod def setup_class(cls): pass def test_client_stub(self): etcd = etcd3.client() assert etcd is not None def test_get_unknown_key(s...
""" test_etcd3 ---------------------------------- Tests for `etcd3` module. """ import os import pytest import etcd3 class TestEtcd3(object): @classmethod def setup_class(cls): pass def test_client_stub(self): etcd = etcd3.client() assert etcd is not None def test_get_un...
Clean out testing keys with etcdctl
Clean out testing keys with etcdctl
Python
apache-2.0
kragniz/python-etcd3
ca558816e26c2899a597698fc773c762d25956c4
tk/material/apps.py
tk/material/apps.py
from django.apps import AppConfig from django.db.models.signals import post_save from watson import search from localized_fields.fields import LocalizedField class MaterialSearchAdapter(search.SearchAdapter): """ Dumps all translated titles and descriptions into the search index. The translated fields ar...
from django.apps import AppConfig from django.db.models.signals import post_save from django.utils import translation from django.conf import settings from watson import search from localized_fields.fields import LocalizedField class MaterialSearchAdapter(search.SearchAdapter): """ Dumps all translated title...
Index localised URLs for search
Index localised URLs for search
Python
agpl-3.0
GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa
84ee7f1c63b992a6e581ca2fcd33522ae19446ff
grako/__init__.py
grako/__init__.py
# -*- coding: utf-8 -*- """ Parse and translate an EBNF grammar into a Python parser for the described language. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from grako import tool genmodel = tool.genmodel codegen = tool.codegen def main(): tool...
# -*- coding: utf-8 -*- """ Parse and translate an EBNF grammar into a Python parser for the described language. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from grako import tool genmodel = tool.genmodel gencode = tool.gencode def main(): tool...
Revert unwanted change in tool/script.
Revert unwanted change in tool/script.
Python
bsd-2-clause
vmuriart/grako,frnknglrt/grako
6136fc2bd2d9d191df7a9e6afd3aa9e4f110d61e
numpy/core/tests/test_print.py
numpy/core/tests/test_print.py
import numpy as np from numpy.testing import * class TestPrint(TestCase): def test_float_types(self) : """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and np.longdouble aren't the same as the python float pr...
import numpy as np from numpy.testing import * def check_float_type(tp): for x in [0, 1,-1, 1e10, 1e20] : assert_equal(str(tp(x)), str(float(x))) def test_float_types(): """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and n...
Use parametric tests for format tests so that it is clearer which type is failing.
Use parametric tests for format tests so that it is clearer which type is failing.
Python
bsd-3-clause
solarjoe/numpy,NextThought/pypy-numpy,musically-ut/numpy,trankmichael/numpy,ViralLeadership/numpy,b-carter/numpy,argriffing/numpy,ogrisel/numpy,mhvk/numpy,mingwpy/numpy,b-carter/numpy,ewmoore/numpy,jakirkham/numpy,ahaldane/numpy,KaelChen/numpy,mhvk/numpy,utke1/numpy,ogrisel/numpy,skymanaditya1/numpy,rmcgibbo/numpy,embr...
32376bf577af51ed43819aa92e89231886e6b619
tests/functional/test_new_resolver_errors.py
tests/functional/test_new_resolver_errors.py
from tests.lib import create_basic_wheel_for_package def test_new_resolver_conflict_requirements_file(tmpdir, script): create_basic_wheel_for_package(script, "base", "1.0") create_basic_wheel_for_package(script, "base", "2.0") create_basic_wheel_for_package( script, "pkga", "1.0", depends=["base==...
from tests.lib import create_basic_wheel_for_package def test_new_resolver_conflict_requirements_file(tmpdir, script): create_basic_wheel_for_package(script, "base", "1.0") create_basic_wheel_for_package(script, "base", "2.0") create_basic_wheel_for_package( script, "pkga", "1.0", depends=["base==...
Test for constraint in message
Test for constraint in message
Python
mit
pypa/pip,pradyunsg/pip,sbidoul/pip,sbidoul/pip,pypa/pip,pfmoore/pip,pfmoore/pip,pradyunsg/pip
4e096718efc41602023d1e2833467d158d2a0456
oscar_sagepay/dashboard/app.py
oscar_sagepay/dashboard/app.py
from django.conf.urls import patterns, url from django.contrib.admin.views.decorators import staff_member_required from oscar.core.application import Application from . import views class SagepayDashboard(Application): name = None list_view = views.Transactions detail_view = views.Transaction def g...
from django.conf.urls import patterns, url from django.contrib.admin.views.decorators import staff_member_required from oscar.core.application import Application from oscar.apps.dashboard.nav import register, Node from . import views node = Node('Datacash', 'sagepay-transaction-list') register(node, 100) class Sag...
Add dashboard node for transaction list
Add dashboard node for transaction list
Python
bsd-3-clause
django-oscar/django-oscar-sagepay-direct
ca5453672be43168bd7a53e1b4d63c2c53ca7365
marconiclient/version.py
marconiclient/version.py
# Copyright (c) 2013 Red Hat, 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 writ...
# Copyright (c) 2013 Red Hat, Inc. # Copyright 2012 OpenStack 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
Make pbr only a build-time dependency.
Make pbr only a build-time dependency. This lets you build python-marconiclient packages that don't require pbr to be installed at all. You would need pbr on the machine running rpmbuild / debuild, but not on the machines that install the packages. Unfortunately, this does not make python-marconiclient able to be ins...
Python
apache-2.0
openstack/python-zaqarclient
2bd449678d34187efdf3e4ca92daa28ea1d9fa48
imagemodal/mixins/fragment.py
imagemodal/mixins/fragment.py
""" Mixin fragment/html behavior into XBlocks """ from __future__ import absolute_import from django.template.context import Context from xblock.fragment import Fragment class XBlockFragmentBuilderMixin(object): """ Create a default XBlock fragment builder """ def build_fragment( self, ...
""" Mixin fragment/html behavior into XBlocks """ from __future__ import absolute_import from django.template.context import Context from xblock.fragment import Fragment class XBlockFragmentBuilderMixin(object): """ Create a default XBlock fragment builder """ def build_fragment( self, ...
Fix bug to make template optional
Fix bug to make template optional
Python
agpl-3.0
Stanford-Online/xblock-image-modal,Stanford-Online/xblock-image-modal,Stanford-Online/xblock-image-modal
af4e705138887f950ebdb3cef06dfab77d89a1b9
indra/util/plot_formatting.py
indra/util/plot_formatting.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import matplotlib fontsize=7 def set_fig_params(): matplotlib.rcParams['font.sans-serif'] = 'Arial' matplotlib.rcParams['text.usetex'] = True matplotlib.rcParams['text.latex.preamble'] = [ '...
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import matplotlib fontsize=7 def set_fig_params(): matplotlib.rcParams['font.sans-serif'] = 'Arial' matplotlib.rcParams['text.usetex'] = True matplotlib.rcParams['text.latex.preamble'] = [ '...
Add default colors to plot formatting
Add default colors to plot formatting
Python
bsd-2-clause
sorgerlab/belpy,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,bgyori/indra,johnbachman/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy
09f38a9f13521c69be2e047628c74ed571f0d8de
ideascube/wsgi.py
ideascube/wsgi.py
""" WSGI config for ideascube project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ideascube.settings") os.environ.setd...
""" WSGI config for ideascube project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ideascube.settings") os.environ.setd...
Load the application before running commands
Load the application before running commands
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
c30898d785d131a8dc08d93fe4142acda5b34081
frappe/core/doctype/docfield/docfield.py
frappe/core/doctype/docfield/docfield.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals from frappe.model.document import Document class DocField(Document): pass
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class DocField(Document): def get_link_doctype(self): '''Returns the Link doctype for the docfield (if applicable) ...
Add get_link_doctype method in DocField
fix: Add get_link_doctype method in DocField
Python
mit
adityahase/frappe,saurabh6790/frappe,almeidapaulopt/frappe,mhbu50/frappe,yashodhank/frappe,almeidapaulopt/frappe,mhbu50/frappe,vjFaLk/frappe,adityahase/frappe,vjFaLk/frappe,vjFaLk/frappe,frappe/frappe,vjFaLk/frappe,saurabh6790/frappe,StrellaGroup/frappe,StrellaGroup/frappe,yashodhank/frappe,frappe/frappe,almeidapaulopt...
ff7ec23bcef13412ee4ad997843664bbb4ff3738
wedding/wsgi.py
wedding/wsgi.py
""" WSGI config for wedding project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from whitenoise.django import Djang...
""" WSGI config for wedding project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wedding.settings") from django.core.w...
Set DJANGO_SETTINGS_MODULE before importing DjangoWhiteNoise
[heroku] Set DJANGO_SETTINGS_MODULE before importing DjangoWhiteNoise
Python
mit
jbinney/wedding,jbinney/wedding,jbinney/wedding
4601656b62d9bf6185cf99ebd3ee107d1c82ce9a
paver/tests/test_path.py
paver/tests/test_path.py
# -*- coding: utf-8 -*- import paver.path import sys import os.path def test_join_on_unicode_path(): merged = b'something/\xc3\xb6'.decode('utf-8') # there is ö after something if not os.path.supports_unicode_filenames and sys.version_info[0] < 3: merged = merged.encode('utf-8') assert merged == o...
# -*- coding: utf-8 -*- import paver.path import sys import os.path def test_join_on_unicode_path(): # This is why we should drop 2.5 asap :] # b'' strings are not supported in 2.5, while u'' string are not supported in 3.2 # -- even syntactically, so if will not help you here if sys.version_info[0] <...
Rewrite unicode join test to work with py25
Rewrite unicode join test to work with py25
Python
bsd-3-clause
nikolas/paver,cecedille1/paver,gregorynicholas/paver,phargogh/paver,gregorynicholas/paver,thedrow/paver,cecedille1/paver
a284cd351e77938d2ba90e7b358b38b5afb4f4bb
fireplace/cards/wog/paladin.py
fireplace/cards/wog/paladin.py
from ..utils import * ## # Minions class OG_006: "Vilefin Inquisitor" play = Summon(CONTROLLER, "OG_006b") class OG_006b: "The Tidal Hand" activate = Summon(CONTROLLER, "OG_006a") class OG_221: "Selfless Hero" deathrattle = GiveDivineShield(RANDOM_FRIENDLY_MINION) ## # Spells ## # Weapons class OG_222...
from ..utils import * ## # Minions class OG_006: "Vilefin Inquisitor" play = Summon(CONTROLLER, "OG_006b") class OG_006b: "The Tidal Hand" activate = Summon(CONTROLLER, "OG_006a") class OG_221: "Selfless Hero" deathrattle = GiveDivineShield(RANDOM_FRIENDLY_MINION) ## # Spells class OG_223: "Divine Stren...
Implement Divine Strength and Stand Against Darkness
Implement Divine Strength and Stand Against Darkness
Python
agpl-3.0
jleclanche/fireplace,beheh/fireplace,NightKev/fireplace
79460959472f44abaed3d03689f9d397a77399c7
apps/careeropportunity/forms.py
apps/careeropportunity/forms.py
from django import forms from apps.careeropportunity.models import CareerOpportunity class AddCareerOpportunityForm(forms.ModelForm): description = forms.CharField(label='Beskrivelse', required=True, widget=forms.Textarea( attrs={'placeholder': 'Detaljert beskrivelse av karrieremuligheten'})) ingress...
from django import forms from apps.careeropportunity.models import CareerOpportunity class AddCareerOpportunityForm(forms.ModelForm): title = forms.CharField(label='Tittel', required=True, widget=forms.TextInput( attrs={'placeholder': 'Tittel for karrieremuligheten'})) ingress = forms.CharField(labe...
Add inputfields for new attributes on careeropportunities and placeholdertext
Add inputfields for new attributes on careeropportunities and placeholdertext
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
9be0a60ee69deda4a1efa82498169e3bdcc9e55a
froide/helper/api_renderers.py
froide/helper/api_renderers.py
''' This needs it's own module due to import cycles as it the class here is referenced in settings. ''' from rest_framework_csv.renderers import PaginatedCSVRenderer class CustomPaginatedCSVRenderer(PaginatedCSVRenderer): """ Our pagination has an objects level with additional facets This renderer only r...
''' This needs it's own module due to import cycles as it the class here is referenced in settings. ''' from rest_framework_csv.renderers import PaginatedCSVRenderer class CustomPaginatedCSVRenderer(PaginatedCSVRenderer): """ Our pagination has an objects level with additional facets This renderer only r...
Fix error on different result structure rendering
Fix error on different result structure rendering
Python
mit
fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide
e5a77f49eecd411d96e2826a789589bd09caae38
pywinauto/unittests/testall.py
pywinauto/unittests/testall.py
import unittest import os.path import os import sys sys.path.append(".") #from pywinauto.timings import Timings #Timings.Fast() excludes = ['test_sendkeys'] def run_tests(): testfolder = os.path.abspath(os.path.split(__file__)[0]) sys.path.append(testfolder) for root, dirs, files in...
import os import sys import unittest import coverage # needs to be called before importing the modules cov = coverage.coverage(branch = True) cov.start() testfolder = os.path.abspath(os.path.dirname(__file__)) package_root = os.path.abspath(os.path.join(testfolder, r"..\..")) sys.path.append(package_root...
Synchronize testing module with BetterBatch one - and integrate Coverage reporting
Synchronize testing module with BetterBatch one - and integrate Coverage reporting
Python
lgpl-2.1
coandco/pywinauto,coandco/pywinauto,coandco/pywinauto
d4cfe4c9d5ff680a85c25c144b077d928386811c
onetime/backends.py
onetime/backends.py
from django.contrib.auth.models import User from onetime.models import Key class OneTimeBackend: def authenticate(self, key): data = Key.objects.get(key=key) if data is None: None if not data.is_valid(): return None return data.user def get_user(self,...
from django.contrib.auth.models import User from onetime.models import Key class OneTimeBackend: def authenticate(self, key): data = Key.objects.filter(key=key) if len(data) == 0: return None data = data[0] if not data.is_valid(): return None retur...
Use filter() instead of get() since the key might be invalid
Use filter() instead of get() since the key might be invalid
Python
agpl-3.0
ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-web...
59d7c19f26d2907413e5ee4cb86cbd534e89135b
examples/livestream_datalogger.py
examples/livestream_datalogger.py
from pymoku import Moku, MokuException, NoDataException from pymoku.instruments import * import time, logging, traceback logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s') logging.getLogger('pymoku').setLevel(logging.INFO) # Use Moku.get_by_serial() or get_by_name() if you don't know the IP...
from pymoku import Moku, MokuException, NoDataException from pymoku.instruments import * import time # Use Moku.get_by_serial() or get_by_name() if you don't know the IP m = Moku.get_by_name('example') i = Oscilloscope() m.attach_instrument(i) try: # 10Hz sample rate. The datalogger is actually just a mode of the Os...
Simplify and clean the livestream data logger
PM-133: Simplify and clean the livestream data logger
Python
mit
liquidinstruments/pymoku
8c177eec8edd0006fd9a86ce7b9b91a28c536971
02_ganymede/ganymede/jupyter_notebook_config.py
02_ganymede/ganymede/jupyter_notebook_config.py
c.NotebookApp.server_extensions = [ 'ganymede.ganymede', 'jupyter_nbgallery' ] c.NotebookApp.allow_origin = 'https://nb.gallery' from ganymede.ganymede import GanymedeHandler import logstash import os if {"L41_LOGSTASH_HOST", "L41_LOGSTASH_PORT"} < set(os.environ): GanymedeHandler.handlers = [ logs...
c.NotebookApp.nbserver_extensions = { 'ganymede.ganymede': 'ganymede.ganymede', 'jupyter_nbgallery': 'jupyter_nbgallery' } c.NotebookApp.allow_origin = 'https://nb.gallery' from ganymede.ganymede import GanymedeHandler import logstash import os if {"L41_LOGSTASH_HOST", "L41_LOGSTASH_PORT"} < set(os.environ): ...
Change server_extensions to nbserver_extensions since server_extensions is deprecated.
Change server_extensions to nbserver_extensions since server_extensions is deprecated.
Python
apache-2.0
kylemvz/nbserver,agude/nbserver,kylemvz/nbserver,Lab41/nbserver,agude/nbserver,Lab41/nbserver
bf6a3e5633b53ee3d65946a4b5ca2427d8edcd16
samples/export_table_to_gcs.py
samples/export_table_to_gcs.py
# [START export_table_to_gcs] def export_table(service, project_id, dataset_id, table_id, gcs_path): """starts a job which exports data from the specified table, to the specified Google Cloud Storage file, returns a job resource""" job_collection = service.jobs() job_data = { 'projectId': projec...
# [START export_table_to_gcs] from samples import auth from samples import poll_job def export_table(service, project_id, dataset_id, table_id, gcs_path): """starts a job which exports data from the specified table, to the specified Google Cloud Storage file, returns a job resource""" job_collection = ser...
Update export example to be runnable.
Update export example to be runnable.
Python
apache-2.0
googlearchive/bigquery-samples-python,googlearchive/bigquery-samples-python
8eaa0f2fef26cc90e3aea5dea1253b7980400375
latest_tweets/templatetags/latest_tweets_tags.py
latest_tweets/templatetags/latest_tweets_tags.py
from django import template from latest_tweets.models import Tweet register = template.Library() @register.assignment_tag def get_latest_tweets(*args, **kwargs): limit = kwargs.pop('limit', None) include_replies = kwargs.pop('include_replies', False) tweets = Tweet.objects.all() # By default we exc...
from django import template from latest_tweets.models import Tweet register = template.Library() @register.assignment_tag def get_latest_tweets(*args, **kwargs): limit = kwargs.pop('limit', None) include_replies = kwargs.pop('include_replies', False) liked_by = kwargs.pop('liked_by', None) tweets = T...
Add tag support for getting liked tweets
Add tag support for getting liked tweets
Python
bsd-3-clause
blancltd/django-latest-tweets
4b3ef2ffd1d3759f6109a8cec022326735d5a48a
lmgtfy/helpers.py
lmgtfy/helpers.py
from datetime import datetime, timedelta from crispy_forms.layout import Submit from lmgtfy.models import Domain, DomainSearch, TLD from lmgtfy.tasks import search_bing_task class CleanSubmitButton(Submit): field_classes = 'btn btn-default' # def search_yahoo(domain): # domain_db_record, _created = Domain....
from datetime import datetime, timedelta from crispy_forms.layout import Submit from lmgtfy.models import Domain, DomainSearch, TLD from lmgtfy.tasks import search_bing_task class CleanSubmitButton(Submit): field_classes = 'btn btn-default' def search_bing(domain): domain_db_record, _created = Domain.object...
Remove unused Yahoo code, correct comment text
Remove unused Yahoo code, correct comment text
Python
mit
opendata/lmgtdfy,opendata/lmgtdfy,todrobbins/lmgtdfy,todrobbins/lmgtdfy
410ac0cb59114714b39b7fbd2d7ef9357702067d
opps/core/models/published.py
opps/core/models/published.py
#!/usr/bin/env python from django.db import models from django.utils.translation import ugettext_lazy as _ from datetime import datetime class PublishedMnager(models.Manager): def all_published(self): return super(PublisherMnager, self).get_query_set().filter( date_available__lte=datetim...
#!/usr/bin/env python from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from datetime import datetime class PublishedMnager(models.Manager): def all_published(self): return super(PublisherMnager, self).get_query_set().filter(...
Add user models on Published class models
Add user models on Published class models
Python
mit
williamroot/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,opps/opps
8cd68fb795295b3a26d30f48f5529389b5ebd4b0
readcsv.py
readcsv.py
# -*- coding: utf-8 -*- """ Created on Sat Jul 26 12:04:49 2014 @author: pgao """ """ Read the CSV NOTE: Manually edited csv file twice to match FIELD NAME format """ import csv datareader = csv.DictReader(open("C:/Users/pgao/Documents/DATA_FIELD_DESCRIPTORS.csv")) data = [] entry = {} current_table = "" for line in...
# -*- coding: utf-8 -*- """ Created on Sat Jul 26 12:04:49 2014 @author: pgao """ """ Read the CSV NOTE: Manually edited csv file twice to match FIELD NAME format """ import csv datareader = csv.DictReader(open("sf1_data_field_descriptors_2010.csv")) data = [] entry = None current_table = "" for line in datareader:...
Fix bug with matrices with >= 10 columns
Fix bug with matrices with >= 10 columns
Python
isc
ikding/census-tools,ikding/census-tools
bddc39150ab9ace8dcb71dc1d0ab7623986fabcd
bibliopixel/animation/mixer.py
bibliopixel/animation/mixer.py
import copy from . import parallel from .. util import color_list class Mixer(parallel.Parallel): def __init__(self, *args, levels=None, master=1, **kwds): self.master = master super().__init__(*args, **kwds) self.mixer = color_list.Mixer( self.color_list, [a.color...
import copy from . import parallel from .. util import color_list class Mixer(parallel.Parallel): def __init__(self, *args, levels=None, master=1, **kwds): self.master = master super().__init__(*args, **kwds) self.mixer = color_list.Mixer( self.color_list, [a.color...
Copy `levels` up into the Mixer animation for addressing convenience
Copy `levels` up into the Mixer animation for addressing convenience
Python
mit
ManiacalLabs/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel
942ccea9445789423b3ea5131dcbd42c5a509797
conans/model/conan_generator.py
conans/model/conan_generator.py
from conans.util.files import save from conans.errors import ConanException from abc import ABCMeta, abstractproperty class Generator(object): __metaclass__ = ABCMeta def __init__(self, deps_build_info, build_info): self._deps_build_info = deps_build_info self._build_info = build_info @a...
from conans.util.files import save from conans.errors import ConanException from abc import ABCMeta, abstractproperty class Generator(object): __metaclass__ = ABCMeta def __init__(self, deps_build_info, build_info): self._deps_build_info = deps_build_info self._build_info = build_info @p...
Fix bug associated with bad ABC implementation.
Fix bug associated with bad ABC implementation.
Python
mit
tivek/conan,mropert/conan,memsharded/conan,dragly/conan,conan-io/conan,dragly/conan,Xaltotun/conan,tivek/conan,mropert/conan,memsharded/conan,luckielordie/conan,Xaltotun/conan,memsharded/conan,conan-io/conan,lasote/conan,birsoyo/conan,conan-io/conan,luckielordie/conan,lasote/conan,birsoyo/conan,memsharded/conan
2bcf80e71ffc75796ef7d3667f61e57a884e5c5b
angr/__init__.py
angr/__init__.py
""" Angr module """ # pylint: disable=wildcard-import import logging logging.getLogger("angr").addHandler(logging.NullHandler()) from .project import * from .functionmanager import * from .variableseekr import * from .regmap import * from .path import * from .errors import * from .surveyor import * from .service impo...
""" Angr module """ # pylint: disable=wildcard-import import logging logging.getLogger("angr").addHandler(logging.NullHandler()) from .project import * from .functionmanager import * from .variableseekr import * from .regmap import * from .path import * from .errors import * from .surveyor import * from .service impo...
Make default logging level ERROR
Make default logging level ERROR
Python
bsd-2-clause
tyb0807/angr,axt/angr,chubbymaggie/angr,haylesr/angr,schieb/angr,chubbymaggie/angr,angr/angr,f-prettyland/angr,haylesr/angr,tyb0807/angr,axt/angr,angr/angr,angr/angr,schieb/angr,iamahuman/angr,chubbymaggie/angr,iamahuman/angr,schieb/angr,tyb0807/angr,iamahuman/angr,axt/angr,f-prettyland/angr,f-prettyland/angr
96ddcc42b7da307433a3dce99aad1b2cdeff58cd
app/app/views.py
app/app/views.py
from pyramid.response import Response from pyramid.view import view_config from sqlalchemy.exc import DBAPIError from .models import DBSession, PathAndRow_Model, SceneList_Model @view_config(route_name='index', renderer='templates/index.jinja2') def index(request): '''Index page.''' lat = float(request.params...
from pyramid.response import Response from pyramid.view import view_config from sqlalchemy.exc import DBAPIError from .models import DBSession, PathAndRow_Model, SceneList_Model from sqs import * import os @view_config(route_name='index', renderer='templates/index.jinja2') def index(request): '''Index page.''' ...
Add sqs to submit view
Add sqs to submit view
Python
mit
recombinators/snapsat,recombinators/snapsat,recombinators/snapsat
1d0585dcb1caaec8b9fbcc7eb8c4c31e6a382af4
models/ras_220_genes/batch_doi_lookup.py
models/ras_220_genes/batch_doi_lookup.py
import csv from indra.literature import pubmed_client, crossref_client doi_cache = {} with open('doi_cache.txt') as f: csvreader = csv.reader(f, delimiter='\t') for row in csvreader: doi_cache[row[0]] = row[1] with open('missing_dois.txt') as f: missing_dois = [line.strip('\n') for line in f.readl...
import csv from indra.literature import pubmed_client, crossref_client doi_cache = {} with open('doi_cache.txt') as f: csvreader = csv.reader(f, delimiter='\t') for row in csvreader: doi_cache[row[0]] = row[1] with open('missing_dois.txt') as f: missing_dois = [line.strip('\n') for line in f.readl...
Add final save to batch lookup
Add final save to batch lookup
Python
bsd-2-clause
sorgerlab/indra,sorgerlab/indra,johnbachman/indra,jmuhlich/indra,johnbachman/indra,sorgerlab/belpy,jmuhlich/indra,johnbachman/belpy,jmuhlich/indra,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,pvtodorov/indra,bgyori/indra,sorgerlab/belpy...
61fb5216d12eb1a604a4a0f913eefc6006caf534
greatbigcrane/project/views.py
greatbigcrane/project/views.py
from django.shortcuts import render_to_response from django.views.generic.list_detail import object_list from django.views.generic.create_update import create_object from project.models import Project def index(request): '''We should move this to a different app''' return render_to_response('index.html') def ...
from django.shortcuts import render_to_response from django.views.generic.list_detail import object_list from django.views.generic.create_update import create_object from project.models import Project def index(request): '''We should move this to a different app''' return render_to_response('index.html') def ...
Drop unused code after return.
Drop unused code after return.
Python
apache-2.0
pnomolos/greatbigcrane,pnomolos/greatbigcrane
7040228388a7ddf5ca379a8382372698e343aa3e
praw/models/reddit/modmail.py
praw/models/reddit/modmail.py
"""Provide models for new modmail.""" from ...const import API_PATH from .base import RedditBase class ModmailConversation(RedditBase): """A class for modmail conversations.""" STR_FIELD = 'id' def __init__(self, reddit, id=None, # pylint: disable=redefined-builtin _data=None): ...
"""Provide models for new modmail.""" from ...const import API_PATH from .base import RedditBase class ModmailConversation(RedditBase): """A class for modmail conversations.""" STR_FIELD = 'id' def __init__(self, reddit, id=None, # pylint: disable=redefined-builtin _data=None): ...
Remove unncessary check for ModmailConversation id
Remove unncessary check for ModmailConversation id
Python
bsd-2-clause
praw-dev/praw,13steinj/praw,gschizas/praw,13steinj/praw,darthkedrik/praw,darthkedrik/praw,leviroth/praw,gschizas/praw,leviroth/praw,praw-dev/praw
f5356198f30002b4b4d26fba424a4bdd546a26e5
keeper/api_v1/errorhandlers.py
keeper/api_v1/errorhandlers.py
"""Error handling functions. Flask calls these functions when different HTTP error codes or Python exceptions are emitted. These handlers provide a JSON response rather than the default HMTL header response. """ from flask import jsonify from ..exceptions import ValidationError from . import api @api.errorhandler(V...
"""Error handling functions. Flask calls these functions when different HTTP error codes or Python exceptions are emitted. These handlers provide a JSON response rather than the default HMTL header response. """ from flask import jsonify import structlog from ..exceptions import ValidationError from . import api @...
Add an error logger to the 500 handler
Add an error logger to the 500 handler
Python
mit
lsst-sqre/ltd-keeper,lsst-sqre/ltd-keeper
4ac4caa0f803394693227be0b225d7a1dcab6611
sasview/__init__.py
sasview/__init__.py
__version__ = "4.0b1" __build__ = "GIT_COMMIT" try: import logging import subprocess import os import platform FNULL = open(os.devnull, 'w') if platform.system() == "Windows": args = ['git', 'describe', '--tags'] else: args = ['git describe --tags'] git_revision = subproc...
__version__ = "4.0b1" __build__ = "GIT_COMMIT" try: import logging import subprocess import os import platform FNULL = open(os.devnull, 'w') if platform.system() == "Windows": args = ['git', 'describe', '--tags'] else: args = ['git describe --tags'] git_revision = subproc...
Clean up un-needed commented line after jkrzywon fixed subprocess bad behaviour
Clean up un-needed commented line after jkrzywon fixed subprocess bad behaviour
Python
bsd-3-clause
lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,SasView/sasview
06fd79674eeb82cd1e6cabca1e513f97ccf48cbf
avocado/forms.py
avocado/forms.py
from django import forms from django.db import models from avocado.models import DataField class DataFieldAdminForm(forms.ModelForm): def clean_app_name(self): app_name = self.cleaned_data['app_name'] if models.get_app(app_name) is None: raise forms.ValidationError('The app "{0}" could...
from django import forms from django.core.exceptions import ImproperlyConfigured from django.db import models from avocado.models import DataField class DataFieldAdminForm(forms.ModelForm): def clean_app_name(self): app_name = self.cleaned_data.get('app_name') try: models.get_app(app_n...
Fix DataField admin validation for identifiers
Fix DataField admin validation for identifiers
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
ea4746f6b809c0c3b2a6931bc863121c07ee2c9a
lib/plugins/method/__init__.py
lib/plugins/method/__init__.py
from yapsy.IPlugin import IPlugin from lib.methods import BaseMethod class IMethodPlugin(BaseMethod, IPlugin): def __init__(self): pass def setNameAndFactory(self, name, factory): self.methodName = name self.factory = factory
from yapsy.IPlugin import IPlugin from lib.methods import BaseMethod class IMethodPlugin(BaseMethod, IPlugin): def __init__(self): pass def setNameAndFactory(self, name, factory): self.methodName = name self.factory = factory @staticmethod def supports(methodName): raise NotImplementedError
Make supports method throw NotImplementedError so that methods failing to implement it does not fail silently
Make supports method throw NotImplementedError so that methods failing to implement it does not fail silently
Python
mit
factorial-io/fabalicious,factorial-io/fabalicious
5dd37364a9616d42291b8841552bdd24aebd908a
selective_search.py
selective_search.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy import segment def calc_adjacency_matrix(label_img, n_region): adjacency = numpy.diag([1] * n_region) h, w = label_img.shape[0], label_img.shape[1] for y in range(h): for x in range(w): here = label_img[y, x] if y <...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy import segment def calc_adjacency_matrix(label_img, n_region): A = numpy.diag([1] * n_region) h, w = label_img.shape[0], label_img.shape[1] for y in range(h): for x in range(w): here = label_img[y, x] if y < h - 1: ...
Change name of local variable
Change name of local variable
Python
mit
belltailjp/selective_search_py,belltailjp/selective_search_py,gamer13/selective_search_py,BradNeuberg/selective_search_py,gamer13/selective_search_py,BradNeuberg/selective_search_py
f36a1bb6c9229615d1cc498c02fb7df066e7cd1c
app/main/views/_templates.py
app/main/views/_templates.py
templates = [ { 'type': 'sms', 'name': 'Confirmation', 'body': 'Lasting power of attorney: We’ve received your application. Applications take between 8 and 10 weeks to process.' # noqa }, { 'type': 'sms', 'name': 'Reminder', 'body': 'Vehicle tax: Your vehicle...
templates = [ { 'type': 'sms', 'name': 'Confirmation with details Jan 2016', 'body': '((name)), we’ve received your ((thing)). We’ll contact you again within 1 week.' }, { 'type': 'sms', 'name': 'Confirmation Jan 2016', 'body': 'We’ve received your payment. We...
Make SMS templates plausible for hack day
Make SMS templates plausible for hack day This commit replaces the previous SMS templates. I’ve written a couple of new ones which are plausible for developers on the hack day: - one with placeholders - one without
Python
mit
alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin
78e24093f314821d7818f31574dbe521c0ae5fef
sharepa/__init__.py
sharepa/__init__.py
from sharepa.search import ShareSearch, basic_search # noqa from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa
from sharepa.search import ShareSearch, basic_search # noqa from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa def source_counts(): return bucket_to_dataframe( 'total_source_counts', basic_search.execute().aggregations.sourceAgg.buckets )
Make it so that source_counts is only executed on purpose
Make it so that source_counts is only executed on purpose
Python
mit
erinspace/sharepa,CenterForOpenScience/sharepa,fabianvf/sharepa,samanehsan/sharepa
f8eb09c5ffca469b72e51db783c667f83ca56237
server/users-microservice/src/config/database.py
server/users-microservice/src/config/database.py
dbDevURI = 'mysql://usersmicroserviceuser:M@+=mm26xt22$%)(@localhost:3306/usersmicroservice' dbURI = 'mysql://root:root@mysql:3306/usersmicroservice'
dbDevURI = 'mysql://localroot:localroot@localhost:3306/usersmicroservice' dbURI = 'mysql://root:root@mysql:3306/usersmicroservice'
Create a local root user for users micro service
Create a local root user for users micro service
Python
mit
Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone
98bf3fd5d278f68f22ba0b5c1f98eb8970455255
teardown_tests.py
teardown_tests.py
#!/usr/bin/env python import os import shutil import sys if not os.environ.get("TEST_NOTEBOOKS"): sys.exit(0) for each in list(sys.argv[1:]) + [ "data.tif", "data.h5", "data_trim.h5", "data_dn.h5", "data_reg.h5", "data_sub.h5", "data_f_f0.h5", "data_wt.h5", "data_norm.h5", ...
#!/usr/bin/env python import os import shutil import sys if not os.environ.get("TEST_NOTEBOOKS"): sys.exit(0) for each in list(sys.argv[1:]) + [ "data.tif", "data.h5", "data_traces.h5", "data_rois.h5", "data.zarr", "data_trim.zarr", "data_dn.zarr", "data_reg.zarr", "data_sub...
Update test files to remove in teardown script
Update test files to remove in teardown script Drops HDF5 files that are no longer generated during routine testing from teardown. Also adds Dask's workspace directory for cleanup.
Python
apache-2.0
DudLab/nanshe_workflow,nanshe-org/nanshe_workflow
fa1a2bf7d46be4a8f018595e806ced0fc5a7e4c8
contrib/internal/build-i18n.py
contrib/internal/build-i18n.py
#!/usr/bin/env python from __future__ import unicode_literals import os import sys from django.core.management.commands.compilemessages import compile_messages from djblets.util.filesystem import is_exe_in_path if __name__ == '__main__': if not is_exe_in_path('msgfmt'): raise RuntimeError('Could not fi...
#!/usr/bin/env python from __future__ import unicode_literals import os import sys import django from django.core.management import call_command import reviewboard if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reviewboard.settings') if hasattr(django, 'setup'): # Dja...
Fix building localization files on modern versions of Django.
Fix building localization files on modern versions of Django. Our build-i18n script, which wraps the building of localization files, had a failed import on modern versions of Django. We previously were attempting to import and run the `compilemessages` command class itself. Now we're doing it correctly by telling Djan...
Python
mit
chipx86/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard,chipx86/reviewboard
7ea131b0c906c8da66f050e5833ded02f8acb495
user_messages/managers.py
user_messages/managers.py
from django.db.models import Manager class ThreadManager(Manager): def inbox(self, user): return self.filter(userthread__user=user, userthread__deleted=False) def unread(self, user): return self.filter(userthread__user=user, userthread__deleted=False, userthread__unread=True) class Mess...
from django.db.models import Manager from user_messages.signals import message_sent class ThreadManager(Manager): def inbox(self, user): return self.filter(userthread__user=user, userthread__deleted=False) def unread(self, user): return self.filter(userthread__user=user, userthread__dele...
Send a signal on each message that is sent to allow for external customization.
Send a signal on each message that is sent to allow for external customization.
Python
mit
arthur-wsw/pinax-messages,eldarion/user_messages,eldarion/user_messages,pinax/pinax-messages,pinax/pinax-messages,arthur-wsw/pinax-messages
5e1815f094f40b527406a07ea1ce751ee0b074a6
tests/__init__.py
tests/__init__.py
tests = ( 'parse_token', 'variable_fields', 'filters', 'blockextend', 'template', )
tests = ( 'parse_token', 'variable_fields', 'filters', 'default_filters', 'blockextend', 'template', )
Add defaults filters tests into all tests list
Add defaults filters tests into all tests list
Python
bsd-3-clause
GrAndSE/lighty-template,GrAndSE/lighty
7fef5ea08c88b59513ff4fce59ccfbd7862122d8
salt/beacons/proxy_example.py
salt/beacons/proxy_example.py
# -*- coding: utf-8 -*- ''' Example beacon to use with salt-proxy .. code-block:: yaml beacons: proxy_example: foo: bar ''' # Import Python libs from __future__ import absolute_import # Important: If used with salt-proxy # this is required for the beacon to load!!! __proxyenabled__ = ['*'] __virt...
# -*- coding: utf-8 -*- ''' Example beacon to use with salt-proxy .. code-block:: yaml beacons: proxy_example: endpoint: beacon ''' # Import Python libs from __future__ import absolute_import import logging # Import salt libs import salt.utils.http # Important: If used with salt-proxy # this is r...
Make a call to beacon end point
Make a call to beacon end point
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
7bd3b5a9f1664bd153c934d75f245a605aadee2a
ovp_core/models/cause.py
ovp_core/models/cause.py
from django.db import models class Cause(models.Model): name = models.CharField('name', max_length=100) def __str__(self): return self.name class Meta: app_label = 'ovp_core' verbose_name = 'cause' verbose_name_plural = 'causes'
import vinaigrette from django.db import models class Cause(models.Model): name = models.CharField('name', max_length=100) def __str__(self): return self.name class Meta: app_label = 'ovp_core' verbose_name = 'cause' verbose_name_plural = 'causes' vinaigrette.register(Cause, ['name'])
Apply django-vinaigrette to Cause model
Apply django-vinaigrette to Cause model
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core
f643e1931ce8e0c4d11db4d8b9eb9ac75b683a80
tests/test_credentials.py
tests/test_credentials.py
from pyutrack import Credentials from tests import PyutrackTest class CredentialsTests(PyutrackTest): def test_empty(self): c = Credentials('root') self.assertIsNone(c.password) self.assertIsNone(c.cookies)
import json import keyring from pyutrack import Credentials from tests import PyutrackTest class CredentialsTests(PyutrackTest): def test_empty(self): c = Credentials('root') self.assertIsNone(c.password) self.assertIsNone(c.cookies) def test_persistence(self): c = Credentia...
Add test for credential persistence
Add test for credential persistence
Python
mit
alisaifee/pyutrack,alisaifee/pyutrack
cf748e2bc4f28a11c79555f2e6c3d1f89d027709
tests/test_memory_leak.py
tests/test_memory_leak.py
import resource import pytest from .models import TestModel as DirtyMixinModel pytestmark = pytest.mark.django_db def test_rss_usage(): DirtyMixinModel() rss_1 = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss for _ in range(1000): DirtyMixinModel() rss_2 = resource.getrusage(resource.RU...
import gc import resource import pytest from .models import TestModel as DirtyMixinModel pytestmark = pytest.mark.django_db def test_rss_usage(): DirtyMixinModel() gc.collect() rss_1 = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss for _ in range(1000): DirtyMixinModel() gc.collect(...
Call gc.collect() before measuring memory usage.
Call gc.collect() before measuring memory usage.
Python
bsd-3-clause
romgar/django-dirtyfields,smn/django-dirtyfields
f15e2f9457fdd6ccc32ac2d8bd8d2c361f219e97
tests/test_bib.py
tests/test_bib.py
""" Testing module for bib.py """ import pytest from bibtextomd.bib import main, reorder
""" Testing module for bib.py """ import pytest from bibtextomd.bib import main, reorder class TestReorder(): def test_single_author_good(self): names = 'Author, First A.' n = reorder(names, 'F.A. Author') assert n == '**F.A. Author**' def test_two_authors_good(self): names =...
Add several tests for the name highlighting function
Add several tests for the name highlighting function
Python
mit
bryanwweber/bibtextomd
71646a47c1d9e47c4920fefe754b648c270eace4
tests/test_cli.py
tests/test_cli.py
import os import shutil from click.testing import CliRunner from gypsy.scripts.cli import cli from conftest import DATA_DIR def remove_path_if_exists(*paths): for path in paths: try: if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path)...
import os import shutil from click.testing import CliRunner from gypsy.scripts.cli import cli from conftest import DATA_DIR def remove_path_if_exists(*paths): #pylint: disable=missing-docstring for path in paths: try: if os.path.isdir(path): shutil.rmtree(path) el...
Add test that cli accepts config file
Add test that cli accepts config file
Python
mit
tesera/pygypsy,tesera/pygypsy
f56689c862629da9e0a71918a6585796430a407e
__init__.py
__init__.py
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 1, 0, 'alpha', 1, False) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if ...
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 1, 0, 'alpha', 1, False) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if ...
Fix the version string generation when not a final or RC release.
Fix the version string generation when not a final or RC release.
Python
mit
brennie/reviewboard,1tush/reviewboard,chazy/reviewboard,bkochendorfer/reviewboard,bkochendorfer/reviewboard,KnowNo/reviewboard,bkochendorfer/reviewboard,chazy/reviewboard,chazy/reviewboard,1tush/reviewboard,KnowNo/reviewboard,reviewboard/reviewboard,KnowNo/reviewboard,Khan/reviewboard,chazy/reviewboard,chipx86/reviewbo...
a7ed3ae2aedcb74a351b850dfa035adda08ea05b
__init__.py
__init__.py
#Shoopdawoop from . import CuraEngineBackend from UM.Preferences import Preferences def getMetaData(): return { "name": "CuraEngine Backend", "type": "Backend" } def register(app): Preferences.addPreference("BackendLocation","../PinkUnicornEngine/CuraEngine") return CuraEngineBackend.CuraEngineBackend() ...
#Shoopdawoop from . import CuraEngineBackend from UM.Preferences import Preferences def getMetaData(): return { 'type': 'backend', 'plugin': { 'name': "CuraEngine Backend" } } def register(app): Preferences.addPreference("BackendLocation","../PinkUnicornEngine/CuraEngi...
Update plugin metadata to the new format
Update plugin metadata to the new format
Python
agpl-3.0
ad1217/Cura,derekhe/Cura,hmflash/Cura,fieldOfView/Cura,totalretribution/Cura,senttech/Cura,bq/Ultimaker-Cura,DeskboxBrazil/Cura,totalretribution/Cura,quillford/Cura,ynotstartups/Wanhao,lo0ol/Ultimaker-Cura,Curahelper/Cura,hmflash/Cura,derekhe/Cura,quillford/Cura,lo0ol/Ultimaker-Cura,fxtentacle/Cura,ad1217/Cura,DeskboxB...
0eca2340a4d38b542659505ba386a23129f8ac0b
google/cloud/speech/__init__.py
google/cloud/speech/__init__.py
# Copyright 2016 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 2016 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, ...
Make Encoding accessible from speech.Encoding.
Make Encoding accessible from speech.Encoding.
Python
apache-2.0
googleapis/python-speech,googleapis/python-speech
ecacafa1c104c319c0abd92ec965c7d5a4c01786
trac/db/tests/__init__.py
trac/db/tests/__init__.py
import unittest from trac.db.tests import api from trac.db.tests import postgres_test from trac.db.tests import backup from trac.db.tests.functional import functionalSuite def suite(): suite = unittest.TestSuite() suite.addTest(api.suite()) suite.addTest(postgres_test.suite()) return suite if __nam...
import unittest from trac.db.tests import api from trac.db.tests import postgres_test from trac.db.tests.functional import functionalSuite def suite(): suite = unittest.TestSuite() suite.addTest(api.suite()) suite.addTest(postgres_test.suite()) return suite if __name__ == '__main__': unittest.m...
Remove backup from tests - it moved to functional
Remove backup from tests - it moved to functional git-svn-id: aefd11945137af0f31499d1cc9b63b54ed7ebb20@8041 af82e41b-90c4-0310-8c96-b1721e28e2e2
Python
bsd-3-clause
jun66j5/trac-ja,netjunki/trac-Pygit2,walty8/trac,walty8/trac,walty8/trac,netjunki/trac-Pygit2,jun66j5/trac-ja,jun66j5/trac-ja,walty8/trac,jun66j5/trac-ja,netjunki/trac-Pygit2
fa495f9f2f887533f870ddedef3a1aea0a699419
oscar/management/commands/oscar_fork_statics.py
oscar/management/commands/oscar_fork_statics.py
import logging import os import shutil from django.db.models import get_model from django.conf import settings from django.core.management.base import BaseCommand, CommandError ProductAlert = get_model('customer', 'ProductAlert') logger = logging.getLogger(__name__) class Command(BaseCommand): """ Copy Osc...
import logging import os import shutil from django.conf import settings from django.core.management.base import BaseCommand, CommandError logger = logging.getLogger(__name__) class Command(BaseCommand): """ Copy Oscar's statics into local project so they can be used as a base for styling a new site. ...
Fix string formatting bug in fork_statics man. command
Fix string formatting bug in fork_statics man. command
Python
bsd-3-clause
amirrpp/django-oscar,kapt/django-oscar,ademuk/django-oscar,nickpack/django-oscar,eddiep1101/django-oscar,bschuon/django-oscar,vovanbo/django-oscar,pasqualguerrero/django-oscar,Jannes123/django-oscar,elliotthill/django-oscar,taedori81/django-oscar,marcoantoniooliveira/labweb,sonofatailor/django-oscar,ahmetdaglarbas/e-co...
99c7c87d1b84b70962250e362dcfff75e77cb3fe
txircd/modules/cmode_k.py
txircd/modules/cmode_k.py
from twisted.words.protocols import irc from txircd.modbase import Mode class PasswordMode(Mode): def commandPermission(self, user, cmd, data): if cmd != "JOIN": return data channels = data["targetchan"] keys = data["keys"] removeChannels = [] for index, chan in channels.enumerate(): if "k" in chan.mo...
from twisted.words.protocols import irc from txircd.modbase import Mode class PasswordMode(Mode): def checkUnset(self, user, target, param): if param == target.mode["k"]: return True return False def commandPermission(self, user, cmd, data): if cmd != "JOIN": return data channels = data["targetchan"]...
Check that the password parameter when unsetting mode k matches the password that is set
Check that the password parameter when unsetting mode k matches the password that is set
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd,DesertBus/txircd
f325b02c66810cff9e3ace8b31e7f3a7b410342f
awx/wsgi.py
awx/wsgi.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. import logging from django.core.wsgi import get_wsgi_application from awx import prepare_env from awx import __version__ as tower_version """ WSGI config for AWX project. It exposes the WSGI callable as a module-level variable named ``application``. For more...
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. import logging from awx import __version__ as tower_version # Prepare the AWX environment. from awx import prepare_env prepare_env() from django.core.wsgi import get_wsgi_application """ WSGI config for AWX project. It exposes the WSGI callable as a module-...
Fix import error by calling prepare_env first
Fix import error by calling prepare_env first
Python
apache-2.0
wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,snahelou/awx
907d8cdd8aa7f27ffb4783155b2621b7903c322b
osgtest/tests/test_82_cvmfs.py
osgtest/tests/test_82_cvmfs.py
import os import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.osgunittest as osgunittest import unittest class TestStopCvmfs(osgunittest.OSGTestCase): def test_01_stop_cvmfs(self): core.skip_ok_unless_installed('cvmfs') self.skip_ok_if(['cvmfs.started-s...
import os import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.osgunittest as osgunittest import unittest class TestStopCvmfs(osgunittest.OSGTestCase): def test_01_stop_cvmfs(self): core.skip_ok_unless_installed('cvmfs') self.skip_ok_if(['cvmfs.started-s...
Make cvmfs test cleanup restart autofs so fermicloud sl5 homedirs don't go away.
Make cvmfs test cleanup restart autofs so fermicloud sl5 homedirs don't go away. git-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@17187 4e558342-562e-0410-864c-e07659590f8c
Python
apache-2.0
efajardo/osg-test,efajardo/osg-test
a75a725af141762b25a77522b43d6e241643baa6
medical_insurance/models/medical_patient.py
medical_insurance/models/medical_patient.py
# -*- coding: utf-8 -*- # © 2015-TODAY LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import fields, models class MedicalPatient(models.Model): _inherit = 'medical.patient' insurance_plan_ids = fields.Many2many( string='Insurance Plans', comodel...
# -*- coding: utf-8 -*- # © 2015-TODAY LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import fields, models class MedicalPatient(models.Model): _inherit = 'medical.patient' insurance_plan_ids = fields.One2many( string='Insurance Plans', comodel_...
Fix incorrect relation in medical_insurance
Fix incorrect relation in medical_insurance
Python
agpl-3.0
laslabs/vertical-medical,laslabs/vertical-medical
178fe53c907b8857865236d9066d7f6f3cf3d9a7
scripts/authentication/editors.py
scripts/authentication/editors.py
#!/usr/bin/env python3 """Manually add editors users""" import redis import json import uuid import datetime if __name__ == "__main__": conn = redis.Redis(decode_responses=True) group_uid = "" for guid in conn.hgetall("groups"): group_details = json.loads(conn.hget("groups", guid)) if group...
#!/usr/bin/env python3 """Manually add editors users""" import redis import json import uuid import datetime if __name__ == "__main__": conn = redis.Redis(decode_responses=True) group_uid = "" for guid in conn.hgetall("groups"): group_details = json.loads(conn.hget("groups", guid)) if group...
Add created_timestamp when creating a new group
Add created_timestamp when creating a new group
Python
agpl-3.0
genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2
92b9b33a13b093d1a9bf6ac22b000405a3403234
chandra_aca/tests/test_residuals.py
chandra_aca/tests/test_residuals.py
import numpy as np from ..centroid_resid import get_obs_slot_residuals def test_multi_ai(): # obsid 15175 has two aspect intervals dyags, dzags = get_obs_slot_residuals(15175, 4) assert np.all(np.abs(dyags) < 3) assert np.all(np.abs(dzags) < 6) def test_obc_centroids(): dyags, dzags = get_obs_slot...
import numpy as np from ..centroid_resid import get_obs_slot_residuals def test_multi_ai(): # obsid 15175 has two aspect intervals dyags, yt, dzags, zt = get_obs_slot_residuals(15175, 4) assert np.all(np.abs(dyags) < 3) assert np.all(np.abs(dzags) < 6) def test_obc_centroids(): dyags, yt, dzags, z...
Update tests using helper method for new API
Update tests using helper method for new API
Python
bsd-2-clause
sot/chandra_aca,sot/chandra_aca
ac4ba28e3b3c221f378edb2d0abbc8cc77a8eae4
src/libmv/multiview/panography_coeffs.py
src/libmv/multiview/panography_coeffs.py
import sympy f2, a12, a1, a2, b12, b1, b2 = sympy.symbols('f2 a12 a1 a2 b12 b1 b2') # Equation 12 from the brown paper; see panography.h equation_12 = ((a12 + f2)**2 * (b1 + f2) * (b2 + f2) - (b12 + f2)**2 * (a1 + f2) * (a2 + f2)) d = equation_12.as_poly(f2).as_dict() print ' // Coefficients in asce...
# Minimal Solutions for Panoramic Stitching. M. Brown, R. Hartley and D. Nister. # International Conference on Computer Vision and Pattern Recognition # (CVPR2007). Minneapolis, June 2007. import sympy f2, a12, a1, a2, b12, b1, b2 = sympy.symbols('f2 a12 a1 a2 b12 b1 b2') # Equation 12 from the brown paper; see pan...
Add xcas source code to obtain panography shared Focal polynomial solver.
Add xcas source code to obtain panography shared Focal polynomial solver.
Python
mit
leoujz/libmv,Shinohara-Takayuki/libmv,tanmengwen/libmv,KangKyungSoo/libmv,jackyspeed/libmv,Ashwinning/libmv,Shinohara-Takayuki/libmv,jackyspeed/libmv,manjunathnarayana/libmv,manjunathnarayana/libmv,KangKyungSoo/libmv,leoujz/libmv,hjm168168/libmv,jackyspeed/libmv,Shinohara-Takayuki/libmv,sanyaade-g2g-repos/libmv,tanmeng...
7e5d8eb0d6eabb427d7e9bd02bac3ee7b90d228d
src/config.py
src/config.py
import urllib import urllib.request proxies = [ False, False ]
import urllib import urllib.request from pprint import pprint proxies = [ '', '' ] _tested_proxies = False def test_proxies(): global _tested_proxies if _tested_proxies: return _tested_proxies = {} def _testproxy(proxyid): if proxyid=='': return True if _tested_proxies.get(proxyid) is not No...
Test proxies before using them.
Test proxies before using them.
Python
mit
koivunen/whoisabusetool
c99f5ffe9e23eeeb8f168c54d5f4b419e553d3b3
wizd/gnotifier.py
wizd/gnotifier.py
import pyinotify import gobject class GNotifier(pyinotify.Notifier): """ A notifier that can be attached to a mainloop """ def __init__(self, watch_manager, default_proc_fun=ProcessEvent()): """ Initialization. @param watch_manager: Watch Manager. @type watch_manager: ...
import pyinotify import gobject class GNotifier(pyinotify.Notifier): """ A notifier that can be attached to a mainloop """ def __init__(self, watch_manager, default_proc_fun=pyinotify.ProcessEvent()): """ Initialization. @param watch_manager: Watch Manager. @type watch...
Add test for GNotifier, fix up bugs
Add test for GNotifier, fix up bugs
Python
lgpl-2.1
wizbit-archive/wizbit,wizbit-archive/wizbit