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
475ff9a1b1eed0cd5f1b20f0a42926b735a4c163
txircd/modules/extra/conn_umodes.py
txircd/modules/extra/conn_umodes.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ModeType from zope.interface import implements class AutoUserModes(ModuleData): implements(IPlugin, IModuleData) name = "AutoUserModes" def actions(self): return [ ("welcome", 50, self.autoSet...
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ModeType from zope.interface import implements class AutoUserModes(ModuleData): implements(IPlugin, IModuleData) name = "AutoUserModes" def actions(self): return [ ("welcome", 50, self.autoSet...
Simplify the AutoUserModes mode type check
Simplify the AutoUserModes mode type check
Python
bsd-3-clause
ElementalAlchemist/txircd,Heufneutje/txircd
c6cb543f35356769dcc0f7fedb099a160e267473
run_tests.py
run_tests.py
#!/usr/bin/env python import os, sys, re, shutil os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' # Use psycopg2cffi for PyPy try: import psycopg2 # noqa except ImportError: # Fall back to psycopg2cffi from psycopg2cffi import compat compat.register() # Set up Django import django from djang...
#!/usr/bin/env python import os, sys, re, shutil os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' # Use psycopg2cffi for PyPy try: import psycopg2 # noqa except ImportError: # Fall back to psycopg2cffi try: from psycopg2cffi import compat compat.register() except ImportError: ...
Stop requiring psycopg2 to run tests
Stop requiring psycopg2 to run tests
Python
bsd-3-clause
LPgenerator/django-cacheops,Suor/django-cacheops
320f26632ee3462aaeb1a88fcdcfe69dbbb2322b
runserver.py
runserver.py
if __name__ == "__main__": from plenario import create_app application = create_app() application.run(host="0.0.0.0")
from plenario import create_app application = create_app() if __name__ == "__main__": application.run(host="0.0.0.0")
Move 'application' outside of if '__main__' -.-
Move 'application' outside of if '__main__' -.-
Python
mit
UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario
c36301ec14e6d10762e613c0c52bf0e48baf9df9
goatools/godag/consts.py
goatools/godag/consts.py
"""GO-DAG constants.""" __copyright__ = "Copyright (C) 2010-2018, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" # pylint: disable=too-few-public-methods class Consts(object): """Constants commonly used in GO-DAG operations.""" NAMESPACE2NS = { 'biological_process' : '...
"""GO-DAG constants.""" __copyright__ = "Copyright (C) 2010-2018, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" # pylint: disable=too-few-public-methods class Consts(object): """Constants commonly used in GO-DAG operations.""" NAMESPACE2NS = { 'biological_process' : '...
Add comment with link to more info
Add comment with link to more info
Python
bsd-2-clause
tanghaibao/goatools,tanghaibao/goatools
9ff4f1e64f8d8208bfe83ed497fa280febcf5ce7
citrination_client/views/descriptors/real_descriptor.py
citrination_client/views/descriptors/real_descriptor.py
from citrination_client.views.descriptors.descriptor import MaterialDescriptor class RealDescriptor(MaterialDescriptor): def __init__(self, key, lower_bound="-Infinity", upper_bound="Infinity", units=""): self.options = dict(lower_bound=lower_bound, upper_bound=upper_bound, units=units) super(Real...
from citrination_client.views.descriptors.descriptor import MaterialDescriptor class RealDescriptor(MaterialDescriptor): def __init__(self, key, lower_bound, upper_bound, units=""): self.options = dict(lower_bound=lower_bound, upper_bound=upper_bound, units=units) super(RealDescriptor, self).__ini...
Remove infinity from valid bounds
Remove infinity from valid bounds
Python
apache-2.0
CitrineInformatics/python-citrination-client
50202a70b4d68c628696904d28ffc58f5f4fb54b
sqla_nose.py
sqla_nose.py
#!/usr/bin/env python """ nose runner script. Only use this script if setuptools is not available, i.e. such as on Python 3K. Otherwise consult README.unittests for the recommended methods of running tests. """ try: import sqlalchemy except ImportError: from os import path import sys sys.path.append...
#!/usr/bin/env python """ nose runner script. Only use this script if setuptools is not available, i.e. such as on Python 3K. Otherwise consult README.unittests for the recommended methods of running tests. """ import sys try: from sqlalchemy_nose.noseplugin import NoseSQLAlchemy except ImportError: from os...
Update for new nose plugin location.
Update for new nose plugin location.
Python
mit
elelianghh/sqlalchemy,sandan/sqlalchemy,dstufft/sqlalchemy,wfxiang08/sqlalchemy,Cito/sqlalchemy,wujuguang/sqlalchemy,alex/sqlalchemy,olemis/sqlalchemy,276361270/sqlalchemy,brianv0/sqlalchemy,wfxiang08/sqlalchemy,Akrog/sqlalchemy,bdupharm/sqlalchemy,davidjb/sqlalchemy,monetate/sqlalchemy,brianv0/sqlalchemy,hsum/sqlalche...
f861ca1f315a414f809993170ea95640505c0506
c2corg_api/scripts/migration/sequences.py
c2corg_api/scripts/migration/sequences.py
from sqlalchemy.sql import text from c2corg_api.scripts.migration.migrate_base import MigrateBase class UpdateSequences(MigrateBase): sequences = [ ('guidebook', 'documents_archives', 'id', 'documents_archives_id_seq'), ('guidebook', 'documents', 'document_id', 'documents_document_id_seq'), ...
from sqlalchemy.sql import text from c2corg_api.scripts.migration.migrate_base import MigrateBase class UpdateSequences(MigrateBase): sequences = [ ('guidebook', 'documents_archives', 'id', 'documents_archives_id_seq'), ('guidebook', 'documents', 'document_id', 'documents_document_id_seq'), ...
Add missing user_id_seq in migration script
Add missing user_id_seq in migration script
Python
agpl-3.0
c2corg/v6_api,c2corg/v6_api,c2corg/v6_api
0e0f61edd95bef03a470ae4717d5d4e390011ae3
chatterbot/ext/django_chatterbot/views.py
chatterbot/ext/django_chatterbot/views.py
from django.views.generic import View from django.http import JsonResponse from chatterbot import ChatBot from chatterbot.ext.django_chatterbot import settings class ChatterBotView(View): chatterbot = ChatBot(**settings.CHATTERBOT) def post(self, request, *args, **kwargs): input_statement = request....
from django.views.generic import View from django.http import JsonResponse from chatterbot import ChatBot from chatterbot.ext.django_chatterbot import settings import json class ChatterBotView(View): chatterbot = ChatBot(**settings.CHATTERBOT) def _serialize_recent_statements(self): if self.chatterb...
Return recent statement data in GET response.
Return recent statement data in GET response.
Python
bsd-3-clause
Reinaesaya/OUIRL-ChatBot,Gustavo6046/ChatterBot,davizucon/ChatterBot,vkosuri/ChatterBot,Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,gunthercox/ChatterBot
e739771d18177e482fb9b3e2aa084e28a11680b5
run_tests.py
run_tests.py
import unittest def main(): # pragma: no cover test_suite = unittest.TestLoader().discover('tests/') results = unittest.TextTestRunner(verbosity=1).run(test_suite) if results.errors or results.failures: exit(1) else: exit(0) if __name__ == '__main__': main()
#!/usr/bin/env python3 import unittest def main(): # pragma: no cover test_suite = unittest.TestLoader().discover('tests/') results = unittest.TextTestRunner(verbosity=1).run(test_suite) if results.errors or results.failures: exit(1) else: exit(0) if __name__ == '__main__': main(...
Allow run-test.py to be launched by './run-test.py' command.
Allow run-test.py to be launched by './run-test.py' command.
Python
mit
ProjetPP/PPP-QuestionParsing-ML-Standalone,ProjetPP/PPP-QuestionParsing-ML-Standalone
5f601f742f7a63a1a504e9af3fca61df9deb4707
util.py
util.py
def topological_sort(start_nodes, dependencies): """ Return a topologically sorted list of :param:`start_nodes` and :param:`dependencies`. Nodes are checked on identity, not equality. Raises a ValueError if no topological sort is possible. :param start_nodes: list of nodes of graph with no i...
def topological_sort(start_nodes, dependencies): """ Return a topologically sorted list of :param:`start_nodes` and :param:`dependencies`. Nodes are checked on identity, not equality. Raises a ValueError if no topological sort is possible. :param start_nodes: sequence of nodes of graph with ...
Fix documentation of top sort.
Fix documentation of top sort. Change wording from list to sequence and include note about how to specify no dependencies. Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>
Python
mit
fhirschmann/penchy,fhirschmann/penchy
b444113a3bb71f30cfd61043e026674cc09f5a94
app/__init__.py
app/__init__.py
from flask import Flask from flask_login import LoginManager from flask_misaka import Misaka from flask_moment import Moment from flask_security import Security, SQLAlchemyUserDatastore from flask_sqlalchemy import SQLAlchemy from flask_whooshalchemy import whoosh_index from config import config db = SQLAlchemy() lm ...
from flask import Flask from flask_login import LoginManager from flask_misaka import Misaka from flask_moment import Moment from flask_security import Security, SQLAlchemyUserDatastore from flask_sqlalchemy import SQLAlchemy from flask_whooshalchemy import whoosh_index from config import config db = SQLAlchemy() lm ...
Add AppSettings dict to app config and inject it
Add AppSettings dict to app config and inject it
Python
mit
Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger
849a4e5daf2eb845213ea76179d7a8143148f39a
lib/mixins.py
lib/mixins.py
class Countable(object): @classmethod def count(cls, options={}): return int(cls.get("count", **options)) class Metafields(object): def metafields(self): return Metafield.find(resource=self.__class__.plural, resource_id=self.id) def add_metafield(self, metafield): if self.is_n...
class Countable(object): @classmethod def count(cls, _options=None, **kwargs): if _options is None: _options = kwargs return int(cls.get("count", **_options)) class Metafields(object): def metafields(self): return Metafield.find(resource=self.__class__.plural, resource_...
Allow count method to be used the same way as find.
Allow count method to be used the same way as find.
Python
mit
varesa/shopify_python_api,metric-collective/shopify_python_api,gavinballard/shopify_python_api,asiviero/shopify_python_api,ifnull/shopify_python_api,Shopify/shopify_python_api,SmileyJames/shopify_python_api
1efdb6034fbf04cd41c4575b09b2e9da1a08eddc
redash/cli/database.py
redash/cli/database.py
from flask.cli import AppGroup from flask_migrate import stamp manager = AppGroup(help="Manage the database (create/drop tables).") @manager.command() def create_tables(): """Create the database tables.""" from redash.models import db db.create_all() # Need to mark current DB as up to date stamp(...
import time from flask.cli import AppGroup from flask_migrate import stamp from sqlalchemy.exc import DatabaseError manager = AppGroup(help="Manage the database (create/drop tables).") def _wait_for_db_connection(db): retried = False while not retried: try: db.engine.execute('SELECT 1;')...
Fix connection error when you run "create_tables"
Fix connection error when you run "create_tables"
Python
bsd-2-clause
chriszs/redash,denisov-vlad/redash,denisov-vlad/redash,denisov-vlad/redash,moritz9/redash,44px/redash,alexanderlz/redash,getredash/redash,alexanderlz/redash,moritz9/redash,alexanderlz/redash,44px/redash,moritz9/redash,moritz9/redash,44px/redash,denisov-vlad/redash,chriszs/redash,getredash/redash,getredash/redash,44px/r...
48ded0ea4def623884d5709768c87e19de279479
modules/mod_nsfw.py
modules/mod_nsfw.py
from modules.module_base import ModuleBase from tools.nsfw import Nsfw class ModuleNSFW(ModuleBase): def __init__(self, bot): ModuleBase.__init__(self, bot) self.name = "NSFW" self.nsfw = Nsfw(self.logger) def notify_command(self, message_id, from_attr, date, chat, commandName, comman...
from modules.module_base import ModuleBase from tools.nsfw import Nsfw class ModuleNSFW(ModuleBase): def __init__(self, bot): ModuleBase.__init__(self, bot) self.name = "NSFW" self.nsfw = Nsfw(self.logger) def notify_command(self, message_id, from_attr, date, chat, commandName, comman...
Fix bot infinte image loop
Fix bot infinte image loop
Python
mit
mamaddeveloper/teleadmin,mamaddeveloper/telegrambot,mamaddeveloper/teleadmin,mamaddeveloper/telegrambot
2431ce65da38d50c83f2f23b55dab64a6b4c0b89
boxsdk/object/__init__.py
boxsdk/object/__init__.py
# coding: utf-8 from __future__ import unicode_literals import six __all__ = [ 'collaboration', 'events', 'file', 'folder', 'group', 'group_membership', 'search', 'user', ] if six.PY2: __all__ = [unicode.encode(x, 'utf-8') for x in __all__]
# coding: utf-8 from __future__ import unicode_literals from six.moves import map # pylint:disable=redefined-builtin __all__ = list(map(str, ['collaboration', 'events', 'file', 'folder', 'group', 'group_membership', 'search', 'user']))
Change format of sub-module names in the object module to str
Change format of sub-module names in the object module to str
Python
apache-2.0
box/box-python-sdk
3b8c76aaee54e0d49656f640c3f18d2a6c6fbe13
tests/test_api.py
tests/test_api.py
"""Tests the isort API module""" import pytest from isort import api, exceptions def test_sort_file_invalid_syntax(tmpdir) -> None: """Test to ensure file encoding is respected""" tmp_file = tmpdir.join(f"test_bad_syntax.py") tmp_file.write_text("""print('mismathing quotes")""", "utf8") with pytest.w...
"""Tests the isort API module""" import pytest from isort import api, exceptions def test_sort_file_invalid_syntax(tmpdir) -> None: """Test to ensure file encoding is respected""" tmp_file = tmpdir.join(f"test_bad_syntax.py") tmp_file.write_text("""print('mismathing quotes")""", "utf8") with pytest.w...
Add initial check file check
Add initial check file check
Python
mit
PyCQA/isort,PyCQA/isort
1e64e4f5c584ffaf88cc419765e408cc725f0c19
models.py
models.py
#!/usr/bin/env python3 from enum import Enum class LineChange: class ChangeType(Enum): added = 1 deleted = 2 modified = 3 def __init__(self, number=None, change_type=None, filename=None, commit=None): self.number = number self.change_type = change_type ...
#!/usr/bin/env python3 from enum import Enum class LineChange: class ChangeType(Enum): added = 1 deleted = 2 modified = 3 def __init__(self, line_number=None, change_type=None, file_path=None, commit_sha=None): self.line_number = line_number self.change_type = change_...
Add equlaity comparisons to LineChange class.
Add equlaity comparisons to LineChange class.
Python
mit
chrisma/marvin,chrisma/marvin
a19e8785e0a13dc854ab626af00144585f946828
models.py
models.py
class Color(object): def __init__(self, r, g, b): self.r = r self.g = g self.b = b class Line(object): def __init__(self, name, api_code, bg_color, fg_color): self.name = name self.api_code = api_code self.bg_color = bg_color self.fg_color = fg_color ...
class Color(object): def __init__(self, r, g, b): self.r = r self.g = g self.b = b class Line(object): def __init__(self, name, api_code, bg_color, fg_color): self.name = name self.api_code = api_code self.bg_color = bg_color self.fg_color = fg_color ...
Make Station.lines into a property
Make Station.lines into a property
Python
mit
kirberich/tube_status
50224b985a2215b8598f274efd33fc5c20054417
tests/test_str.py
tests/test_str.py
import pytest from hypothesis import given from hypothesis.strategies import lists, text from datatyping.datatyping import validate @given(ss=lists(text())) def test_simple(ss): assert validate([str], ss) is None @given(s=text()) def test_simple_error(s): with pytest.raises(TypeError): validate([str...
import pytest from hypothesis import given from hypothesis.strategies import integers, text from datatyping.datatyping import validate @given(string=text()) def test_simple(string): assert validate(str, string) is None @given(not_string=integers()) def test_simple_error(not_string): with pytest.raises(Type...
Rewrite str tests with hypothesis Remove lists from testing
Rewrite str tests with hypothesis Remove lists from testing
Python
mit
Zaab1t/datatyping
5f8befe38592c75464cf03f698123d5e9f6606b8
src/tutorials/code/python/chat/1.py
src/tutorials/code/python/chat/1.py
# Address of the beam website. # No trailing slash. beam_addr = 'https://beam.pro' # Username of the account. username = 'username' # Password of the account. password = 'password' # The id of the channel you want to connect to. channel = 12345
# Address of the beam website. # No trailing slash. BEAM_ADDR = 'https://beam.pro' # Username of the account. USERNAME = 'username' # Password of the account. PASSWORD = 'password' # The id of the channel you want to connect to. CHANNEL = 12345
FIx broken Python code in chat bot tutorial
FIx broken Python code in chat bot tutorial
Python
mit
WatchBeam/developers,WatchBeam/developers,WatchBeam/developers,WatchBeam/developers,WatchBeam/developers
f0118092290355b486ed1c524c7f41cdb7c5697e
server.py
server.py
from PodSixNet.Channel import Channel from PodSixNet.Server import Server from time import sleep #Create the channel to deal with our incoming requests from the client #A new channel is created every time a client connects class ClientChannel(Channel): #Create a function that will respond to every request from t...
from PodSixNet.Channel import Channel from PodSixNet.Server import Server from time import sleep #Create the channel to deal with our incoming requests from the client #A new channel is created every time a client connects class ClientChannel(Channel): #Create a function that will respond to every request from t...
Create a game class to store information about an instantiated game object
Create a game class to store information about an instantiated game object
Python
mit
thebillington/pygame_multiplayer_server
c6837af1af2939965976bfb45099bf7c2407a9da
twitter_api/middleware/ghetto_oauth.py
twitter_api/middleware/ghetto_oauth.py
from django.contrib.auth.models import User import re class GhettoOAuthMiddleware(object): def process_view(self, request, view_func, view_args, view_kwargs): user_id = None if 'HTTP_AUTHORIZATION' in request.META and request.META['HTTP_AUTHORIZATION'].startswith('OAuth'): m = re.search...
from django.contrib.auth.models import User import re class GhettoOAuthMiddleware(object): def process_view(self, request, view_func, view_args, view_kwargs): user_id = self._get_token_from_header(request, 'HTTP_AUTHORIZATION') if not user_id: user_id = self._get_token_from_header(reque...
Add more HTTP headers to GhettoOauth
Add more HTTP headers to GhettoOauth The official iPhone Twitter client uses HTTP_X_VERIFY_CREDENTIALS_AUTHORIZATION when it's connecting to image upload services.
Python
bsd-2-clause
simonw/bugle_project,devfort/bugle,simonw/bugle_project,devfort/bugle,devfort/bugle
a84bd0dd803243b20874137fdb2d72d52bcee984
app/views/post_view.py
app/views/post_view.py
from flask import render_template, redirect, url_for from flask_classy import FlaskView, route from flask_user import login_required from ..models import PostModel from ..forms import PostForm class Post(FlaskView): """ Here will handle post creations, delete and update.""" def get(self, entity_id): ...
from flask import render_template, redirect, url_for from flask_classy import FlaskView, route from flask_user import login_required, current_user from ..models import PostModel from ..forms import PostForm class Post(FlaskView): """ Here will handle post creations, delete and update.""" def get(self, entity...
Update post view to save username references and save a post id in user entity
Update post view to save username references and save a post id in user entity
Python
mit
oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog
4688d48ceeb365174353ab710d03c39dda10a115
tssim/__init__.py
tssim/__init__.py
# -*- coding: utf-8 -*- __author__ = """Franz Woellert""" __email__ = 'franz.woellert@gmail.com' __version__ = '0.1.0'
# -*- coding: utf-8 -*- __author__ = """Franz Woellert""" __email__ = 'franz.woellert@gmail.com' __version__ = '0.1.0' from tssim.core.series import TimeSeries from tssim.core.function import TimeFunction from tssim.core.track import TimeTrack from tssim.functions import random
Adjust module and class references to accessible from package top level.
Adjust module and class references to accessible from package top level.
Python
mit
mansenfranzen/tssim
57a02c9e3bb0ed82ee84a08dbadba0dac4e7f2f4
test_insertion_sort.py
test_insertion_sort.py
from random import shuffle import pytest from insertion_sort import in_sort def test_insertion_sort(): expected = range(20) unsorted = expected[:] shuffle(unsorted) in_sort(unsorted) actual = unsorted assert expected == actual def test_insertion_sort_wrong_type(): with pytest.raises(Typ...
from random import shuffle import pytest from insertion_sort import in_sort def test_insertion_sort(): expected = range(20) unsorted = expected[:] shuffle(unsorted) in_sort(unsorted) actual = unsorted assert expected == actual def test_insertion_sort_with_duplicates(): expected = [1, 3,...
Add insertion sort with duplicate values test
Add insertion sort with duplicate values test
Python
mit
jonathanstallings/data-structures
a6a8141bcc40ac124a0425a63594578538852a02
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ilya Akhmadullin # Copyright (c) 2013 Ilya Akhmadullin # # License: MIT # """This module exports the jscs plugin class.""" from SublimeLinter.lint import Linter class Jscs(Linter): """Provides an interface to...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ilya Akhmadullin # Copyright (c) 2013 Ilya Akhmadullin # # License: MIT # """This module exports the jscs plugin class.""" from SublimeLinter.lint import Linter class Jscs(Linter): """Provides an interface to...
Use the full option name for clarity and also search in the user's home directory
Use the full option name for clarity and also search in the user's home directory
Python
mit
roberthoog/SublimeLinter-jscs,SublimeLinter/SublimeLinter-jscs
ce92ad058f24e884e196e793027c7a53e00739e8
memory.py
memory.py
class Memory(object): def __init__(self, size): self.size = size self.memory = bytearray([0] * size) def read(self, addr, count): if addr + count > len(self.memory): raise Exception('read exceeds memory bounds') return str(self.memory[addr:addr+count]) def write...
class Memory(object): def __init__(self, size): self.size = size self.memory = bytearray([0] * size) def read(self, addr, count): if addr + count > self.size: raise Exception('read exceeds memory bounds') return str(self.memory[addr:addr+count]) def write(self, ...
Use Memory.size field for read/write checks
Use Memory.size field for read/write checks
Python
mit
mossberg/spym,mossberg/spym
9cd3bb79126fa2431ba4ae03811ac30fb77b9b46
netcat.py
netcat.py
#!/usr/bin/python2 import argparse import socket import sys parser = argparse.ArgumentParser(description='Simple netcat in pure python.') parser.add_argument('-z', '--scan', action='store_true') parser.add_argument('-w', '--timeout', metavar='SECONDS', type=int) parser.add_argument('-v', '--verbose', action='store_tru...
#!/usr/bin/python import argparse import socket import sys parser = argparse.ArgumentParser(description='Simple netcat in pure python.') parser.add_argument('-s', '--source', metavar='ADDRESS') parser.add_argument('-v', '--verbose', action='store_true') parser.add_argument('-w', '--wait', metavar='SECONDS', type=int) ...
Support python 2 and 3
Support python 2 and 3 Add source argument. Update arguments to use long names from GNU netcat.
Python
unlicense
benformosa/Toolbox,benformosa/Toolbox
f8dcceb9702c079e16bda30582e561ffeb2e857b
billjobs/urls.py
billjobs/urls.py
from django.conf.urls import url, include from . import views urlpatterns = [ url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf, name='generate-pdf'), url(r'^users/$', views.UserAdmin.as_view(), name='users'), url(r'^users/(?P<pk>[0-9]+)/$', views.UserAdminDetail.as_view(), name='user-deta...
from django.conf.urls import url, include from rest_framework.authtoken.views import obtain_auth_token from . import views urlpatterns = [ url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf, name='generate-pdf'), url(r'^users/$', views.UserAdmin.as_view(), name='users'), url(r'^users/(?P<pk...
Add rest_framework view to obtain auth token
Add rest_framework view to obtain auth token
Python
mit
ioO/billjobs
0101bdc12b00ecb0a1a208f6a1f49e670a5362a6
user_profile/models.py
user_profile/models.py
from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): user = models.OneToOneField(User) description = models.TextField(max_length=3000) picture = models.ImageField(blank=True, upload_to='media/profiles/') thumbnail = models.ImageField( upload_to='media/p...
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from django.contrib.auth.models import User class UserProfile(models.Model): user = models.OneToOneField(User) description = models.TextField(max_length=300...
Create user_profile automatically after user creation
Create user_profile automatically after user creation
Python
mit
DeWaster/Tviserrys,DeWaster/Tviserrys
523e5780fd467222967bce3c03186d5af7f3623f
entrec/char_rnn_test.py
entrec/char_rnn_test.py
import tensorflow as tf from .char_rnn import char_rnn def test_char_rnn(): for i, (sentence_shape, labels_shape) in enumerate([ [[None, 64, 8], [None, 64]], [[None, None, 8], [None, None]], [[None, None, None], [None, None]]]): for mode in [tf.contrib.learn.ModeKeys.T...
import tensorflow as tf from .char_rnn import char_rnn def test_char_rnn(): for i, (sentence_shape, labels_shape) in enumerate([ [[11, 64, 8], [11, 64]], [[None, 64, 8], [None, 64]], [[None, None, 8], [None, None]], [[None, None, None], [None, None]]]): for...
Test char rnn with static batch size
Test char rnn with static batch size
Python
unlicense
raviqqe/tensorflow-entrec,raviqqe/tensorflow-entrec
52cbbadd3cf56ebc6783313058dbe129a4852a1d
call_server/extensions.py
call_server/extensions.py
# define flask extensions in separate file, to resolve import dependencies from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() from flask_caching import Cache cache = Cache() from flask_assets import Environment assets = Environment() from flask_babel import Babel babel = Babel() from flask_mail import Mail ...
# define flask extensions in separate file, to resolve import dependencies from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() from flask_caching import Cache cache = Cache() from flask_assets import Environment assets = Environment() from flask_babel import Babel babel = Babel() from flask_mail import Mail ...
Update script-src to include newrelic
Update script-src to include newrelic
Python
agpl-3.0
OpenSourceActivismTech/call-power,18mr/call-congress,spacedogXYZ/call-power,18mr/call-congress,spacedogXYZ/call-power,18mr/call-congress,OpenSourceActivismTech/call-power,OpenSourceActivismTech/call-power,spacedogXYZ/call-power,spacedogXYZ/call-power,18mr/call-congress,OpenSourceActivismTech/call-power
0aee34bc19d43f2369a121da2f9cfff05225fdbc
comet/__init__.py
comet/__init__.py
__description__ = "VOEvent Broker" __url__ = "http://comet.transientskp.org/" __author__ = "John Swinbank" __contact__ = "swinbank@princeton.edu" __version__ = "2.1.0-pre"
__description__ = "VOEvent Broker" __url__ = "http://comet.transientskp.org/" __author__ = "John Swinbank" __contact__ = "swinbank@princeton.edu" __version__ = "2.1.0-pre" import sys if sys.version_info.major <= 2: BINARY_TYPE = str else: BINARY_TYPE = bytes
Add alias to appropriate raw bytes for this Python.
Add alias to appropriate raw bytes for this Python.
Python
bsd-2-clause
jdswinbank/Comet,jdswinbank/Comet
664ce646983abc10fc6437b400b18bdca26b48c5
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by skulanov,,, # Copyright (c) 2015 skulanov,,, # # License: MIT # """This module exports the Rpmlint plugin class.""" from SublimeLinter.lint import Linter, util class Rpmlint(Linter): """Provides an interface ...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by skulanov,,, # Copyright (c) 2015 skulanov,,, # # License: MIT # """This module exports the Rpmlint plugin class.""" from SublimeLinter.lint import Linter, util class Rpmlint(Linter): """Provides an interface ...
Fix regexp for rpmlint output
Fix regexp for rpmlint output
Python
mit
SergK/SublimeLinter-contrib-rpmlint
760bafe686a6937c60cf9ee162c7e59ba673a5c3
wagtail/embeds/migrations/0008_allow_long_urls.py
wagtail/embeds/migrations/0008_allow_long_urls.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("wagtailembeds", "0007_populate_hash"), ] operations = [ migrations.AlterField( model_name="embed", name="hash", field=models.CharField(db_index=True, max...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("wagtailembeds", "0007_populate_hash"), ] operations = [ migrations.AlterField( model_name="embed", name="hash", field=models.CharField(db_index=True, max...
Add missing max_length on temporary thumbnail_url migration
Add missing max_length on temporary thumbnail_url migration Fixes #7323
Python
bsd-3-clause
gasman/wagtail,mixxorz/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,jnns/wagtail,zerolab/wagtail,jnns/wagtail,thenewguy/wagtail,rsalmaso/wagtail,gasman/wagtail,torchbox/wagtail,gasman/wagtail,jnns/wagtail,rsalmaso/wagtail,zerolab/wagtail,thenewguy/wagtail,thenewguy/wagtail,wagtail/wagtail,zerolab/wagtail,mixxorz/wagtail,w...
a59a8566418547da2a33ff678f9855bc1adf64bb
plugins/websites.py
plugins/websites.py
from smartbot import utils class Plugin: def __call__(self, bot): bot.on_hear(r"(https?:\/\/[^\s]+)", self.on_hear) bot.on_help("websites", self.on_help) def on_hear(self, bot, msg, reply): for i, url in enumerate(msg["match"]): reply("[{0}]: {1}".format(i, utils.get_websit...
from smartbot import utils class Plugin: def __call__(self, bot): bot.on_hear(r"(https?:\/\/[^\s]+)", self.on_hear) bot.on_help("websites", self.on_help) def on_hear(self, bot, msg, reply): for i, url in enumerate(msg["match"]): title = utils.get_website_title(url) ...
Check for website title before replying
Check for website title before replying
Python
mit
Cyanogenoid/smartbot,Muzer/smartbot,tomleese/smartbot,thomasleese/smartbot-old
0f427ed334f8a58e888872d60419709cfd6f41c3
var/spack/repos/builtin/packages/nccmp/package.py
var/spack/repos/builtin/packages/nccmp/package.py
from spack import * import os class Nccmp(Package): """Compare NetCDF Files""" homepage = "http://nccmp.sourceforge.net/" url = "http://downloads.sourceforge.net/project/nccmp/nccmp-1.8.2.0.tar.gz" version('1.8.2.0', '81e6286d4413825aec4327e61a28a580') depends_on('netcdf') def install(s...
from spack import * class Nccmp(Package): """Compare NetCDF Files""" homepage = "http://nccmp.sourceforge.net/" url = "http://downloads.sourceforge.net/project/nccmp/nccmp-1.8.2.0.tar.gz" version('1.8.2.0', '81e6286d4413825aec4327e61a28a580') depends_on('netcdf') def install(self, spec,...
Tweak nccmp to be more spack-compatible.
Tweak nccmp to be more spack-compatible. - Spack doesn't set F90, but it confuses the nccmp build. Just remove it from the environment. - TODO: should build environment unset this variable?
Python
lgpl-2.1
skosukhin/spack,matthiasdiener/spack,EmreAtes/spack,iulian787/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,tmerrick1/spack,TheTimmy/spack,iulian787/spack,EmreAtes/spack,TheTimmy/spack,krafczyk/spack,LLNL/spack,lgarren/spack,TheTimmy/spack,iulian787/spack,iulian787/spack,tmerrick1/spack,lgarren/spack,matthi...
c621bc7c94dbbeb5540b2ce46437ee24ecbc33dd
test/test_interface.py
test/test_interface.py
from cloudbridge.cloud import interfaces from test.helpers import ProviderTestBase class CloudInterfaceTestCase(ProviderTestBase): def __init__(self, methodName, provider): super(CloudInterfaceTestCase, self).__init__( methodName=methodName, provider=provider) def test_name_property(self...
import cloudbridge from cloudbridge.cloud import interfaces from test.helpers import ProviderTestBase class CloudInterfaceTestCase(ProviderTestBase): def __init__(self, methodName, provider): super(CloudInterfaceTestCase, self).__init__( methodName=methodName, provider=provider) def test...
Add a library version test
Add a library version test
Python
mit
gvlproject/cloudbridge,ms-azure-cloudbroker/cloudbridge,gvlproject/libcloudbridge
e2437ba31ea2c7f35afaeb2ec966062b2dfa2f5e
manage.py
manage.py
from os.path import abspath from flask import current_app as app from app import create_app, db # from app.model import init_db from flask.ext.script import Manager manager = Manager(create_app) manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development') manager.add_option('-f', '--cfgfile', dest...
from os.path import abspath from flask import current_app as app from app import create_app, db # from app.model import init_db, populate_db() from flask.ext.script import Manager manager = Manager(create_app) manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development') manager.add_option('-f', '-...
Add popdb() and edit descriptions
Add popdb() and edit descriptions
Python
mit
nerevu/prometheus-api,nerevu/prometheus-api,nerevu/prometheus-api
60e3dd17ca8acd4a88a1e7332d3a86e1890d989c
pdbcs/main.py
pdbcs/main.py
#!/usr/bin/env python import argparse import os import pdb import pkg_resources def main(): parser = argparse.ArgumentParser() parser.add_argument('script') args = parser.parse_args() script_name = os.path.basename(args.script) ep = pkg_resources.iter_entry_points('console_scripts', script_name...
#!/usr/bin/env python import argparse import os import pdb import sys import pkg_resources def main(): parser = argparse.ArgumentParser() parser.add_argument('script') args, scriptargs = parser.parse_known_args() script_name = os.path.basename(args.script) ep = pkg_resources.iter_entry_points('...
Allow script args to be passed; reconstitute sys.argv for script
Allow script args to be passed; reconstitute sys.argv for script Signed-off-by: Dan Mick <b07550071eaa6a9296289c43bbd6c90559196431@inktank.com>
Python
apache-2.0
dreamhost/pdbcs
c736708c008c51e1a49427beb320e83b03b9d58c
students/psbriant/final_project/clean_data.py
students/psbriant/final_project/clean_data.py
""" Name: Paul Briant Date: 12/11/16 Class: Introduction to Python Assignment: Final Project Description: Code for Final Project """ import pandas from datetime import datetime # Change source to smaller file. data = pandas.read_csv("data/Seattle_Real_Time_Fire_911_Calls.csv")
""" Name: Paul Briant Date: 12/11/16 Class: Introduction to Python Assignment: Final Project Description: Code for Final Project """ import pandas from datetime import datetime # Change source to smaller file. data = pandas.read_csv("data/Residential_Water_Usage_Zip_Code_on_Top.csv") data_columns = ["Date_Text", "Da...
Move to fix column names.
Move to fix column names.
Python
unlicense
UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016
f47781055326d6f259dd1b0d4b6be9cf47554977
craigschart/craigschart.py
craigschart/craigschart.py
from bs4 import BeautifulSoup import requests def get_html(): r = requests.get('http://vancouver.craigslist.ca/search/cto?query=Expedition') print(r.status_code) print(r.text) return r.text def main(): html = get_html() soup = BeautifulSoup(html, 'lxml') print(soup.prettify()) print(...
from bs4 import BeautifulSoup import requests def get_html(url): r = requests.get(url) return r.text def add_start(url, start): parts = url.split('?') return parts[0] + '?s={}'.format(start) + '&' + parts[1] def main(): url = 'http://vancouver.craigslist.ca/search/cto?query=Expedition' htm...
Enable search of paginated pages
Enable search of paginated pages
Python
mit
supermitch/craigschart
77138f52d63be6c58d94f5ba9e0928a12b15125b
vumi/application/__init__.py
vumi/application/__init__.py
"""The vumi.application API.""" __all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager", "MessageStore"] from vumi.application.base import ApplicationWorker from vumi.application.session import SessionManager from vumi.application.tagpool import TagpoolManager from vumi.application.message_store...
"""The vumi.application API.""" __all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager", "MessageStore", "HTTPRelayApplication"] from vumi.application.base import ApplicationWorker from vumi.application.session import SessionManager from vumi.application.tagpool import TagpoolManager from vumi.a...
Add HTTPRelayApplication to vumi.application package API.
Add HTTPRelayApplication to vumi.application package API.
Python
bsd-3-clause
harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi
ae1696364f078d7813076c7e0a937ad30a19e84f
receiver/receive.py
receiver/receive.py
#!/usr/bin/env/python import socket, fcntl, sys #Lock to only allow one instance of this program to run pid_file = '/tmp/send.pid' fp = open(pid_file, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: print 'An instance of this program is already running' sys.exit(0) import Adafruit_C...
#!/usr/bin/env python import socket, fcntl, sys #Lock to only allow one instance of this program to run pid_file = '/tmp/send.pid' fp = open(pid_file, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: print 'An instance of this program is already running' sys.exit(0) import Adafruit_C...
Fix header of Python file
Fix header of Python file Now correctly points to the Python interpretor
Python
mit
sapientsalamander/Pi_Packet_Project,sapientsalamander/Pi_Packet_Project,sapientsalamander/Pi_Packet_Project,sapientsalamander/Pi_Packet_Project,sapientsalamander/Pi_Packet_Project
029df34ce4a69adf5321531b229503d66169c9a6
tests/optimizers/test_conjugate_gradient.py
tests/optimizers/test_conjugate_gradient.py
from pymanopt.optimizers import ConjugateGradient from .._test import TestCase class TestConjugateGradient(TestCase): def test_beta_type(self): with self.assertRaises(ValueError): ConjugateGradient(beta_rule="SomeUnknownBetaRule")
import numpy as np import numpy.testing as np_testing from nose2.tools import params import pymanopt from pymanopt.optimizers import ConjugateGradient from .._test import TestCase class TestConjugateGradient(TestCase): def setUp(self): n = 32 matrix = np.random.normal(size=(n, n)) matrix...
Add simple end-to-end test case for beta rules
Add simple end-to-end test case for beta rules Signed-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>
Python
bsd-3-clause
pymanopt/pymanopt,pymanopt/pymanopt
57991e6232a0f7fe081aba03ce2beb493ff110ff
tests/test_bg_color.py
tests/test_bg_color.py
import pytest import webview from .util import destroy_window, run_test def bg_color(): import webview destroy_window(webview) webview.create_window('Background color test', 'https://www.example.org', background_color='#0000FF') def test_bg_color(): run_test(bg_color)
import pytest from .util import destroy_window, run_test def bg_color(): import webview destroy_window(webview) webview.create_window('Background color test', 'https://www.example.org', background_color='#0000FF') def invalid_bg_color(): import webview with pytest.raises(ValueError): web...
Add invalid bg_color test cases
Add invalid bg_color test cases
Python
bsd-3-clause
shivaprsdv/pywebview,r0x0r/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,shivaprsdv/pywebview
d3bfb0d65314df39a42390dd5a7d40dd7a61b758
myname.py
myname.py
"""Little module to find the path of a Cosmo box simulation""" import os.path as path base=path.expanduser("~/data/Cosmo/") def get_name(sim, ff=True): """Get the directory for a simulation""" halo = "Cosmo"+str(sim)+"_V6" if ff: halo=path.join(halo,"L25n512/output") else: halo=path.j...
"""Little module to find the path of a Cosmo box simulation""" import os.path as path base=path.expanduser("~/data/Cosmo/") def get_name(sim, ff=True, box=25): """Get the directory for a simulation""" halo = "Cosmo"+str(sim)+"_V6" if ff: halo=path.join(halo,"L"+str(box)+"n512/output") else: ...
Allow loading of different box sizes
Allow loading of different box sizes
Python
mit
sbird/fake_spectra,sbird/fake_spectra,sbird/fake_spectra
88dc55b86d432b2fcc9e214acbd3f9064e4debdb
tests/test_datasets.py
tests/test_datasets.py
import pytest from tests import api RESULT_ATTRIBUTES = [ 'id', 'total_products', 'total_stores', 'total_inventories', 'total_product_inventory_count', 'total_product_inventory_volume_in_milliliters', 'total_product_inventory_price_in_cents', 'store_ids', 'product_ids', 'added...
import pytest from tests import api RESULT_ATTRIBUTES = [ 'id', 'total_products', 'total_stores', 'total_inventories', 'total_product_inventory_count', 'total_product_inventory_volume_in_milliliters', 'total_product_inventory_price_in_cents', 'store_ids', 'product_ids', 'added...
Add test for latest datasets
Add test for latest datasets
Python
mit
shamrt/LCBOAPI
8234e5dff9265d9fd5a94ffff5e58e154664395d
support/tests/test_command.py
support/tests/test_command.py
import unittest # Remember: # Import your package here # Install AAAPT package to run the tests class Test_{package_name}Command(unittest.TestCase): pass
# Remember to install AAAPT package to run the tests import unittest # Import your package here # To reload your tests every time you save your command file, add the following to it: # for test_file in glob.glob("tests/test_*.py"): # key = "{package_name}." + test_file[:-3].replace("/", ".") # if key in sy...
Add a way to reload the tests from the main command file
Add a way to reload the tests from the main command file
Python
mit
NicoSantangelo/package-boilerplate
6db982edae5e1cac2bc254651dd7264cd289130d
astropy/nddata/__init__.py
astropy/nddata/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The `astropy.nddata` subpackage provides the `~astropy.nddata.NDData` class and related tools to manage n-dimensional array-based data (e.g. CCD images, IFU Data, grid-based simulation data, ...). This is more than just `numpy.ndarray` objects, becaus...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The `astropy.nddata` subpackage provides the `~astropy.nddata.NDData` class and related tools to manage n-dimensional array-based data (e.g. CCD images, IFU Data, grid-based simulation data, ...). This is more than just `numpy.ndarray` objects, becaus...
Add NDDataBase to package import
Add NDDataBase to package import
Python
bsd-3-clause
mhvk/astropy,stargaser/astropy,funbaker/astropy,aleksandr-bakanov/astropy,kelle/astropy,AustereCuriosity/astropy,funbaker/astropy,larrybradley/astropy,joergdietrich/astropy,AustereCuriosity/astropy,aleksandr-bakanov/astropy,dhomeier/astropy,MSeifert04/astropy,larrybradley/astropy,stargaser/astropy,bsipocz/astropy,joerg...
4fbf3f6c70b2cde60ced0da0ebd47dbb5e14ce84
plasmapy/physics/tests/test_dimensionless.py
plasmapy/physics/tests/test_dimensionless.py
from plasmapy.physics.dimensionless import (beta) import astropy.units as u import numpy as np B = 1.0 * u.T n = 5e19 * u.m ** -3 T = 1e6 * u.K def test_beta_dimensionless(): # Check that beta is dimensionless float(beta(T, n, B)) def quantum_theta_dimensionless(): # Check that quantum theta is dimens...
from plasmapy.physics.dimensionless import (beta) import astropy.units as u import numpy as np B = 1.0 * u.T n = 5e19 * u.m ** -3 T = 1e6 * u.K def test_beta_dimensionless(): # Check that beta is dimensionless float(beta(T, n, B)) def quantum_theta_dimensionless(): # Check that quantum theta is dimens...
Fix nan comparison in new dimensionless beta nan test
Fix nan comparison in new dimensionless beta nan test
Python
bsd-3-clause
StanczakDominik/PlasmaPy
e34b738ea28f98de2cc039a1c0a9a0b5478f7fac
viper/common/abstracts.py
viper/common/abstracts.py
# This file is part of Viper - https://github.com/botherder/viper # See the file 'LICENSE' for copying permission. import argparse class ArgumentParser(argparse.ArgumentParser): def error(self, message): raise Exception('error: {}\n'.format(message)) class Module(object): cmd = '' description ...
# This file is part of Viper - https://github.com/botherder/viper # See the file 'LICENSE' for copying permission. import argparse class ArgumentErrorCallback(Exception): def __init__(self, message, level=''): self.message = message.strip() + '\n' self.level = level.strip() def __str__(self...
Improve the error handling, better use of ArgumentParser.
Improve the error handling, better use of ArgumentParser.
Python
bsd-3-clause
jack51706/viper,Beercow/viper,kevthehermit/viper,S2R2/viper,jorik041/viper,postfix/viper-1,cwtaylor/viper,postfix/viper-1,jack51706/viper,kevthehermit/viper,MeteorAdminz/viper,jahrome/viper,jahrome/viper,Beercow/viper,Beercow/viper,MeteorAdminz/viper,S2R2/viper,cwtaylor/viper,jorik041/viper
e3edaa6a1a970b266a7411dcadbf86dccb5d8234
tests/run.py
tests/run.py
import os import sys import dj_database_url import django from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings from django.test.runner import DiscoverRunner BASEDIR = os.path.dirname(os.path.dirname(__file__)) settings.configure( DATABASES={ 'default': dj_database_u...
import os import sys import dj_database_url import django from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings from django.test.runner import DiscoverRunner BASEDIR = os.path.dirname(os.path.dirname(__file__)) settings.configure( DATABASES={ 'default': dj_database_u...
Remove if branch to test django > 1.7
Remove if branch to test django > 1.7
Python
bsd-2-clause
incuna/django-user-deletion
8c3fecb4fc3a2787d6c7c6a5ce015c9e01941e3d
src/dynmen/__init__.py
src/dynmen/__init__.py
# -*- coding: utf-8 -*- from .menu import Menu, MenuError del menu
# -*- coding: utf-8 -*- from .menu import Menu, MenuError del menu def new_dmenu(**kwargs): from .dmenu import DMenu return DMenu(**kwargs) def new_rofi(**kwargs): from .rofi import Rofi return Rofi(**kwargs)
Add factory functions for dmenu and rofi in root dynmen file
Add factory functions for dmenu and rofi in root dynmen file
Python
mit
frostidaho/dynmen
ee80818b8ff12cd351581b4c1652e64561d34a4c
rest_framework_simplejwt/token_blacklist/models.py
rest_framework_simplejwt/token_blacklist/models.py
from django.contrib.auth import get_user_model from django.db import models from django.utils.six import python_2_unicode_compatible User = get_user_model() @python_2_unicode_compatible class OutstandingToken(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) jti = models.UUIDField(uni...
from django.conf import settings from django.db import models from django.utils.six import python_2_unicode_compatible @python_2_unicode_compatible class OutstandingToken(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) jti = models.UUIDField(unique=True) token ...
Fix broken tests in 1.8-1.10
Fix broken tests in 1.8-1.10
Python
mit
davesque/django-rest-framework-simplejwt,davesque/django-rest-framework-simplejwt
3aecc94e0e84c5cc4944e04a06574329ce684f9d
tests/__init__.py
tests/__init__.py
from pycassa.system_manager import * TEST_KS = 'PycassaTestKeyspace' def setup_package(): sys = SystemManager() if TEST_KS in sys.list_keyspaces(): sys.drop_keyspace(TEST_KS) try: sys.create_keyspace(TEST_KS, 1) sys.create_column_family(TEST_KS, 'Standard1') sys.create_colu...
from pycassa.system_manager import * from pycassa.cassandra.constants import * TEST_KS = 'PycassaTestKeyspace' def setup_package(): sys = SystemManager() if TEST_KS in sys.list_keyspaces(): sys.drop_keyspace(TEST_KS) try: sys.create_keyspace(TEST_KS, 1) sys.create_column_family(TES...
Create counter CFs for tests if version > 0.7
Create counter CFs for tests if version > 0.7
Python
mit
pycassa/pycassa,pycassa/pycassa
ca15f2d991d4d35f1dfc194bfa81c99504574e15
wagtail/contrib/simple_translation/apps.py
wagtail/contrib/simple_translation/apps.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class SimpleTranslationAppConfig(AppConfig): name = "wagtail.contrib.simple_translation" label = "simple_translation" verbose_name = _("Wagtail simple translation")
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class SimpleTranslationAppConfig(AppConfig): name = "wagtail.contrib.simple_translation" label = "simple_translation" verbose_name = _("Wagtail simple translation") default_auto_field = 'django.db.models.AutoField...
Set default_auto_field on simple_translation app config
Set default_auto_field on simple_translation app config Prevents the warning "simple_translation.SimpleTranslation: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'." when running under Django 3.2.
Python
bsd-3-clause
wagtail/wagtail,rsalmaso/wagtail,mixxorz/wagtail,zerolab/wagtail,wagtail/wagtail,jnns/wagtail,wagtail/wagtail,mixxorz/wagtail,jnns/wagtail,torchbox/wagtail,torchbox/wagtail,gasman/wagtail,gasman/wagtail,thenewguy/wagtail,gasman/wagtail,wagtail/wagtail,rsalmaso/wagtail,mixxorz/wagtail,torchbox/wagtail,mixxorz/wagtail,rs...
1e5fb3c13922944ce2126820bfd5c806e0b1c93f
gertty/view/__init__.py
gertty/view/__init__.py
# Copyright 2014 OpenStack Foundation # # 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...
# Copyright 2014 OpenStack Foundation # # 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...
Add message attribute to DisplayError
Add message attribute to DisplayError The .message attribute was dropped from the base exception class in py3. Since we use it, set it directly. Change-Id: I27124c6d00216b335351ef6985ddf869f2fd1366
Python
apache-2.0
openstack/gertty,stackforge/gertty
40d0b5d2d86de6954b93fa90d7a04a84e9e2248b
tests/conftest.py
tests/conftest.py
import pytest import pathlib import json import app.mapping mappings_dir = (pathlib.Path(__file__).parent / "../mappings").resolve() services_mappings = ( "services", ) @pytest.fixture(scope="module", params=services_mappings) def services_mapping_file_name_and_path(request): return (request.param, mappin...
import pytest import pathlib import json import app.mapping mappings_dir = (pathlib.Path(__file__).parent / "../mappings").resolve() services_mappings = ( "services-g-cloud-10", ) @pytest.fixture(scope="module", params=services_mappings) def services_mapping_file_name_and_path(request): return (request.pa...
Use g-cloud-10 services mapping for tests
Use g-cloud-10 services mapping for tests
Python
mit
alphagov/digitalmarketplace-search-api,alphagov/digitalmarketplace-search-api
8ca841f2cc30e13cbefcc10e0b2ae669c8aed23f
pythonforandroid/recipes/libnacl/__init__.py
pythonforandroid/recipes/libnacl/__init__.py
from pythonforandroid.toolchain import PythonRecipe class LibNaClRecipe(PythonRecipe): version = '1.4.4' url = 'https://github.com/saltstack/libnacl/archive/v{version}.tar.gz' depends = ['hostpython2', 'setuptools'] site_packages_name = 'libnacl' call_hostpython_via_targetpython = False recipe = L...
from pythonforandroid.toolchain import PythonRecipe class LibNaClRecipe(PythonRecipe): version = '1.4.4' url = 'https://github.com/saltstack/libnacl/archive/v{version}.tar.gz' depends = ['hostpython2', 'setuptools', 'libsodium'] site_packages_name = 'libnacl' call_hostpython_via_targetpython = Fals...
Fix libnacl recipe missing libsodium
Fix libnacl recipe missing libsodium
Python
mit
kivy/python-for-android,germn/python-for-android,germn/python-for-android,rnixx/python-for-android,germn/python-for-android,germn/python-for-android,kivy/python-for-android,rnixx/python-for-android,kronenpj/python-for-android,kivy/python-for-android,PKRoma/python-for-android,rnixx/python-for-android,kronenpj/python-for...
2059d6ac5478f1e8fa5adc1a00c77c9f74892940
tests/test_sst.py
tests/test_sst.py
import unittest import pandas as pd from banpei.sst import SST class TestSST(unittest.TestCase): def setUp(self): self.raw_data = pd.read_csv('tests/test_data/periodic_wave.csv') self.data = self.raw_data['y'] def test_detect(self): model = SST(w=50) results = model.detect(se...
import unittest import pandas as pd from banpei.sst import SST class TestSST(unittest.TestCase): def setUp(self): self.raw_data = pd.read_csv('tests/test_data/periodic_wave.csv') self.data = self.raw_data['y'] def test_detect_by_svd(self): model = SST(w=50) results = model.de...
Add test of detection using lanczos method
Add test of detection using lanczos method
Python
mit
tsurubee/banpei
ca0e1cc8c2454b67e7dadceb009b9fa49821f903
tests/sensors/test_sensors.py
tests/sensors/test_sensors.py
import pytest import six from tilezilla import sensors def test_friendly_names_data(): # Test this variable is dict # Should contain [SENSOR (str)]:[MAPPING (dict)] # where: # MAPPING is a dict of [friendly_name (str)]:[band id (int)] assert isinstance(sensors.SENSOR_FRIENDLY_NAMES, dict) s...
import six from tilezilla import sensors def test_friendly_names_data(): # Test this variable is dict # Should contain [SENSOR (str)]:[MAPPING (dict)] # where: # MAPPING is a dict of [friendly_name (str)]:[band id (int)] assert isinstance(sensors.SENSOR_FRIENDLY_NAMES, dict) sensor_names = ...
Fix string type comparison for py2
Fix string type comparison for py2
Python
bsd-3-clause
ceholden/landsat_tile,ceholden/landsat_tiles,ceholden/landsat_tile,ceholden/tilezilla,ceholden/landsat_tiles
39d0c335759781de8cf1644cdf499588441b434d
tviserrys/urls.py
tviserrys/urls.py
from django.contrib.auth import views as auth_views from django.conf.urls import patterns, include, url from django.conf.urls import url from django.contrib import admin from . import views from tviserrys.settings import MEDIA_ROOT urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), url(r'^adm...
from django.contrib.auth import views as auth_views from django.conf.urls import patterns, include, url from django.conf.urls import url from django.contrib import admin from . import views from tviserrys.settings import MEDIA_ROOT urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), url(r'^tvi...
Add Tviit and profile url patterns
Add Tviit and profile url patterns
Python
mit
DeWaster/Tviserrys,DeWaster/Tviserrys
83e48445400c8556a7ef8f9064965b9d77e3d877
tools/build_interface_docs.py
tools/build_interface_docs.py
#!/usr/bin/env python """Script to auto-generate interface docs. """ # stdlib imports import os import sys #***************************************************************************** if __name__ == '__main__': nipypepath = os.path.abspath('..') sys.path.insert(1,nipypepath) # local imports from inte...
#!/usr/bin/env python """Script to auto-generate interface docs. """ # stdlib imports import os import sys #***************************************************************************** if __name__ == '__main__': nipypepath = os.path.abspath('..') sys.path.insert(1,nipypepath) # local imports from inte...
Remove NipypeTester from doc generation.
Remove NipypeTester from doc generation. git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@1373 ead46cd0-7350-4e37-8683-fc4c6f79bf00
Python
bsd-3-clause
FCP-INDI/nipype,pearsonlab/nipype,blakedewey/nipype,dmordom/nipype,dgellis90/nipype,fprados/nipype,Leoniela/nipype,mick-d/nipype_source,wanderine/nipype,mick-d/nipype,sgiavasis/nipype,rameshvs/nipype,gerddie/nipype,grlee77/nipype,arokem/nipype,christianbrodbeck/nipype,carolFrohlich/nipype,rameshvs/nipype,carlohamalaine...
bce0d37239f3d054274c0a1c90402e03d6e48b69
climate/data/montecarlo.py
climate/data/montecarlo.py
import numpy class dist: normal, random = range(2) # Monte carlo simulation data def montecarlo(callback, samples, **kwargs): """ generate random samples based on values """ vals = {} for var in kwargs: if isinstance(kwargs[var], tuple): (minVal, maxVal, distribution) = kwargs[var]...
import numpy class dist: normal, random = range(2) # Monte carlo simulation data def montecarlo(callback, samples, **kwargs): """ generate random samples based on values """ vals = {} for var in kwargs: if isinstance(kwargs[var], tuple): (minVal, maxVal, distribution) = kwargs[var]...
Change in the implementation of normal distribution
Change in the implementation of normal distribution
Python
mit
dionhaefner/veros,dionhaefner/veros
5e9c6c527902fd8361391f111a88a8f4b4ce71df
aospy/proj.py
aospy/proj.py
"""proj.py: aospy.Proj class for organizing work in single project.""" import time from .utils import dict_name_keys class Proj(object): """Project parameters: models, regions, directories, etc.""" def __init__(self, name, vars={}, models={}, default_models={}, regions={}, direc_out='', nc_d...
"""proj.py: aospy.Proj class for organizing work in single project.""" import time from .utils import dict_name_keys class Proj(object): """Project parameters: models, regions, directories, etc.""" def __init__(self, name, vars={}, models={}, default_models={}, regions={}, direc_out='', nc_d...
Delete unnecessary vars attr of Proj
Delete unnecessary vars attr of Proj
Python
apache-2.0
spencerkclark/aospy,spencerahill/aospy
ef72b229732610c3b6c8ccdd9c599002986707f3
test_knot.py
test_knot.py
# -*- coding: utf-8 -*- import unittest from flask import Flask from flask.ext.knot import Knot def create_app(): app = Flask(__name__) app.config['TESTING'] = True return app class TestKnot(unittest.TestCase): def test_acts_like_container(self): app = create_app() dic = Knot(app) ...
# -*- coding: utf-8 -*- import unittest from flask import Flask from flask.ext.knot import Knot, get_container def create_app(): app = Flask(__name__) app.config['TESTING'] = True return app class TestKnot(unittest.TestCase): def test_acts_like_container(self): app = create_app() di...
Add test for shared container.
Add test for shared container.
Python
mit
jaapverloop/flask-knot
595419eaa5b5f411e477357872c7dd28067c9210
src/books/models.py
src/books/models.py
from django.db import models from datetime import date from django.utils import timezone # Create your models here. class Book(models.Model): title = models.CharField(max_length=200) author = models.CharField(max_length=200) year = models.DateTimeField('year published', help_text="Please use the following format:...
from django.db import models from datetime import datetime from django.utils import timezone # Create your models here. class Book(models.Model): title = models.CharField(max_length=200) author = models.CharField(max_length=200) year = models.DateTimeField('year published', help_text="Please use the following for...
Fix date error in books model
Fix date error in books model Fix typos and the auto addition of date to the date_added field.
Python
mit
melkisedek/sen_project,melkisedek/sen_project,melkisedek/sen_project
97894a171d1831838da28b757aabb352bc5ecfd9
patches/sitecustomize.py
patches/sitecustomize.py
# Monkey patches BigQuery client creation to use proxy. # Import torch before anything else. This is a hacky workaround to an error on dlopen # reporting a limit on static TLS, tracked in https://github.com/pytorch/pytorch/issues/2575 import torch import os _HOST_FILE = "/etc/hosts" kaggle_proxy_token = os.getenv("K...
# Monkey patches BigQuery client creation to use proxy. # Import torch before anything else. This is a hacky workaround to an error on dlopen # reporting a limit on static TLS, tracked in https://github.com/pytorch/pytorch/issues/2575 import torch import os kaggle_proxy_token = os.getenv("KAGGLE_DATA_PROXY_TOKEN") if...
Revert "Support adding an /etc/host entry for the data proxy, if asked."
Revert "Support adding an /etc/host entry for the data proxy, if asked." This reverts commit 062f975d92c5795feb530e3ea1914d3c7dd3a96b. There is no more need for this support in the docker image. It is fully externally handled through docker run's `--add-host` feature.
Python
apache-2.0
Kaggle/docker-python,Kaggle/docker-python
5690b8dfe529dd83b1531517d900a7e8512aa061
utilities/python/graph_dfs.py
utilities/python/graph_dfs.py
def graph_dfs(matrix): rows, cols = len(matrix), len(matrix[0]) visited = set() directions = ((0, 1), (0, -1), (1, 0), (-1, 0)) def dfs(i, j): if (i, j) in visited: return visited.add((i, j)) # Traverse neighbors. for direction in directions: next_...
def graph_dfs(matrix): rows, cols = len(matrix), len(matrix[0]) visited = set() directions = ((0, 1), (0, -1), (1, 0), (-1, 0)) def dfs(i, j): if (i, j) in visited: return visited.add((i, j)) # Traverse neighbors. for direction in directions: next_...
Add follow up with matrix traversal
Add follow up with matrix traversal
Python
mit
yangshun/tech-interview-handbook,yangshun/tech-interview-handbook,yangshun/tech-interview-handbook,yangshun/tech-interview-handbook,yangshun/tech-interview-handbook
7f7ba15ec7fb22cf4a458e8cbaef8eac785c034b
pivot/test/test_utils.py
pivot/test/test_utils.py
""" Tests utility scripts """ import os from django.test import TestCase, RequestFactory from django.test.utils import override_settings import pivot from pivot.utils import get_latest_term, is_more_recent from pivot.templatetags.pivot_extras import year_select_tab TEST_CSV_PATH = os.path.join(os.path.dirname(pivot...
""" Tests utility scripts """ import os from django.test import TestCase, RequestFactory from django.test.utils import override_settings import pivot from pivot.utils import get_latest_term, is_more_recent from pivot.templatetags.pivot_extras import year_select_tab TEST_CSV_PATH = os.path.join(os.path.dirname(pivot...
Add simple test for coverage.
Add simple test for coverage.
Python
apache-2.0
uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot
5bdbb48585891e0c800b7e685e25295a1ba706e2
src/listen.py
src/listen.py
import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHANNEL = 'logfire' def listen(args): global MSGPATTERN rserver = redis.Redis('localhost') rserver.subscribe(CHANNEL) db = get_db(args.mongohost) for packet in rserver.list...
import redis import re from common import get_db from datetime import datetime MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$') CHANNEL = 'logfire' def listen(args): global MSGPATTERN rserver = redis.Redis('localhost') pubsub = rserver.pubsub() pubsub.subscribe(CHANNEL) db = get_db(args.mongohost) ...
Make redis subscription work with python-redis' latest versions
Make redis subscription work with python-redis' latest versions
Python
mit
jay3sh/logfire,jay3sh/logfire
674826aeab8fa0016eed829110740f9a93247b58
fedora/manager/manager.py
fedora/manager/manager.py
from django.core.validators import URLValidator from django.core.exceptions import ValidationError import inspect import requests, json class FedoraConnectionManager: __oerUri = '' __parserTemplates = set() def __init__(self, uri, templates=[], auto_retrieved=True): validator = URLValidator(ve...
from django.core.validators import URLValidator from django.core.exceptions import ValidationError import inspect import requests, json class FedoraConnectionManager: __oerUri = '' __parserTemplates = set() def __init__(self, uri, templates=[], auto_retrieved=True): validator = URLValidator(...
Change concatination of parsed data
Change concatination of parsed data
Python
mit
sitdh/fedora-parser
5aae611b4e3de3b53a9dc91d0fc23c0db24802b4
analysis/export_dockets.py
analysis/export_dockets.py
#!/usr/bin/env python import sys import os import csv import time from datetime import datetime from collections import namedtuple from pymongo import Connection pid = os.getpid() DOCKETS_QUERY = {'scraped': True} DOCKET_FIELDS = ['docket_id', 'title', 'agency', 'year'] if __name__ == '__main__': # set up opt...
#!/usr/bin/env python import sys import os import csv import time from datetime import datetime from collections import namedtuple from pymongo import Connection pid = os.getpid() DOCKETS_QUERY = {'scraped': True} DOCKET_FIELDS = ['docket_id', 'title', 'agency', 'year'] def filter_for_postgres(v): if v is None...
Make docket export work (done last week, but not committed for some reason).
Make docket export work (done last week, but not committed for some reason).
Python
bsd-3-clause
sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper
d88429d072f79c38d65ccaf3519495905f12f03f
calaccess_website/management/commands/updatedownloadswebsite.py
calaccess_website/management/commands/updatedownloadswebsite.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Update to the latest CAL-ACCESS snapshot and bake static website pages. """ import logging from django.core.management import call_command from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand logger = logging.getLogger(__name__) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Update to the latest CAL-ACCESS snapshot and bake static website pages. """ import logging from django.core.management import call_command from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand logger = logging.getLogger(__name__) ...
Add processing cmd to update routine
Add processing cmd to update routine
Python
mit
california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website
0e87bd1939fe48896b840de59d69b990b8f5d91f
giki/formatter.py
giki/formatter.py
from markdown2 import markdown from docutils.core import publish_parts from textile import textile def rst(string): """Wraps the ReST parser in Docutils. Note that Docutils wraps its output in a `<div class='document'>`.""" return publish_parts( source=string, settings_overrides={ 'file_insertion_enabled':...
from markdown2 import markdown from docutils.core import publish_parts from textile import textile def rst(string): """Wraps the ReST parser in Docutils. Note that Docutils wraps its output in a `<div class='document'>`.""" return publish_parts( source=string, settings_overrides={ 'file_insertion_enabled':...
Add some extras to the Markdown parser
Add some extras to the Markdown parser
Python
bsd-2-clause
adambrenecki/giki
bc3aee78bb5be3afa639b8c572273b662aea1721
glue/tests/test_settings_helpers.py
glue/tests/test_settings_helpers.py
from mock import patch import os from glue.config import SettingRegistry from glue._settings_helpers import load_settings, save_settings def test_roundtrip(tmpdir): settings = SettingRegistry() settings.add('STRING', 'green', str) settings.add('INT', 3, int) settings.add('FLOAT', 5.5, float) se...
from mock import patch import os from glue.config import SettingRegistry from glue._settings_helpers import load_settings, save_settings def test_roundtrip(tmpdir): settings = SettingRegistry() settings.add('STRING', 'green', str) settings.add('INT', 3, int) settings.add('FLOAT', 5.5, float) s...
Improve unit test for settings helpers
Improve unit test for settings helpers
Python
bsd-3-clause
saimn/glue,stscieisenhamer/glue,stscieisenhamer/glue,saimn/glue
ff4d64fe5ad47e9012a49b95b1804c67da637141
gapipy/resources/booking/document.py
gapipy/resources/booking/document.py
from __future__ import unicode_literals from ..base import Resource class Document(Resource): _resource_name = 'documents' _is_listable = False _as_is_fields = ['id', 'href', 'mime_type', 'content', 'type', 'audience'] _date_time_fields_utc = ['date_created'] _resource_fields = [ ('booki...
from __future__ import unicode_literals from ..base import Resource class Document(Resource): _resource_name = 'documents' _is_listable = False _as_is_fields = ['id', 'href', 'mime_type', 'content', 'type', 'audience'] _date_time_fields_utc = ['date_created'] _resource_fields = [ ('booki...
Add `audience` field back to Invoice resource
Add `audience` field back to Invoice resource - field should be exposed in both Document and Invoice resources
Python
mit
gadventures/gapipy
e01b0c9129c05e366605639553201f0dc2af2756
django_fsm_log/apps.py
django_fsm_log/apps.py
from __future__ import unicode_literals from django.apps import AppConfig from django.conf import settings from django.utils.module_loading import import_string from django_fsm.signals import pre_transition, post_transition class DjangoFSMLogAppConfig(AppConfig): name = 'django_fsm_log' verbose_name = "Djang...
from __future__ import unicode_literals from django.apps import AppConfig from django.conf import settings from django.utils.module_loading import import_string from django_fsm.signals import pre_transition, post_transition class DjangoFSMLogAppConfig(AppConfig): name = 'django_fsm_log' verbose_name = "Djang...
Revert "Solve warning coming from django 4.0"
Revert "Solve warning coming from django 4.0"
Python
mit
gizmag/django-fsm-log,ticosax/django-fsm-log
099ff76e6b7ea10535fd85de1709a53baa9c9252
examples/install_german_voices.py
examples/install_german_voices.py
#!/usr/bin/python import subprocess import os pkgs = [ '"VOICEID:com.apple.speech.synthesis.voice.anna.premium_2" IN tags', '"VOICEID:com.apple.speech.synthesis.voice.steffi.premium_2" IN tags', '"VOICEID:com.apple.speech.synthesis.voice.yannick.premium_2" IN tags' ] for pkg in pkgs: subprocess.call(['/usr/bin/p...
#!/usr/bin/python import subprocess import os import platform num = int(platform.release().split('.')[0])-10 # 13=>3: Mavericks, 12=>2: Mountain Lion, 11=>1: Lion if num <= 0: raise Exception("Voices are not available in OS X below 10.7") if num == 1: num = '' else: num = '_%d' % num pkgs = [ '"VOICEID:com.apple...
Make voices example work on 10.7-10.9
Make voices example work on 10.7-10.9
Python
mit
mkuron/PredicateInstaller
cc76b7658a62528137f14733731b6b3f3a541384
booster_bdd/features/steps/stackAnalyses.py
booster_bdd/features/steps/stackAnalyses.py
from behave import when, then from features.src.support import helpers from features.src.stackAnalyses import StackAnalyses from pyshould import should_not @when(u'I send Maven package manifest pom-effective.xml to stack analysis') def when_send_manifest(context): global sa sa = StackAnalyses() spaceName...
from behave import when, then from features.src.support import helpers from features.src.stackAnalyses import StackAnalyses from pyshould import should_not @when(u'I send Maven package manifest pom-effective.xml to stack analysis') def when_send_manifest(context): sa = StackAnalyses() spaceName = helpers.get...
Store stack analysis in the context
Store stack analysis in the context
Python
apache-2.0
ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test
2551415469854dbaaff3bf1033904df6e477bbf7
readthedocs/projects/migrations/0007_migrate_canonical_data.py
readthedocs/projects/migrations/0007_migrate_canonical_data.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def migrate_canonical(apps, schema_editor): Project = apps.get_model("projects", "Project") for project in Project.objects.all(): if project.canonical_url: domain = project.domains.create( ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def migrate_canonical(apps, schema_editor): Project = apps.get_model("projects", "Project") for project in Project.objects.all(): if project.canonical_url: try: domain = projec...
Make canonical domain transition more smooth
Make canonical domain transition more smooth
Python
mit
techtonik/readthedocs.org,clarkperkins/readthedocs.org,pombredanne/readthedocs.org,stevepiercy/readthedocs.org,pombredanne/readthedocs.org,SteveViss/readthedocs.org,rtfd/readthedocs.org,techtonik/readthedocs.org,rtfd/readthedocs.org,wijerasa/readthedocs.org,rtfd/readthedocs.org,stevepiercy/readthedocs.org,stevepiercy/r...
548fb65618dfce8aa43671f79231628a773a8f88
imagekit/admin.py
imagekit/admin.py
from django.utils.translation import ugettext_lazy as _ from django.template.loader import render_to_string class AdminThumbnail(object): """ A convenience utility for adding thumbnails to Django's admin change list. """ short_description = _('Thumbnail') allow_tags = True def __init__(self,...
from django.utils.translation import ugettext_lazy as _ from django.template.loader import render_to_string class AdminThumbnail(object): """ A convenience utility for adding thumbnails to Django's admin change list. """ short_description = _('Thumbnail') allow_tags = True def __init__(self,...
Allow callables for AdminThumbnail image_field arg
Allow callables for AdminThumbnail image_field arg This allows images from related models to be displayed. Closes #138.
Python
bsd-3-clause
pcompassion/django-imagekit,pcompassion/django-imagekit,tawanda/django-imagekit,pcompassion/django-imagekit,tawanda/django-imagekit,FundedByMe/django-imagekit,FundedByMe/django-imagekit
018baf83b5293799c8f79652c902aa0fa752161e
pysswords/credential.py
pysswords/credential.py
import os class Credential(object): def __init__(self, name, login, password, comments): self.name = name self.login = login self.password = password self.comments = comments def save(self, database_path): credential_path = os.path.join(database_path, self.name) ...
import os class Credential(object): def __init__(self, name, login, password, comments): self.name = name self.login = login self.password = password self.comments = comments def save(self, database_path): credential_path = os.path.join(database_path, self.name) ...
Reformat string representation of Credentials
Reformat string representation of Credentials
Python
mit
eiginn/passpie,marcwebbie/passpie,marcwebbie/pysswords,scorphus/passpie,eiginn/passpie,marcwebbie/passpie,scorphus/passpie
381ad771134a68f8b83277c2c91aeb199ba6ff96
telemetry/telemetry/web_perf/timeline_based_page_test.py
telemetry/telemetry/web_perf/timeline_based_page_test.py
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page_test class TimelineBasedPageTest(page_test.PageTest): """Page test that collects metrics with TimelineBasedMeasurement...
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page_test class TimelineBasedPageTest(page_test.PageTest): """Page test that collects metrics with TimelineBasedMeasurement...
Fix browser restart in TimelineBasedPageTest
[Telemetry] Fix browser restart in TimelineBasedPageTest The TimelineBasedPageTest constructor was passing in error a string where its parent constructor expects a Boolean value for the needs_browser_restart_after_each_page option. BUG=504368 Review URL: https://codereview.chromium.org/1206323002 Cr-Commit-Position...
Python
bsd-3-clause
SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,benschmaus/catapult,sahiljain/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult,SummerLW/P...
d9024a447ab097e2becd9444d42b7639389e2846
mail/app/handlers/amqp.py
mail/app/handlers/amqp.py
import logging from carrot.messaging import Publisher from carrot.connection import BrokerConnection from lamson.routing import route, route_like, stateless from config.settings import relay from lamson import view, queue @route("forge-list@(host)") #@route("(post_name)@osb\\.(host)") @stateless def POSTING(message...
import logging from carrot.messaging import Publisher from carrot.connection import BrokerConnection from lamson.routing import route, route_like, stateless from config.settings import relay from lamson import view, queue @route("forge-list@(host)") #@route("(post_name)@osb\\.(host)") @stateless def POSTING(message...
Change carrot serialization from JSON to 'pickle'
Change carrot serialization from JSON to 'pickle'
Python
apache-2.0
leotrubach/sourceforge-allura,Bitergia/allura,apache/allura,Bitergia/allura,lym/allura-git,apache/allura,apache/allura,apache/incubator-allura,leotrubach/sourceforge-allura,heiths/allura,apache/allura,Bitergia/allura,leotrubach/sourceforge-allura,Bitergia/allura,heiths/allura,leotrubach/sourceforge-allura,Bitergia/allu...
91735062c85ccf852792b2a0c6509044b90c99c0
tests/test_listener.py
tests/test_listener.py
#!/usr/bin/env python import pytest import pg_bawler.core def test_register_handlers(): listener = pg_bawler.core.ListenerMixin() assert listener.register_handler(None) == 0 assert listener.register_handler(True) == 1 assert listener.unregister_handler(None) assert not listener.unregister_handler...
#!/usr/bin/env python import os import pytest import pg_bawler.core def test_register_handlers(): listener = pg_bawler.core.ListenerMixin() assert listener.register_handler(None) == 0 assert listener.register_handler(True) == 1 assert listener.unregister_handler(None) assert not listener.unregis...
Use env variables for postgres conn in tests
Use env variables for postgres conn in tests
Python
bsd-3-clause
beezz/pg_bawler,beezz/pg_bawler
2c9343ed11ffff699f53fb99a444a90cca943070
tests/triangle_test.py
tests/triangle_test.py
import numpy as np import triangle import astropy.io.ascii as ascii import matplotlib.pyplot as plt pyout = ascii.read('test.pyout') idlout = ascii.read('test.idlout') fig, axarr = plt.subplots(9, 9, figsize=(10, 10)) fig.suptitle("Black = python, red = IDL") triangle.corner(np.array([pyout['alpha'], pyout['beta'], p...
import numpy as np import corner import astropy.io.ascii as ascii import matplotlib.pyplot as plt pyout = ascii.read('test.pyout') idlout = ascii.read('test.idlout') fig, axarr = plt.subplots(9, 9, figsize=(10, 10)) fig.suptitle("Black = python, red = IDL") corner.corner(np.array([pyout['alpha'], pyout['beta'], pyout...
Use updated corner plot API
Use updated corner plot API
Python
bsd-2-clause
jmeyers314/linmix
86e6cb5e32b9698fad734da9ce4c2be8dea586e0
resolverapi/__init__.py
resolverapi/__init__.py
import os from flask import Flask from flask_restful import Api from dns.resolver import Resolver from flask_cors import CORS dns_resolver = Resolver() def create_app(config_name): app = Flask(__name__) if config_name == 'dev': app.config.from_object('resolverapi.config.DevelopmentConfig') else...
import os from flask import Flask, jsonify from flask_restful import Api from dns.resolver import Resolver from flask_cors import CORS dns_resolver = Resolver() def create_app(config_name): app = Flask(__name__) if config_name == 'dev': app.config.from_object('resolverapi.config.DevelopmentConfig')...
Create root page for api.openresolve.com
Create root page for api.openresolve.com
Python
bsd-2-clause
opendns/OpenResolve
22c8428392e83e33552dbe9df82cc4647311cd8f
common/settings.py
common/settings.py
import optparse, os, pickle config = {'charity':False, 'propagate_factor':2, 'accept_latency':2000} def setup(): parser = optparse.OptionParser() parser.add_option('-c', '--charity', dest='charity', default=None, a...
import optparse, os, pickle config = {'charity':False, 'propagate_factor':2, 'accept_latency':2000} def setup(): parser = optparse.OptionParser() parser.add_option('-c', '--charity', dest='charity', default=None, a...
Add primitive server option for easier debugging
Add primitive server option for easier debugging
Python
mit
gappleto97/Senior-Project
c1daf2130c20cedbe18c4c5e58584960f8ffc239
serve.py
serve.py
import sys from http.server import HTTPServer, BaseHTTPRequestHandler class MyHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): client_ip = self.client_address[0] if client_ip == '127.0.0.1' and 'X-Real-IP' in self.headers: client_ip = self.headers['X-Real-IP'] s...
import json from string import capwords import sys from http.server import HTTPServer, BaseHTTPRequestHandler import ssl import urllib.request class MyHTTPRequestHandler(BaseHTTPRequestHandler): def __tabulate_results(self, json_obj): table = '' for k, v in json_obj.items(): table +=...
Add URI param that queries freegeoip
Add URI param that queries freegeoip
Python
mit
afreeorange/what-is-my-ip
d16c99033f10be0b35a3d2bb18914d364c51b677
metro_sale/sale_product.py
metro_sale/sale_product.py
# -*- encoding: utf-8 -*- from osv import fields,osv #the ID for the purchase requisition and the material request class sale_product(osv.osv): _name = "sale.product" _description = "Sale Product" _columns = { 'name': fields.char('ID', size=32, required=True), 'note': fields.char('Descriptio...
# -*- encoding: utf-8 -*- from osv import fields,osv #the ID for the purchase requisition and the material request class sale_product(osv.osv): _name = "sale.product" _description = "Sale Product" _columns = { 'name': fields.char('ID', size=32, required=True), 'note': fields.char('Descriptio...
Add the ID unique constraint
Add the ID unique constraint
Python
agpl-3.0
john-wang-metro/metro-openerp,837278709/metro-openerp,john-wang-metro/metro-openerp,837278709/metro-openerp,john-wang-metro/metro-openerp,837278709/metro-openerp
ce077d09ec680dcb0aaadd8f58ec9d3f9ad3263a
app/soc/modules/gci/views/common_templates.py
app/soc/modules/gci/views/common_templates.py
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Use the refactored timeline helpers for remaining time.
Use the refactored timeline helpers for remaining time.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
3ee9bcc4b4322ba2464cb5f954da4f29de388ef9
gateware/info/__init__.py
gateware/info/__init__.py
""" Module for info embedded in the gateware / board. """ from litex.build.generic_platform import ConstraintError from litex.gen import * from litex.soc.interconnect.csr import * from gateware.info import git from gateware.info import dna from gateware.info import platform as platform_info class Info(Module, AutoC...
""" Module for info embedded in the gateware / board. """ from litex.build.generic_platform import ConstraintError from litex.gen import * from litex.soc.interconnect.csr import * from gateware.info import git from gateware.info import dna from gateware.info import xadc from gateware.info import platform as platform_...
Add xadc if device supports it.
gateware: Add xadc if device supports it.
Python
bsd-2-clause
cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware
94b757e2132c1fe59cd2c80d7d7b29aad125d471
tests/graph_test.py
tests/graph_test.py
from mythril.analysis.callgraph import generate_graph from mythril.analysis.symbolic import SymExecWrapper from mythril.ethereum import util from mythril.solidity.soliditycontract import EVMContract from tests import ( BaseTestCase, TESTDATA_INPUTS, TESTDATA_OUTPUTS_EXPECTED, TESTDATA_OUTPUTS_CURRENT, )...
from mythril.analysis.callgraph import generate_graph from mythril.analysis.symbolic import SymExecWrapper from mythril.ethereum import util from mythril.solidity.soliditycontract import EVMContract from tests import ( BaseTestCase, TESTDATA_INPUTS, TESTDATA_OUTPUTS_EXPECTED, TESTDATA_OUTPUTS_CURRENT, )...
Set execution timeout to be lower
Set execution timeout to be lower Otherwise the test would be much slower
Python
mit
b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril
8e68d7fab7b39828c31da734c8f47305c49e3fdd
twitterbot.py
twitterbot.py
import tweepy import time class TwitterBot: def __init__(self, auth, listen_msg, response_msg): auth = tweepy.OAuthHandler(auth['consumer_key'], auth['consumer_secret']) auth.set_access_token(auth['access_token'], auth['access_token_secret']) self.api = tweepy.API(auth) self.respon...
import tweepy import time class TwitterBot: def __init__(self, auth, listen_msg, response_msg): auth = tweepy.OAuthHandler(auth['consumer_key'], auth['consumer_secret']) auth.set_access_token(auth['access_token'], auth['access_token_secret']) self.api = tweepy.API(auth) self.respon...
Update Tweet method for api change
Update Tweet method for api change
Python
mit
kshvmdn/twitter-autoreply,kshvmdn/twitter-birthday-responder,kshvmdn/TwitterBirthdayResponder
5ff18f77dd3f38c7209e2b7bca1f2f84d002b00a
tools/glidein_ls.py
tools/glidein_ls.py
#!/bin/env python # # glidein_ls # # Execute a ls command on the job directory # # Usage: # glidein_ls.py <cluster>.<process> [-name <schedd_name>] [-pool <pool_name> ] [-timeout <nr secs> # import os import string import stat import sys sys.path.append("lib") sys.path.append("../lib") import glideinMonitor def cre...
#!/bin/env python # # condor_ls # # Description: # Execute a ls command on a condor job working directory # # Usage: # glidein_ls.py <cluster>.<process> [<dir>] [-name <schedd_name>] [-pool <pool_name> ] [-timeout <nr secs>] # # Author: # Igor Sfiligoi (May 2007) # # License: # Fermitools # import os,os.path imp...
Change rel paths into abspaths
Change rel paths into abspaths
Python
bsd-3-clause
bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS,holzman/glideinwms-old,holzman/glideinwms-old,bbockelm/glideinWMS
9c0d1f252bad1837545fa848c39786a98e6fd0ea
setup.py
setup.py
from distutils.core import setup setup( name='xirvik-tools', version='0.0.1', author='Fa An', author_email='2998784916@qq.com', packages=['xirvik'], url='https://faan/xirvik-tools', license='LICENSE.txt', description='Xirvik (ruTorrent mostly) tools.', long_description=open('README....
from distutils.core import setup setup( name='xirvik-tools', version='0.0.2', author='Fa An', author_email='2998784916@qq.com', packages=['xirvik', 'xirvik.client'], url='https://faan/xirvik-tools', license='LICENSE.txt', description='Xirvik (ruTorrent mostly) tools.', long_descript...
Add client part of package
Add client part of package
Python
mit
Tatsh/xirvik-tools
663d0674ebdfd2f4ea5483479890e3a762d57755
l10n_ar_aeroo_sale/__openerp__.py
l10n_ar_aeroo_sale/__openerp__.py
# -*- coding: utf-8 -*- { 'name': 'Argentinian Like Sale Order Aeroo Report', 'version': '1.0', 'category': 'Localization/Argentina', 'sequence': 14, 'summary': '', 'description': """ Argentinian Like Sale Order / Quotation Aeroo Report ==================================================== ""...
# -*- coding: utf-8 -*- { 'name': 'Argentinian Like Sale Order Aeroo Report', 'version': '1.0', 'category': 'Localization/Argentina', 'sequence': 14, 'summary': '', 'description': """ Argentinian Like Sale Order / Quotation Aeroo Report ==================================================== ""...
FIX dependency on aeroo rpoert
FIX dependency on aeroo rpoert
Python
agpl-3.0
bmya/odoo-argentina,ingadhoc/odoo-argentina,jobiols/odoo-argentina,bmya/odoo-argentina,adhoc-dev/odoo-argentina,adrianpaesani/odoo-argentina,jobiols/odoo-argentina,adrianpaesani/odoo-argentina,adhoc-dev/odoo-argentina
0b3220b0e212bba1dd197e6d2304249142b332c8
presentationsapp/views.py
presentationsapp/views.py
from django.shortcuts import render, redirect from models import * # Create your views here. def index(req): return render(req, "landing.html", {'request': req}) def login(req): return render(req, "login.html", {'request': req}) def register(req): if req.method == 'POST': try: user = User(email = req.POST[...
from django.shortcuts import render, redirect from models import * # Create your views here. def index(req): return render(req, "landing.html", {'request': req}) def login(req): if req.method == 'POST': try: user = User.objects.get(email = req.POST['email']) if user.check_password(req.POST['password']): ...
Add save for registration & login logic
Add save for registration & login logic
Python
mit
masonsbro/presentations