commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
0b452dca8c517b180df037fafc52f6e2b09811c1 | fix class name | rrooij/LibreRead,rrooij/LibreRead,rrooij/LibreRead | books/forms.py | books/forms.py | from django.forms import ModelForm
from .models import BookReader, User
class UserForm(ModelForm):
class Meta:
model = User
class BookReaderForm(ModelForm):
class Meta:
model = BookReader
excluse = ['user']
| from django.forms import ModelForm
from .models import BookReader, User
class UserForm(ModelForm):
class Meta:
model = User
class BookReader(ModelForm):
class Meta:
model = BookReader
excluse = ['user']
| agpl-3.0 | Python |
f78ef9ff6094b23316a170cf8ae33056ba358aae | Remove a TODO | tdryer/feeder,tdryer/feeder | feedreader/handlers.py | feedreader/handlers.py | """APIRequestHandler subclasses for API endpoints."""
from tornado.web import HTTPError
from feedreader.api_request_handler import APIRequestHandler
class MainHandler(APIRequestHandler):
def get(self):
username = self.require_auth()
self.write({"message": "Hello world!"})
class UsersHandler(A... | """APIRequestHandler subclasses for API endpoints."""
from tornado.web import HTTPError
from feedreader.api_request_handler import APIRequestHandler
class MainHandler(APIRequestHandler):
def get(self):
username = self.require_auth()
self.write({"message": "Hello world!"})
class UsersHandler(A... | mit | Python |
cd37746924a6b6b94afd044688c4a2554d0f50d1 | fix variable name for id | freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net | import.py | import.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, db, Request
from glob import glob
from sqlalchemy.exc import IntegrityError
from OpenSSL import crypto
from datetime import datetime
for path in glob("{}/freifunk_*.crt".format(app.config['DIRECTORY'])):
with open(path) as certfile:
print(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, db, Request
from glob import glob
from sqlalchemy.exc import IntegrityError
from OpenSSL import crypto
from datetime import datetime
for path in glob("{}/freifunk_*.crt".format(app.config['DIRECTORY'])):
with open(path) as certfile:
print(... | mit | Python |
d4da07688c0b1244bad24c26483a0f1b94a8fab0 | remove that filtering option | creimers/graphene-advent,creimers/graphene-advent | src/apps/calendar/schema.py | src/apps/calendar/schema.py | from graphene import relay, AbstractType, String
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from .models import Calendar, Day
class CalendarNode(DjangoObjectType):
"""
how does this work?
"""
class Meta:
model = Calendar
... | from graphene import relay, AbstractType, String
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from .models import Calendar, Day
class CalendarNode(DjangoObjectType):
"""
how does this work?
"""
class Meta:
model = Calendar
... | mit | Python |
4a30762680fd3ee9b95795f39e10e15faf4279e8 | remove language intolerance | fsufitch/discord-boar-bot,fsufitch/discord-boar-bot | src/boarbot/modules/echo.py | src/boarbot/modules/echo.py | import discord
from boarbot.common.botmodule import BotModule
from boarbot.common.events import EventType
class EchoModule(BotModule):
async def handle_event(self, event_type, args):
if event_type == EventType.MESSAGE:
await self.echo(args[0])
async def echo(self, message: discord.Message... | import discord
from boarbot.common.botmodule import BotModule
from boarbot.common.events import EventType
class EchoModule(BotModule):
async def handle_event(self, event_type, args):
if event_type == EventType.MESSAGE:
await self.echo(args[0])
async def echo(self, message: discord.Message... | mit | Python |
e8d0c7f678689c15049186360c08922be493587a | Remove non-existant flask.current_app.debug doc ref. | mbr/flask-nav,mbr/flask-nav | flask_nav/renderers.py | flask_nav/renderers.py | from flask import current_app
from dominate import tags
from visitor import Visitor
class Renderer(Visitor):
"""Base interface for navigation renderers.
Visiting a node should return a string or an object that converts to a
string containing HTML."""
def visit_object(self, node):
"""Fallbac... | from flask import current_app
from dominate import tags
from visitor import Visitor
class Renderer(Visitor):
"""Base interface for navigation renderers.
Visiting a node should return a string or an object that converts to a
string containing HTML."""
def visit_object(self, node):
"""Fallbac... | mit | Python |
f6df8c05d247650f4899d1101c553230a60ccc70 | Improve registration response messages | mattgreen/fogeybot | fogeybot/cogs/users.py | fogeybot/cogs/users.py | from discord.ext.commands import command
class UserCommands(object):
def __init__(self, bot, api, db):
self.bot = bot
self.api = api
self.db = db
@command(description="Registers/updates your battle tag", pass_context=True)
async def register(self, ctx, battletag: str):
if '... | from discord.ext.commands import command
class UserCommands(object):
def __init__(self, bot, api, db):
self.bot = bot
self.api = api
self.db = db
@command(description="Registers/updates your battle tag", pass_context=True)
async def register(self, ctx, battletag: str):
if '... | mit | Python |
db711fe24ffff78d21db3af8e437dc2f2f1b48a7 | Add space at top of class bruteforce_ssh_pyes | mpurzynski/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,mozilla/MozDef,mpurzynski/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,ameihm0912/M... | alerts/bruteforce_ssh_pyes.py | alerts/bruteforce_ssh_pyes.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
# Je... | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
# Je... | mpl-2.0 | Python |
b1b33a778d7abca2aa29e9612b6a75ff4aa7d64f | add UnboundError to actionAngle | jobovy/galpy,jobovy/galpy,followthesheep/galpy,jobovy/galpy,followthesheep/galpy,jobovy/galpy,followthesheep/galpy,followthesheep/galpy | galpy/actionAngle_src/actionAngle.py | galpy/actionAngle_src/actionAngle.py | import math as m
class actionAngle:
"""Top-level class for actionAngle classes"""
def __init__(self,*args,**kwargs):
"""
NAME:
__init__
PURPOSE:
initialize an actionAngle object
INPUT:
OUTPUT:
HISTORY:
2010-07-11 - Written - Bovy (... | import math as m
class actionAngle:
"""Top-level class for actionAngle classes"""
def __init__(self,*args,**kwargs):
"""
NAME:
__init__
PURPOSE:
initialize an actionAngle object
INPUT:
OUTPUT:
HISTORY:
2010-07-11 - Written - Bovy (... | bsd-3-clause | Python |
a0af5dc1478fe8b639cc5a37898ad180f1f20a89 | Add --midi option to CLI | accraze/python-twelve-tone | src/twelve_tone/cli.py | src/twelve_tone/cli.py | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mtwelve_tone` python will execute
``__main__.py`` as ... | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mtwelve_tone` python will execute
``__main__.py`` as ... | bsd-2-clause | Python |
81612e20e327b4b4eabb4c77201dd6b8d2d21e93 | Add get_default getter to config. | riga/law,riga/law | law/config.py | law/config.py | # -*- coding: utf-8 -*-
"""
law Config interface.
"""
__all__ = ["Config"]
import os
import tempfile
import six
from six.moves.configparser import ConfigParser
class Config(ConfigParser):
_instance = None
_default_config = {
"core": {
"db_file": os.environ.get("LAW_DB_FILE", os.pat... | # -*- coding: utf-8 -*-
"""
law Config interface.
"""
__all__ = ["Config"]
import os
import tempfile
import six
from six.moves.configparser import ConfigParser
class Config(ConfigParser):
_instance = None
_default_config = {
"core": {
"db_file": os.environ.get("LAW_DB_FILE", os.pat... | bsd-3-clause | Python |
67444868b1c7c50da6d490893d72991b65b2aa7b | Add superlance supervisord plugin | datastax/cstar_perf,mambocab/cstar_perf,datastax/cstar_perf,mambocab/cstar_perf,mambocab/cstar_perf,datastax/cstar_perf,datastax/cstar_perf,mambocab/cstar_perf | frontend/setup.py | frontend/setup.py | import sys
from setuptools import setup, find_packages
requires = (
'flask',
'Flask-Script',
'flask_sockets',
'gunicorn',
'cassandra-driver',
'google-api-python-client',
'ecdsa',
'daemonize',
'websocket-client',
'pyzmq',
'fabric',
'pyyaml',
'supervisor',
'pexpect... | import sys
from setuptools import setup, find_packages
requires = (
'flask',
'Flask-Script',
'flask_sockets',
'gunicorn',
'cassandra-driver',
'google-api-python-client',
'ecdsa',
'daemonize',
'websocket-client',
'pyzmq',
'fabric',
'pyyaml',
'supervisor',
'pexpect... | apache-2.0 | Python |
a16cda69c2ec0e96bf5b5a558e288d22b353f28f | change work folder before build | Roland0511/slua,Roland0511/slua,Roland0511/slua,Roland0511/slua,Roland0511/slua,Roland0511/slua | build/build.py | build/build.py | #!/usr/bin/env python2.7
# coding=utf-8
import subprocess
import platform
import os
import sys
def build(platform):
print("[Start Build] Target Platform: " + platform)
build_folder = os.path.split(os.path.realpath(__file__))[0]
#change folder
os.chdir(build_folder)
build_script = ""
if platfo... | #!/usr/bin/env python2.7
# coding=utf-8
import subprocess
import platform
import os
import sys
def build(platform):
print("[Start Build] Target Platform: " + platform)
build_script = ""
if platform == "windows":
build_script = "make_win_with_2015_static.bat"
subprocess.Popen(["cmd.exe","/C"... | mit | Python |
b70d3c2c75befe747079697a66b1bb417749e786 | Update Workflow: add abstract method .on_failure() | botify-labs/simpleflow,botify-labs/simpleflow | simpleflow/workflow.py | simpleflow/workflow.py | from __future__ import absolute_import
class Workflow(object):
"""
Main interface to define a workflow by submitting tasks for asynchronous
execution.
The actual behavior depends on the executor backend.
"""
def __init__(self, executor):
self._executor = executor
def submit(self... | from __future__ import absolute_import
class Workflow(object):
"""
Main interface to define a workflow by submitting tasks for asynchronous
execution.
The actual behavior depends on the executor backend.
"""
def __init__(self, executor):
self._executor = executor
def submit(self... | mit | Python |
7a5cb953f64dce841d88b9c8b45be7719c617ba2 | Fix games init file | kevinwilde/WildeBot,kevinwilde/WildeBot,kevinwilde/WildeBot,kevinwilde/WildeBot | games/__init__.py | games/__init__.py | import Game
import Mancala
import Player
import TicTacToe | __all__ = ['Game', 'Mancala', 'Player', 'TicTacToe'] | mit | Python |
147c85aff3e93ebb39d984a05cec970b3dc7edc0 | Add expires_at field to jwt that was removed accidentally (#242) | ONSdigital/ras-frontstage,ONSdigital/ras-frontstage,ONSdigital/ras-frontstage | frontstage/jwt.py | frontstage/jwt.py | """
Module to create jwt token.
"""
from datetime import datetime, timedelta
from jose import jwt
from frontstage import app
def timestamp_token(token):
"""Time stamp the expires_in argument of the OAuth2 token. And replace with an expires_in UTC timestamp"""
current_time = datetime.now()
expires_in = ... | """
Module to create jwt token.
"""
from datetime import datetime, timedelta
from jose import jwt
from frontstage import app
def timestamp_token(token):
"""Time stamp the expires_in argument of the OAuth2 token. And replace with an expires_in UTC timestamp"""
current_time = datetime.now()
expires_in = ... | mit | Python |
e8b49384d3e9e23485199ef131f0cb8f818a2a02 | edit default port | patricklam/get-image-part | get-image-part.py | get-image-part.py | import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os
from PIL import Image
N = 20
class MainHandler(tornado.web.RequestHandler):
def get(self):
n = int(random.uniform(0,N))
img = int(self.get_argument("img"))
fn = os.path.join(os.path.d... | import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os
from PIL import Image
N = 20
class MainHandler(tornado.web.RequestHandler):
def get(self):
n = int(random.uniform(0,N))
img = int(self.get_argument("img"))
fn = os.path.join(os.path.d... | bsd-2-clause | Python |
3e33a94580d386be71298bcc7fb2d4a4bc19dd34 | apply only the unified diff instead of the whole file | balabit/git-magic,balabit/git-magic | gitmagic/fixup.py | gitmagic/fixup.py | import gitmagic
from git.cmd import Git
from io import import StringIO
def fixup(repo, destination_picker, change_finder, args={}):
repo.index.reset()
for change in change_finder(repo):
_apply_change(repo, change)
destination_commits = destination_picker.pick(change)
if not destination_... | import gitmagic
def fixup(repo, destination_picker, change_finder, args={}):
repo.index.reset()
for change in change_finder(repo):
_apply_change(repo, change)
destination_commits = destination_picker.pick(change)
if not destination_commits:
repo.index.commit( message = "WARN... | mit | Python |
eb642e63cd32b972ccdec4f487b9a7e2e7cb17b5 | make product_change_type template filter work with hidden plans | romonzaman/django-billing,gabrielgrant/django-billing,romonzaman/django-billing,gabrielgrant/django-billing | billing/templatetags/billing_tags.py | billing/templatetags/billing_tags.py | from django import template
import billing.loading
from pricing.products import Product
register = template.Library()
@register.filter
def product_change_type(product, user):
upc = user.billing_account.get_current_product_class()
if isinstance(product, Product):
product = type(product)
if upc:
... | from django import template
import billing.loading
from pricing.products import Product
register = template.Library()
@register.filter
def product_change_type(product, user):
upc = user.billing_account.get_current_product_class()
if isinstance(product, Product):
product = type(product)
if upc:
... | agpl-3.0 | Python |
bf188dfae49ab23c8f5dd7eeb105951f6c068b7f | Add filtering by is_circle to Role admin. | wearespindle/flindt,wearespindle/flindt,wearespindle/flindt | backend/feedbag/role/admin.py | backend/feedbag/role/admin.py | from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import Role
class IsCircleListFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _('Is Circle')
# Parameter... | from django.contrib import admin
from .models import Role
@admin.register(Role)
class RoleAdmin(admin.ModelAdmin):
list_display = ('name',
'is_circle',
'parent',
'purpose',
'archived',
)
list_filter = ('archiv... | agpl-3.0 | Python |
0fac23c22307ca598e0cc6712280903c2a7d559d | Improve auto battle module | mythnc/gbf-bot | gbf_bot/auto_battle.py | gbf_bot/auto_battle.py | import logging
import random
import time
import pyautogui
from . import top_left, window_size
from . import auto_battle_config as config
from . import utility
from .components import Button
logger = logging.getLogger(__name__)
attack = Button('attack.png', config['attack'])
auto = Button('auto.png', config['auto'])
... | import logging
import random
import time
import pyautogui
from . import auto_battle_config as config
from .components import Button
logger = logging.getLogger(__name__)
attack = Button('attack.png', config['attack'])
auto = Button('auto.png', config['auto'])
def activate(battle_time):
pyautogui.PAUSE = 1.3
... | mit | Python |
d37c2328a8ed58778f4c39091add317878831b4e | increment version | gbrammer/grizli | grizli/version.py | grizli/version.py | # git describe --tags
__version__ = "0.7.0-47-g6450ea1"
| # git describe --tags
__version__ = "0.7.0-41-g39ad8ff"
| mit | Python |
d30d10a477f0b46fa73da76cb1b010e1376c3ff2 | Update version for a new PYPI package. | guillemborrell/gtable | gtable/version.py | gtable/version.py | __version__ = '0.7'
| __version__ = '0.6.2'
| bsd-3-clause | Python |
f9dadd363d9f370d884c0b127e1f63df8916f3c8 | Rename some functions | franzpl/sweep,spatialaudio/sweep | calculation.py | calculation.py | """Calculation functions."""
from __future__ import division
import numpy as np
from . import plotting
import matplotlib.pyplot as plt
from scipy.signal import butter, freqz
def deconv_process(excitation, system_response, fs):
"""Deconvolution.
It is a necessity to zeropadd the excitation signal
to avoid... | """Calculation functions."""
from __future__ import division
import numpy as np
from scipy.signal import butter, freqz
def deconv_process(excitation, system_response, fs):
"""Deconvolution.
It is a necessity to zeropadd the excitation signal
to avoid zircular artifacts, if the system response is longer
... | mit | Python |
88f36912de48a84e4e3778889948f85655ba9064 | Remove token logging | maxgoedjen/canis | canis/oauth.py | canis/oauth.py | from os import environ
from urllib import urlencode
from datetime import datetime, timedelta
from flask import Flask, request, redirect
import requests
app = Flask(__name__)
SPOTIFY_CLIENT_ID = environ['CANIS_SPOTIFY_API_CLIENT_ID']
SPOTIFY_SECRET = environ['CANIS_SPOTIFY_API_SECRET']
SPOTIFY_CALLBACK = environ.get(... | from os import environ
from urllib import urlencode
from datetime import datetime, timedelta
from flask import Flask, request, redirect
import requests
app = Flask(__name__)
SPOTIFY_CLIENT_ID = environ['CANIS_SPOTIFY_API_CLIENT_ID']
SPOTIFY_SECRET = environ['CANIS_SPOTIFY_API_SECRET']
SPOTIFY_CALLBACK = environ.get(... | mit | Python |
1391dd0b084f2c26fd5d0afceb81ffb5daab5dcf | Remove path and user filter from admin | aschn/drf-tracking,frankie567/drf-tracking | rest_framework_tracking/admin.py | rest_framework_tracking/admin.py | from django.contrib import admin
from .models import APIRequestLog
class APIRequestLogAdmin(admin.ModelAdmin):
date_hierarchy = 'requested_at'
list_display = ('id', 'requested_at', 'response_ms', 'status_code',
'user', 'method',
'path', 'remote_addr', 'host',
... | from django.contrib import admin
from .models import APIRequestLog
class APIRequestLogAdmin(admin.ModelAdmin):
date_hierarchy = 'requested_at'
list_display = ('id', 'requested_at', 'response_ms', 'status_code',
'user', 'method',
'path', 'remote_addr', 'host',
... | isc | Python |
ad4b5ccf7c89fa67e69d065c47edaa9e18c009ee | add docstrings add if __name__ == '__main__': to make pydoc work | unseenlaser/machinekit,bobvanderlinden/machinekit,ArcEye/machinekit-testing,kinsamanka/machinekit,cdsteinkuehler/linuxcnc,kinsamanka/machinekit,mhaberler/machinekit,ianmcmahon/linuxcnc-mirror,bobvanderlinden/machinekit,araisrobo/linuxcnc,kinsamanka/machinekit,bobvanderlinden/machinekit,bmwiedemann/linuxcnc-mirror,arais... | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | lgpl-2.1 | Python |
214b1882a0eaf00bdd5dedbb02a28bba7f8d247b | update version to 1.1.7 | cartologic/cartoview,cartologic/cartoview,cartologic/cartoview,cartologic/cartoview | cartoview/__init__.py | cartoview/__init__.py | __version__ = (1, 1, 7, 'alpha', 0)
| __version__ = (1, 1, 5, 'alpha', 0)
| bsd-2-clause | Python |
455e1fe93b612c7049059cf217652862c995fe97 | Replace dict(<list_comprehension>) pattern with dict comprehension | bmihelac/django-import-export,copperleaftech/django-import-export,django-import-export/django-import-export,jnns/django-import-export,django-import-export/django-import-export,bmihelac/django-import-export,daniell/django-import-export,jnns/django-import-export,daniell/django-import-export,jnns/django-import-export,copp... | import_export/instance_loaders.py | import_export/instance_loaders.py | from __future__ import unicode_literals
class BaseInstanceLoader(object):
"""
Base abstract implementation of instance loader.
"""
def __init__(self, resource, dataset=None):
self.resource = resource
self.dataset = dataset
def get_instance(self, row):
raise NotImplemented... | from __future__ import unicode_literals
class BaseInstanceLoader(object):
"""
Base abstract implementation of instance loader.
"""
def __init__(self, resource, dataset=None):
self.resource = resource
self.dataset = dataset
def get_instance(self, row):
raise NotImplemented... | bsd-2-clause | Python |
ac8c1b6849c490c776636e3771e80344e6b0fb2e | Update github3.search.user for consistency | sigmavirus24/github3.py | github3/search/user.py | github3/search/user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import users
from ..models import GitHubCore
class UserSearchResult(GitHubCore):
"""Representation of a search result for a user.
This object has the following attributes:
.. attribute:: score
The confidence score of this ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import users
from ..models import GitHubCore
class UserSearchResult(GitHubCore):
def _update_attributes(self, data):
result = data.copy()
#: Score of the result
self.score = self._get_attribute(result, 'score')
... | bsd-3-clause | Python |
b15f401fe270b69e46fb3009c4d55c917736fb27 | Bump version | guildai/guild,guildai/guild,guildai/guild,guildai/guild | guild/__init__.py | guild/__init__.py | # Copyright 2017 TensorHub, 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 2017 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
156817ee4e11c6a363511d915a9ea5cf96e41fb5 | add statistics tracking | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | benchbuild/experiments/mse.py | benchbuild/experiments/mse.py | """
Test Maximal Static Expansion.
This tests the maximal static expansion implementation by
Nicholas Bonfante (implemented in LLVM/Polly).
"""
from benchbuild.extensions import ExtractCompileStats
from benchbuild.experiment import RuntimeExperiment
from benchbuild.extensions import RunWithTime, RuntimeExtension
from ... | """
Test Maximal Static Expansion.
This tests the maximal static expansion implementation by
Nicholas Bonfante (implemented in LLVM/Polly).
"""
from benchbuild.experiment import RuntimeExperiment
from benchbuild.extensions import RunWithTime, RuntimeExtension
from benchbuild.settings import CFG
class PollyMSE(Runtim... | mit | Python |
8a178f1249b968e315b8492ed15c033aca119033 | Reset closed site property | jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | bluebottle/clients/tests/test_api.py | bluebottle/clients/tests/test_api.py | from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from rest_framework import status
from bluebottle.clients import properties
from bluebottle.test.utils import BluebottleTestCase
class ClientSettingsTestCase(BluebottleTestCase):
def setUp(self):
super(ClientSet... | from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from rest_framework import status
from bluebottle.clients import properties
from bluebottle.test.utils import BluebottleTestCase
class ClientSettingsTestCase(BluebottleTestCase):
def setUp(self):
super(ClientSet... | bsd-3-clause | Python |
e469163c5b103483b294f9c1f37c918177e7dbce | Make prsync.py really useful | angr/angr-dev,angr/angr-dev | admin/prsync.py | admin/prsync.py | #!/usr/bin/env python
import os
import sys
import subprocess
import urlparse
import pygithub3
try:
import angr
angr_dir = os.path.realpath(os.path.join(os.path.dirname(angr.__file__), '../..'))
except ImportError:
print 'Please run this script in the angr virtualenv!'
sys.exit(1)
def main(branch_nam... | #!/usr/bin/env python
import os
import sys
import subprocess
import urlparse
import pygithub3
try:
import angr
angr_dir = os.path.realpath(os.path.join(os.path.dirname(angr.__file__), '../..'))
except ImportError:
print 'Please run this script in the angr virtualenv!'
sys.exit(1)
def main(branch_nam... | bsd-2-clause | Python |
9f32fee9da5ccffec9a86f62ab9a55625eb65ff7 | Fix menu user input | dgengtek/scripts,dgengtek/scripts | admin/wakeup.py | admin/wakeup.py | #!/bin/env python3
from pathlib import Path
import subprocess
import logging
import sys
logger = logging.getLogger(__name__)
wol_path = "~/.config/wol.cfg"
# TODO query list from database when available
def main():
global wol_path
wol_path = Path(wol_path).expanduser()
# iterate wake on lan list, wollist
... | #!/bin/env python3
from pathlib import Path
import subprocess
def main():
main.path = Path(".config/wol.cfg")
main.path = main.path.home().joinpath(main.path)
# iterate wake on lan list, wollist
menu = generate_menulist(main.path)
if display_menu(menu):
hostname, hwadress = menu[main.user_c... | mit | Python |
3a3a8217bd5ff63c77eb4d386bda042cfd7a1196 | delete the depency to sale_order_extend | ClearCorp/odoo-clearcorp,ClearCorp/odoo-clearcorp,ClearCorp/odoo-clearcorp,ClearCorp/odoo-clearcorp | sale_order_report/__openerp__.py | sale_order_report/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Sale Order Report',
'summary': 'Sale order report in Qweb',
'version': '8.0.1.0',
'category': 'Sales',
'website': 'http://clearcorp.cr',
'author': 'ClearCorp',
'license'... | # -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Sale Order Report',
'summary': 'Sale order report in Qweb',
'version': '8.0.1.0',
'category': 'Sales',
'website': 'http://clearcorp.cr',
'author': 'ClearCorp',
'license'... | agpl-3.0 | Python |
7700e8b9a5a62fce875156482170c4fbc4cae902 | Update shortcut template | jeremykid/swjblog,jeremykid/swjblog,jeremykid/swjblog | swjblog/polls/views.py | swjblog/polls/views.py | from django.http import HttpResponse
from django.template import loader
from django.shortcuts import get_object_or_404, render
# Create your views here.
from .models import Question
# def index(request):
# latest_question_list = Question.objects.order_by('-pub_date')[:5]
# template = loader.get_template('po... | from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
# Create your views here.
from .models import Question
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
cont... | mit | Python |
0e780569b8d40f3b9599df4f7d4a457f23b3f54f | Make uploader work | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | stoneridge_uploader.py | stoneridge_uploader.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import glob
import os
import requests
import stoneridge
class StoneRidgeUploader(object):
""... | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import glob
import os
import human_curl as requests
import stoneridge
class StoneRidgeUploader(o... | mpl-2.0 | Python |
5b1790664ad5268a1d1764b81d1fa7e8fea5aabe | Bump version number. | markmuetz/stormtracks,markmuetz/stormtracks | stormtracks/version.py | stormtracks/version.py | VERSION = (0, 5, 0, 6, 'alpha')
def get_version(form='short'):
if form == 'short':
return '.'.join([str(v) for v in VERSION[:4]])
elif form == 'long':
return '.'.join([str(v) for v in VERSION][:4]) + '-' + VERSION[4]
else:
raise ValueError('unrecognised form specifier: {0}'.format(... | VERSION = (0, 5, 0, 5, 'alpha')
def get_version(form='short'):
if form == 'short':
return '.'.join([str(v) for v in VERSION[:4]])
elif form == 'long':
return '.'.join([str(v) for v in VERSION][:4]) + '-' + VERSION[4]
else:
raise ValueError('unrecognised form specifier: {0}'.format(... | mit | Python |
a82d419d17c67cfd7842cf104994b9ecbda96e94 | Delete existing libnccl before installing NCCL | GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nccl.py | perfkitbenchmarker/linux_packages/nccl.py | # Copyright 2018 PerfKitBenchmarker 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 appli... | # Copyright 2018 PerfKitBenchmarker 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 appli... | apache-2.0 | Python |
13ae8cf8eddba1cf40d89307ba1c52480cbac472 | Bump version | TheTrain2000/async2rewrite | async2rewrite/__init__.py | async2rewrite/__init__.py | """
Convert discord.py code using abstract syntax trees.
"""
__title__ = 'async2rewrite'
__author__ = 'Tyler Gibbs'
__version__ = '0.0.3'
__copyright__ = 'Copyright 2017 TheTrain2000'
__license__ = 'MIT'
from .main import *
| """
Convert discord.py code using abstract syntax trees.
"""
__title__ = 'async2rewrite'
__author__ = 'Tyler Gibbs'
__version__ = '0.0.2'
__copyright__ = 'Copyright 2017 TheTrain2000'
__license__ = 'MIT'
from .main import *
| mit | Python |
0639158e539f0f1c1a6d4dac1753179429257017 | add django_pluralize template filter | mozilla/source,ryanpitts/source,ryanpitts/source,ryanpitts/source,mozilla/source,ryanpitts/source,mozilla/source,mozilla/source | source/base/helpers.py | source/base/helpers.py | import datetime
import logging
import os
from django.conf import settings
from django.template.defaultfilters import linebreaks as django_linebreaks,\
escapejs as django_escapejs, pluralize as django_pluralize
from jingo import register
from sorl.thumbnail import get_thumbnail
logger = logging.getLogger('base.he... | import datetime
import logging
import os
from django.conf import settings
from django.template.defaultfilters import linebreaks as django_linebreaks,\
escapejs as django_escapejs
from jingo import register
from sorl.thumbnail import get_thumbnail
logger = logging.getLogger('base.helpers')
@register.filter
def l... | bsd-3-clause | Python |
aa4be6a435222003bf5e87df5c1f8d34394592fe | add celery conf | pyprism/Hiren-Git-Commit-Reminder,pyprism/Hiren-Git-Commit-Reminder | hiren/__init__.py | hiren/__init__.py | from github.celery import app as celery_app | mit | Python | |
9abe7a776c4b0a4995a1c3a3d16f02bcba93f12e | add sin flute | miltonsarria/dsp-python,miltonsarria/dsp-python,miltonsarria/dsp-python | audio/fourier_an_audio.py | audio/fourier_an_audio.py | #Milton Orlando Sarria
#analisis espectral de sinusoides
import matplotlib.pyplot as plt
import numpy as np
from fourierFunc import fourierAn
import wav_rw as wp
from scipy.signal import get_window
filename1='sound/flute-A4.wav'
filename2='sound/violin-B3.wav'
#leer los archivos de audio
fs,x1=wp.wavread(filename1)
... | #Milton Orlando Sarria
#analisis espectral de sinusoides
import matplotlib.pyplot as plt
import numpy as np
from fourierFunc import fourierAn
import wav_rw as wp
filename1='sound/flute-A4.wav'
filename2='sound/violin-B3.wav'
#leer los archivos de audio
fs,x1=wp.wavread(filename1)
fs,x2=wp.wavread(filename2)
t=(np.... | mit | Python |
53b43e51c4d073dae4f3ccad896ba1744ca1284b | Update version | edx/auth-backends | auth_backends/_version.py | auth_backends/_version.py | __version__ = '0.1.2' # pragma: no cover
| __version__ = '0.1.1' # pragma: no cover
| agpl-3.0 | Python |
2321ddb5f6d7731597f4f122a87041933348f064 | Enable Unicode tests | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/tests/test_unicode.py | gmn/src/d1_gmn/tests/test_unicode.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | apache-2.0 | Python |
3868a4ef30835ed1904a37318013e20f2295a8a9 | Remove fantastic from COB theme | City-of-Bloomington/ckanext-cob,City-of-Bloomington/ckanext-cob | ckanext/cob/plugin.py | ckanext/cob/plugin.py | import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
def groups():
# Return a list of groups
return toolkit.get_action('group_list')(data_dict={'all_fields': True})
def dataset_count():
# Return a count of all datasets
result = toolkit.get_action('package_search')(data_dict={'rows': 1... | import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
def groups():
# Return a list of groups
return toolkit.get_action('group_list')(data_dict={'all_fields': True})
def dataset_count():
# Return a count of all datasets
result = toolkit.get_action('package_search')(data_dict={'rows': 1... | agpl-3.0 | Python |
46c1c21c0190aa95f4fede8fa1d98bbae7cf38c5 | test mode defaults to true - fix for #21 | NaturalHistoryMuseum/ckanext-doi,NaturalHistoryMuseum/ckanext-doi,NaturalHistoryMuseum/ckanext-doi | ckanext/doi/config.py | ckanext/doi/config.py | #!/usr/bin/env python
# encoding: utf-8
"""
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
"""
from pylons import config
from paste.deploy.converters import asbool
TEST_PREFIX = '10.5072'
ENDPOINT = 'https://mds.datacite.org'
TEST_ENDPOINT = 'https://test.datacite.org/mds'
def g... | #!/usr/bin/env python
# encoding: utf-8
"""
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
"""
from pylons import config
from paste.deploy.converters import asbool
TEST_PREFIX = '10.5072'
ENDPOINT = 'https://mds.datacite.org'
TEST_ENDPOINT = 'https://test.datacite.org/mds'
def g... | mit | Python |
bf8ab86d536570790d135f0f46c97ffb30a83535 | update background_substraction.py | cmput402w2016/CMPUT402W16T2 | background_subtraction.py | background_subtraction.py | # Reference: http://docs.opencv.org/master/db/d5c/tutorial_py_bg_subtraction.html
# requires opencv v3.1.0
import numpy as np
import cv2
# TODO: remove hard coded file name
cap = cv2.VideoCapture('videos/sample_video_2.mp4')
# Here are the 3 ways of background subtraction
# createBackgroundSubtractorMOG2 seems to gi... | # Reference: http://docs.opencv.org/master/db/d5c/tutorial_py_bg_subtraction.html
import numpy as np
import cv2
# TODO: remove hard coded file name
cap = cv2.VideoCapture('videos/sample_video_2.mp4')
# Here are the 3 ways of background subtraction
# createBackgroundSubtractorMOG2 seems to give the best result. Need ... | apache-2.0 | Python |
1f815ad5cb7535132a60297808abfa959709ba65 | Fix redirect_to_login | aipescience/django-daiquiri,aipescience/django-daiquiri,aipescience/django-daiquiri | daiquiri/files/views.py | daiquiri/files/views.py | import logging
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.views.generic import View
from .utils import file_exists, check_file, send_file
logger = logging.getLogger(__name__)
class FileView(View):
def ... | import logging
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import redirect
from django.views.generic import View
from .utils import file_exists, check_file, send_file
logger = logging.getLogger(__name__)
class FileView(View):
def get(self, request,... | apache-2.0 | Python |
3ce5f60102d5de7367a06e7412e9e31597e40a58 | revert to original hello world | tylerdave/PyTN2016-Click-Tutorial,tylerdave/PyTN2016-Click-Tutorial | click_tutorial/cli.py | click_tutorial/cli.py | import click
@click.command()
def cli():
click.echo("Hello, World!")
if __name__ == '__main__':
cli()
| import click
@click.argument('name')
@click.command()
def cli(name):
click.echo("Hello, {0}!".format(name))
if __name__ == '__main__':
cli()
| mit | Python |
d44250f60e9676618170bd61f8f6bc438078ef87 | Add celery settings. | klen/fquest | base/config/production.py | base/config/production.py | " Production settings must be here. "
from .core import *
from os import path as op
SECRET_KEY = 'SecretKeyForSessionSigning'
ADMINS = frozenset([MAIL_USERNAME])
# flask.ext.collect
# -----------------
COLLECT_STATIC_ROOT = op.join(op.dirname(ROOTDIR), 'static')
# dealer
DEALER_PARAMS = dict(
backends=('git', ... | " Production settings must be here. "
from .core import *
from os import path as op
SECRET_KEY = 'SecretKeyForSessionSigning'
ADMINS = frozenset([MAIL_USERNAME])
# flask.ext.collect
# -----------------
COLLECT_STATIC_ROOT = op.join(op.dirname(ROOTDIR), 'static')
# dealer
DEALER_PARAMS = dict(
backends=('git', ... | bsd-3-clause | Python |
871f49eea1197af8224c601833e6e96f59697eb3 | Update phishing_database.py | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/phishing_database.py | plugins/feeds/public/phishing_database.py | #!/usr/bin/env python
"""This class will incorporate the PhishingDatabase feed into yeti."""
from datetime import timedelta
import logging
from core.observables import Url
from core.feed import Feed
from core.errors import ObservableValidationError
class PhishingDatabase(Feed):
"""This class will pull the Phishi... | from datetime import timedelta
import logging
from core.observables import Url
from core.feed import Feed
from core.errors import ObservableValidationError
class PhishingDatabase(Feed):
""" This class will pull the PhishingDatabase feed from github on a 12 hour interval. """
default_values = {
'frequ... | apache-2.0 | Python |
453e50823d3fb7a5937311e9118abbcbd5309855 | Implement a bunch more rare neutral minions | liujimj/fireplace,Ragowit/fireplace,smallnamespace/fireplace,liujimj/fireplace,Meerkov/fireplace,Meerkov/fireplace,amw2104/fireplace,smallnamespace/fireplace,jleclanche/fireplace,oftc-ftw/fireplace,Ragowit/fireplace,beheh/fireplace,butozerca/fireplace,amw2104/fireplace,butozerca/fireplace,oftc-ftw/fireplace,NightKev/fi... | fireplace/carddata/minions/neutral/rare.py | fireplace/carddata/minions/neutral/rare.py | import random
from ...card import *
from fireplace.enums import Race
# Injured Blademaster
class CS2_181(Card):
def action(self):
self.damage(4)
# Young Priestess
class EX1_004(Card):
def endTurn(self):
other_minions = [t for t in self.controller.field if t is not self]
if other_minions:
random.choice(ot... | from ...card import *
# Abomination
class EX1_097(Card):
def deathrattle(self):
for target in self.controller.getTargets(TARGET_ALL_CHARACTERS):
target.damage(2)
# Bloodsail Corsair
class NEW1_025(Card):
def action(self):
weapon = self.controller.opponent.hero.weapon
if self.controller.opponent.hero.weap... | agpl-3.0 | Python |
730489e4f6a7f3067ad67c16512c2cbcb97f3272 | stop gap on astronmical solar zenith | samsammurphy/gee-atmcorr-S2-batch | bin/astronomical.py | bin/astronomical.py | """
astronomical.py, Sam Murphy (2017-04-27)
Astronomical calculations (e.g. solar angles) for
processing satellite imagery through Google Earth
Engine.
"""
import ee
class Astronomical:
pi = 3.141592653589793
degToRad = pi / 180 # degress to radians
radToDeg = 180 / pi # radians to degress
def sin(x):retu... | """
astronomical.py, Sam Murphy (2017-04-27)
Astronomical calculations (e.g. solar angles) for
processing satellite imagery through Google Earth
Engine.
"""
import ee
class Astronomical:
pi = 3.141592653589793
degToRad = pi / 180 # degress to radians
radToDeg = 180 / pi # radians to degress
def sin(x):retu... | apache-2.0 | Python |
9e3becba368e5cc916c9af99a89e62e502d0a506 | Fix syntax error in urls | sevazhidkov/greenland,sevazhidkov/greenland | greenland/urls.py | greenland/urls.py | """greenland URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | """greenland URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | mit | Python |
dbd3999ff1df5d031b7a800a2d2417f041b2ed29 | Expand build script for 4 scenarios | ankur-gos/PSL-Bipedal,ankur-gos/PSL-Bipedal | build.py | build.py | '''
build.py
Script to build and run everything
Ankur Goswami, agoswam3@ucsc.edu
'''
import config
import preprocessing.parser.parse as parser
import preprocessing.preprocessing as preprocesser
import subprocess
import output.filter_truth as ft
'''
build_cleaned_default
run the default pipeline ... | '''
build.py
Script to build and run everything
Ankur Goswami, agoswam3@ucsc.edu
'''
import config
import preprocessing.parser.parse as parser
import preprocessing.preprocessing as preprocesser
import subprocess
import output.filter_truth as ft
'''
build_cleaned_default
run the default pipeline ... | mit | Python |
548edcb10ef949d394388282d052da36135982d7 | Add coveralls support[5]. | filipecn/Ponos,filipecn/Ponos,filipecn/Ponos | build.py | build.py | #!/usr/bin/python
import os
import shutil
from subprocess import call
import sys
import platform
cur_path = os.getcwd()
build_path = os.getcwd() + "/build"
if platform.system() == 'Windows':
build_path = os.getcwd() + "/win_build"
if 'test' in sys.argv:
os.chdir(build_path)
r = call(["make tests"], shell=... | #!/usr/bin/python
import os
import shutil
from subprocess import call
import sys
import platform
cur_path = os.getcwd()
build_path = os.getcwd() + "/build"
if platform.system() == 'Windows':
build_path = os.getcwd() + "/win_build"
if 'test' in sys.argv:
os.chdir(build_path)
r = call(["make tests"], shell=... | mit | Python |
df41dcb3c8538e482bcc61f9817ce26569652b6b | build script set user data for git | ervitis/logging_service,ervitis/logging_service | build.py | build.py | # -*- coding: utf-8 -*-
import os
import sh
from logging_service import __version__ as version
GIT_USER = 'circle-ci'
GIT_EMAIL = 'vitomarti@gmail.com'
def open_file(path):
return open(path, 'r+')
def get_git(repo_path):
return sh.git.bake(_cwd=repo_path)
def set_user_data_git(git):
git('config', '... | # -*- coding: utf-8 -*-
import os
import sh
from logging_service import __version__ as version
def open_file(path):
return open(path, 'r+')
def get_git(repo_path):
return sh.git.bake(_cwd=repo_path)
def main():
file_build = open_file('build_version')
lines = file_build.readlines()
build_vers... | mit | Python |
54b8e07ac412e757fb32ebfa19b75ef8a72f6688 | Print build path | jzf2101/release,jzf2101/release,datamicroscopes/release,datamicroscopes/release | build.py | build.py | #!/usr/bin/env python
import sys
import os
from argparse import ArgumentParser
from subprocess import check_call, check_output
def ensure_tool(name):
check_call(['which', name])
def build_and_publish(path, args):
login_command = get_login_command(args)
print >>sys.stderr, "Test anaconda.org login:"
... | #!/usr/bin/env python
import sys
import os
from argparse import ArgumentParser
from subprocess import check_call, check_output
def ensure_tool(name):
check_call(['which', name])
def build_and_publish(path, args):
login_command = get_login_command(args)
print >>sys.stderr, "Test anaconda.org login:"
... | bsd-3-clause | Python |
3d52e82a295c7c7d6b77d81a1d2c6ac0929bb120 | make sqlitecache bundable. | cournape/sqlite_cache | sqlite_cache/__init__.py | sqlite_cache/__init__.py | from __future__ import absolute_import
from .core import SQLiteCache # pragma: no cover
| from sqlite_cache.core import SQLiteCache # pragma: no cover
| bsd-3-clause | Python |
60690c178f3adb5a2e05e4960e3b142dbf6c1aad | update cache | yonoho/utils | cache.py | cache.py | import inspect
import json as json
from functools import wraps
from hashlib import md5
def cache_json(func, key_prefix='', expire=0, expire_at='', redis_client=None):
"""key_prefix is optional.
if use, it should be unique at module level within the redis db,
__module__ & func_name & all arguments wo... | import json as json
def cache_json(func, key_prefix='', expire=0, expire_at='', redis_client=None):
"""key_prefix should be unique at module level within the redis db,
func name & all arguments would also be part of the key.
redis_client: it's thread safe.
to avoid giving `redis_client` param every t... | mit | Python |
c40376c36312e582704b4fafbc36f4b17171394f | switch to using selectors | roadhump/SublimeLinter-eslint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2014 roadhump
#
# License: MIT
#
"""This module exports the ESLint plugin class."""
import logging
import re
from SublimeLinter.lint import NodeLinter
logger = logging.getLogger('SublimeLi... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2014 roadhump
#
# License: MIT
#
"""This module exports the ESLint plugin class."""
import logging
import re
from SublimeLinter.lint import NodeLinter
logger = logging.getLogger('SublimeLi... | mit | Python |
6a9d6d30dc7ea207e2f4d8179a5ef99a95fce4e5 | Fix bug in ListingGenerator with limit=None. | praw-dev/praw,darthkedrik/praw,nmtake/praw,gschizas/praw,RGood/praw,darthkedrik/praw,leviroth/praw,gschizas/praw,praw-dev/praw,13steinj/praw,RGood/praw,leviroth/praw,13steinj/praw,nmtake/praw | praw/models/listinggenerator.py | praw/models/listinggenerator.py | from .prawmodel import PRAWModel
class ListingGenerator(PRAWModel):
"""Instances of this class generate ``RedditModels``"""
def __init__(self, reddit, url, limit=100, params=None):
"""Initialize a ListingGenerator instance.
:param reddit: An instance of :class:`.Reddit`.
:param url: ... | from .prawmodel import PRAWModel
class ListingGenerator(PRAWModel):
"""Instances of this class generate ``RedditModels``"""
def __init__(self, reddit, url, limit=100, params=None):
"""Initialize a ListingGenerator instance.
:param reddit: An instance of :class:`.Reddit`.
:param url: ... | bsd-2-clause | Python |
bf7562d9f45a777163f2ac775dc9cf4afe99a930 | Change 'language' to 'syntax', that is more precise terminology. | tylertebbs20/Practice-SublimeLinter-jshint,tylertebbs20/Practice-SublimeLinter-jshint,SublimeLinter/SublimeLinter-jshint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jshint
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
from Sub... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jshint
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
from Sub... | mit | Python |
cea40608a1efe16310c7b978fba40abcde26ced4 | make flake8 happy | Flet/SublimeLinter-contrib-semistandard | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Dan Flettre
# Copyright (c) 2015 Dan Flettre
#
# License: MIT
#
"""This module exports the Semistandard plugin class."""
from SublimeLinter.lint import NodeLinter
class Semistandard(NodeLinter):
"""Provides a... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Dan Flettre
# Copyright (c) 2015 Dan Flettre
#
# License: MIT
#
"""This module exports the Semistandard plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Semistandard(NodeLinter):
"""Prov... | mit | Python |
9bfe8cd21931c69d79657aa275be02af21ec78f1 | Simplify `cmd` property | codequest-eu/SublimeLinter-contrib-reek | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Bartosz Kruszczynski
# Copyright (c) 2015 Bartosz Kruszczynski
#
# License: MIT
#
"""This module exports the Reek plugin class."""
from SublimeLinter.lint import RubyLinter
import re
class Reek(RubyLinter):
""... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Bartosz Kruszczynski
# Copyright (c) 2015 Bartosz Kruszczynski
#
# License: MIT
#
"""This module exports the Reek plugin class."""
from SublimeLinter.lint import RubyLinter
import re
class Reek(RubyLinter):
""... | mit | Python |
68293b6075ead70651924761e4e3187286ad6765 | Add the proper tests user/pass. | grandmasterchef/WhatManager2,MADindustries/WhatManager2,MADindustries/WhatManager2,MADindustries/WhatManager2,karamanolev/WhatManager2,karamanolev/WhatManager2,grandmasterchef/WhatManager2,karamanolev/WhatManager2,grandmasterchef/WhatManager2,davols/WhatManager2,davols/WhatManager2,davols/WhatManager2,karamanolev/WhatM... | integration_tests/test_basic_page_loads.py | integration_tests/test_basic_page_loads.py | from django.contrib.auth.models import User
from django.test import testcases
from django.test.client import Client
class Fail(testcases.TestCase):
def setUp(self):
super(Fail, self).setUp()
u = User(username='john_doe')
u.set_password('password')
u.is_superuser = True
u.s... | from django.contrib.auth.models import User
from django.test import testcases
from django.test.client import Client
class Fail(testcases.TestCase):
def setUp(self):
super(Fail, self).setUp()
u = User(username='john_doe')
u.set_password('password')
u.is_superuser = True
u.s... | mit | Python |
853dc8de1d077494c707a5ec8a6b75ac0e0628cf | Add trailing slash to URL for consistency. | kurtraschke/cadors-parse,kurtraschke/cadors-parse | cadorsfeed/views.py | cadorsfeed/views.py | from werkzeug import redirect, Response
from werkzeug.exceptions import NotFound
from cadorsfeed.utils import expose, url_for, db
from parse import parse
from fetch import fetchLatest, fetchReport
@expose('/report/latest/')
def latest_report(request):
if 'latest' in db:
latestDate = db['latest']
else:... | from werkzeug import redirect, Response
from werkzeug.exceptions import NotFound
from cadorsfeed.utils import expose, url_for, db
from parse import parse
from fetch import fetchLatest, fetchReport
@expose('/report/latest')
def latest_report(request):
if 'latest' in db:
latestDate = db['latest']
else:
... | mit | Python |
cb50a43435de4e3b62324d1b738f3775cabe7367 | Fix reverse url in RecentChangesFeed | mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextmp-popit,mysociety/yournextmp-popit | candidates/feeds.py | candidates/feeds.py | from __future__ import unicode_literals
import re
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from django.utils.text import slugify
from django.utils.translation import uget... | from __future__ import unicode_literals
import re
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from django.utils.text import slugify
from django.utils.translation import uget... | agpl-3.0 | Python |
847d9c4a1e88b9e00a3be082db635743866a8abd | Fix tests | tiagoengel/udacity-item-catalog,tiagoengel/udacity-item-catalog,tiagoengel/udacity-item-catalog,tiagoengel/udacity-item-catalog | catalog/__init__.py | catalog/__init__.py | from os import environ
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
DB_URL = 'postgresql:///catalog' + ('_test' if environ.get('ENV') == 'test' else '')
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
i... | from os import environ
from flask import Flask
from flask_wtf.csrf import CSRFProtect
from flask_sqlalchemy import SQLAlchemy
DB_URL = 'postgresql:///catalog' + ('_test' if environ.get('ENV') == 'test' else '')
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
app.config['SQLALCHEMY_TRACK_MODIFICA... | mit | Python |
147a24ea0ba9da03b3774b7993e20e785776e027 | Use sys.nstates in stead of using A.shape[0] | python-control/python-control | control/passivity.py | control/passivity.py | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
from . import statesp as ss
import numpy as np
import cvxopt as cvx
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that is a solution exists, t... | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
from . import statesp as ss
import numpy as np
import cvxopt as cvx
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that is a solution exists, t... | bsd-3-clause | Python |
b8e556871ff4aff9b85c67cc010814a0e6f60386 | Add new constants and change existing file names. | isislovecruft/scramblesuit,isislovecruft/scramblesuit | const.py | const.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module defines constant values for the ScrambleSuit protocol.
While some values can be changed, in general they should not. If you do not
obey, be at least careful because the protocol could easily break.
"""
# Length of the HMAC used to authenticate the ticket... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module defines constant values for the ScrambleSuit protocol.
While some values can be changed, in general they should not. If you do not
obey, be at least careful because the protocol could easily break.
"""
# FIXME - Directory where long-lived information is ... | bsd-3-clause | Python |
2a030ce151cdb6eaaa3933bd7f958edf658ab209 | Make the parent directory part of the Python path for custom management commands to work. | pupeno/bonvortaro | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
sys.path.append(os.path.abspath(".."))
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory contain... | #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | agpl-3.0 | Python |
0feb5947af0dacc53ba624723593dd88b0b4653a | Fix shop creation | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | byceps/services/shop/shop/service.py | byceps/services/shop/shop/service.py | """
byceps.services.shop.shop.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Optional
from ....database import db
from ....typing import PartyID
from .models import Shop as DbShop
from .transfer.models impo... | """
byceps.services.shop.shop.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Optional
from ....database import db
from ....typing import PartyID
from .models import Shop as DbShop
from .transfer.models impo... | bsd-3-clause | Python |
c0e903c3dab9fea0594d023ab9c049ca408bd9a4 | Cover text: outlined | Zomega/leech,kemayo/leech | cover.py | cover.py |
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
import textwrap
def make_cover(title, author, width=600, height=800, fontname="Helvetica", fontsize=40, bgcolor=(120, 20, 20), textcolor=(255, 255, 255), wrapat=30):
img = Image.new("RGBA", (width, height), bgcolor)
draw = ImageDraw.Draw(img)... |
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
import textwrap
def make_cover(title, author, width=600, height=800, fontname="Helvetica", fontsize=40, bgcolor=(120, 20, 20), textcolor=(255, 255, 255), wrapat=30):
img = Image.new("RGBA", (width, height), bgcolor)
draw = ImageDraw.Draw(img)... | mit | Python |
8c233868e82a6828d21574b0d488699c1c7b1443 | Update test_ValueType.py | nathanbjenx/cairis,failys/CAIRIS,failys/CAIRIS,failys/CAIRIS,nathanbjenx/cairis,nathanbjenx/cairis,nathanbjenx/cairis | cairis/cairis/test/test_ValueType.py | cairis/cairis/test/test_ValueType.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | apache-2.0 | Python |
7cac8f8ba591315d68e223503c4e93f976c8d89d | Set default race and class without extra database queries | mpirnat/django-tutorial-v2 | characters/views.py | characters/views.py | from django.shortcuts import get_object_or_404, redirect, render
from characters.forms import CharacterForm
from characters.models import Character, Class, Race
def index(request):
all_characters = Character.objects.all()
context = {'all_characters': all_characters}
return render(request, 'characters/ind... | from django.shortcuts import get_object_or_404, redirect, render
from characters.forms import CharacterForm
from characters.models import Character, Class, Race
def index(request):
all_characters = Character.objects.all()
context = {'all_characters': all_characters}
return render(request, 'characters/ind... | mit | Python |
daabf57935c9bec91ee4ce0bcd4713790fe928ea | use celery | Impactstory/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,total-impact/total-impact-webapp | daily.py | daily.py | from totalimpactwebapp.user import User
from totalimpactwebapp import db
import datetime
import tasks
"""
requires these env vars be set in this environment:
DATABASE_URL
"""
def page_query(q):
offset = 0
while True:
r = False
for elem in q.limit(100).offset(offset):
r = True
... | from totalimpactwebapp.user import User
from totalimpactwebapp import db
import datetime
import tasks
"""
requires these env vars be set in this environment:
DATABASE_URL
"""
def page_query(q):
offset = 0
while True:
r = False
for elem in q.limit(100).offset(offset):
r = True
... | mit | Python |
a2cc8a5e6009bda68edf85a432d9a8ec002e99a1 | Fix #80 | vadimcn/vscode-lldb,vadimcn/vscode-lldb,vadimcn/vscode-lldb,vadimcn/vscode-lldb,vadimcn/vscode-lldb,vadimcn/vscode-lldb,vadimcn/vscode-lldb | adapter/__init__.py | adapter/__init__.py | import sys
PY2 = sys.version_info[0] == 2
if PY2:
is_string = lambda v: isinstance(v, basestring)
# python2-based LLDB accepts utf8-encoded ascii strings only.
to_lldb_str = lambda s: s.encode('utf8', 'backslashreplace') if isinstance(s, unicode) else s
from_lldb_str = lambda s: s.decode('utf8', 'repla... | import sys
PY2 = sys.version_info[0] == 2
if PY2:
is_string = lambda v: isinstance(v, basestring)
to_lldb_str = lambda s: s.encode('utf8', 'backslashreplace')
from_lldb_str = lambda s: s.decode('utf8', 'replace')
xrange = xrange
else:
is_string = lambda v: isinstance(v, str)
to_lldb_str = str
... | mit | Python |
dc50a4ec058f9893e87a069bc64e4715ecfa0bea | Add initial status code assertion | sjagoe/usagi | haas_rest_test/plugins/assertions.py | haas_rest_test/plugins/assertions.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
from __future__ import absolute_import, unicode_literals
from jsonschema.exceptions import ValidationEr... | # -*- coding: utf-8 -*-
# Copyright (c) 2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
from __future__ import absolute_import, unicode_literals
class StatusCodeAssertion(object):
_sche... | bsd-3-clause | Python |
b9ea36d80ec256988a772e621eb91481cff5e464 | Bump version to 0.3 | dmsimard/python-cicoclient | cicoclient/shell.py | cicoclient/shell.py | # Copyright Red Hat, Inc. 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... | # Copyright Red Hat, Inc. 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... | apache-2.0 | Python |
561de1d124289058eafde34547e8fc773c3e9793 | Rename strips to d_strips | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | board.py | board.py |
import direction_strips as ds_m
from pente_exceptions import *
from defines import *
class Board():
def __init__(self, size, clone_it=False):
self.size = size
if not clone_it:
self.set_to_empty()
def set_to_empty(self):
self.d_strips = []
self.d_strips.append(ds_m.... |
import direction_strips as ds_m
from pente_exceptions import *
from defines import *
class Board():
def __init__(self, size, clone_it=False):
self.size = size
if not clone_it:
self.set_to_empty()
def set_to_empty(self):
self.strips = [] # TODO Rename to d_strips
se... | mit | Python |
62e9510fe2fbe3186c7c817a5c287322a65b1dc9 | Fix linearPotential import to new package structure | jobovy/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy | galpy/potential/IsothermalDiskPotential.py | galpy/potential/IsothermalDiskPotential.py | ###############################################################################
# IsothermalDiskPotential.py: class that implements the one-dimensional
# self-gravitating isothermal disk
###############################################################################
import numpy
from .li... | ###############################################################################
# IsothermalDiskPotential.py: class that implements the one-dimensional
# self-gravitating isothermal disk
###############################################################################
import numpy
from gal... | bsd-3-clause | Python |
b927fe276af848b6c9a4653e04421a739e63037c | remove unused import | dmaticzka/EDeN,fabriziocosta/EDeN,smautner/EDeN,dmaticzka/EDeN,smautner/EDeN,fabriziocosta/EDeN | test/test_graphprot.py | test/test_graphprot.py | from scripttest import TestFileEnvironment
import re
# from filecmp import cmp
bindir = "graphprot/"
script = "graphprot_seqmodel"
# test file environment
datadir = "test/"
testdir = "test/testenv_graphprot_seqmodel/"
# directories relative to test file environment
bindir_rel = "../../" + bindir
datadir_rel = "../../"... | from scripttest import TestFileEnvironment
import re
import os
# from filecmp import cmp
bindir = "graphprot/"
script = "graphprot_seqmodel"
# test file environment
datadir = "test/"
testdir = "test/testenv_graphprot_seqmodel/"
# directories relative to test file environment
bindir_rel = "../../" + bindir
datadir_rel ... | mit | Python |
56f24e52f961da414f0610e6bd815812b4a14ef6 | Update utils.py | googleinterns/smart-content-summary,googleinterns/smart-content-summary,googleinterns/smart-content-summary | classifier/utils.py | classifier/utils.py | # coding=utf-8
# Copyright 2019 The Google Research 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 applicab... | # coding=utf-8
# Copyright 2019 The Google Research 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 applicab... | apache-2.0 | Python |
c28112624b3c735c610f756a6bff1497e9516c64 | Revise naive alg to more intuitive one: separate checking index and value | bowen0701/algorithms_data_structures | alg_find_peak_1D.py | alg_find_peak_1D.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def find_peak_naive(arr):
"""Find peak by naive iteration.
Time complexity: O(n).
"""
for i in range(len(arr)):
if i == 0:
if arr[i] > arr[i + 1]:
return ar... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def find_peak_naive(arr):
"""Find peak by naive iteration.
Time complexity: O(n).
"""
for i in range(len(arr)):
if i == 0 and arr[i] > arr[i + 1]:
return arr[i]
eli... | bsd-2-clause | Python |
dbec204b242ab643de162046ba73dca32043c6c2 | Implement __getattr__ to reduce code | CubicComet/exercism-python-solutions | space-age/space_age.py | space-age/space_age.py | class SpaceAge(object):
YEARS = {"on_earth": 1,
"on_mercury": 0.2408467,
"on_venus": 0.61519726,
"on_mars": 1.8808158,
"on_jupiter": 11.862615,
"on_saturn": 29.447498,
"on_uranus": 84.016846,
"on_neptune": 164.79132}
def... | class SpaceAge(object):
def __init__(self, seconds):
self.seconds = seconds
@property
def years(self):
return self.seconds/31557600
def on_earth(self):
return round(self.years, 2)
def on_mercury(self):
return round(self.years/0.2408467, 2)
def on_venus(self):
... | agpl-3.0 | Python |
8b275ccb96b8fe3c2c3919e11f08e988219a1e14 | Add the process PID in the logs | joel-airspring/Diamond,eMerzh/Diamond-1,signalfx/Diamond,rtoma/Diamond,Ensighten/Diamond,mfriedenhagen/Diamond,rtoma/Diamond,tusharmakkar08/Diamond,signalfx/Diamond,jriguera/Diamond,joel-airspring/Diamond,codepython/Diamond,gg7/diamond,ramjothikumar/Diamond,signalfx/Diamond,skbkontur/Diamond,stuartbfox/Diamond,works-mo... | src/diamond/utils/log.py | src/diamond/utils/log.py | # coding=utf-8
import logging
import logging.config
import sys
import os
class DebugFormatter(logging.Formatter):
def __init__(self, fmt=None):
if fmt is None:
fmt = ('%(created)s\t' +
'[%(processName)s:%(process)d:%(levelname)s]\t' +
'%(message)s')
... | # coding=utf-8
import logging
import logging.config
import sys
import os
class DebugFormatter(logging.Formatter):
def __init__(self, fmt=None):
if fmt is None:
fmt = '%(created)s\t[%(processName)s:%(levelname)s]\t%(message)s'
self.fmt_default = fmt
self.fmt_prefix = fmt.repla... | mit | Python |
419db3c559d836d6ba77c758212a55051e6c8fab | Add FIXME for module as function arg | jbcoe/PyObjDictTools | test_obj_dict_tools.py | test_obj_dict_tools.py | from obj_dict_tools import *
from nose.tools import raises
@dict_fields(['name', 'size'])
class Simple:
def __init__(self, name=None, size=None):
self.name = name
self.size = size
@dict_fields(['first', 'second'])
class Pair:
def __init__(self, first=None, second=None):
self.first ... | from obj_dict_tools import *
from nose.tools import raises
@dict_fields(['name', 'size'])
class Simple:
def __init__(self, name=None, size=None):
self.name = name
self.size = size
@dict_fields(['first', 'second'])
class Pair:
def __init__(self, first=None, second=None):
self.first ... | mit | Python |
b6f57d8aaeff8f85c89c381b972113810a468412 | use lat, lon | LogLock/LogLock.backend | models.py | models.py | from random import choice, randint
import urllib2, json
from pushbullet import PushBullet
from os import environ
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, geocoded_ip, mandrill):
ip = ip
latitude = form.get... | from random import choice, randint
import urllib2, json
from pushbullet import PushBullet
from os import environ
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, geocoded_ip, mandrill):
ip = ip
latitude = form.get... | agpl-3.0 | Python |
a0f96b2b25d309c8934ffe9a197f3d66c9097b52 | replace phone to email for privacy | dev-seahouse/cs2108MiniProject,dev-seahouse/cs2108MiniProject | models.py | models.py | from app import db
from datetime import datetime
class Profile(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
gender = db.Column(db.String(1))
age = db.Column(db.Integer())
email = db.Column(db.String(50), unique=True)
description = db.Colu... | from app import db
from datetime import datetime
class Profile(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
gender = db.Column(db.String(1))
age = db.Column(db.Integer())
description = db.Column(db.String(300))
date = db.Column(db.DateTim... | mit | Python |
9c8bde1e57ad2e70c7b3b9188bff9b90e85434e6 | Send email and push | LogLock/LogLock.backend | models.py | models.py | from random import choice, randint
import urllib2, json
from pushbullet import PushBullet
from os import environ
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, mandrill):
ip = ip
latitude = form.get('latitude', ... | from random import choice
import urllib2, json
from pushbullet import PushBullet
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, mandrill):
ip = ip
geo = form.get('geo', None)
os = form.get('os', None)... | agpl-3.0 | Python |
ea8cbcaf41f01a46390882fbc99e6e14d70a49d1 | Create an API auth token for every newly created user | WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed | src/mmw/apps/user/models.py | src/mmw/apps/user/models.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=settings.AUTH_USER_MODEL... | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
class ItsiUserManager(models.Manager):
def create_itsi_user(self, user, itsi_id):
itsi_user = self.create(user=user, itsi_id=itsi_id)
return itsi_user
class ItsiUser(models.Model):
user = models.... | apache-2.0 | Python |
4f27b87b9ee600c7c1c05ae9fece549b9c18e2a4 | Create default instance in middleware if not found. | opencorato/sayit,opencorato/sayit,opencorato/sayit,opencorato/sayit | speeches/middleware.py | speeches/middleware.py | from instances.models import Instance
class InstanceMiddleware:
"""This middleware sets request.instance to the default Instance for all
requests. This can be changed/overridden if you use SayIt in a way that
uses multiple instances."""
def process_request(self, request):
request.instance, _ = ... | from instances.models import Instance
class InstanceMiddleware:
"""This middleware sets request.instance to the default Instance for all
requests. This can be changed/overridden if you use SayIt in a way that
uses multiple instances."""
def process_request(self, request):
request.instance = Ins... | agpl-3.0 | Python |
2980c30a8de6cbdf5d22bb269c16f8c5ad499ba8 | Fix build output (dots on one line) | dincamihai/salt-toaster,dincamihai/salt-toaster | build.py | build.py | import re
import argparse
from utils import build_docker_image
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--nocache', action='store_true', default=False)
args = parser.parse_args()
content = ''
stream = build_docker_image(nocache=args.nocache)
for item in stream:
... | import argparse
from utils import build_docker_image
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--nocache', action='store_true', default=False)
args = parser.parse_args()
for item in build_docker_image(nocache=args.nocache):
print item.values()[0]
if __name__ == '__m... | mit | Python |
c16fb96de6154dec7bf0fc934dd9f7e1ac4b69f4 | bump version | spthaolt/curtsies,sebastinas/curtsies,thomasballinger/curtsies | curtsies/__init__.py | curtsies/__init__.py | """Terminal-formatted strings"""
__version__='0.1.15'
from .window import FullscreenWindow, CursorAwareWindow
from .input import Input
from .termhelpers import Nonblocking, Cbreak, Termmode
from .formatstring import FmtStr, fmtstr
from .formatstringarray import FSArray, fsarray
| """Terminal-formatted strings"""
__version__='0.1.14'
from .window import FullscreenWindow, CursorAwareWindow
from .input import Input
from .termhelpers import Nonblocking, Cbreak, Termmode
from .formatstring import FmtStr, fmtstr
from .formatstringarray import FSArray, fsarray
| mit | Python |
e468abbc033a48d0222f50cf85319802f05fc57a | Check doctest | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/onse/tests.py | custom/onse/tests.py | import doctest
from datetime import date
from nose.tools import assert_equal
from custom.onse import tasks
def test_get_last_quarter():
test_dates = [
(date(2020, 1, 1), '2019Q4'),
(date(2020, 3, 31), '2019Q4'),
(date(2020, 4, 1), '2020Q1'),
(date(2020, 6, 30), '2020Q1'),
... | from datetime import date
from nose.tools import assert_equal
from custom.onse.tasks import get_last_quarter
def test_get_last_quarter():
test_dates = [
(date(2020, 1, 1), '2019Q4'),
(date(2020, 3, 31), '2019Q4'),
(date(2020, 4, 1), '2020Q1'),
(date(2020, 6, 30), '2020Q1'),
... | bsd-3-clause | Python |
e6357827a670c71e2489b5468b89a65153719ba4 | Fix syntax (backward compatible) | python-social-auth/social-storage-sqlalchemy,joelstanner/python-social-auth,drxos/python-social-auth,lamby/python-social-auth,robbiet480/python-social-auth,henocdz/python-social-auth,san-mate/python-social-auth,jeyraof/python-social-auth,jeyraof/python-social-auth,mrwags/python-social-auth,DhiaEddineSaidi/python-social... | social/strategies/tornado_strategy.py | social/strategies/tornado_strategy.py | import json
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/', 1)
... | import json
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/', 1)
... | bsd-3-clause | Python |
6bfab23170c108c50c9b2dc4988e8670ed677d65 | Allow including html files. Build script made executable. | Darchangel/git-presentation,Darchangel/git-presentation | build.py | build.py | #!/usr/bin/python
import distutils.core
from os import path
import re
include_folder = 'slides'
include_templates = ['{}.html', '{}.md']
include_regex = re.compile('@@([a-zA-Z0-9-_]+)')
in_file = 'index.html'
out_folder = '../dist'
out_file_name = 'index.html'
dirs_to_copy = ['css', 'js', 'lib', 'plugin']
def main()... | import distutils.core
from os import path
import re
include_folder = 'slides'
include_template = '{}.md'
include_regex = re.compile('@@([a-zA-Z0-9-_]+)')
in_file = 'index.html'
out_folder = '../dist'
out_file_name = 'index.html'
dirs_to_copy = ['css', 'js', 'lib', 'plugin']
def main():
print('Copying static dire... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.