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
b278cf74b6ac57daee8e4ead6044f43ffd89a1f1
importer/importer/__init__.py
importer/importer/__init__.py
import aiohttp import os.path from datetime import datetime from aioes import Elasticsearch from .importer import import_data from .kudago import KudaGo from .utils import read_json_file ELASTIC_ENDPOINTS = ['localhost:9200'] ELASTIC_ALIAS = 'theatrics' async def initialize(): elastic = Elasticsearch(ELASTIC_E...
import aiohttp import os.path from datetime import datetime from aioes import Elasticsearch from .importer import import_data from .kudago import KudaGo from .utils import read_json_file ELASTIC_ENDPOINTS = ['localhost:9200'] ELASTIC_ALIAS = 'theatrics' # commands async def initialize(): elastic = Elasticsear...
Remove all previous aliases when initializing
Remove all previous aliases when initializing
Python
mit
despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics
3dd205a9dad39abb12e7a05c178117545402c2e1
reinforcement-learning/train.py
reinforcement-learning/train.py
"""This is the agent which currently takes the action with proper q learning.""" import time start = time.time() from tqdm import tqdm import env import os import rl env.make("text") episodes = 10000 import argparse parser = argparse.ArgumentParser(description="Train agent on the falling game.") parser.add_argument("...
"""This is the agent which currently takes the action with proper q learning.""" import time start = time.time() from tqdm import tqdm import env import os import rl env.make("text") episodes = 10000 import argparse parser = argparse.ArgumentParser(description="Train agent on the falling game.") parser.add_argument("...
Update to newest version of rl.py.
Update to newest version of rl.py.
Python
mit
danieloconell/Louis
f88c2135ddc197283bbfb8b481774deb613571cf
python/raindrops/raindrops.py
python/raindrops/raindrops.py
def raindrops(number): if is_three_a_factor(number): return "Pling" return "{}".format(number) def is_three_a_factor(number): return number % 3 == 0
def raindrops(number): if is_three_a_factor(number): return "Pling" if is_five_a_factor(number): return "Plang" return "{}".format(number) def is_three_a_factor(number): return number % 3 == 0 def is_five_a_factor(number): return number % 5 == 0
Handle 5 as a factor
Handle 5 as a factor
Python
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
2f10aa07422c8132218d8af336406629b336550c
docs/src/conf.py
docs/src/conf.py
# -*- coding: utf-8 -*- import os import stat from os.path import join, abspath from subprocess import call def prepare(globs, locs): # RTD defaults the current working directory to where conf.py resides. # In our case, that means <root>/docs/src/. cwd = os.getcwd() root = abspath(join(cwd, '..', '..'...
# -*- coding: utf-8 -*- import os import stat from os.path import join, abspath from subprocess import call def prepare(globs, locs): # RTD defaults the current working directory to where conf.py resides. # In our case, that means <root>/docs/src/. cwd = os.getcwd() root = abspath(join(cwd, '..', '..'...
Replace execfile with py3-compatible equivalent
Replace execfile with py3-compatible equivalent
Python
bsd-3-clause
fpoirotte/XRL
5e5a6a55d43bf66c7f71d054b92a66528bf2a571
driver/driver.py
driver/driver.py
from abc import ABCMeta, abstractmethod class Driver(metaclass=ABCMeta): @abstractmethod def create(self): pass @abstractmethod def resize(self, id, quota): pass @abstractmethod def clone(self, id): pass @abstractmethod def remove(self, id): pass ...
from abc import ABCMeta, abstractmethod class Driver(metaclass=ABCMeta): @abstractmethod def create(self, requirements): pass @abstractmethod def _set_quota(self, id, quota): pass @abstractmethod def resize(self, id, quota): pass @abstractmethod def clone(sel...
Fix inconsistency in parameters with base class
Fix inconsistency in parameters with base class
Python
apache-2.0
PressLabs/cobalt,PressLabs/cobalt
1fe377ec1957d570a1dcc860c2bda415088bf6be
dwight_chroot/platform_utils.py
dwight_chroot/platform_utils.py
import os import pwd import subprocess from .exceptions import CommandFailed def get_user_shell(): return pwd.getpwuid(os.getuid()).pw_shell def execute_command_assert_success(cmd, **kw): returned = execute_command(cmd, **kw) if returned.returncode != 0: raise CommandFailed("Command {0!r} fail...
import os import pwd import subprocess from .exceptions import CommandFailed def get_user_shell(): return pwd.getpwuid(os.getuid()).pw_shell def execute_command_assert_success(cmd, **kw): returned = execute_command(cmd, **kw) if returned.returncode != 0: raise CommandFailed("Command {0!r} fail...
Fix execute_command_assert_success return code logging
Fix execute_command_assert_success return code logging
Python
bsd-3-clause
vmalloc/dwight,vmalloc/dwight,vmalloc/dwight
b1c5f75c266f5f5b9976ce2ca7c2b9065ef41bb1
groupmestats/generatestats.py
groupmestats/generatestats.py
import argparse import webbrowser from .groupserializer import GroupSerializer from .statistic import all_statistics from .statistics import * def gstat_stats(): parser = argparse.ArgumentParser(description="Generates stats for a group") parser.add_argument("-g", "--group", dest="group_name", required=True, ...
import argparse import webbrowser from .groupserializer import GroupSerializer from .statistic import all_statistics from .statistics import * def gstat_stats(): parser = argparse.ArgumentParser(description="Generates stats for a group") parser.add_argument("-g", "--group", dest="group_name", required=True, ...
Print args when generating stats
Print args when generating stats
Python
mit
kjteske/groupmestats,kjteske/groupmestats
7b7f33439b16faeef67022374cf88ba9a275ce8a
flocker/filesystems/interfaces.py
flocker/filesystems/interfaces.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Interfaces that filesystem APIs need to expose. """ from __future__ import absolute_import from zope.interface import Interface class IFilesystemSnapshots(Interface): """ Support creating and listing snapshots of a specific filesystem. ""...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Interfaces that filesystem APIs need to expose. """ from __future__ import absolute_import from zope.interface import Interface class IFilesystemSnapshots(Interface): """ Support creating and listing snapshots of a specific filesystem. ""...
Address review comment: Don't state the obvious.
Address review comment: Don't state the obvious.
Python
apache-2.0
LaynePeng/flocker,agonzalezro/flocker,AndyHuu/flocker,achanda/flocker,jml/flocker,AndyHuu/flocker,lukemarsden/flocker,mbrukman/flocker,runcom/flocker,Azulinho/flocker,jml/flocker,mbrukman/flocker,w4ngyi/flocker,hackday-profilers/flocker,achanda/flocker,lukemarsden/flocker,achanda/flocker,beni55/flocker,lukemarsden/floc...
df51d042bf1958f48fc39f1f3870285c87491243
lemon/templatetags/main_menu.py
lemon/templatetags/main_menu.py
from django.template import Library, Variable from django.template import TemplateSyntaxError, VariableDoesNotExist from django.template.defaulttags import URLNode from ..models import MenuItem from ..settings import CONFIG register = Library() class MainMenuItemURLNode(URLNode): def __init__(self, content_ty...
from django.core.urlresolvers import reverse, NoReverseMatch from django.template import Library, Variable, Node from django.template import TemplateSyntaxError, VariableDoesNotExist from django.template.defaulttags import URLNode from ..models import MenuItem from ..settings import CONFIG register = Library() cla...
Fix main menu url reversing in admin
Fix main menu url reversing in admin
Python
bsd-3-clause
trilan/lemon,trilan/lemon,trilan/lemon
e548713f5192d125b1313fa955240965a1136de8
plugin/__init__.py
plugin/__init__.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
# -*- coding: utf-8 -*- ######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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/license...
UPDATE init; add utf-8 encoding
UPDATE init; add utf-8 encoding
Python
apache-2.0
fastconnect/cloudify-azure-plugin
28786f30be37bb43a175262f96b618fc440d5ace
send-email.py
send-email.py
#!/usr/bin/env python3 import datetime import os import sys import smtplib from email.mime.text import MIMEText def timeString(): return str(datetime.datetime.now()) if not os.path.exists('email-list'): print(timeString(), ':\tERROR: email-list not found.', sep='') quit(1) if not os.path.exists('credent...
#!/usr/bin/env python3 import datetime import os import sys import smtplib from email.mime.text import MIMEText def timeString(): return str(datetime.datetime.now()) if not os.path.exists('email-list'): print(timeString(), ':\tERROR: email-list not found.', sep='') quit(1) if not os.path.exists('credent...
Change email subject. Not much of an ALERT if it happens every day.
Change email subject. Not much of an ALERT if it happens every day.
Python
unlicense
nerflad/mds-new-products,nerflad/mds-new-products,nerflad/mds-new-products
400c506627deca5d85454928254b1968e09dc33e
scrape.py
scrape.py
import scholarly import requests _EXACT_SEARCH = '/scholar?q="{}"' _START_YEAR = '&as_ylo={}' _END_YEAR = '&as_yhi={}' def search(query, exact=True, start_year=None, end_year=None): """Search by scholar query and return a generator of Publication objects""" url = _EXACT_SEARCH.format(requests.utils.quote(query...
import re import requests import scholarly _EXACT_SEARCH = '/scholar?q="{}"' _START_YEAR = '&as_ylo={}' _END_YEAR = '&as_yhi={}' class Papers(object): """Wrapper around scholarly._search_scholar_soup that allows one to get the number of papers found in the search with len()""" def __init__(self, query, s...
Allow getting number of results found with len()
Allow getting number of results found with len()
Python
mit
Spferical/cure-alzheimers-fund-tracker,Spferical/cure-alzheimers-fund-tracker,Spferical/cure-alzheimers-fund-tracker
ce2ea43a9ca49caa50e26bc7d7e11ba97edea929
src/zeit/content/article/edit/browser/tests/test_header.py
src/zeit/content/article/edit/browser/tests/test_header.py
import zeit.content.article.edit.browser.testing class HeaderModules(zeit.content.article.edit.browser.testing.EditorTestCase): def test_can_create_module_by_drag_and_drop(self): s = self.selenium self.add_article() block = 'quiz' # copy&paste from self.create_block() s.cl...
import zeit.content.article.edit.browser.testing class HeaderModules(zeit.content.article.edit.browser.testing.EditorTestCase): def test_can_create_module_by_drag_and_drop(self): s = self.selenium self.add_article() # Select header that allows header module s.click('css=#edit-form...
Fix test, needs to select proper header for header-module to be enabled (belongs to commit:eb1b6fa)
ZON-3167: Fix test, needs to select proper header for header-module to be enabled (belongs to commit:eb1b6fa)
Python
bsd-3-clause
ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article
2e9cb250d58474354bdfff1edb4fc9e71ee95d60
lightbus/utilities/importing.py
lightbus/utilities/importing.py
import importlib import logging from typing import Sequence, Tuple, Callable import pkg_resources logger = logging.getLogger(__name__) def import_module_from_string(name): return importlib.import_module(name) def import_from_string(name): components = name.split(".") mod = __import__(components[0]) ...
import importlib import logging import sys from typing import Sequence, Tuple, Callable import pkg_resources logger = logging.getLogger(__name__) def import_module_from_string(name): if name in sys.modules: return sys.modules[name] else: return importlib.import_module(name) def import_from...
Fix to import_module_from_string() to prevent multiple imports
Fix to import_module_from_string() to prevent multiple imports
Python
apache-2.0
adamcharnock/lightbus
0c18e83248a752a3191da1d9c8369fafc2b61674
purepython/urls.py
purepython/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'purepython.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), )
from django.conf.urls import patterns, include, url from django.contrib import admin from fb.views import index admin.autodiscover() urlpatterns = patterns('', url(r'^$', index), url(r'^admin/', include(admin.site.urls)), )
Add url to access the index view.
Add url to access the index view.
Python
apache-2.0
pure-python/brainmate
b74c56b3999800917946378f20288407347710e6
social/backends/gae.py
social/backends/gae.py
""" Google App Engine support using User API """ from __future__ import absolute_import from google.appengine.api import users from social.backends.base import BaseAuth from social.exceptions import AuthException class GoogleAppEngineAuth(BaseAuth): """GoogleAppengine authentication backend""" name = 'googl...
""" Google App Engine support using User API """ from __future__ import absolute_import from google.appengine.api import users from social.backends.base import BaseAuth from social.exceptions import AuthException class GoogleAppEngineAuth(BaseAuth): """GoogleAppengine authentication backend""" name = 'googl...
Rename to be consistent with backend name
Rename to be consistent with backend name
Python
bsd-3-clause
ononeor12/python-social-auth,barseghyanartur/python-social-auth,tutumcloud/python-social-auth,webjunkie/python-social-auth,cmichal/python-social-auth,henocdz/python-social-auth,mchdks/python-social-auth,falcon1kr/python-social-auth,cmichal/python-social-auth,contracode/python-social-auth,SeanHayes/python-social-auth,Vi...
b78c457d52702beb5067eb7c3067cb69af5e935d
itunes/exceptions.py
itunes/exceptions.py
""" exceptions.py Copyright © 2015 Alex Danoff. All Rights Reserved. 2015-08-02 This file defines custom exceptions for the iTunes funcitonality. """ class ITunesError(Exception): """ Base exception class for iTunes interface. """ pass class AppleScriptError(ITunesError): """ Represents an e...
""" exceptions.py Copyright © 2015 Alex Danoff. All Rights Reserved. 2015-08-02 This file defines custom exceptions for the iTunes funcitonality. """ class ITunesError(Exception): """ Base exception class for iTunes interface. """ pass class AppleScriptError(ITunesError): """ Represents an e...
Add custom exception for track-related errors
Add custom exception for track-related errors The new exception type (`TrackError`) will be used when a track cannot be played or found.
Python
mit
adanoff/iTunesTUI
b339c25068e849dbbf769f22893125b15325eb66
figgypy/utils.py
figgypy/utils.py
import os def env_or_default(var, default=None): """Get environment variable or provide default. Args: var (str): environment variable to search for default (optional(str)): default to return """ if var in os.environ: return os.environ[var] return default
# -*- coding: utf-8 -*- from __future__ import unicode_literals from future.utils import bytes_to_native_str as n from base64 import b64encode import os import boto3 def env_or_default(var, default=None): """Get environment variable or provide default. Args: var (str): environment variable to searc...
Add new helper function to encrypt for KMS
Add new helper function to encrypt for KMS
Python
mit
theherk/figgypy
0f4ca12e524be7cbd82ac79e81a62015b47ca6ef
openfisca_core/tests/formula_helpers.py
openfisca_core/tests/formula_helpers.py
# -*- coding: utf-8 -*- import numpy from nose.tools import raises from openfisca_core.formula_helpers import apply_threshold as apply_threshold from openfisca_core.tools import assert_near @raises(AssertionError) def test_apply_threshold_with_too_many_thresholds(): input = numpy.array([10]) thresholds = [5]...
# -*- coding: utf-8 -*- import numpy from nose.tools import raises from openfisca_core.formula_helpers import apply_threshold as apply_threshold from openfisca_core.tools import assert_near @raises(AssertionError) def test_apply_threshold_with_too_many_thresholds(): input = numpy.array([10]) thresholds = [5]...
Add more tricky case test for apply_threshold
Add more tricky case test for apply_threshold
Python
agpl-3.0
benjello/openfisca-core,openfisca/openfisca-core,benjello/openfisca-core,sgmap/openfisca-core,openfisca/openfisca-core
342e6134a63c5b575ae8e4348a54f61350bca2da
parser/crimeparser/pipelinesEnricher.py
parser/crimeparser/pipelinesEnricher.py
from geopy import Nominatim from geopy.extra.rate_limiter import RateLimiter class GeoCodePipeline(object): def open_spider(self, spider): geolocator = Nominatim(timeout=5) self.__geocodeFunc = RateLimiter(geolocator.geocode, min_delay_seconds=2) def process_item(self, item, spider): ...
from geopy import Nominatim, Photon from geopy.extra.rate_limiter import RateLimiter class GeoCodePipeline(object): def open_spider(self, spider): geolocator = Photon(timeout=5) self.__geocodeFunc = RateLimiter(geolocator.geocode, min_delay_seconds=2) def process_item(self, item, spider): ...
Use Phonon instead of Nominatim for geo coding
Use Phonon instead of Nominatim for geo coding Phonon is more fault tolerant to spelling mistakes.
Python
mit
aberklotz/crimereport,aberklotz/crimereport,aberklotz/crimereport
5398a864449db0a1d6ec106ddb839fff3b6afcda
mopidy_frontpanel/frontend.py
mopidy_frontpanel/frontend.py
from __future__ import unicode_literals import logging from mopidy.core import CoreListener import pykka import .menu import BrowseMenu import .painter import Painter logger = logging.getLogger(__name__) class FrontPanel(pykka.ThreadingActor, CoreListener): def __init__(self, config, core): super(Fron...
from __future__ import unicode_literals import logging from mopidy.core import CoreListener import pykka import .menu import BrowseMenu import .painter import Painter logger = logging.getLogger(__name__) class FrontPanel(pykka.ThreadingActor, CoreListener): def __init__(self, config, core): super(Fron...
Handle playback changes in FrontPanel
Handle playback changes in FrontPanel
Python
apache-2.0
nick-bulleid/mopidy-frontpanel
76b916c6f53d97b4658c16a85f10302e75794bcd
kitsune/upload/storage.py
kitsune/upload/storage.py
import hashlib import itertools import os import time from django.conf import settings from django.core.files.storage import FileSystemStorage from storages.backends.s3boto3 import S3Boto3Storage DjangoStorage = S3Boto3Storage if settings.AWS_ACCESS_KEY_ID else FileSystemStorage class RenameFileStorage(DjangoStor...
import hashlib import itertools import os import time from django.conf import settings from django.core.files.storage import FileSystemStorage from storages.backends.s3boto3 import S3Boto3Storage DjangoStorage = S3Boto3Storage if settings.AWS_ACCESS_KEY_ID else FileSystemStorage class RenameFileStorage(DjangoStor...
Update RenameFileStorage method to be 1.11 compatible
Update RenameFileStorage method to be 1.11 compatible
Python
bsd-3-clause
mozilla/kitsune,anushbmx/kitsune,mozilla/kitsune,anushbmx/kitsune,anushbmx/kitsune,mozilla/kitsune,mozilla/kitsune,anushbmx/kitsune
669325d6ca93f81c4635d7d3d57120d8e23e5251
organizations/backends/forms.py
organizations/backends/forms.py
from django import forms from django.contrib.auth.models import User class InvitationRegistrationForm(forms.ModelForm): first_name = forms.CharField(max_length=30) last_name = forms.CharField(max_length=30) password = forms.CharField(max_length=30, widget=forms.PasswordInput) password_confirm = forms....
from django import forms from django.contrib.auth.models import User class InvitationRegistrationForm(forms.ModelForm): first_name = forms.CharField(max_length=30) last_name = forms.CharField(max_length=30) password = forms.CharField(max_length=30, widget=forms.PasswordInput) password_confirm = forms....
Hide all unnecessary user info
Hide all unnecessary user info Excludes all User fields save for useranme, first/last name, email, and password. Also clears the username of its default data.
Python
bsd-2-clause
aptivate/django-organizations,arteria/django-ar-organizations,GauthamGoli/django-organizations,aptivate/django-organizations,DESHRAJ/django-organizations,DESHRAJ/django-organizations,GauthamGoli/django-organizations,st8st8/django-organizations,bennylope/django-organizations,arteria/django-ar-organizations,aptivate/djan...
16fdad8ce40a539d732c8def4898aae0f2d58cd0
foxybot/registrar.py
foxybot/registrar.py
class CommandRegistrar(): """A singleton to manage the command table and command execution""" _instance = None def __init__(self): self.command_table = {} @staticmethod def instance(): """Get the singleton, create an instance if needed""" if not CommandRegistrar._instanc...
class CommandRegistrar(): """A singleton to manage the command table and command execution""" _instance = None def __init__(self): self.command_table = {} @staticmethod def instance(): """Get the singleton, create an instance if needed""" if not CommandRegistrar._instanc...
Add `commands` property to `CommandManager` to allow retrieving the command table
Add `commands` property to `CommandManager` to allow retrieving the command table
Python
bsd-2-clause
6180/foxybot
5bb0259a747651290f91c0384ca93492a423c82d
IPython/utils/docs.py
IPython/utils/docs.py
# encoding: utf-8 # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os GENERATING_DOCUMENTATION = os.environ.get("IN_SPHINX_RUN", None) == "True"
import os GENERATING_DOCUMENTATION = os.environ.get("IN_SPHINX_RUN", None) == "True"
Remove outdated header as suggested
Remove outdated header as suggested Co-authored-by: Matthias Bussonnier <bc6ce7c050ee90e1f3b70c16cec57d4205e63b6c@gmail.com>
Python
bsd-3-clause
ipython/ipython,ipython/ipython
bc50a924c50fb22a0ac03b3b696d6fba4efcd120
src/main.py
src/main.py
#!/usr/bin/env python2 import sys from direct.showbase.ShowBase import ShowBase import panda3d.core as p3d import ecs from player import PlayerController class NodePathComponent(ecs.Component): __slots__ = [ "nodepath", ] def __init__(self, modelpath=None): if modelpath is not None: ...
#!/usr/bin/env python2 import math import sys from direct.showbase.ShowBase import ShowBase import panda3d.core as p3d import ecs from player import PlayerController class NodePathComponent(ecs.Component): __slots__ = [ "nodepath", ] def __init__(self, modelpath=None): if modelpath is no...
Change fov scaling to "Hor+".
Change fov scaling to "Hor+".
Python
apache-2.0
Moguri/sigurd
6d2d915d7bec4e4a8e733a073ec3dc79a1d06812
src/stop.py
src/stop.py
import os import json from flask import Flask from flask import request from flask import json import services app = Flask(__name__) digitransitAPIService = services.DigitransitAPIService() @app.route('/') def hello_world(): return 'Hello World!' @app.route('/test') def digitransit_test(): return json.d...
import os import json from flask import Flask from flask import make_response from flask import request from flask import json import services app = Flask(__name__) digitransitAPIService = services.DigitransitAPIService() @app.route('/') def hello_world(): return 'Hello World!' @app.route('/test') def digit...
Set response content type of a json response to application/json
Set response content type of a json response to application/json
Python
mit
STOP2/stop2.0-backend,STOP2/stop2.0-backend
7cfdf48bd04ba45a962901e1778ba05bab4699e6
readthedocs/core/migrations/0005_migrate-old-passwords.py
readthedocs/core/migrations/0005_migrate-old-passwords.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-11 17:28 from __future__ import unicode_literals from django.db import migrations def forwards_func(apps, schema_editor): User = apps.get_model('auth', 'User') old_password_patterns = ( 'sha1$', # RTD's production database does...
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-11 17:28 from __future__ import unicode_literals from django.db import migrations from django.contrib.auth.hashers import make_password def forwards_func(apps, schema_editor): User = apps.get_model('auth', 'User') old_password_patterns = ( ...
Migrate old passwords without "set_unusable_password"
Migrate old passwords without "set_unusable_password"
Python
mit
rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org
673f4ad22ccd14f9feb68cfc3afc1f34580c0a51
test/teeminus10_helpers_test.py
test/teeminus10_helpers_test.py
from teeminus10_helpers import * import unittest class TestInTimeOfDay(unittest.TestCase): def setUp(self): self.location = ephem.city('London') self.location.date = datetime(2013, 03, 14, 9, 0, 0) self.pass_day_time = datetime(2013, 03, 14, 12, 0, 0) self.pass_night_time = datetime...
from teeminus10_helpers import * import unittest class TestInTimeOfDay(unittest.TestCase): def setUp(self): self.location = ephem.city('London') self.location.date = datetime(2013, 03, 14, 9, 0, 0) self.pass_day_time = datetime(2013, 03, 14, 12, 0, 0) self.pass_night_time = datetime...
Remove sun setup for now
Remove sun setup for now
Python
mit
jpgneves/t-10_server,jpgneves/t-10_server
848c3a8b754d7a359da94c211f58d16bdf34c804
fabfile.py
fabfile.py
# -*- coding: utf-8 -*- u""" .. module:: fabfile Be aware, that becaus fabric doesn't support py3k You need to execute this particular script using Python 2. """ import contextlib from fabric.api import cd from fabric.api import env from fabric.api import prefix from fabric.api import run env.user = 'root' env.host...
# -*- coding: utf-8 -*- u""" .. module:: fabfile Be aware, that becaus fabric doesn't support py3k You need to execute this particular script using Python 2. """ import contextlib from fabric.api import cd from fabric.api import env from fabric.api import prefix from fabric.api import run env.user = 'root' env.host...
Add js tasks to fabric update
Add js tasks to fabric update
Python
mit
komitywa/wysadzulice.pl,magul/wysadzulice.pl,magul/wysadzulice.pl,magul/wysadzulice.pl,komitywa/wysadzulice.pl,komitywa/wysadzulice.pl
db4ecaba64a4fbd9d432b461ca0df5b63dd11fb4
marathon_acme/cli.py
marathon_acme/cli.py
import argparse import sys def main(raw_args=sys.argv[1:]): """ A tool to automatically request, renew and distribute Let's Encrypt certificates for apps running on Marathon and served by marathon-lb. """ parser = argparse.ArgumentParser( description='Automatically manage ACME certificates...
import argparse import sys def main(raw_args=sys.argv[1:]): """ A tool to automatically request, renew and distribute Let's Encrypt certificates for apps running on Marathon and served by marathon-lb. """ parser = argparse.ArgumentParser( description='Automatically manage ACME certificates...
Add --group option to CLI
Add --group option to CLI
Python
mit
praekeltfoundation/certbot,praekeltfoundation/certbot
316533b3d0864c3cf3dba7ae7a3a83e30a02f33a
scrape-10k.py
scrape-10k.py
import csv import time import requests import lxml.html top10k = {} for page_index in range(1, 201): print('Requesting page {}'.format(page_index)) url = 'https://osu.ppy.sh/p/pp/' payload = { 'm': 0, # osu! standard gamemode 'o': 1, # descending order 'page': page_index, } ...
import csv import time import collections import requests import lxml.html top10k = collections.OrderedDict() for page_index in range(1, 201): print('Requesting page {}'.format(page_index)) url = 'https://osu.ppy.sh/p/pp/' payload = { 'm': 0, # osu! standard gamemode 'o': 1, # descendin...
Maintain top 10k order when writing into file
Maintain top 10k order when writing into file
Python
mit
Cyanogenoid/osu-modspecific-rank
89b9bb45b17d457f6cf158330dfde6fe00e78cf4
core/storage/statistics/models.py
core/storage/statistics/models.py
# coding: utf-8 # # Copyright 2013 Google 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 ...
# coding: utf-8 # # Copyright 2013 Google 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 ...
Fix omission in previous commit.
Fix omission in previous commit.
Python
apache-2.0
leandrotoledo/oppia,rackstar17/oppia,zgchizi/oppia-uc,nagyistoce/oppia,kennho/oppia,MAKOSCAFEE/oppia,raju249/oppia,hazmatzo/oppia,Atlas-Sailed-Co/oppia,Atlas-Sailed-Co/oppia,mit0110/oppia,brylie/oppia,nagyistoce/oppia,BenHenning/oppia,dippatel1994/oppia,VictoriaRoux/oppia,CMDann/oppia,kennho/oppia,cleophasmashiri/oppia...
d68935dfb34f7c5fc463f94e49f0c060717b17b8
cmsplugin_contact_plus/checks.py
cmsplugin_contact_plus/checks.py
# -*- coding: utf-8 -*- from django.core.checks import Warning, register def warn_1_3_changes(app_configs, **kwargs): return [ Warning( 'cmsplugin-contact-plus >= 1.3 has renamed the "input" field. Do not forget to migrate your ' 'database and update your templates', hi...
# -*- coding: utf-8 -*- from django.core.checks import Warning, register def warn_1_3_changes(app_configs, **kwargs): return [ Warning( 'cmsplugin-contact-plus >= 1.3 has renamed the "input" field. Do not forget to migrate your ' 'database and update your templates', hi...
Comment out warning for renamed field
Comment out warning for renamed field
Python
bsd-3-clause
arteria/cmsplugin-contact-plus,arteria/cmsplugin-contact-plus,worthwhile/cmsplugin-remote-form,worthwhile/cmsplugin-remote-form
f0f66aa917d9ec85cfbe2a0460b2d4b4d5ffe0eb
middleware/hat_manager.py
middleware/hat_manager.py
class HatManager(object): def __init__(self, sense): self.sense = sense self._pressure = self.sense.get_pressure() self._temperature = self.sense.get_temperature() self._humidity = self.sense.get_humidity() def refresh_state(self): self._pressure = self.sense.get_press...
class HatManager(object): def __init__(self, sense): self.sense = sense self._pressure = self.sense.get_pressure() self._temperature = self.sense.get_temperature() self._humidity = self.sense.get_humidity() def refresh_state(self): self._pressure = self.sense.get_press...
Add a method to print a message on the sense hat
Add a method to print a message on the sense hat
Python
mit
ylerjen/pir-hat,ylerjen/pir-hat,ylerjen/pir-hat
60173acbecf1239872411b2ca0dd9eb75b543843
tests/sentry/web/frontend/test_organization_stats.py
tests/sentry/web/frontend/test_organization_stats.py
from __future__ import absolute_import from django.core.urlresolvers import reverse from sentry.testutils import TestCase, PermissionTestCase class OrganizationStatsPermissionTest(PermissionTestCase): def setUp(self): super(OrganizationStatsPermissionTest, self).setUp() self.path = reverse('sent...
from __future__ import absolute_import from django.core.urlresolvers import reverse from sentry.testutils import TestCase, PermissionTestCase class OrganizationStatsPermissionTest(PermissionTestCase): def setUp(self): super(OrganizationStatsPermissionTest, self).setUp() self.path = reverse('sent...
Correct permission tests for organization stats
Correct permission tests for organization stats
Python
bsd-3-clause
looker/sentry,alexm92/sentry,gg7/sentry,zenefits/sentry,vperron/sentry,ifduyue/sentry,imankulov/sentry,JamesMura/sentry,daevaorn/sentry,mitsuhiko/sentry,JackDanger/sentry,ewdurbin/sentry,BuildingLink/sentry,daevaorn/sentry,kevinlondon/sentry,songyi199111/sentry,TedaLIEz/sentry,kevinlondon/sentry,wujuguang/sentry,mitsuh...
54e5ee0cb6df1f47a1a6edd114c65ad62fd0c517
node/floor_divide.py
node/floor_divide.py
#!/usr/bin/env python from nodes import Node class FloorDiv(Node): char = "f" args = 2 results = 1 @Node.test_func([3,2], [1]) @Node.test_func([6,-3], [-2]) def func(self, a:Node.number,b:Node.number): """a/b. Rounds down, returns an int.""" return a//b @Node.test...
#!/usr/bin/env python from nodes import Node class FloorDiv(Node): char = "f" args = 2 results = 1 @Node.test_func([3,2], [1]) @Node.test_func([6,-3], [-2]) def func(self, a:Node.number,b:Node.number): """a/b. Rounds down, returns an int.""" return a//b @Node.test...
Add a group chunk, chunks a list into N groups
Add a group chunk, chunks a list into N groups
Python
mit
muddyfish/PYKE,muddyfish/PYKE
80737e5de2ca3f0f039c9d4fbbf3df4ac8b59193
run.py
run.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import twitter_rss import time import subprocess import config # Launch web server p = subprocess.Popen(['/usr/bin/python2', config.INSTALL_DIR + 'server.py']) # Update the feeds try: while 1: print 'Updating ALL THE FEEDS!' try: with open...
#!/usr/bin/env python # -*- coding: utf-8 -*- import twitter_rss import time import subprocess import config import sys # Launch web server p = subprocess.Popen([sys.executable, config.INSTALL_DIR + 'server.py']) # Update the feeds try: while 1: print 'Updating ALL THE FEEDS!' try: wi...
Use sys.executable instead of harcoded python path
Use sys.executable instead of harcoded python path Fixes issue when running in a virtualenv and in non-standard python installations.
Python
mit
Astalaseven/twitter-rss,Astalaseven/twitter-rss
d7d1e2937c9f09189aad713db1f5ee5d2d6a64bd
run.py
run.py
# -*- coding: utf-8 -*- """ This script generates all the relevant figures from the experiment. """ from Modules.processing import * from Modules.plotting import * set_sns() save = True savetype = ".eps" show = True def main(): plot_perf_curves(save=save, savetype=savetype) plot_perf_curves(subplots=False, ...
# -*- coding: utf-8 -*- """ This script generates all the relevant figures from the experiment. """ from Modules.processing import * from Modules.plotting import * set_sns() save = True savetype = ".eps" show = True def main(): plot_perf_curves(save=save, savetype=savetype) plot_perf_curves(subplots=False, ...
Make K transport bar graph
Make K transport bar graph
Python
mit
UNH-CORE/RM2-tow-tank
5f14b7217f81b6d7653f94065d1a3305204cf83b
ddcz/templatetags/creations.py
ddcz/templatetags/creations.py
from django import template from django.contrib.staticfiles.storage import staticfiles_storage from ..creations import RATING_DESCRIPTIONS register = template.Library() @register.inclusion_tag('creations/rating.html') def creation_rating(rating, skin): return { 'rating_description': RATING_DESCRIPTIONS[r...
from django import template from django.contrib.staticfiles.storage import staticfiles_storage from ..creations import RATING_DESCRIPTIONS register = template.Library() @register.inclusion_tag('creations/rating.html') def creation_rating(rating, skin): return { 'rating_description': "Hodnocení: %s" % RAT...
Add explicit rating word to rating alt
Add explicit rating word to rating alt
Python
mit
dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard
6b59d17aa06741f40bb99dde6c10950de3a142e6
utils/load.py
utils/load.py
#!/usr/local/bin/python from website import carts import urllib2 import json def load(): carts.remove_all() host = 'http://data.cityofnewyork.us/resource/xfyi-uyt5.json' for i in range(0, 7000, 1000): query = 'permit_type_description=MOBILE+FOOD+UNIT&$offset=%d' % i request = host + '?' +...
#!/usr/local/bin/python from website import carts import urllib2 import json def load(): carts.remove_all() request = 'http://data.cityofnewyork.us/resource/akqf-qv4n.json' for i in range(0, 24000, 1000): query = '?$offset=%d' % i data = urllib2.urlopen(request + query) results =...
Change cart structure and url endpoint for getting cart data
Change cart structure and url endpoint for getting cart data
Python
bsd-3-clause
stuycs-softdev-fall-2013/proj3-7-cartwheels,stuycs-softdev-fall-2013/proj3-7-cartwheels
de1c2842d7f07025f23e9b12efc7dd52e4d0efbf
device_notifications/tests/model_tests.py
device_notifications/tests/model_tests.py
from mock import patch from django.test.testcases import TestCase from device_notifications import settings from device_notifications.models import AbstractBaseDevice from device_notifications.models import InvalidDeviceType class ConcreteTestDevice(AbstractBaseDevice): pass @patch.object(settings, 'get_devi...
from mock import patch from django.test.testcases import TestCase from device_notifications import settings from device_notifications.models import AbstractBaseDevice from device_notifications.models import InvalidDeviceType class ConcreteTestDevice(AbstractBaseDevice): pass class AbstractBaseDeviceTests(Tes...
Patch get_device_model in the setUp and tearDown methods so that we don't send the mock object to each test method.
Patch get_device_model in the setUp and tearDown methods so that we don't send the mock object to each test method.
Python
bsd-3-clause
roverdotcom/django-device-notifications
b6dcb4029d3bf4b402a6874c942c9e4a105f2a62
tracker_project/tracker_project/urls.py
tracker_project/tracker_project/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),...
from django.conf.urls import patterns, include, url from django.contrib import admin from django.core.urlresolvers import reverse_lazy urlpatterns = patterns( '', url(r'^$', 'tracker_project.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('django.contri...
Fix login and logout URLs
Fix login and logout URLs
Python
mit
abarto/tracker_project,abarto/tracker_project,abarto/tracker_project,vivek8943/tracker_project,vivek8943/tracker_project,vivek8943/tracker_project
02140561a29a2b7fe50f7bf2402da566e60be641
bluebottle/organizations/serializers.py
bluebottle/organizations/serializers.py
from rest_framework import serializers from bluebottle.organizations.models import Organization from bluebottle.utils.serializers import URLField class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = ('id', 'name', 'slug', 'address_line1', 'address_l...
from rest_framework import serializers from bluebottle.organizations.models import Organization from bluebottle.utils.serializers import URLField class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = ('id', 'name', 'slug', 'address_line1', 'address_l...
Make the name of an organization required
Make the name of an organization required
Python
bsd-3-clause
jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle
33f2075396ded90e3cf17033985f29d262965500
dariah_static_data/management/commands/import_tadirah_vcc.py
dariah_static_data/management/commands/import_tadirah_vcc.py
from dariah_static_data.models import VCC from dariah_static_data.management.commands._private_helper import Command as SuperCommand class Command(SuperCommand): filename = 'tadirah_vcc.csv' fieldnames = ['uri', 'name', 'description'] mapping = [('name', 'name', 1), ('uri', 'uri', 1), ('description', 'des...
from dariah_static_data.models import TADIRAHVCC from dariah_static_data.management.commands._private_helper import Command as SuperCommand class Command(SuperCommand): filename = 'tadirah_vcc.csv' fieldnames = ['uri', 'name', 'description'] mapping = [('name', 'name', 1), ('uri', 'uri', 1), ('description...
Fix incorrect import after refactor of dariah_static_data models.
Fix incorrect import after refactor of dariah_static_data models.
Python
apache-2.0
DANS-KNAW/dariah-contribute,DANS-KNAW/dariah-contribute
add508b780d16fd2da2fd0639304935b762c001f
tests/cupy_tests/binary_tests/test_packing.py
tests/cupy_tests/binary_tests/test_packing.py
import unittest from cupy import testing @testing.gpu class TestPacking(unittest.TestCase): _multiprocess_can_split_ = True
import numpy import unittest from cupy import testing @testing.gpu class TestPacking(unittest.TestCase): _multiprocess_can_split_ = True @testing.for_int_dtypes() @testing.numpy_cupy_array_equal() def check_packbits(self, data, xp, dtype): a = xp.array(data, dtype=dtype) return xp.p...
Add tests for packbits and unpackbits
Add tests for packbits and unpackbits
Python
mit
okuta/chainer,niboshi/chainer,ktnyt/chainer,chainer/chainer,ktnyt/chainer,jnishi/chainer,ysekky/chainer,pfnet/chainer,wkentaro/chainer,keisuke-umezawa/chainer,ktnyt/chainer,chainer/chainer,hvy/chainer,jnishi/chainer,anaruse/chainer,wkentaro/chainer,keisuke-umezawa/chainer,ronekko/chainer,niboshi/chainer,chainer/chainer...
09ef3ba394faf9edc941e30e5c3f86bffa96d645
plugins/eightball.py
plugins/eightball.py
# Copyright (c) 2013-2014 Molly White # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, copy, modify, merge, publish, # di...
# Copyright (c) 2013-2014 Molly White # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, copy, modify, merge, publish, # di...
Add documentation for 8ball command
Add documentation for 8ball command
Python
mit
quanticle/GorillaBot,molly/GorillaBot,quanticle/GorillaBot,molly/GorillaBot
7c5061e4fbf0737ce07f13cb9102cdbbacf73115
pyethapp/tests/test_genesis.py
pyethapp/tests/test_genesis.py
import pytest from ethereum import blocks from ethereum.db import DB from ethereum.config import Env from pyethapp.utils import merge_dict from pyethapp.utils import update_config_from_genesis_json import pyethapp.config as konfig from pyethapp.profiles import PROFILES def check_genesis(profile): config = dict(et...
from pprint import pprint import pytest from ethereum import blocks from ethereum.db import DB from ethereum.config import Env from pyethapp.utils import merge_dict from pyethapp.utils import update_config_from_genesis_json import pyethapp.config as konfig from pyethapp.profiles import PROFILES @pytest.mark.parametri...
Fix & cleanup profile genesis tests
Fix & cleanup profile genesis tests
Python
mit
ethereum/pyethapp,gsalgado/pyethapp,gsalgado/pyethapp,changwu-tw/pyethapp,RomanZacharia/pyethapp,changwu-tw/pyethapp,RomanZacharia/pyethapp,ethereum/pyethapp
71d42d763bdb2d0c1bd8474a4da99695d5b77f91
alg_selection_sort.py
alg_selection_sort.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division def selection_sort(nums): """Selection Sort algortihm. Time complexity: O(n^2). Space complexity: O(1). """ # Start from the last num, iteratively select next max num to swap them. f...
from __future__ import absolute_import from __future__ import print_function from __future__ import division def selection_sort(nums): """Selection Sort algortihm. Time complexity: O(n^2). Space complexity: O(1). """ # Start from the last num, iteratively select max num to swap. for i in re...
Revise to i_max and enhance comments
Revise to i_max and enhance comments
Python
bsd-2-clause
bowen0701/algorithms_data_structures
a8d3790e4ef539c2a833fa493aeef4456b4a5dbb
unchecked_repos.py
unchecked_repos.py
#!/usr/bin/env python """List repos missing from repos.yaml.""" from __future__ import print_function import yaml from helpers import paginated_get REPOS_URL = "https://api.github.com/orgs/{org}/repos" # This is hacky; you need to have repo-tools-data cloned locally one dir up. # To do this properly, you should us...
#!/usr/bin/env python """List repos missing from repos.yaml.""" from __future__ import print_function import yaml from helpers import paginated_get REPOS_URL = "https://api.github.com/orgs/{org}/repos" # This is hacky; you need to have repo-tools-data cloned locally one dir up. # To do this properly, you should us...
Check for unchecked repos in more than just the edx org
Check for unchecked repos in more than just the edx org
Python
apache-2.0
edx/repo-tools,edx/repo-tools
4a9d1a373b5a460f1e793dd94d0c248e81b75f40
website/addons/box/settings/defaults.py
website/addons/box/settings/defaults.py
# OAuth app keys BOX_KEY = None BOX_SECRET = None BOX_AUTH_CSRF_TOKEN = 'box-auth-csrf-token'
# OAuth app keys BOX_KEY = None BOX_SECRET = None BOX_OAUTH_TOKEN_ENDPOINT = 'https://www.box.com/api/oauth2/token' BOX_OAUTH_AUTH_ENDPOINT = 'https://www.box.com/api/oauth2/authorize'
Add oauth endpoints to settings
Add oauth endpoints to settings
Python
apache-2.0
caneruguz/osf.io,GageGaskins/osf.io,GageGaskins/osf.io,ticklemepierce/osf.io,ticklemepierce/osf.io,kwierman/osf.io,samchrisinger/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,DanielSBrown/osf.io,zkraime/osf.io,MerlinZhang/osf.io,mfraezz/osf.io,pattisdr/osf.io,monikagrabowska/osf.io,monikagrabowska/osf.io,asanfilip...
62d7c94968d70564839b32375fac6608720c2a67
backend/pycon/urls.py
backend/pycon/urls.py
from api.views import GraphQLView from django.contrib import admin from django.urls import include, path from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path("admin/", admin.site.urls), path("graphql", csrf_exempt(GraphQLView.as_view()), name="graphql"), path("user/", include("users.ur...
from api.views import GraphQLView from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path("admin/", admin.site.urls), path("graphql", csrf_exempt(...
Add media url when running in debug mode
Add media url when running in debug mode
Python
mit
patrick91/pycon,patrick91/pycon
7185c5ef58757949197081808bf237f0111e7a86
packages/mono.py
packages/mono.py
class MonoPackage (Package): def __init__ (self): Package.__init__ (self, 'mono', '2.10.6', sources = [ 'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2', 'patches/mono-runtime-relocation.patch' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--wit...
class MonoPackage (Package): def __init__ (self): Package.__init__ (self, 'mono', '2.10.6', sources = [ 'http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2', 'patches/mono-runtime-relocation.patch' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--wit...
Fix building Mono 32-bit with Mac 10.7 SDK
Fix building Mono 32-bit with Mac 10.7 SDK
Python
mit
mono/bockbuild,BansheeMediaPlayer/bockbuild,bl8/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,bl8/bockbuild,bl8/bockbuild,mono/bockbuild
6246c26365b2df4cbb91142969aa857c7187e094
app/test_base.py
app/test_base.py
from flask.ext.testing import TestCase import unittest from app import app, db class BaseTestCase(TestCase): def create_app(self): app.config.from_object('config.TestingConfiguration') return app def setUp(self): db.create_all() def tearDown(self): db.session.remove() ...
from flask.ext.testing import TestCase import unittest from app import create_app, db class BaseTestCase(TestCase): def create_app(self): return create_app('config.TestingConfiguration') def setUp(self): db.create_all() def tearDown(self): db.session.remove() db.drop_all()...
Update tests to leverage factory pattern
Update tests to leverage factory pattern
Python
mit
rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy
fcd98cc714b5a790eaf2e946c492ab4e14700568
scripts/award_badge_to_user.py
scripts/award_badge_to_user.py
#!/usr/bin/env python """Award a badge to a user. :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import click from byceps.services.user_badge import service as badge_service from byceps.util.system import get_config_filename_from_env_or_exit from bootstrap.validator...
#!/usr/bin/env python """Award a badge to a user. :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import click from byceps.database import db from byceps.services.user_badge.models.badge import Badge, BadgeID from byceps.services.user_badge import service as badge_ser...
Change script to avoid creation of badge URLs to make it work outside of a *party-specific* app context
Change script to avoid creation of badge URLs to make it work outside of a *party-specific* app context
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps
8332dc01c3c743543f4c3faff44da84436ae5da2
planner/forms.py
planner/forms.py
from django.contrib.auth.forms import AuthenticationForm from django import forms from django.core.validators import MinLengthValidator from .models import PoolingUser from users.forms import UserCreationForm class LoginForm(AuthenticationForm): username = forms.CharField(widget=forms.EmailInput(attrs={'placehold...
from django.contrib.auth.forms import AuthenticationForm from django import forms from django.core.validators import MinLengthValidator from .models import PoolingUser, Trip, Step from users.forms import UserCreationForm class LoginForm(AuthenticationForm): username = forms.CharField(widget=forms.EmailInput(attrs...
Add Trip and Step ModelForms
Add Trip and Step ModelForms
Python
mit
livingsilver94/getaride,livingsilver94/getaride,livingsilver94/getaride
bd4e1c3f511ac1163e39d99fdc8e70f261023c44
setup/create_player_seasons.py
setup/create_player_seasons.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import concurrent.futures from db.common import session_scope from db.player import Player from utils.player_data_retriever import PlayerDataRetriever def create_player_seasons(simulation=False): data_retriever = PlayerDataRetriever() with session_scope() as s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import concurrent.futures from db.common import session_scope from db.player import Player from utils.player_data_retriever import PlayerDataRetriever def create_player_seasons(simulation=False): data_retriever = PlayerDataRetriever() with session_scope() as s...
Update player season retrieval function
Update player season retrieval function
Python
mit
leaffan/pynhldb
f2a88e4849876970c29b568b897dff88ffe09306
djrichtextfield/urls.py
djrichtextfield/urls.py
from django.conf.urls import url from djrichtextfield.views import InitView urlpatterns = [ url('^init.js$', InitView.as_view(), name='djrichtextfield_init') ]
from django.urls import path from djrichtextfield.views import InitView urlpatterns = [ path('init.js', InitView.as_view(), name='djrichtextfield_init') ]
Use path instead of soon to be deprecated url
Use path instead of soon to be deprecated url
Python
mit
jaap3/django-richtextfield,jaap3/django-richtextfield
c080865fdb36da2718774ddff436325d947be323
test/test_fit_allocator.py
test/test_fit_allocator.py
from support import lib,ffi from qcgc_test import QCGCTest class FitAllocatorTest(QCGCTest): def test_macro_consistency(self): self.assertEqual(2**lib.QCGC_LARGE_FREE_LIST_FIRST_EXP, lib.qcgc_small_free_lists + 1) last_exp = lib.QCGC_LARGE_FREE_LIST_FIRST_EXP + lib.qcgc_large_free_lists - 1 ...
from support import lib,ffi from qcgc_test import QCGCTest class FitAllocatorTest(QCGCTest): def test_macro_consistency(self): self.assertEqual(2**lib.QCGC_LARGE_FREE_LIST_FIRST_EXP, lib.qcgc_small_free_lists + 1) last_exp = lib.QCGC_LARGE_FREE_LIST_FIRST_EXP + lib.qcgc_large_free_lists - 1 ...
Add test for index to cells
Add test for index to cells
Python
mit
ntruessel/qcgc,ntruessel/qcgc,ntruessel/qcgc
b0a6652a11236409ec3e2606e04621f714a3ab63
test/test_jobs/__init__.py
test/test_jobs/__init__.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
Test generic creator of jobs.
Test generic creator of jobs.
Python
agpl-3.0
jean/pybossa,Scifabric/pybossa,geotagx/pybossa,OpenNewsLabs/pybossa,jean/pybossa,inteligencia-coletiva-lsd/pybossa,geotagx/pybossa,stefanhahmann/pybossa,stefanhahmann/pybossa,PyBossa/pybossa,Scifabric/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa
af31c71e49b7d63c24ab7d7c04a5e908451263e2
iati/core/tests/test_utilities.py
iati/core/tests/test_utilities.py
"""A module containing tests for the library implementation of accessing utilities.""" from lxml import etree import iati.core.resources import iati.core.utilities class TestUtilities(object): """A container for tests relating to utilities""" def test_convert_to_schema(self): """Check that an etree c...
"""A module containing tests for the library implementation of accessing utilities.""" from lxml import etree import iati.core.resources import iati.core.utilities class TestUtilities(object): """A container for tests relating to utilities""" def test_convert_to_schema(self): """Check that an etree c...
Add more logging test stubs
Add more logging test stubs
Python
mit
IATI/iati.core,IATI/iati.core
0deac2fe49d1240a1d5fee1b9c47313bde84d609
seleniumlogin/__init__.py
seleniumlogin/__init__.py
from importlib import import_module from django.contrib.auth import SESSION_KEY, BACKEND_SESSION_KEY, HASH_SESSION_KEY def force_login(user, driver, base_url): from django.conf import settings SessionStore = import_module(settings.SESSION_ENGINE).SessionStore selenium_login_start_page = getattr(settings, ...
from importlib import import_module from django.contrib.auth import SESSION_KEY, BACKEND_SESSION_KEY, HASH_SESSION_KEY def force_login(user, driver, base_url): from django.conf import settings SessionStore = import_module(settings.SESSION_ENGINE).SessionStore selenium_login_start_page = getattr(settings, ...
Change how the base_url is turned into a domain
Change how the base_url is turned into a domain
Python
mit
feffe/django-selenium-login,feffe/django-selenium-login
56e764835e75035452a6a1ea06c386ec61dbe872
src/rinoh/stylesheets/__init__.py
src/rinoh/stylesheets/__init__.py
# This file is part of rinohtype, the Python document preparation system. # # Copyright (c) Brecht Machiels. # # Use of this source code is subject to the terms of the GNU Affero General # Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. import inspect import os import sys from .. import DATA...
# This file is part of rinohtype, the Python document preparation system. # # Copyright (c) Brecht Machiels. # # Use of this source code is subject to the terms of the GNU Affero General # Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. import inspect import os import sys from .. import DATA...
Fix the auto-generated docstrings of style sheets
Fix the auto-generated docstrings of style sheets
Python
agpl-3.0
brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype
b448d52e5a30346633dd20e52431af39eb6859ec
importer/importer/connections.py
importer/importer/connections.py
import aioes from .utils import wait_for_all_services from .settings import ELASTICSEARCH_ENDPOINTS async def connect_to_elasticsearch(): print("Connecting to Elasticsearch...") await wait_for_all_services(ELASTICSEARCH_ENDPOINTS, timeout=10) elastic = aioes.Elasticsearch(ELASTICSEARCH_ENDPOINTS) aw...
import aioes from .utils import wait_for_all_services from .settings import ELASTICSEARCH_ENDPOINTS async def connect_to_elasticsearch(): print("Connecting to Elasticsearch...") await wait_for_all_services(ELASTICSEARCH_ENDPOINTS, timeout=10) elastic = aioes.Elasticsearch(ELASTICSEARCH_ENDPOINTS) re...
Remove the pointless cluster health check
Remove the pointless cluster health check
Python
mit
despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics
70d435e1176a1132db6a04c34c04567df354d1d9
cla_backend/apps/reports/management/commands/mi_cb1_report.py
cla_backend/apps/reports/management/commands/mi_cb1_report.py
# coding=utf-8 import logging from django.core.management.base import BaseCommand logger = logging.getLogger(__name__) class Command(BaseCommand): help = "This runs the MCCB1sSLA report" def handle(self, *args, **options): self.create_report() def create_report(): print("stuff goes her...
# coding=utf-8 import logging from django.core.management.base import BaseCommand from reports.tasks import ExportTask from core.models import get_web_user from django.views.decorators.csrf import csrf_exempt logger = logging.getLogger(__name__) class Command(BaseCommand): help = "This runs the MCCB1sSLA report"...
Send weekly report to aws
Send weekly report to aws
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
28803e4669f4c7b2b84e53e39e3a0a99ff57572d
skyfield/__main__.py
skyfield/__main__.py
# -*- coding: utf-8 -*- import pkg_resources import skyfield from skyfield.api import load from skyfield.functions import load_bundled_npy def main(): print('Skyfield version: {0}'.format(skyfield.__version__)) print('jplephem version: {0}'.format(version_of('jplephem'))) print('sgp4 version: {0}'.format(...
# -*- coding: utf-8 -*- import pkg_resources import numpy as np import skyfield from skyfield.api import load from skyfield.functions import load_bundled_npy def main(): print('Skyfield version: {0}'.format(skyfield.__version__)) print('jplephem version: {0}'.format(version_of('jplephem'))) print('sgp4 ve...
Fix “python -m skyfield” following ∆T array rename
Fix “python -m skyfield” following ∆T array rename
Python
mit
skyfielders/python-skyfield,skyfielders/python-skyfield
b812a8da81ec9943d11b8cb9f709e234c90a2282
stylo/utils.py
stylo/utils.py
from uuid import uuid4 class MessageBus: """A class that is used behind the scenes to coordinate events and timings of animations. """ def __init__(self): self.subs = {} def new_id(self): """Use this to get a name to use for your events.""" return str(uuid4()) def re...
import inspect from uuid import uuid4 def get_parameters(f): return list(inspect.signature(f).parameters.keys()) class MessageBus: """A class that is used behind the scenes to coordinate events and timings of animations. """ def __init__(self): self.subs = {} def new_id(self): ...
Add the function back for now
Add the function back for now
Python
mit
alcarney/stylo,alcarney/stylo
602184794c3f38bf6307cf68f4d61294b523c009
examples/LKE_example.py
examples/LKE_example.py
from pygraphc.misc.LKE import * from pygraphc.evaluation.ExternalEvaluation import * # set input and output path ip_address = '161.166.232.17' standard_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1/' + ip_address standard_file = standard_path + 'auth.log.anon.labeled' analyzed_file = 'auth.log....
from pygraphc.misc.LKE import * from pygraphc.evaluation.ExternalEvaluation import * # set input and output path dataset_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1_perday/' groundtruth_file = dataset_path + 'Dec 1.log.labeled' analyzed_file = 'Dec 1.log' OutputPath = '/home/hudan/Git/pygraph...
Edit path and external evaluation
Edit path and external evaluation
Python
mit
studiawan/pygraphc
2739999c6fa0628e7cfe7a918e3cde3b7d791d66
tests/astroplpython/data/test_Timeseries.py
tests/astroplpython/data/test_Timeseries.py
''' Created on Jul 16, 2014 @author: thomas ''' import unittest class TestTimeseries (unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_strToXTArray (self): import astroplpython.data.Timeseries as t strarr = ['(1,1.)', '(2,2.)', '(2.1,3.)', '...
''' Created on Jul 16, 2014 @author: thomas ''' import unittest class TestTimeseries (unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_strToXTArray (self): import astroplpython.data.Timeseries as Timeseries # test data stra...
Modify test to match changes in class
Modify test to match changes in class
Python
mit
brianthomas/astroplpython,brianthomas/astroplpython
5b7789d519be7251c58b68879f013d5f3bf0c950
tests/thread/thread_stacksize1.py
tests/thread/thread_stacksize1.py
# test setting the thread stack size # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd import sys import _thread # different implementations have different minimum sizes if sys.implementation == 'micropython': sz = 2 * 1024 else: sz = 32 * 1024 def foo(): pass def thread_entry(...
# test setting the thread stack size # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd import sys import _thread # different implementations have different minimum sizes if sys.implementation.name == 'micropython': sz = 2 * 1024 else: sz = 32 * 1024 def foo(): pass def thread_e...
Make stack-size test run correctly and reliable on uPy.
tests/thread: Make stack-size test run correctly and reliable on uPy.
Python
mit
mhoffma/micropython,HenrikSolver/micropython,ryannathans/micropython,dmazzella/micropython,mhoffma/micropython,PappaPeppar/micropython,MrSurly/micropython,tuc-osg/micropython,oopy/micropython,oopy/micropython,SHA2017-badge/micropython-esp32,AriZuu/micropython,toolmacher/micropython,redbear/micropython,mhoffma/micropyth...
ec9b1f0ebda55e3e02e597e10ac28d62286b922f
SimPEG/EM/NSEM/Utils/__init__.py
SimPEG/EM/NSEM/Utils/__init__.py
""" module SimPEG.EM.NSEM.Utils Collection of utilities that are usefull for the NSEM problem NOTE: These utilities are not well test, use with care """ from __future__ import absolute_import from .MT1Dsolutions import get1DEfields # Add the names of the functions from .MT1Danalytic import getEHfields, getImpedanc...
""" module SimPEG.EM.NSEM.Utils Collection of utilities that are usefull for the NSEM problem NOTE: These utilities are not well test, use with care """ from __future__ import absolute_import from .MT1Dsolutions import get1DEfields # Add the names of the functions from .MT1Danalytic import getEHfields, getImpedanc...
Fix import issue due to name changes
Fix import issue due to name changes
Python
mit
simpeg/simpeg
3a470c02a1a171f876200258897d6e277a1aab91
tournamentcontrol/competition/signals/__init__.py
tournamentcontrol/competition/signals/__init__.py
from django.db import models from tournamentcontrol.competition.signals.custom import match_forfeit # noqa from tournamentcontrol.competition.signals.ladders import ( # noqa changed_points_formula, scale_ladder_entry, team_ladder_entry_aggregation, ) from tournamentcontrol.competition.signals.matches imp...
from django.db import models from tournamentcontrol.competition.signals.custom import match_forfeit # noqa from tournamentcontrol.competition.signals.ladders import ( # noqa changed_points_formula, scale_ladder_entry, team_ladder_entry_aggregation, ) from tournamentcontrol.competition.signals.matches imp...
Stop using the undocumented get_all_related_objects_with_model API
Stop using the undocumented get_all_related_objects_with_model API
Python
bsd-3-clause
goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic
cbb90d03b83a495b1c46514a583538f2cfc0d29c
test/functional/test_manager.py
test/functional/test_manager.py
from osmviz.manager import PILImageManager, OSMManager import PIL.Image as Image def test_pil(): imgr = PILImageManager("RGB") osm = OSMManager(image_manager=imgr) image, bnds = osm.createOSMImage((30, 35, -117, -112), 9) wh_ratio = float(image.size[0]) / image.size[1] image2 = image.resize((int(8...
from osmviz.manager import PILImageManager, OSMManager import PIL.Image as Image def test_pil(): image_manager = PILImageManager("RGB") osm = OSMManager(image_manager=image_manager) image, bounds = osm.createOSMImage((30, 31, -117, -116), 9) wh_ratio = float(image.size[0]) / image.size[1] image2 =...
Reduce number of tiles downloaded
Reduce number of tiles downloaded
Python
mit
hugovk/osmviz,hugovk/osmviz
257686cfa72318c0b476d4623731080f848c4942
app.py
app.py
import requests from flask import Flask, render_template app = Flask(__name__) BBC_id= "bbc-news" API_KEY = "c4002216fa5446d582b5f31d73959d36" @app.route("/") def index(): r = requests.get( f"https://newsapi.org/v1/articles?source={BBC_id}&sortBy=top&apiKey={API_KEY}" ) return render_template("in...
import requests from flask import Flask, render_template app = Flask(__name__, instance_relative_config=True) app.config.from_pyfile("appconfig.py") BBC_id= "bbc-news" @app.route("/") def index(): r = requests.get( f"https://newsapi.org/v1/articles?source={BBC_id}&sortBy=top&apiKey={app.config['API_KEY']...
Use instance folder to load configuration file.
Use instance folder to load configuration file.
Python
mit
alchermd/headlines,alchermd/headlines
d1ccd3e93043d11a22e873e7ccdb76d749746151
api/app/app.py
api/app/app.py
import os import logging from flask import Flask from model.base import db from route.base import blueprint # Register models and routes import model import route logging.basicConfig(level=logging.INFO) app = Flask(__name__) # app.config['PROPAGATE_EXCEPTIONS'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'postgre...
import os import logging from uwsgidecorators import postfork from flask import Flask from model.base import db from route.base import blueprint # Register models and routes import model import route logging.basicConfig(level=logging.INFO) app = Flask(__name__) # app.config['PROPAGATE_EXCEPTIONS'] = True app.config[...
Refresh db connections on uwsgi fork
Refresh db connections on uwsgi fork
Python
mit
hexa4313/velov-companion-server,hexa4313/velov-companion-server
08fbfa49129a42821b128913e4aa9fbacf966f20
grizzly-jersey/setup.py
grizzly-jersey/setup.py
import subprocess import sys import setup_util import os def start(args): try: subprocess.check_call("mvn clean package shade:shade", shell=True, cwd="grizzly-jersey") subprocess.Popen("java -jar target/grizzly-jersey-example-0.1.jar".rsplit(" "), cwd="grizzly-jersey") return 0 except subprocess.Called...
import subprocess import sys import setup_util import os def start(args): try: subprocess.check_call("mvn clean package", shell=True, cwd="grizzly-jersey") subprocess.Popen("java -jar target/grizzly-jersey-example-0.1.jar".rsplit(" "), cwd="grizzly-jersey") return 0 except subprocess.CalledProcessError...
Fix the build so it no longer double-shades. This removes all the warnings it printed.
Fix the build so it no longer double-shades. This removes all the warnings it printed.
Python
bsd-3-clause
yunspace/FrameworkBenchmarks,grob/FrameworkBenchmarks,herloct/FrameworkBenchmarks,Ocramius/FrameworkBenchmarks,nbrady-techempower/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,nkasvosve/FrameworkBenchmarks,grob/FrameworkBenchmarks,victorbriz/FrameworkBenchmarks,sxend/FrameworkBenchmarks,jet...
8ae763c69bbba11a264f8404b8189a53c63d4f40
marathon_itests/environment.py
marathon_itests/environment.py
import time from itest_utils import wait_for_marathon from itest_utils import print_container_logs def before_all(context): wait_for_marathon() def after_scenario(context, scenario): """If a marathon client object exists in our context, delete any apps in Marathon and wait until they die.""" if scenari...
import time from itest_utils import wait_for_marathon from itest_utils import print_container_logs def before_all(context): wait_for_marathon() def after_scenario(context, scenario): """If a marathon client object exists in our context, delete any apps in Marathon and wait until they die.""" if context...
Move log print to after_step
Move log print to after_step
Python
apache-2.0
Yelp/paasta,gstarnberger/paasta,gstarnberger/paasta,Yelp/paasta,somic/paasta,somic/paasta
605443886582d13c2b45b19fad86854bf4e8ddbd
backend/catalogue/serializers.py
backend/catalogue/serializers.py
from rest_framework import serializers from .models import Release, Track, Comment class CommentSerializer(serializers.ModelSerializer): class Meta: model = Comment fields = ('id', 'comment') class TrackSerializer(serializers.ModelSerializer): cdid = serializers.StringRelatedField( re...
from rest_framework import serializers from .models import Release, Track, Comment class CommentSerializer(serializers.ModelSerializer): class Meta: model = Comment fields = ('id', 'comment') class TrackSerializer(serializers.ModelSerializer): class Meta: model = Track fields...
Add more fields to Release serializer.
Add more fields to Release serializer.
Python
mit
ThreeDRadio/playlists,ThreeDRadio/playlists,ThreeDRadio/playlists
1118541b1cdea7f6079bb63d000ba54f69dfa119
books/views.py
books/views.py
from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.shortcuts import render from books import models from books import forms @login_required def receipt_list(request...
from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.shortcuts import render from books import models from books import forms @login_required def receipt_list(request, user_...
Use form.save for receipt creation
Use form.save for receipt creation
Python
mit
trimailov/finance,trimailov/finance,trimailov/finance
1e01e66f23f7a2ca541a29d29658749f95352c41
generate-key.py
generate-key.py
#!/usr/bin/python import os import sqlite3 import sys import time if len(sys.argv) < 3: raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0]) db = sqlite3.connect('/var/lib/zon-api/data.db') api_key = str(os.urandom(26).encode('hex')) tier = 'free' name = sys.argv[1] email = sys.argv[...
#!/usr/bin/python import os import sqlite3 import sys import time db = sqlite3.connect('/var/lib/zon-api/data.db') if len(sys.argv) < 3: print('Usage: %s "Firstname Lastname" email@example.com' % sys.argv[0]) print('\nLast keys:') query = 'SELECT * FROM client ORDER by reset DESC limit 10' for client...
Print last 10 generated keys when no arguments were given.
Print last 10 generated keys when no arguments were given.
Python
bsd-3-clause
ZeitOnline/content-api,ZeitOnline/content-api
2af5eff46cbae0927aeee135c22304e108519659
server/python_django/file_uploader/__init__.py
server/python_django/file_uploader/__init__.py
""" @author: Ferdinand E. Silva @email: ferdinandsilva@ferdinandsilva.com @website: http://ferdinandsilva.com """ import os from django.utils import simplejson as json class qqFileUploader(object): def __init__(self, allowedExtensions=None, sizeLimit=1024): self.allowedExtensions = allowedExtensions or [...
""" @author: Ferdinand E. Silva @email: ferdinandsilva@ferdinandsilva.com @website: http://ferdinandsilva.com """ import os from django.conf import settings from django.utils import simplejson as json class qqFileUploader(object): def __init__(self, allowedExtensions=None, sizeLimit=None): self.allowedEx...
Use the default file upload max memory size
Use the default file upload max memory size
Python
mit
SimonWaldherr/uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,FineUploader/fine-uploader
5c874677cc978e1cdd563a563d62bae162d3b7ac
mycroft/skills/audioservice.py
mycroft/skills/audioservice.py
import time from mycroft.messagebus.message import Message class AudioService(): def __init__(self, emitter): self.emitter = emitter self.emitter.on('MycroftAudioServiceTrackInfoReply', self._track_info) self.info = None def _track_info(self, message=None): self.info = messag...
import time from mycroft.messagebus.message import Message class AudioService(): def __init__(self, emitter): self.emitter = emitter self.emitter.on('MycroftAudioServiceTrackInfoReply', self._track_info) self.info = None def _track_info(self, message=None): self.info = messag...
Add check for valid type of tracks
Add check for valid type of tracks
Python
apache-2.0
aatchison/mycroft-core,MycroftAI/mycroft-core,MycroftAI/mycroft-core,aatchison/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core,Dark5ide/mycroft-core,forslund/mycroft-core
77ef9f4a7ccd51d7b070da31ff4c30768653bb7b
tools/build_modref_templates.py
tools/build_modref_templates.py
#!/usr/bin/env python """Script to auto-generate our API docs. """ # stdlib imports import os # local imports from apigen import ApiDocWriter #***************************************************************************** if __name__ == '__main__': package = 'nipype' outdir = os.path.join('api','generated') ...
#!/usr/bin/env python """Script to auto-generate our API docs. """ # stdlib imports import os # local imports from apigen import ApiDocWriter #***************************************************************************** if __name__ == '__main__': package = 'nipype' outdir = os.path.join('api','generated') ...
Remove alloy and s3 from generated docs, just for 0.1 release.
Remove alloy and s3 from generated docs, just for 0.1 release. git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@496 ead46cd0-7350-4e37-8683-fc4c6f79bf00
Python
bsd-3-clause
blakedewey/nipype,gerddie/nipype,FCP-INDI/nipype,rameshvs/nipype,blakedewey/nipype,satra/NiPypeold,FCP-INDI/nipype,FredLoney/nipype,arokem/nipype,dmordom/nipype,pearsonlab/nipype,pearsonlab/nipype,Leoniela/nipype,glatard/nipype,mick-d/nipype_source,mick-d/nipype,dmordom/nipype,arokem/nipype,carlohamalainen/nipype,mick-...
0f3c33de86d38cf47f84df97a79e838d37264b7c
sugar/session/LogWriter.py
sugar/session/LogWriter.py
import os import sys import dbus class LogWriter: def __init__(self, application): self._application = application bus = dbus.SessionBus() proxy_obj = bus.get_object('com.redhat.Sugar.Logger', '/com/redhat/Sugar/Logger') self._logger = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Logger') def start(self): ...
import os import sys import dbus import gobject class LogWriter: def __init__(self, application): self._application = application bus = dbus.SessionBus() proxy_obj = bus.get_object('com.redhat.Sugar.Logger', '/com/redhat/Sugar/Logger') self._logger = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Logger') def ...
Add messages on idle so that we don't break
Add messages on idle so that we don't break
Python
lgpl-2.1
sugarlabs/sugar-toolkit,ceibal-tatu/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit,manuq/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,godiard/sugar-toolkit-gtk3,Daksh/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,gusDuarte/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolki...
2022357fd0f81be6f3ca91718a6c8c1d1d46ac1b
examples/olfaction/config_files/gen_olf_stimuli.py
examples/olfaction/config_files/gen_olf_stimuli.py
""" Create odorant stimuli in hd5 format """ """ Create the gexf configuration based on E. Hallem's cell paper on 2006 """ import numpy as np import h5py osn_num = 1375; f = h5py.File("al.hdf5","w") dt = 1e-4 # time step Ot = 2000 # number of data point during reset period Rt = 1000 # number of data point during o...
""" Create odorant stimuli in hd5 format """ """ Create the gexf configuration based on E. Hallem's cell paper on 2006 """ import numpy as np import h5py osn_num = 1375; f = h5py.File("olfactory_stimulus.h5","w") dt = 1e-4 # time step Ot = 2000 # number of data point during reset period Rt = 1000 # number of data ...
Rename olfactory stimulus file and internal array.
Rename olfactory stimulus file and internal array. --HG-- branch : LPU
Python
bsd-3-clause
cerrno/neurokernel
58d131e8aceb1adbbcdce2e1d4a86f5fb4615196
Lib/xml/__init__.py
Lib/xml/__init__.py
"""Core XML support for Python. This package contains three sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Meggins...
"""Core XML support for Python. This package contains three sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Meggins...
Remove the outer test for __name__; not necessary.
Remove the outer test for __name__; not necessary.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
2b58318ad7134a8c894b70918520a89b51a2d6dd
cla_backend/apps/reports/tests/test_utils.py
cla_backend/apps/reports/tests/test_utils.py
import mock import os from boto.s3.connection import S3Connection from django.test import TestCase, override_settings from reports.utils import get_s3_connection class UtilsTestCase(TestCase): @override_settings(AWS_ACCESS_KEY_ID="000000000001", AWS_SECRET_ACCESS_KEY="000000000002") def test_get_s3_connectio...
import mock import os from boto.s3.connection import S3Connection from django.test import TestCase, override_settings from reports.utils import get_s3_connection class UtilsTestCase(TestCase): @override_settings(AWS_ACCESS_KEY_ID="000000000001", AWS_SECRET_ACCESS_KEY="000000000002", AWS_S3_HOST="s3.eu-west-2.ama...
Modify s3 connection test for new AWS_S3_HOST setting
Modify s3 connection test for new AWS_S3_HOST setting The value is now calculated from the env var at load time, so mocking the env var value is not effective (cherry picked from commit 044219df7123e3a03a38cc06c9e8e8e9e80b0cbe)
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
9477478f81315edcc0e5859b2325ea70694ea2be
lemon/sitemaps/views.py
lemon/sitemaps/views.py
from django.shortcuts import render from django.utils.translation import get_language from lemon.sitemaps.models import Item def sitemap_xml(request): qs = Item.objects.filter(sites=request.site, enabled=True, language=get_language()) return render(request, 'sitemaps/sitemap.xml', {'object_...
from django.shortcuts import render from lemon.sitemaps.models import Item def sitemap_xml(request): qs = Item.objects.filter(sites=request.site, enabled=True) return render(request, 'sitemaps/sitemap.xml', {'object_list': qs}, content_type='application/xml')
Remove language filtration in sitemap.xml
Remove language filtration in sitemap.xml
Python
bsd-3-clause
trilan/lemon,trilan/lemon,trilan/lemon
6bf26f15855ee6e13e11a2b026ee90b9302a68a7
PyFVCOM/__init__.py
PyFVCOM/__init__.py
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '1.6.1' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import buoy_tools from PyFV...
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '1.6.1' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import buoy_tools from PyFV...
Add a better name for the coordinate functions. Eventually, ll2utm will be deprecated.
Add a better name for the coordinate functions. Eventually, ll2utm will be deprecated.
Python
mit
pwcazenave/PyFVCOM
751c38ebe052a689b7962491ffd5f54b593da397
harvesting/datahub.io/fix-urls.py
harvesting/datahub.io/fix-urls.py
import sys fix_url = sys.argv[1] for line in sys.stdin: e = line.strip().split(" ") if e[0].startswith("_:"): e[0] = "<%s>" % e[0].replace("_:",fix_url) if e[2].startswith("_:"): e[2] = "<%s>" % e[2].replace("_:",fix_url) print(" ".join(e))
import sys fix_url = sys.argv[1] dct = "<http://purl.org/dc/terms/" dcelems = ["contributor", "coverage>", "creator>", "date>", "description>", "format>", "identifier>", "language>", "publisher>", "relation>", "rights>", "source>", "subject>", "title>", "type>"] for line in sys.stdin: e = ...
Fix datathub DCT uris to DC
Fix datathub DCT uris to DC
Python
apache-2.0
liderproject/linghub,liderproject/linghub,liderproject/linghub,liderproject/linghub
e8d321c35d6e0a8294e0766c3836efe192ae2df0
print_items_needing_requeue.py
print_items_needing_requeue.py
""" Walks through your greader-logs directory (or directory containing them) and prints every item_name that has been finished but has no valid .warc.gz (as determined by greader-warc-checker's .verification logs) """ import os import sys try: import simplejson as json except ImportError: import json basename = os....
""" Walks through your greader-logs directory (or directory containing them) and prints every item_name that has been finished but has no valid .warc.gz (as determined by greader-warc-checker's .verification logs) """ import os import sys try: import simplejson as json except ImportError: import json basename = os....
Print items that are bad *or* missing
Print items that are bad *or* missing
Python
mit
ludios/greader-warc-checker
400c8de8a3a714da21c0e2b175c6e4adad3677b9
syft/__init__.py
syft/__init__.py
import importlib import pkgutil ignore_packages = set(['test']) def import_submodules(package, recursive=True): """ Import all submodules of a module, recursively, including subpackages :param package: package (name or actual module) :type package: str | module :rtype: dict[str, types.ModuleType] ...
import importlib import pkgutil ignore_packages = set(['test']) def import_submodules(package, recursive=True): """ Import all submodules of a module, recursively, including subpackages :param package: package (name or actual module) :type package: str | module :rtype: dict[str, types.ModuleType] ...
Check for the name of the submodule we'd like to ignore in a more general way.
Check for the name of the submodule we'd like to ignore in a more general way.
Python
apache-2.0
aradhyamathur/PySyft,sajalsubodh22/PySyft,OpenMined/PySyft,dipanshunagar/PySyft,sajalsubodh22/PySyft,dipanshunagar/PySyft,joewie/PySyft,cypherai/PySyft,cypherai/PySyft,joewie/PySyft,aradhyamathur/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
849b9eb93220af324343facb5f83d112de952fa0
mpltools/util.py
mpltools/util.py
import matplotlib.pyplot as plt __all__ = ['figure', 'figsize'] def figure(aspect_ratio=1.3, scale=1, width=None, *args, **kwargs): """Return matplotlib figure window. Parameters ---------- aspect_ratio : float Aspect ratio, width / height, of figure. scale : float Scale default...
import matplotlib.pyplot as plt __all__ = ['figure', 'figsize'] def figure(aspect_ratio=1.3, scale=1, width=None, *args, **kwargs): """Return matplotlib figure window. Calculate figure height using `aspect_ratio` and *default* figure width. Parameters ---------- aspect_ratio : float As...
Add note to docstring of `figure` and `figsize`.
ENH: Add note to docstring of `figure` and `figsize`.
Python
bsd-3-clause
tonysyu/mpltools,matteoicardi/mpltools
fef12d2a5cce5c1db488a4bb11b9c21b83a66cab
avocado/export/_json.py
avocado/export/_json.py
import json import inspect from _base import BaseExporter class JSONGeneratorEncoder(json.JSONEncoder): "Handle generator objects and expressions." def default(self, obj): if inspect.isgenerator(obj): return list(obj) return super(JSONGeneratorEncoder, self).default(obj) class JS...
import inspect from django.core.serializers.json import DjangoJSONEncoder from _base import BaseExporter class JSONGeneratorEncoder(DjangoJSONEncoder): "Handle generator objects and expressions." def default(self, obj): if inspect.isgenerator(obj): return list(obj) return super(JSO...
Update JSONGeneratorEncoder to subclass DjangoJSONEncoder This handles Decimals and datetimes
Update JSONGeneratorEncoder to subclass DjangoJSONEncoder This handles Decimals and datetimes
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
f7fac123bf72af01272bc27a1dfabb788f611908
bandit/backends/smtp.py
bandit/backends/smtp.py
from __future__ import unicode_literals from django.core.mail.backends.smtp import EmailBackend as SMTPBackend from bandit.backends.base import HijackBackendMixin, LogOnlyBackendMixin class HijackSMTPBackend(HijackBackendMixin, SMTPBackend): """ This backend intercepts outgoing messages drops them to a sing...
from __future__ import unicode_literals from django.core.mail.backends.smtp import EmailBackend as SMTPBackend from bandit.backends.base import HijackBackendMixin, LogOnlyBackendMixin class HijackSMTPBackend(HijackBackendMixin, SMTPBackend): """ This backend intercepts outgoing messages drops them to a sing...
Update LogOnlySMTPBackend docstring. Not only admin emails are allowed, all approved emails are still sent.
Update LogOnlySMTPBackend docstring. Not only admin emails are allowed, all approved emails are still sent.
Python
bsd-3-clause
caktus/django-email-bandit,caktus/django-email-bandit
527593c5f183054e330894e6b7161e24cca265a5
lily/notes/factories.py
lily/notes/factories.py
import random import factory from factory.declarations import SubFactory, SelfAttribute, LazyAttribute from factory.django import DjangoModelFactory from faker.factory import Factory from lily.accounts.factories import AccountFactory from lily.contacts.factories import ContactFactory from lily.users.factories import ...
import random from datetime import datetime import pytz import factory from factory.declarations import SubFactory, SelfAttribute, LazyAttribute from factory.django import DjangoModelFactory from faker.factory import Factory from lily.accounts.factories import AccountFactory from lily.contacts.factories import Contac...
Fix so testdata can be loaded when setting up local environment
Fix so testdata can be loaded when setting up local environment
Python
agpl-3.0
HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily
245dd2ef403cd88aebf5dd8923585a9e0489dd97
mongoalchemy/util.py
mongoalchemy/util.py
# The MIT License # # Copyright (c) 2010 Jeffrey Jenkins # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
# The MIT License # # Copyright (c) 2010 Jeffrey Jenkins # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
Change UNSET to so bool(UNSET) is False.
Change UNSET to so bool(UNSET) is False.
Python
mit
shakefu/MongoAlchemy,shakefu/MongoAlchemy,shakefu/MongoAlchemy
ba98874be9370ec49c2c04e89d456f723b5d083c
monitoring/test/test_data/exceptions.py
monitoring/test/test_data/exceptions.py
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
Adjust tests for python-monascaclient >= 1.3.0
Adjust tests for python-monascaclient >= 1.3.0 the exceptions module was moved out of the openstack.common namespace, so try to import the new location first and fall back to the old one if it doesn't exist. Change-Id: I3305775baaab15dca8d5e7e5cfc0932f94d4d153
Python
apache-2.0
openstack/monasca-ui,openstack/monasca-ui,openstack/monasca-ui,stackforge/monasca-ui,stackforge/monasca-ui,stackforge/monasca-ui,stackforge/monasca-ui,openstack/monasca-ui
8ef41f9ac8ec8a7b7fc9e63b2ff6453782c41d62
demo/__init__.py
demo/__init__.py
"""Package for PythonTemplateDemo.""" __project__ = 'PythonTemplateDemo' __version__ = '0.0.0' VERSION = __project__ + '-' + __version__
"""Package for PythonTemplateDemo.""" __project__ = 'PythonTemplateDemo' __version__ = '0.0.0' VERSION = __project__ + '-' + __version__ PYTHON_VERSION = 3, 4 import sys if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test) exit("Python {}.{}+ is required.".format(*PYTHON_VERSION))
Deploy Travis CI build 381 to GitHub
Deploy Travis CI build 381 to GitHub
Python
mit
jacebrowning/template-python-demo
edf151feea948ebf4a9f00a0248ab1f363cacfac
scaffolder/commands/install.py
scaffolder/commands/install.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from optparse import make_option from optparse import OptionParser from scaffolder import get_minion_path from scaffolder.core.template import TemplateManager from scaffolder.core.commands import BaseCommand class InstallCommand(BaseCommand): option_list = BaseCommand...
#!/usr/bin/env python # -*- coding: utf-8 -*- from optparse import make_option from optparse import OptionParser from scaffolder import get_minion_path from scaffolder.core.template import TemplateManager from scaffolder.core.commands import BaseCommand class InstallCommand(BaseCommand): option_list = BaseCommand...
Remove __init__ method, not needed.
InstallCommand: Remove __init__ method, not needed.
Python
mit
goliatone/minions