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
f1939ef0eadb164dfbe95bf90b3a4cd8757c8a75
src/ovirtsdk/infrastructure/common.py
src/ovirtsdk/infrastructure/common.py
# # Copyright (c) 2010 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
# # Copyright (c) 2010 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
Add empty export method to decorator base
sdk: Add empty export method to decorator base Decorators for resources and collections extend a common base class, for example: class VMSnapshotDisks(Base) The resource decorators also extend the corresponding parameter class: class VMSnapshotDisk(params.Disk, Base) This means that resource decorators impleme...
Python
apache-2.0
DragonRoman/ovirt-engine-sdk,DragonRoman/ovirt-engine-sdk,DragonRoman/ovirt-engine-sdk
18e07d14cf0c0f72e1af50b55bd054d917cb346b
docs/source/parameters.py
docs/source/parameters.py
def _getvar(var, path, default=None): with open(path) as f: for line in f: if var in line: g = {} l = {} exec line in g, l return l[var] return default def _version(): import os return _getvar("__version__", os.path.jo...
def _getvar(var, path, default=None): with open(path) as f: for line in f: if var in line and "=" in line and "__all__" not in line: g = {} l = {} exec line in g, l return l[var] return default def _version(): import os ...
Read doc version number from _metadata.py
Read doc version number from _metadata.py
Python
apache-2.0
datawire/bakerstreet,datawire/bakerstreet
b1b4b0efd8619e1cb00ee317cc4d57e4dce00eec
projects/wsgi.py
projects/wsgi.py
""" WSGI config for projects project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
""" WSGI config for projects project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
Read the script name if the proxy passes it
Read the script name if the proxy passes it
Python
mit
cmheisel/project-status-dashboard,cmheisel/project-status-dashboard,cmheisel/project-status-dashboard
d8e5dce3489817a5065c045688b03f9e85c0b9a4
tests/data_structures/commons/binary_search_tree_unit_test.py
tests/data_structures/commons/binary_search_tree_unit_test.py
import unittest from pyalgs.data_structures.commons.binary_search_tree import BinarySearchTree class BinarySearchTreeUnitTest(unittest.TestCase): def test_binarySearchTree(self): bst = BinarySearchTree.create() bst.put("one", 1) bst.put("two", 2) bst.put("three", 3) bst.p...
import unittest from pyalgs.data_structures.commons.binary_search_tree import BinarySearchTree class BinarySearchTreeUnitTest(unittest.TestCase): def test_binarySearchTree(self): bst = BinarySearchTree.create() bst.put("one", 1) bst.put("two", 2) bst.put("three", 3) bst.p...
Increase the unit test coverage for the binary search tree
Increase the unit test coverage for the binary search tree
Python
bsd-3-clause
chen0040/pyalgs
c8e7400008f19f89519cbfd067c8e82f41fc503a
signac/__init__.py
signac/__init__.py
""" signac aids in the management, access and analysis of large-scale computational investigations. The framework provides a simple data model, which helps to organize data production and post-processing as well as distribution among collaboratos. """ # The VERSION string represents the actual (development) version o...
""" signac aids in the management, access and analysis of large-scale computational investigations. The framework provides a simple data model, which helps to organize data production and post-processing as well as distribution among collaboratos. """ from . import contrib from . import db # The VERSION string repre...
Put contrib and db into global API.
Put contrib and db into global API.
Python
bsd-3-clause
csadorf/signac,csadorf/signac
17198f73f66190711a2df3c7b47008b2a0c50f8e
transaction_downloader/transaction_downloader.py
transaction_downloader/transaction_downloader.py
"""Transaction Downloader. Usage: transaction-downloader auth --account=<account-name> transaction-downloader -h | --help transaction-downloader --version Options: -h --help Show this screen. --version Show version. --account=<account-name> Account to work with. """ from d...
"""Transaction Downloader. Usage: transaction-downloader auth --account=<account-name> transaction-downloader -h | --help transaction-downloader --version Options: -h --help Show this screen. --version Show version. --account=<account-name> Account to work with. """ import...
Add function to read in plaid + account credentials into one structure.
Add function to read in plaid + account credentials into one structure.
Python
mit
ebridges/plaid2qif,ebridges/plaid2qif,ebridges/plaid2qif
d9adcad2b67b7e25e5997f3bfafb0208ab225fa9
tests/integration/cattletest/core/test_proxy.py
tests/integration/cattletest/core/test_proxy.py
from common_fixtures import * # NOQA import requests def test_proxy(client, admin_user_client): domain = 'releases.rancher.com' s = admin_user_client.by_id_setting('api.proxy.whitelist') if domain not in s.value: s.value += ',{}'.format(domain) admin_user_client.update(s, value=s.value)...
from common_fixtures import * # NOQA import requests def test_proxy(client, admin_user_client): domain = 'releases.rancher.com' s = admin_user_client.by_id_setting('api.proxy.whitelist') if domain not in s.value: s.value += ',{}'.format(domain) admin_user_client.update(s, value=s.value)...
Use http for proxy test
Use http for proxy test
Python
apache-2.0
cjellick/cattle,vincent99/cattle,vincent99/cattle,cloudnautique/cattle,jimengliu/cattle,wlan0/cattle,rancher/cattle,cjellick/cattle,Cerfoglg/cattle,rancherio/cattle,rancherio/cattle,rancherio/cattle,wlan0/cattle,cloudnautique/cattle,jimengliu/cattle,rancher/cattle,cjellick/cattle,cloudnautique/cattle,Cerfoglg/cattle,Ce...
e39bcde813d35c8079743fbed7e77f2c8e4b4596
examples/mainwindow.py
examples/mainwindow.py
import sys from os.path import join, dirname, abspath from qtpy import uic from qtpy.QtCore import Slot from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox import qtmodern.styles import qtmodern.windows _UI = join(dirname(abspath(__file__)), 'mainwindow.ui') class MainWindow(QMainWindow): def __...
import sys from os.path import join, dirname, abspath from qtpy import uic from qtpy.QtCore import Slot from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox import qtmodern.styles import qtmodern.windows _UI = join(dirname(abspath(__file__)), 'mainwindow.ui') class MainWindow(QMainWindow): def __...
Update example to switch between light and dark themes
Update example to switch between light and dark themes
Python
mit
gmarull/qtmodern
8da480a92f3e27807275868c27cb41cbde8504d8
neo/test/rawiotest/test_alphaomegarawio.py
neo/test/rawiotest/test_alphaomegarawio.py
""" Tests of neo.rawio.examplerawio Note for dev: if you write a new RawIO class your need to put some file to be tested at g-node portal, Ask neuralensemble list for that. The file need to be small. Then you have to copy/paste/renamed the TestExampleRawIO class and a full test will be done to test if the new coded I...
""" Tests of neo.rawio.examplerawio Note for dev: if you write a new RawIO class your need to put some file to be tested at g-node portal, Ask neuralensemble list for that. The file need to be small. Then you have to copy/paste/renamed the TestExampleRawIO class and a full test will be done to test if the new coded I...
Set logging level higher so we don't spam tests with debug messages
Set logging level higher so we don't spam tests with debug messages
Python
bsd-3-clause
INM-6/python-neo,apdavison/python-neo,JuliaSprenger/python-neo,NeuralEnsemble/python-neo,samuelgarcia/python-neo
369adf5a3a303612edf9f0169c7b37b7c711a852
frappe/website/page_renderers/web_page.py
frappe/website/page_renderers/web_page.py
import frappe class WebPage(object): def __init__(self, path=None, http_status_code=None): self.headers = None self.http_status_code = http_status_code or 200 if not path: path = frappe.local.request.path self.path = path.strip('/ ') self.basepath = None self.basename = None self.name = None self.r...
import frappe class WebPage(object): def __init__(self, path=None, http_status_code=None): self.headers = None self.http_status_code = http_status_code or 200 if not path: path = frappe.local.request.path self.path = path.strip('/ ') self.basepath = '' self.basename = '' self.name = '' self.route =...
Set default value as empty string
fix: Set default value as empty string
Python
mit
frappe/frappe,mhbu50/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe,almeidapaulopt/frappe,yashodhank/frappe,almeidapaulopt/frappe,mhbu50/frappe,yashodhank/frappe,StrellaGroup/frappe,mhbu50/frappe,almeidapaulopt/frappe,yashodhank/frappe,almeidapaulopt/frappe,StrellaGroup/frappe,mhbu50/frappe,yashodhank/frappe
5c6dd036e9fc14d04805a0f31af5a9c28fe51cf5
tx_salaries/management/commands/generate_transformer_hash.py
tx_salaries/management/commands/generate_transformer_hash.py
from django.core.management.base import BaseCommand from optparse import make_option from ...utils import transformer class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--sheet', action='store', dest='sheet', default=None, help='Sheet name'), ma...
from django.core.management.base import BaseCommand from optparse import make_option from ...utils import transformer class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--sheet', action='store', dest='sheet', default=None, help='Sheet name'), ma...
Add message if transformer_hash already exists
Add message if transformer_hash already exists
Python
apache-2.0
texastribune/tx_salaries,texastribune/tx_salaries
3c742914bd032648665f9069456d78c0a03e5568
bluebottle/projects/documents.py
bluebottle/projects/documents.py
from django_elasticsearch_dsl import DocType, Index from bluebottle.projects.models import Project # The name of your index project = Index('projects') # See Elasticsearch Indices API reference for available settings project.settings( number_of_shards=1, number_of_replicas=0 ) @project.doc_type class Projec...
from django_elasticsearch_dsl import DocType from bluebottle.projects.models import Project from bluebottle.utils.documents import MultiTenantIndex # The name of your index project = MultiTenantIndex('projects') # See Elasticsearch Indices API reference for available settings project.settings( number_of_shards=1,...
Use a different index for different tenants
Use a different index for different tenants
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
3f81676d8bc39b459d98a1a91b9ced97be58451d
celestial/exoplanets_importer.py
celestial/exoplanets_importer.py
import requests import csv from models import Planet, SolarSystem from django.core.exceptions import ValidationError class ExoplanetsImporter: @staticmethod def run(filename = None): if filename!=None: csv_data = open(filename) else: csv_data = requests.get('http://exopl...
import requests import csv from models import Planet, SolarSystem from django.core.exceptions import ValidationError class ExoplanetsImporter: @staticmethod def run(filename = None): if filename!=None: csv_data = open(filename) else: csv_data = requests.get('http://exopl...
Refactor importer slightly to avoid creation problems
Refactor importer slightly to avoid creation problems
Python
mit
Floppy/kepler-explorer,Floppy/kepler-explorer,Floppy/kepler-explorer
5387fa4c96bb0cdc62e83203065dda84d91c8a57
project_recalculate/models/resource_calendar.py
project_recalculate/models/resource_calendar.py
# -*- coding: utf-8 -*- # See README.rst file on addon root folder for license details from openerp import models, api from datetime import datetime, timedelta class ResourceCalendar(models.Model): _inherit = 'resource.calendar' @api.v7 def get_working_days_of_date(self, cr, uid, id, start_dt=None, end_...
# -*- coding: utf-8 -*- # See README.rst file on addon root folder for license details from openerp import models, api from datetime import datetime, timedelta class ResourceCalendar(models.Model): _inherit = 'resource.calendar' @api.v7 def get_working_days_of_date(self, cr, uid, id, start_dt=None, end_...
Define UTC as tz in get_working_days_of_date method
[FIX] Define UTC as tz in get_working_days_of_date method
Python
agpl-3.0
OCA/project,OCA/project
354af0bd82da57e718e9612ffb11e3b56d335fbf
projects/search_indexes.py
projects/search_indexes.py
import datetime import os from haystack.indexes import * from haystack import site from projects.models import File, ImportedFile from projects import constants class FileIndex(SearchIndex): text = CharField(document=True, use_template=True) author = CharField(model_attr='project__user') project = CharFiel...
import datetime import os import codecs from haystack.indexes import * from haystack import site from projects.models import File, ImportedFile from projects import constants class FileIndex(SearchIndex): text = CharField(document=True, use_template=True) author = CharField(model_attr='project__user') pro...
Fix unicode fail in search indexing.
Fix unicode fail in search indexing.
Python
mit
atsuyim/readthedocs.org,tddv/readthedocs.org,singingwolfboy/readthedocs.org,raven47git/readthedocs.org,LukasBoersma/readthedocs.org,stevepiercy/readthedocs.org,johncosta/private-readthedocs.org,michaelmcandrew/readthedocs.org,espdev/readthedocs.org,wijerasa/readthedocs.org,Tazer/readthedocs.org,sid-kap/readthedocs.org,...
a4e402caf7b5a90607b6a206046c96c53a37e860
slack_client/exceptions.py
slack_client/exceptions.py
class SlackError(Exception): pass class SlackNo(SlackError): def __init__(self, msg_error): self.msg = msg_error def __str__(self): return repr(self.msg) class SlackTooManyRequests(SlackError): def __init__(self, time_to_wait): self.time_to_wait = time_to_wait def __str__...
class SlackError(Exception): pass class SlackNo(SlackError): pass class SlackMissingAPI(SlackError): pass
Add a custom exception (SlackMissingAPI)
Add a custom exception (SlackMissingAPI) This exception is raised when a SlackObject is created without any way to get an API. Remove custom implementation for exceptions. There is no reason strong enough for this.
Python
mit
Shir0kamii/slack-client
f9d0d6af3d4b2d4b4ca88ba5aa0565f29528bf96
snakeplan/projects/urls.py
snakeplan/projects/urls.py
from django.conf.urls.defaults import patterns, url urlpatterns = patterns('snakeplan.projects.views', (r'^$', 'projects.index'), (r'^story/(.*)/', 'stories.index'), (r'^iteration/(.*)/', 'iterations.index'), (r'^create/', 'projects.create_project'), url(r'^(.*)/', 'projects.project_iterations', n...
from django.conf.urls.defaults import patterns, url urlpatterns = patterns('snakeplan.projects.views', (r'^$', 'projects.index'), (r'^story/(.*)/', 'stories.index'), (r'^iteration/(.*)/', 'iterations.index'), (r'^create/', 'projects.create_project'), (r'^(.*)/iterations', 'projects.project_iterati...
Add /project/<id>/iterations route for the hell of it(I think it makes more sense)
Add /project/<id>/iterations route for the hell of it(I think it makes more sense)
Python
apache-2.0
mcrute/snakeplan,mcrute/snakeplan,mcrute/snakeplan
e37ae5f799e02cc2308793af585316557e59e6cf
froide/redaction/utils.py
froide/redaction/utils.py
import os import base64 import tempfile import subprocess def convert_to_pdf(post): path = tempfile.mkdtemp() pagenr = 1 while True: data = post.get('page_%s' % pagenr) if data is None: break if not data.startswith('data:image/png;base64,'): continue ...
import os import base64 import tempfile import subprocess def convert_to_pdf(post): path = tempfile.mkdtemp() pagenr = 1 while True: data = post.get('page_%s' % pagenr) if data is None: break if not data.startswith('data:image/png;base64,'): continue ...
Write to png file in binary mode
Write to png file in binary mode
Python
mit
stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide
2a5b68a9357ac576a684880549a93f32335e5761
pyramid_zipkin/__init__.py
pyramid_zipkin/__init__.py
from pyramid.tweens import MAIN def includeme(config): # pragma: no cover """ :type config: :class:`pyramid.config.Configurator` """ config.add_tween('pyramid_zipkin.zipkin.zipkin_tween', over=MAIN)
from pyramid.tweens import EXCVIEW def includeme(config): # pragma: no cover """ :type config: :class:`pyramid.config.Configurator` """ config.add_tween('pyramid_zipkin.zipkin.zipkin_tween', over=EXCVIEW)
Change to over=EXCVIEW to make response status work correctly
Change to over=EXCVIEW to make response status work correctly
Python
apache-2.0
Yelp/pyramid_zipkin,bplotnick/pyramid_zipkin
3cfbe13f53837a0cb5065b37f4c0a6ae5c9dd50d
cutthroat/views/signin.py
cutthroat/views/signin.py
from tornado import template from tornado.web import authenticated from cutthroat.handlers import ViewHandler class SignIn(ViewHandler): """SignIn""" def get(self): self.render("signin.html") class Landing(ViewHandler): """Landing""" @authenticated def get(self): _, player =...
from tornado import template from tornado.web import authenticated from cutthroat.handlers import ViewHandler class SignIn(ViewHandler): """SignIn""" def get(self): self.render("signin.html") class Landing(ViewHandler): """Landing""" @authenticated def get(self): _, player =...
Add room redirect clause to Landing
Add room redirect clause to Landing
Python
agpl-3.0
hfaran/LivesPool,hfaran/LivesPool,hfaran/LivesPool,hfaran/LivesPool
5f0a4f33196c368318dba21aaa66956d4b973d60
usig_normalizador_amba/settings.py
usig_normalizador_amba/settings.py
# coding: UTF-8 from __future__ import absolute_import default_settings = { 'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/', 'callejero_caba_server': 'http://usig.buenosaires.gov.ar/servicios/Callejero', } # Tipo de normalizacion CALLE = 0 CALLE_ALTURA = 1 CALLE_Y_CALLE = 2...
# coding: UTF-8 from __future__ import absolute_import default_settings = { 'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/', 'callejero_caba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero', } # Tipo de normalizacion CALLE = 0 CALLE_ALTURA = 1 CALLE_Y_CALLE = 2...
Fix a la url del callejero CABA
Fix a la url del callejero CABA
Python
mit
usig/normalizador-amba,hogasa/normalizador-amba
8830b0e726a671fa2b0bbafd1487148ae23fc1d4
admin/forms.py
admin/forms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import riak from wtforms.fields import TextField, TextAreaField, SelectField from wtforms.validators import Required from wtforms_tornado import Form class ConnectionForm(Form): name = TextField(validators=[Required()]) conection = TextField(validators=[Required(...
#!/usr/bin/env python # -*- coding: utf-8 -*- import riak from wtforms.fields import TextField, TextAreaField, SelectField from wtforms.validators import Required from wtforms_tornado import Form def ObjGenerate(bucket, key, value=None, _type=tuple): myClient = riak.RiakClient(protocol='http', ...
Create new method object generate get riak bucket and generate tuple or list
Create new method object generate get riak bucket and generate tuple or list
Python
mit
chrisdamba/mining,seagoat/mining,avelino/mining,jgabriellima/mining,AndrzejR/mining,jgabriellima/mining,mining/mining,mlgruby/mining,chrisdamba/mining,mlgruby/mining,mlgruby/mining,seagoat/mining,AndrzejR/mining,avelino/mining,mining/mining
46e9db6167a9c4f7f778381da888537c00d35bfd
emailsupport/admin.py
emailsupport/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from models import Email, Resolution class ResolutionInline(admin.StackedInline): model = Resolution max_num = 1 class EmailAdmin(admin.ModelAdmin): list_display = ('subject', 'submitter', 'get_state_displ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from models import Email, Resolution class ResolutionInline(admin.StackedInline): model = Resolution max_num = 1 class EmailAdmin(admin.ModelAdmin): list_display = ('subject', 'submitter', 'get_state_displ...
Add prev. and next email to context only if exist original (current)
Add prev. and next email to context only if exist original (current)
Python
mit
rosti-cz/django-emailsupport
9359a236bc955a84b53417246fb5b4b2e3d04389
i18n/tests/loader_tests.py
i18n/tests/loader_tests.py
import unittest import i18n class TestFileLoader(unittest.TestCase): def test_dummy(self): self.assertTrue(hasattr(i18n, 'resource_loader')) suite = unittest.TestLoader().loadTestsFromTestCase(TestFileLoader) unittest.TextTestRunner(verbosity=2).run(suite)
import unittest from i18n import resource_loader class TestFileLoader(unittest.TestCase): def test_nonexisting_extension(self): self.assertRaises(resource_loader.I18nFileLoadError, resource_loader.load_resource, "foo.bar") suite = unittest.TestLoader().loadTestsFromTestCase(TestFileLoader) unittest.Text...
Add test for nonexisting file extensions.
Add test for nonexisting file extensions.
Python
mit
tuvistavie/python-i18n
d9b46a4d06bf6832aa5dbb394ae97325e0578400
survey/tests/test_default_settings.py
survey/tests/test_default_settings.py
from survey.tests import BaseTest from django.test import override_settings from django.conf import settings from django.test import tag from survey import set_default_settings @tag("set") @override_settings() class TestDefaultSettings(BaseTest): def test_set_choices_separator(self): url = "/admin/survey/...
from survey.tests import BaseTest from django.test import override_settings from django.conf import settings from survey import set_default_settings from survey.exporter.tex.survey2tex import Survey2Tex @override_settings() class TestDefaultSettings(BaseTest): def test_set_choices_separator(self): url = "...
Add - Test for setting ROOT
Add - Test for setting ROOT
Python
agpl-3.0
Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey
b4b905333f8847be730f30fbc53ac7a172195cdc
src/sentry/api/endpoints/group_events.py
src/sentry/api/endpoints/group_events.py
from __future__ import absolute_import from sentry.api.base import DocSection from sentry.api.bases import GroupEndpoint from sentry.api.serializers import serialize from sentry.api.paginator import DateTimePaginator from sentry.models import Event, Group from sentry.utils.apidocs import scenario, attach_scenarios @...
from __future__ import absolute_import from sentry.api.base import DocSection from sentry.api.bases import GroupEndpoint from sentry.api.serializers import serialize from sentry.api.paginator import DateTimePaginator from sentry.models import Event, Group from sentry.utils.apidocs import scenario, attach_scenarios @...
Add query param to event list
Add query param to event list
Python
bsd-3-clause
looker/sentry,BuildingLink/sentry,mvaled/sentry,fotinakis/sentry,zenefits/sentry,BuildingLink/sentry,gencer/sentry,gencer/sentry,JamesMura/sentry,zenefits/sentry,alexm92/sentry,ifduyue/sentry,BuildingLink/sentry,JamesMura/sentry,JackDanger/sentry,gencer/sentry,fotinakis/sentry,nicholasserra/sentry,JackDanger/sentry,mva...
6f5be9af15898f089c3ee83ca1f05fbd4570fcfa
src/cms/apps/news/models.py
src/cms/apps/news/models.py
"""Models used by the news publication application.""" from django.db import models from cms.apps.pages.models import Page, PageBase, PageField, HtmlField from cms.apps.news.content import NewsFeed, NewsArticle class Article(PageBase): """A news article.""" news_feed = PageField(Page, ...
"""Models used by the news publication application.""" from django.db import models from cms.apps.pages.models import Page, PageBase, PageField, HtmlField from cms.apps.news.content import NewsFeed, NewsArticle class Article(PageBase): """A news article.""" news_feed = PageField(Page, ...
Set unique together on news article.
Set unique together on news article.
Python
bsd-3-clause
lewiscollard/cms,etianen/cms,etianen/cms,danielsamuels/cms,jamesfoley/cms,lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,dan-gamble/cms,jamesfoley/cms,danielsamuels/cms,etianen/cms,danielsamuels/cms
824ead425a80feeb7dc1fbd6505cf50c6e2ffd90
ui_extensions/playground/views.py
ui_extensions/playground/views.py
from django.shortcuts import render from extensions.views import admin_extension, tab_extension, \ TabExtensionDelegate, dashboard_extension from resourcehandlers.models import ResourceHandler from utilities.logger import ThreadLogger logger = ThreadLogger(__name__) class ResourceHandlerTabDelegate(TabExtension...
from django.shortcuts import render from extensions.views import admin_extension, tab_extension, \ TabExtensionDelegate, dashboard_extension from resourcehandlers.models import ResourceHandler from utilities.logger import ThreadLogger logger = ThreadLogger(__name__) class ResourceHandlerTabDelegate(TabExtension...
Add more info to TabDelegate example
Add more info to TabDelegate example Provide details on how to limit a tab delegate to a specific resource handler.
Python
apache-2.0
CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge
1f2ad74d0ba33de7a964c5d675493434bd6fde74
days/apps/days/models.py
days/apps/days/models.py
"""Models for the days app.""" from django.db import models class Event(models.Model): """Representation of a notable historical event.""" date = models.DateField( help_text='When the event occurred.' ) description = models.TextField( help_text='A description of the event.' ) ...
"""Models for the days app.""" from django.db import models class Event(models.Model): """Representation of a notable historical event.""" # How to perform lookups on this field: https://docs.djangoproject.com/en/1.9/ref/models/querysets/#month date = models.DateField( help_text='When the event oc...
Document info for performing lookups on date fields
Document info for performing lookups on date fields
Python
mit
rlucioni/days
25cebf23c84d8e1136a3e2b503e574aa1c7263e6
dbaas_zabbix/dbaas_api.py
dbaas_zabbix/dbaas_api.py
# -*- coding: utf-8 -*- class DatabaseAsAServiceApi(object): def __init__(self, databaseinfra): self.databaseinfra = databaseinfra self.driver = self.get_databaseinfra_driver() self.database_instances = self.get_database_instances() def get_all_instances(self, ): return self.d...
# -*- coding: utf-8 -*- class DatabaseAsAServiceApi(object): def __init__(self, databaseinfra): self.databaseinfra = databaseinfra self.driver = self.get_databaseinfra_driver() self.database_instances = self.get_database_instances() def get_all_instances(self, ): return self.d...
Add databaseinfra get engine name
Add databaseinfra get engine name
Python
bsd-3-clause
globocom/dbaas-zabbix,globocom/dbaas-zabbix
ab9a38793645a9c61cf1c320e5a4db9bf7b03ccf
grow/deployments/utils.py
grow/deployments/utils.py
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On initial commit, no HEAD yet.') try:...
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On initial commit, no HEAD yet.') try:...
Allow operating in an environment with a detached HEAD.
Allow operating in an environment with a detached HEAD.
Python
mit
grow/pygrow,denmojo/pygrow,grow/grow,grow/grow,grow/pygrow,codedcolors/pygrow,grow/grow,grow/pygrow,denmojo/pygrow,denmojo/pygrow,denmojo/pygrow,codedcolors/pygrow,codedcolors/pygrow,grow/grow
2b39c89e86ca00ca6bbca88d68e1bccf9c94efd4
grab/spider/decorators.py
grab/spider/decorators.py
import functools import logging from weblib.error import ResponseNotValid def integrity(integrity_func, integrity_errors=(ResponseNotValid,), ignore_errors=()): """ Args: :param integrity_func: couldb callable or string contains name of method to call """ def build_d...
import functools import logging from weblib.error import ResponseNotValid def integrity(integrity_func, integrity_errors=(ResponseNotValid,), ignore_errors=()): """ Args: :param integrity_func: couldb callable or string contains name of method to call """ def build_d...
Fix exception handling in integrity decorator
Fix exception handling in integrity decorator
Python
mit
SpaceAppsXploration/grab,alihalabyah/grab,giserh/grab,raybuhr/grab,SpaceAppsXploration/grab,maurobaraldi/grab,lorien/grab,DDShadoww/grab,pombredanne/grab-1,maurobaraldi/grab,lorien/grab,raybuhr/grab,DDShadoww/grab,huiyi1990/grab,liorvh/grab,shaunstanislaus/grab,istinspring/grab,kevinlondon/grab,pombredanne/grab-1,huiyi...
257b186eb64638d6638be93633d4db02ce14d390
docker_log_es/storage.py
docker_log_es/storage.py
#!/usr/bin/env python # encoding: utf-8 import socket from os import environ as env from tornado.netutil import Resolver from tornado import gen from tornado.httpclient import AsyncHTTPClient class UnixResolver(Resolver): def initialize(self, resolver): self.resolver = resolver def close(self): ...
#!/usr/bin/env python # encoding: utf-8 import socket from os import environ as env from tornado.netutil import Resolver from tornado import gen from tornado.httpclient import AsyncHTTPClient class UnixResolver(Resolver): def initialize(self, resolver): self.resolver = resolver def close(self): ...
Connect to the "elasticsearch" host by default
Connect to the "elasticsearch" host by default
Python
mit
ei-grad/docker-log-es
27a944d5fc74972a90e8dd69879ebc27c4412b99
test/python_api/default-constructor/sb_frame.py
test/python_api/default-constructor/sb_frame.py
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetFrameID() obj.GetPC() obj.SetPC(0xffffffff) obj.GetSP() obj.GetFP() obj.GetPCAddress() obj.GetSymbolContext(0) obj.GetModule() obj.GetCo...
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetFrameID() obj.GetPC() obj.SetPC(0xffffffff) obj.GetSP() obj.GetFP() obj.GetPCAddress() obj.GetSymbolContext(0) obj.GetModule() obj.GetCo...
Add FindValue() and WatchValue() fuzz calls to the mix.
Add FindValue() and WatchValue() fuzz calls to the mix. git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@140439 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb
5ff559f386957844f32d6f96987bcece5c9a43cc
webserver/profiles/templatetags/profile_tags.py
webserver/profiles/templatetags/profile_tags.py
""" gravatar_url from https://en.gravatar.com/site/implement/images/django/ """ from django import template from django.conf import settings import urllib import hashlib register = template.Library() class GravatarUrlNode(template.Node): def __init__(self, email): self.email = template.Variable(email) ...
""" gravatar_url from https://en.gravatar.com/site/implement/images/django/ """ from django import template from django.conf import settings import urllib import hashlib register = template.Library() class GravatarUrlNode(template.Node): def __init__(self, email): self.email = template.Variable(email) ...
Use secure gravatar and fix gravatar image size
Use secure gravatar and fix gravatar image size Fixes #106 Fixes #112
Python
bsd-3-clause
siggame/webserver,siggame/webserver,siggame/webserver
ff445030337b087513114f327b05e89fdfc7d31d
test_sempai.py
test_sempai.py
import jsonsempai import os import shutil import sys import tempfile TEST_FILE = '''{ "three": 3 }''' class TestSempai(object): def setup(self): self.direc = tempfile.mkdtemp(prefix='jsonsempai') sys.path.append(self.direc) with open(os.path.join(self.direc, 'test_sempai.json'), 'w') a...
import jsonsempai import os import shutil import sys import tempfile TEST_FILE = '''{ "three": 3 }''' class TestSempai(object): def setup(self): self.direc = tempfile.mkdtemp(prefix='jsonsempai') sys.path.append(self.direc) with open(os.path.join(self.direc, 'sempai.json'), 'w') as f: ...
Add a couple more tests
Add a couple more tests
Python
mit
kragniz/json-sempai
d594747d7f5027b6994d98eaa17ed59d6dcb40de
tests/model/test_pwave_classifiers.py
tests/model/test_pwave_classifiers.py
from unittest import TestCase import numpy as np from construe.knowledge.abstraction_patterns.segmentation.pwave import _CLASSIFIERS as classifier class TestClassifier(TestCase): def test_classifier(self): limb = classifier[0] prec = classifier[1] X_test = np.loadtxt("pw_samples.csv", del...
from unittest import TestCase import os import numpy as np from construe.knowledge.abstraction_patterns.segmentation.pwave import _CLASSIFIERS as classifier path = os.path.dirname(__file__) class TestClassifier(TestCase): def test_classifier(self): limb = classifier[0] prec = classifier[1] ...
Fix test path to file dir to be able to load classifier data
Fix test path to file dir to be able to load classifier data
Python
agpl-3.0
citiususc/construe,citiususc/construe,citiususc/construe
c9940a91dd78eb2215559f02b356e15a89fcea28
indra/tests/test_eidos.py
indra/tests/test_eidos.py
import os from indra.sources import eidos from indra.statements import Influence path_this = os.path.dirname(os.path.abspath(__file__)) test_json = os.path.join(path_this, 'eidos_test.json') def test_process_json(): ep = eidos.process_json_file(test_json) assert ep is not None assert len(ep.statements) ...
import os from indra.sources import eidos from indra.statements import Influence path_this = os.path.dirname(os.path.abspath(__file__)) test_json = os.path.join(path_this, 'eidos_test.json') def test_process_json(): ep = eidos.process_json_file(test_json) assert ep is not None assert len(ep.statements) ...
Add tests for eidos found_by annotation
Add tests for eidos found_by annotation
Python
bsd-2-clause
johnbachman/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/indra,bgyori/indra,bgyori/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra
6d83e409dcf56806b433c10012717b3551c69a4f
kobo/hub/decorators.py
kobo/hub/decorators.py
# -*- coding: utf-8 -*- import socket from django.core.exceptions import PermissionDenied, SuspiciousOperation from kobo.decorators import decorator_with_args from kobo.django.xmlrpc.decorators import * def validate_worker(func): def _new_func(request, *args, **kwargs): if not request.user.is_authentic...
# -*- coding: utf-8 -*- import socket from django.core.exceptions import PermissionDenied, SuspiciousOperation from kobo.decorators import decorator_with_args from kobo.django.xmlrpc.decorators import * def validate_worker(func): def _new_func(request, *args, **kwargs): if not request.user.is_authentic...
Remove reverse DNS validation for Kobo worker
Remove reverse DNS validation for Kobo worker
Python
lgpl-2.1
release-engineering/kobo,release-engineering/kobo,release-engineering/kobo,release-engineering/kobo
3d8f50f39f76cbeb07136c75d6e65dc4132d7aa2
hr_expense_sequence/models/hr_expense_expense.py
hr_expense_sequence/models/hr_expense_expense.py
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api class HrExpens...
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api class HrExpens...
Write expense number on account move
Write expense number on account move
Python
agpl-3.0
acsone/hr,Antiun/hr,raycarnes/hr,Vauxoo/hr,feketemihai/hr,alanljj/oca_hr,xpansa/hr,thinkopensolutions/hr,open-synergy/hr,yelizariev/hr,microcom/hr,microcom/hr,charbeljc/hr,open-synergy/hr,Endika/hr,iDTLabssl/hr,Endika/hr,hbrunn/hr,alanljj/oca_hr,VitalPet/hr,thinkopensolutions/hr,iDTLabssl/hr,rschnapka/hr,damdam-s/hr,An...
cab50585aca7a25d52436ab5d7fd9f75f08a185b
epiphany/test/test_compiled_c.py
epiphany/test/test_compiled_c.py
from epiphany.sim import Epiphany import os.path import pytest elf_dir = os.path.join('epiphany', 'test', 'c') @pytest.mark.parametrize("elf_file,expected", [('nothing.elf', 176), ]) def test_compiled_c(elf_file, expected, capsys): """Test an ELF file that has bee...
from epiphany.sim import Epiphany import os.path import pytest elf_dir = os.path.join('epiphany', 'test', 'c') @pytest.mark.parametrize("elf_file,expected", [('nothing.elf', 176), ('fib.elf', 441), ]) def test_compi...
Add fib.elf to integration tests.
Add fib.elf to integration tests.
Python
bsd-3-clause
futurecore/revelation,moreati/revelation,moreati/revelation,futurecore/revelation,futurecore/revelation
a412166af39edd7a78a1127dba2ecb5c65986049
feder/cases/factories.py
feder/cases/factories.py
from feder.cases import models from feder.institutions.factories import InstitutionFactory from feder.monitorings.factories import MonitoringFactory import factory from feder.users.factories import UserFactory class CaseFactory(factory.django.DjangoModelFactory): name = factory.Sequence('case-{0}'.format) use...
from feder.institutions.factories import InstitutionFactory from feder.monitorings.factories import MonitoringFactory import factory from feder.users.factories import UserFactory from .models import Case class CaseFactory(factory.django.DjangoModelFactory): name = factory.Sequence('case-{0}'.format) user = fa...
Clean up import in CaseFactory
Clean up import in CaseFactory
Python
mit
watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder
e96e39bc3b5c540dc2cdcee26c6562c358745f93
citrination_client/base/tests/test_base_client.py
citrination_client/base/tests/test_base_client.py
from citrination_client.base import BaseClient from citrination_client.base.errors import CitrinationClientError def test_none_api_key(): """ Ensures that an error is thrown if a client is instantiated without an API key """ try: client = BaseClient(None, "mycitrinationsite") assert False except Ci...
from citrination_client.base import BaseClient from citrination_client.base.errors import CitrinationClientError from citrination_client import __version__ def test_none_api_key(): """ Ensures that an error is thrown if a client is instantiated without an API key """ try: client = BaseClient(None, "mycit...
Update test to use new version location
Update test to use new version location
Python
apache-2.0
CitrineInformatics/python-citrination-client
be315047f477377d19681063906480eb74f1e59f
mqtt_logger/serializers.py
mqtt_logger/serializers.py
"""Serializers for the use with rest-pandas""" from rest_framework import serializers from .models import MQTTMessage import re import copy class MessageSerializer(serializers.ModelSerializer): class Meta: model = MQTTMessage fields = ['id', 'time_recorded', 'topic', 'payload'] pandas_in...
"""Serializers for the use with rest-pandas""" from rest_framework import serializers from .models import MQTTMessage import re import copy class MessageSerializer(serializers.ModelSerializer): class Meta: model = MQTTMessage fields = ['id', 'time_recorded', 'topic', 'payload'] pandas_in...
Remove the topic and time from the pandas index so they are included in the json output again.
Remove the topic and time from the pandas index so they are included in the json output again.
Python
mit
ast0815/mqtt-hub,ast0815/mqtt-hub
ee35232228b8959bb790b971bf1661b1b3ea41fe
tests/manage.py
tests/manage.py
#!/usr/bin/env python import channels.log import logging import os import sys PROJECT_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) sys.path.insert(0, PROJECT_ROOT) def get_channels_logger(*args, **kwargs): """Return logger for channels.""" return logging.getLogger("django.channels") #...
#!/usr/bin/env python import logging import os import sys PROJECT_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) sys.path.insert(0, PROJECT_ROOT) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") # if len(sys.argv) > 1 and sys.argv[1] == 'runser...
Fix logging compatibility with the latest Channels
Fix logging compatibility with the latest Channels
Python
apache-2.0
genialis/resolwe,jberci/resolwe,jberci/resolwe,genialis/resolwe
d197f74334d1733189f77dd3b12cb7db934ccd18
lc0007_reverse_integer.py
lc0007_reverse_integer.py
"""Leetcode 7. Reverse Integer Easy URL: https://leetcode.com/problems/reverse-integer/description/ Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the r...
"""Leetcode 7. Reverse Integer Easy URL: https://leetcode.com/problems/reverse-integer/description/ Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the r...
Add comments & space lines
Add comments & space lines
Python
bsd-2-clause
bowen0701/algorithms_data_structures
1838a160221859a40d208bc95352b105c53edb5f
partner_communication_switzerland/models/res_users.py
partner_communication_switzerland/models/res_users.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging from odoo import api, models _logger = logging.getLogger(__name__) class ResUsers(models.Model): _inherit = 'res.users' @api.multi def action_reset_password(self): create_mode = boo...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging from odoo import api, models from odoo.addons.auth_signup.models.res_partner import now _logger = logging.getLogger(__name__) class ResUsers(models.Model): _inherit = 'res.users' @api.multi ...
FIX password reset method that was not resetting the password
FIX password reset method that was not resetting the password
Python
agpl-3.0
CompassionCH/compassion-switzerland,ecino/compassion-switzerland,CompassionCH/compassion-switzerland,ecino/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,ecino/compassion-switzerland,CompassionCH/compassion-switzerland
b071e9c5ac8ae479c8c5ab38c2e0a886c846b0e5
pybossa/repositories/project_stats_repository.py
pybossa/repositories/project_stats_repository.py
# -*- coding: utf8 -*- # This file is part of PYBOSSA. # # Copyright (C) 2015 Scifabric LTD. # # 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 your op...
# -*- coding: utf8 -*- # This file is part of PYBOSSA. # # Copyright (C) 2015 Scifabric LTD. # # 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 your op...
Add desc and orderby to repo
Add desc and orderby to repo
Python
agpl-3.0
Scifabric/pybossa,PyBossa/pybossa,Scifabric/pybossa,PyBossa/pybossa
0da4c663e8a48bb759a140ca304ce35d3a8b5dcf
pyconde/events/templatetags/event_tags.py
pyconde/events/templatetags/event_tags.py
import datetime from django import template from .. import models register = template.Library() @register.inclusion_tag('events/tags/list_events.html') def list_events(number_of_events=3): now = datetime.datetime.now() events = models.Event.objects.filter(date__gte=now).all()[:number_of_events] has_ra...
from django import template from .. import models register = template.Library() @register.inclusion_tag('events/tags/list_events.html') def list_events(number_of_events=None): events = models.Event.objects.all() if number_of_events is not None: events = events[:number_of_events] has_range = Fal...
Remove future-restriction on list_events tag
Remove future-restriction on list_events tag
Python
bsd-3-clause
zerok/pyconde-website-mirror,EuroPython/djep,EuroPython/djep,EuroPython/djep,pysv/djep,pysv/djep,EuroPython/djep,zerok/pyconde-website-mirror,pysv/djep,pysv/djep,pysv/djep,zerok/pyconde-website-mirror
2114527f8de7b7e5175b43c54b4b84db2f169a01
djangocms_forms/migrations/0004_redirect_delay.py
djangocms_forms/migrations/0004_redirect_delay.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('djangocms_forms', '0003_add_referrer_field'), ] operations = [ migrations.AddField( model_name='formdefinition',...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('djangocms_forms', '0003_add_referrer_field'), ] operations = [ migrations.AddField( model_name='formdefinition',...
Update migrations — `verbose_name` for `redirect_delay` fields
Update migrations — `verbose_name` for `redirect_delay` fields
Python
bsd-3-clause
mishbahr/djangocms-forms,mishbahr/djangocms-forms,mishbahr/djangocms-forms
8b84353d366daf1b1f0a19aff51d9d817428c6b9
primestg/message.py
primestg/message.py
from lxml.objectify import fromstring import binascii import zlib def is_gziped(content): return binascii.hexlify(content[:2].encode('utf-8')) == b'1f8b' class BaseMessage(object): """ Base XML message. """ def __init__(self, xml): """ Create an object of BaseMessage. :p...
from lxml.objectify import fromstring import binascii import zlib def is_gziped(content): signature = content[:2] try: res = binascii.hexlify(signature) == b'1f8b' except: res = binascii.hexlify(signature.encode('utf-8')) == b'1f8b' return res class BaseMessage(object): """ ...
FIX works with py3 binary data and string data
FIX works with py3 binary data and string data
Python
agpl-3.0
gisce/primestg
834a6a65f144e17f22851230d2baf3524f5e98c0
flexget/plugins/est_released.py
flexget/plugins/est_released.py
import logging from flexget.plugin import get_plugins_by_group, register_plugin log = logging.getLogger('est_released') class EstimateRelease(object): """ Front-end for estimator plugins that estimate release times for various things (series, movies). """ def estimate(self, entry): """ ...
import logging from flexget.plugin import get_plugins_by_group, register_plugin log = logging.getLogger('est_released') class EstimateRelease(object): """ Front-end for estimator plugins that estimate release times for various things (series, movies). """ def estimate(self, entry): """ ...
Fix estimator loop, consider rest plugins as well.
Fix estimator loop, consider rest plugins as well.
Python
mit
ianstalk/Flexget,qk4l/Flexget,malkavi/Flexget,crawln45/Flexget,tobinjt/Flexget,xfouloux/Flexget,asm0dey/Flexget,Flexget/Flexget,ibrahimkarahan/Flexget,vfrc2/Flexget,jacobmetrick/Flexget,crawln45/Flexget,tarzasai/Flexget,Pretagonist/Flexget,xfouloux/Flexget,spencerjanssen/Flexget,lildadou/Flexget,JorisDeRieck/Flexget,ja...
ca563ca11fe04202ae38799ee992a48e0a01fd86
material/admin/modules.py
material/admin/modules.py
from karenina import modules class Admin(modules.InstallableModule): icon = "mdi-action-settings-applications" order = 1000 @property def label(self): return 'Administration' def has_perm(self, user): return user.is_staff
from karenina import modules class Admin(modules.Module): icon = "mdi-action-settings-applications" order = 1000 @property def label(self): return 'Administration' def has_perm(self, user): return user.is_staff
Add module declaration for karenina
Add module declaration for karenina
Python
bsd-3-clause
thiagoramos-luizalabs/django-material,refnode/django-material,lukasgarcya/django-material,viewflow/django-material,MonsterKiller/django-material,viewflow/django-material,barseghyanartur/django-material,MonsterKiller/django-material,un33k/django-material,afifnz/django-material,Axelio/django-material,viewflow/django-mate...
4cf56e47f27053bcfe01059427fceceb55d7da91
labs/01_keras/solutions/keras_sgd_and_momentum.py
labs/01_keras/solutions/keras_sgd_and_momentum.py
model = Sequential() model.add(Dense(hidden_dim, input_dim=input_dim, activation="tanh")) model.add(Dense(output_dim, activation="softmax")) model.add(Activation("softmax")) optimizer = optimizers.SGD(lr=0.1, momentum=0.9, nesterov=True) model.compile(optimizer=optimizer, loss='categorical_crossentropy...
model = Sequential() model.add(Dense(hidden_dim, input_dim=input_dim, activation="tanh")) model.add(Dense(output_dim, activation="softmax")) optimizer = optimizers.SGD(lr=0.1, momentum=0.9, nesterov=True) model.compile(optimizer=optimizer, loss='categorical_crossentropy', metrics=['accura...
Remove leftover line in solution for 01_keras
Remove leftover line in solution for 01_keras
Python
mit
m2dsupsdlclass/lectures-labs,m2dsupsdlclass/lectures-labs
d4e721e3179c1f3fbce283b96b937fa4864786c3
src/amber/hokuyo/hokuyo.py
src/amber/hokuyo/hokuyo.py
import serial import sys import os from amber.hokuyo.hokuyo_common import HokuyoController from amber.tools import serial_port, config __author__ = 'paoolo' pwd = os.path.dirname(os.path.abspath(__file__)) config.add_config_ini('%s/hokuyo.ini' % pwd) SERIAL_PORT = config.HOKUYO_SERIAL_PORT BAUD_RATE = config.HOKU...
import logging.config import sys import os import time import serial from amber.hokuyo.hokuyo_common import HokuyoController from amber.tools import serial_port, config __author__ = 'paoolo' LOGGER_NAME = 'AmberPipes' pwd = os.path.dirname(os.path.abspath(__file__)) config.add_config_ini('%s/hokuyo.ini' % pwd) log...
Add restart mechanism for Hokuyo, update logging mechanism
Add restart mechanism for Hokuyo, update logging mechanism
Python
mit
project-capo/amber-python-drivers,project-capo/amber-python-drivers
bd39a28e25dc8a3c79ef9b1b9ba7e6924a3f682b
test/test_basic.py
test/test_basic.py
#!/usr/bin/env python # vim: set ts=4 sw=4 et sts=4 ai: # # Test some basic functionality. # import unittest import os import sys sys.path.append('..') class TestQBasic(unittest.TestCase): def setUp(self): if os.path.exists('/tmp/q'): os.remove('/tmp/q') def tearDown(self): self...
#!/usr/bin/env python # vim: set ts=4 sw=4 et sts=4 ai: # # Test some basic functionality. # import unittest import os import sys sys.path.append('..') class TestQBasic(unittest.TestCase): def setUp(self): if os.path.exists('/tmp/q'): os.remove('/tmp/q') def tearDown(self): self...
Work on older Python without assertIn method.
Work on older Python without assertIn method.
Python
apache-2.0
zestyping/q
f5984fbd4187f4af65fb39b070f91870203d869b
openedx/stanford/djangoapps/register_cme/admin.py
openedx/stanford/djangoapps/register_cme/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import ExtraInfo admin.site.register(ExtraInfo)
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import ExtraInfo class ExtraInfoAdmin(admin.ModelAdmin): """ Admin interface for ExtraInfo model. """ list_display = ('user', 'get_email', 'last_name', 'first_name',) search_fields = ('user__user...
Change `ExtraInfo` to user fields, add search
Change `ExtraInfo` to user fields, add search `Register_cme/extrainfo` in Django Admin was previously displaying users as `ExtraInfo` objects which admins had to click on individually to see each user's information. Each user is now displayed with fields: username, email, last and first name. Username is clickable to ...
Python
agpl-3.0
Stanford-Online/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform,caesar2164/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform
19dc04eb48a9484540298aa9a15fca016486921b
shop/models/fields.py
shop/models/fields.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import connection POSTGRES_FLAG = False if str(connection.vendor) == 'postgresql': POSTGRES_FLAG = True try: if POSTGRES_FLAG: from django.contrib.postgres.fields import JSONField else: raise ImportError except...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from distutils.version import LooseVersion import re from django.db import connection POSTGRES_FLAG = False if str(connection.vendor) == 'postgresql': POSTGRES_FLAG = True try: import psycopg2 version = re.search('([0-9.]+)', psycopg2.__vers...
Add control over psycopg2's version (need to be bigger or equal than 2.5.4)
Add control over psycopg2's version (need to be bigger or equal than 2.5.4)
Python
bsd-3-clause
nimbis/django-shop,nimbis/django-shop,jrief/django-shop,divio/django-shop,khchine5/django-shop,awesto/django-shop,divio/django-shop,khchine5/django-shop,divio/django-shop,awesto/django-shop,awesto/django-shop,jrief/django-shop,jrief/django-shop,nimbis/django-shop,khchine5/django-shop,nimbis/django-shop,jrief/django-sho...
1d26fddd3fb1581138117b2fbeeb21877bc48883
sample_app/utils.py
sample_app/utils.py
import tornado.web import ipy_table from transperth.location import Location class BaseRequestHandler(tornado.web.RequestHandler): @property def args(self): args = self.request.arguments return { k: [sv.decode() for sv in v] for k, v in args.items() } def...
import tornado.web import ipy_table from transperth.location import Location class BaseRequestHandler(tornado.web.RequestHandler): @property def args(self): args = self.request.arguments return { k: [sv.decode() for sv in v] for k, v in args.items() } def...
Add dollar sign to fares, sort by fare type
Add dollar sign to fares, sort by fare type
Python
mit
Mause/pytransperth,Mause/pytransperth
b82a7beffac7ccd497f88e7f72a70e9c3ae7146a
syntacticframes_project/loadmapping/migrations/0002_auto_20140916_1053.py
syntacticframes_project/loadmapping/migrations/0002_auto_20140916_1053.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from os.path import join from django.db import models, migrations from django.conf import settings from loadmapping.models import LVFVerb def import_verbs(apps, schema_editor): LVFVerb = apps.get_model('loadmapping', 'LVFVerb') with...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from os.path import join from django.db import models, migrations from django.conf import settings from loadmapping.models import LVFVerb def import_verbs(apps, schema_editor): LVFVerb = apps.get_model('loadmapping', 'LVFVerb') LVFV...
Allow to reverse LVFVerb migration
Allow to reverse LVFVerb migration
Python
mit
aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor
2c70c70099cffe88439fa082fb0e7942d8cfed88
tests/run_tests.py
tests/run_tests.py
#!/bin/env python """Run HTCondor-CE unit tests""" import glob import unittest TESTS = [test.strip('.py') for test in glob.glob('test*.py')] SUITE = unittest.TestLoader().loadTestsFromNames(TESTS) unittest.TextTestRunner(verbosity=2).run(SUITE)
#!/bin/env python """Run HTCondor-CE unit tests""" import glob import unittest import sys TESTS = [test.strip('.py') for test in glob.glob('test*.py')] SUITE = unittest.TestLoader().loadTestsFromNames(TESTS) RESULTS = unittest.TextTestRunner(verbosity=2).run(SUITE) if not RESULTS.wasSuccessful(): sys.exit(1)
Exit non-zero if unit tests failed
Exit non-zero if unit tests failed
Python
apache-2.0
matyasselmeci/htcondor-ce,brianhlin/htcondor-ce,opensciencegrid/htcondor-ce,djw8605/htcondor-ce,brianhlin/htcondor-ce,brianhlin/htcondor-ce,matyasselmeci/htcondor-ce,opensciencegrid/htcondor-ce,bbockelm/htcondor-ce,opensciencegrid/htcondor-ce,matyasselmeci/htcondor-ce,djw8605/htcondor-ce,bbockelm/htcondor-ce,djw8605/ht...
bb27b536193fcc6ada7ab6a4193ac1bf889569d7
indra/sources/hypothesis/api.py
indra/sources/hypothesis/api.py
import requests
import requests from indra.config import get_config from .processor import HypothesisProcessor base_url = 'https://api.hypothes.is/api/' api_key = get_config('HYPOTHESIS_API_KEY') headers = {'Authorization': 'Bearer %s' % api_key, 'Accept': 'application/vnd.hypothesis.v1+json', 'content-type': '...
Implement fetching annotations for a given group
Implement fetching annotations for a given group
Python
bsd-2-clause
bgyori/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,bgyori/indra
3224ea27a23e1c254bb93a110be1bd481585cb99
mosecom_air/api/models.py
mosecom_air/api/models.py
#coding: utf-8 from django.db import models class Substance(models.Model): name = models.TextField(unique=True, db_index=True) alias = models.TextField() class Station(models.Model): name = models.TextField(unique=True, db_index=True) alias = models.TextField() class Unit(models.Model): name = m...
#coding: utf-8 from django.db import models class Substance(models.Model): name = models.TextField(unique=True, db_index=True) alias = models.TextField() class Station(models.Model): name = models.TextField(unique=True, db_index=True) alias = models.TextField() class Unit(models.Model): name = m...
Add index for Measurement model
Add index for Measurement model
Python
mit
elsid/mosecom-air,elsid/mosecom-air,elsid/mosecom-air
8054982b3aa106a9551e792f6453993484a17f2a
tests/unit/test_factory.py
tests/unit/test_factory.py
# -*- coding: utf-8 -*- """Test Factory Module This module contains the tests for the OpenRecords Application Factory """ import os import flask import json import pytest from app import create_app def test_default_config(): """Test the default config class is the DevelopmentConfig""" assert isinstance(cr...
# -*- coding: utf-8 -*- """Test Factory Module This module contains the tests for the OpenRecords Application Factory """ import os import flask import json import pytest from app import create_app @pytest.mark.skip(reason="Scheduler is not functioning and needs to be replaced.") def test_default_config(): """...
Mark test_default_config as skip; Scheduler needs to be rewritten
Mark test_default_config as skip; Scheduler needs to be rewritten
Python
apache-2.0
CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords
e7cba721d78860d0151cc65793e567b0da719d39
regserver/regulations/tests/partial_view_tests.py
regserver/regulations/tests/partial_view_tests.py
from unittest import TestCase from mock import Mock, patch from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_context_data(self, generator): generator.ge...
from unittest import TestCase from mock import Mock, patch from django.test import RequestFactory from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_context_da...
Change test, so that view has a request object
Change test, so that view has a request object
Python
cc0-1.0
ascott1/regulations-site,18F/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,adderall/regulations-site,adderall/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,EricSchles/regulations-site,EricSchles/regulations-site,willb...
b8e9a2af61e1b8fe45e32966495e46357a145a56
dom/automation/detect_assertions.py
dom/automation/detect_assertions.py
#!/usr/bin/env python def amiss(logPrefix): global ignoreList foundSomething = False currentFile = file(logPrefix + "-err", "r") # map from (assertion message) to (true, if seen in the current file) seenInCurrentFile = {} for line in currentFile: line = line.strip("\x07").rstrip(...
#!/usr/bin/env python import platform def amiss(logPrefix): global ignoreList foundSomething = False currentFile = file(logPrefix + "-err", "r") # map from (assertion message) to (true, if seen in the current file) seenInCurrentFile = {} for line in currentFile: line = line.stri...
Make known_assertions.txt cross-machine and hopefully also cross-platform.
Make known_assertions.txt cross-machine and hopefully also cross-platform.
Python
mpl-2.0
nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz
32ac109aec82210ccfa617b438a844b0f300157c
comics/core/context_processors.py
comics/core/context_processors.py
from django.conf import settings from django.db.models import Count, Max from comics.core.models import Comic def site_settings(request): return { 'site_title': settings.COMICS_SITE_TITLE, 'site_tagline': settings.COMICS_SITE_TAGLINE, 'google_analytics_code': settings.COMICS_GOOGLE_ANALYTI...
from django.conf import settings from django.db.models import Count, Max from comics.core.models import Comic def site_settings(request): return { 'site_title': settings.COMICS_SITE_TITLE, 'site_tagline': settings.COMICS_SITE_TAGLINE, 'google_analytics_code': settings.COMICS_GOOGLE_ANALYTI...
Add search_enabled to site settings context processor
Add search_enabled to site settings context processor
Python
agpl-3.0
jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,klette/comics,klette/comics,datagutten/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics
8ea3ab66f8a8a71a311bc30b3abec8b9ad681a4e
tpt/util/s3util.py
tpt/util/s3util.py
import boto import logging from tpt import private_settings from boto.s3.key import Key from django.http import StreamingHttpResponse from django.http import Http404 logger = logging.getLogger(__name__) def stream_object(key_name): s3 = boto.connect_s3( aws_access_key_id = private_settings.AWS_ACCESS...
import boto import logging from tpt import private_settings from boto.s3.key import Key from django.http import StreamingHttpResponse from django.http import Http404 logger = logging.getLogger(__name__) def stream_object(key_name): s3 = boto.connect_s3( aws_access_key_id = private_settings.AWS_ACCESS...
Add Etag header to proxy response from s3
Add Etag header to proxy response from s3
Python
apache-2.0
youprofit/rust-ci-1,hansjorg/rust-ci,youprofit/rust-ci-1,hansjorg/rust-ci,youprofit/rust-ci-1,youprofit/rust-ci-1
1edd6ee6b71b3f3ac9654cc47804592613dd61ec
clowder/clowder/cli/init_controller.py
clowder/clowder/cli/init_controller.py
from cement.ext.ext_argparse import expose from clowder.cli.abstract_base_controller import AbstractBaseController class InitController(AbstractBaseController): class Meta: label = 'init' stacked_on = 'base' stacked_type = 'nested' description = 'Clone repository to clowder direct...
import sys from cement.ext.ext_argparse import expose from termcolor import colored, cprint from clowder.cli.abstract_base_controller import AbstractBaseController from clowder.util.decorators import network_connection_required class InitController(AbstractBaseController): class Meta: label = 'init' ...
Add `clowder init` logic to Cement controller
Add `clowder init` logic to Cement controller
Python
mit
JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder
8846747540b54b47e97a06471cd3daedc3a28f47
modules/pipeurlbuilder.py
modules/pipeurlbuilder.py
# pipeurlbuilder.py # import urllib from pipe2py import util def pipe_urlbuilder(context, _INPUT, conf, **kwargs): """This source builds a url and yields it forever. Keyword arguments: context -- pipeline context _INPUT -- not used conf: BASE -- base PATH -- path elements ...
# pipeurlbuilder.py # import urllib from pipe2py import util def pipe_urlbuilder(context, _INPUT, conf, **kwargs): """This source builds a url and yields it forever. Keyword arguments: context -- pipeline context _INPUT -- not used conf: BASE -- base PATH -- path elements ...
Remove trailing slash (google charts don't like it)
Remove trailing slash (google charts don't like it)
Python
mit
nerevu/riko,nerevu/riko
9532a28dacefec67ea67f94cf992a505d8a6629d
utilities/ticker-update.py
utilities/ticker-update.py
import requests from bs4 import BeautifulSoup URL = 'https://finance.yahoo.com/quote/' secutities = [] with open("ticker-updates,cong", r) as conf_file: securities = conf_file.readlines() securities = [s.strip() for s in securities] for security in securities: query = URL + security page = reques...
import requests from bs4 import BeautifulSoup URL = 'https://finance.yahoo.com/quote/' CONF_FILE = "ticker-updates.conf" secutities = [] with open(CONF_FILE, "r") as conf_file: securities = conf_file.readlines() securities = [s.strip() for s in securities] print(securities) for security in securitie...
Fix file read, start on sell price
Fix file read, start on sell price
Python
mit
daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various
06ec5baaa799836c656f67b083b77197943d97f2
drogher/__init__.py
drogher/__init__.py
from . import shippers def barcode(b): for klass in ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']: shipper = getattr(shippers, klass)(b) if shipper.is_valid: return shipper return shippers.Unknown(b)
from . import shippers def barcode(b, barcode_classes=None): if barcode_classes is None: barcode_classes = ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13'] for klass in barcode_classes: shipper = getattr(shippers, klass)(b) if shipper.is_valid: return s...
Allow barcode classes to be optionally specified
Allow barcode classes to be optionally specified
Python
bsd-3-clause
jbittel/drogher
6f16efcce43683868fde945ce59d87311f81a87c
virtool/downloads/utils.py
virtool/downloads/utils.py
""" Utilities focussing on formatting FASTA files. """ def format_fasta_entry(otu_name: str, isolate_name: str, sequence_id: str, sequence: str) -> str: """ Create a FASTA header and sequence block for a sequence in a otu DNA FASTA file downloadable from Virtool. :param otu_name: the otu name to include...
""" Utilities focussing on formatting FASTA files. """ def format_fasta_entry(otu_name: str, isolate_name: str, sequence_id: str, sequence: str) -> str: """ Create a FASTA header and sequence block for a sequence in a otu DNA FASTA file downloadable from Virtool. :param otu_name: the otu name to include...
Add function to format subtraction filename
Add function to format subtraction filename
Python
mit
igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool
610a1b000fd9de6e7e4c994e10c30c1aa9acbb82
csunplugged/utils/check_glossary_links.py
csunplugged/utils/check_glossary_links.py
"""Module for checking glossary links found within Markdown conversions.""" from utils.errors.CouldNotFindGlossaryTerm import CouldNotFindGlossaryTerm from topics.models import GlossaryTerm def check_converter_glossary_links(glossary_links, md_file_path): """Process glossary links found by Markdown converter. ...
"""Module for checking glossary links found within Markdown conversions.""" from django.core.exceptions import DoesNotExist from utils.errors.CouldNotFindGlossaryTerm import CouldNotFindGlossaryTerm from topics.models import GlossaryTerm def check_converter_glossary_links(glossary_links, md_file_path): """Proces...
Add import for Django exception
Add import for Django exception
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
bacff0ca6cae1f7488853f565b3030eb49ebad01
cherryontop/decorators/qp.py
cherryontop/decorators/qp.py
import functools import inspect import cherrypy from cherrypy.lib.httputil import parse_query_string from cherryontop.errors import InvalidParameter, UnexpectedParameter def typecast_query_params(*a, **kw): allowed, cast_funcs = _get_checks(*a, **kw) def wrap(f): dynamic_url_args = _positional_arg_...
import functools from cherryontop.errors import InvalidParameter, UnexpectedParameter def typecast_query_params(*a, **kw): allowed, cast_funcs = _get_checks(*a, **kw) def wrap(f): @functools.wraps(f) def wrapped(*args, **kwargs): # all supplied parameters allowed? for...
Revert "confirm query params never overwrite dynamic url components"
Revert "confirm query params never overwrite dynamic url components" This reverts commit 9aa3a57a289985d24877515995b3f1d589624a8d. Conflicts: cherryontop/decorators/qp.py
Python
bsd-3-clause
csira/cherryontop
88f00611ea000d0fed984e93aaa661db2c2bd79e
contrib/tempest/tempest/exceptions/share_exceptions.py
contrib/tempest/tempest/exceptions/share_exceptions.py
# Copyright 2014 Mirantis 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...
# Copyright 2014 Mirantis 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...
Add exception to tempest plugin
Add exception to tempest plugin Exception 'SnapshotBuildErrorException' was used, but was not defined. Change-Id: Ida7554d65eb6657fa05b7d53cbfa452cc0239f74
Python
apache-2.0
bswartz/manila,openstack/manila,vponomaryov/manila,weiting-chen/manila,jcsp/manila,scality/manila,NetApp/manila,NetApp/manila,openstack/manila,sajuptpm/manila,vponomaryov/manila,redhat-openstack/manila,sajuptpm/manila,jcsp/manila,bswartz/manila,redhat-openstack/manila,scality/manila,weiting-chen/manila
17cf285748ee519c6d28971baefbf4ed506fac1e
water_level/water_level.py
water_level/water_level.py
''' Created on Aug 1, 2017 @author: alkaitz ''' ''' [3 2 3] -> 1 ''' if __name__ == '__main__': pass
''' Created on Aug 1, 2017 @author: alkaitz ''' ''' An integer array defines the height of a 2D set of columns. After it rains enough amount of water, how much water will be contained in the valleys formed by these mountains? Ex: [3 2 3] X X X W X X X X -> X X X -> 1 X X X X X X ''' d...
Include initial solution for the water level problem problem
Include initial solution for the water level problem problem
Python
mit
alkaitz/general-programming
d3f5e0e2d6104963237a0626d608cc1b0949b762
zounds/learn/functional.py
zounds/learn/functional.py
import numpy as np def hyperplanes(means, stds, n_planes): if len(means) != len(stds): raise ValueError('means and stds must have the same length') n_features = len(means) a = np.random.normal(means, stds, (n_planes, n_features)) b = np.random.normal(means, stds, (n_planes, n_features)) p...
import numpy as np def hyperplanes(means, stds, n_planes): if len(means) != len(stds): raise ValueError('means and stds must have the same length') n_features = len(means) a = np.random.normal(means, stds, (n_planes, n_features)) b = np.random.normal(means, stds, (n_planes, n_features)) p...
Add an option to also return intermediate example norms
Add an option to also return intermediate example norms
Python
mit
JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds
6068905219a04974f18033b3cf64b2a037f05d7b
opps/core/__init__.py
opps/core/__init__.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from django.conf import settings trans_app_label = _('Opps') settings.INSTALLED_APPS += ('opps.article', 'opps.image', 'opps.channel', 'opps.source', 'redactor', 'tagging',) settings.REDACTOR_OPT...
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from django.conf import settings trans_app_label = _('Opps') settings.INSTALLED_APPS += ('opps.article', 'opps.image', 'opps.channel', 'opps.source', 'django.contrib.redirects', 'redactor', ...
Add django contrib redirects on opps core init
Add django contrib redirects on opps core init
Python
mit
opps/opps,opps/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps
540493a69ff2e9a5e6cc93a75b34af3c9f79b808
plugins/generic/syntax.py
plugins/generic/syntax.py
#!/usr/bin/env python """ Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import re from lib.core.exception import SqlmapUndefinedMethod class Syntax: """ This class defines generic syntax functionalities for plugins. """ def __in...
#!/usr/bin/env python """ Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import re from lib.core.exception import SqlmapUndefinedMethod class Syntax: """ This class defines generic syntax functionalities for plugins. """ def __in...
Fix for empty strings (previously '' was just removed)
Fix for empty strings (previously '' was just removed)
Python
apache-2.0
RexGene/monsu-server,RexGene/monsu-server,dtrip/.ubuntu,dtrip/.ubuntu
22cfc216d3c0a11f5c90b27919fb0590cd3a210f
doc/render.py
doc/render.py
# Copyright 2014 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 applicable law or ag...
# Copyright 2014 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 applicable law or ag...
Make documentation generator strip copyright header from inline examples
Make documentation generator strip copyright header from inline examples
Python
apache-2.0
google/jsonnet,bowlofstew/jsonnet,davidzchen/jsonnet,Neeke/jsonnet,huggsboson/jsonnet,bowlofstew/jsonnet,sparkprime/jsonnet,google/jsonnet,huggsboson/jsonnet,Neeke/jsonnet,habibmasuro/jsonnet,lamuguo/jsonnet,bowlofstew/jsonnet,google/jsonnet,huggsboson/jsonnet,darioajr/jsonnet,sparkprime/jsonnet,bowlofstew/jsonnet,lamu...
0bdc48ce94a8c501dba1ce2925615714a46a1728
pygameMidi_extended.py
pygameMidi_extended.py
#import pygame.midi.Output from pygame.midi import Output class Output(Output):#pygame.midi.Output): def set_pan(self, pan, channel): assert (0 <= channel <= 15) assert pan <= 127 self.write_short(0xB0 + channel, 0x0A, pan) def set_volume(self, volume, channel): ...
#import pygame.midi.Output from pygame.midi import Output class Output(Output):#pygame.midi.Output): def set_pan(self, pan, channel): assert (0 <= channel <= 15) assert pan <= 127 self.write_short(0xB0 + channel, 0x0A, pan) def set_volume(self, volume, channel): ...
Add method for instrument bank
Add method for instrument bank
Python
bsd-3-clause
RenolY2/py-playBMS
38cf3aed45ac604884d4ae1fed30714755f46cc8
discussion/forms.py
discussion/forms.py
from django import forms from discussion.models import Comment, Post, Discussion class CommentForm(forms.ModelForm): class Meta: exclude = ('user', 'post') model = Comment class PostForm(forms.ModelForm): class Meta: exclude = ('user', 'discussion') model = Post class Sear...
from django import forms from discussion.models import Comment, Post, Discussion class CommentForm(forms.ModelForm): class Meta: exclude = ('user', 'post') model = Comment widgets = { 'body' : forms.Textarea(attrs={'placeholder' : 'Reply to this conversation'}), } cl...
Set widgets for textareas so we can set placeholder attribute
Set widgets for textareas so we can set placeholder attribute
Python
bsd-2-clause
lehins/lehins-discussion,incuna/django-discussion,incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion
61679e3faf44bc1d54388f617554f03809b2eead
gpytorch/kernels/periodic_kernel.py
gpytorch/kernels/periodic_kernel.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import math import torch from torch import nn from .kernel import Kernel class PeriodicKernel(Kernel): def __init__( self, log_lengthscale_bounds=...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import math import torch from torch import nn from .kernel import Kernel class PeriodicKernel(Kernel): def __init__( self, log_lengthscale_bounds=...
Fix dimensions of periodic kernel parameters
Fix dimensions of periodic kernel parameters
Python
mit
jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch
d2d81cfe441171085f954c30eec718a0220ac286
hoomd/md/pytest/test_table_pressure.py
hoomd/md/pytest/test_table_pressure.py
import hoomd import io def test_table_pressure(simulation_factory, two_particle_snapshot_factory): """Test that write.table can log MD pressure values.""" thermo = hoomd.md.compute.ThermodynamicQuantities(hoomd.filter.All()) snap = two_particle_snapshot_factory() if snap.communicator.rank == 0: ...
import hoomd import io import numpy def test_table_pressure(simulation_factory, two_particle_snapshot_factory): """Test that write.table can log MD pressure values.""" thermo = hoomd.md.compute.ThermodynamicQuantities(hoomd.filter.All()) snap = two_particle_snapshot_factory() if snap.communicator.rank...
Add output check on the pressure quantity
Add output check on the pressure quantity
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
b690b87094b4205b448ba1ea5dda546c3e7a976d
python/xi_plugin/style.py
python/xi_plugin/style.py
# Copyright 2017 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 applicable law or ag...
# Copyright 2017 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 applicable law or ag...
Support setting alpha in colors
Support setting alpha in colors
Python
apache-2.0
google/xi-editor,fuchsia-mirror/third_party-xi-editor,modelorganism/xi-editor,fuchsia-mirror/third_party-xi-editor,modelorganism/xi-editor,google/xi-editor,modelorganism/xi-editor,fuchsia-mirror/third_party-xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor,google/xi-editor
8dc1bab80e52442999eb59e096abd5848c4e8d66
unicornclient/routine.py
unicornclient/routine.py
import threading import queue class Routine(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.queue = queue.Queue() self.manager = None self.no_wait = False def run(self): while True: got_task = False data = None ...
import threading import queue class Routine(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.queue = queue.Queue() self.manager = None self.no_wait = False self.is_stopping = False def run(self): while True: got_task = Fals...
Allow one last call to process before stopping
Allow one last call to process before stopping
Python
mit
amm0nite/unicornclient,amm0nite/unicornclient
b1685dc4a0a2036378d47f07d7315e5b1935a4ad
hyrodactil/tests/openings/models.py
hyrodactil/tests/openings/models.py
from django.test import TestCase from ..factories._applications import ApplicationFactory from ..factories._companysettings import InterviewStageFactory from ..factories._openings import OpeningFactory class OpeningsModelsTests(TestCase): def test_applicants_stats(self): opening = OpeningFactory() ...
from django.test import TestCase from ..factories._applications import ApplicationFactory from ..factories._companysettings import InterviewStageFactory from ..factories._openings import OpeningFactory class OpeningsModelsTests(TestCase): def test_applicants_stats(self): opening = OpeningFactory() ...
Fix tests for positioned stages
openings: Fix tests for positioned stages
Python
mit
hizardapp/Hizard,hizardapp/Hizard,hizardapp/Hizard
ac27cb2348748a774ab2ae14ade2c49de94c2b4f
frigg/worker/cli.py
frigg/worker/cli.py
# -*- coding: utf8 -*- from fabric import colors from frigg.worker.fetcher import fetcher class Commands(object): @staticmethod def start(): print(colors.green("Starting frigg worker")) fetcher() @staticmethod def unknown_command(): print(colors.red("Unknown command")) def ...
# -*- coding: utf8 -*- import os import logging.config from fabric import colors from .fetcher import fetcher class Commands(object): @staticmethod def start(): print(colors.green("Starting frigg worker")) fetcher() @staticmethod def unknown_command(): print(colors.red("Unk...
Add loading of logging config
Add loading of logging config
Python
mit
frigg/frigg-worker
98e5a1fe20e6eefa108ca3e5323da1bf3ad65be9
corehq/apps/hqadmin/management/commands/shutdown_celery_worker_by_hostname.py
corehq/apps/hqadmin/management/commands/shutdown_celery_worker_by_hostname.py
from django.core.management.base import BaseCommand from django.conf import settings from celery import Celery class Command(BaseCommand): help = "Gracefully shutsdown a celery worker" args = 'hostname' def handle(self, hostname, *args, **options): celery = Celery() celery.config_from_obj...
from django.core.management.base import BaseCommand from django.conf import settings from celery import Celery from corehq.apps.hqadmin.utils import parse_celery_pings class Command(BaseCommand): help = "Gracefully shutsdown a celery worker" args = 'hostname' def handle(self, hostname, *args, **options)...
Exit 1 based on whether or not it was shutdown correctly
Exit 1 based on whether or not it was shutdown correctly
Python
bsd-3-clause
dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
2d1488669721a46350b5c0f06a049f5d4816f931
sauna/plugins/ext/disk.py
sauna/plugins/ext/disk.py
from sauna.plugins import PluginRegister from sauna.plugins.base import PsutilPlugin my_plugin = PluginRegister('Disk') @my_plugin.plugin() class Disk(PsutilPlugin): @my_plugin.check() def used_percent(self, check_config): check_config = self._strip_percent_sign_from_check_config(check_config) ...
import os from sauna.plugins import PluginRegister from sauna.plugins.base import PsutilPlugin my_plugin = PluginRegister('Disk') @my_plugin.plugin() class Disk(PsutilPlugin): @my_plugin.check() def used_percent(self, check_config): check_config = self._strip_percent_sign_from_check_config(check_co...
Create Disk check to monitor inodes
Create Disk check to monitor inodes
Python
bsd-2-clause
bewiwi/sauna,NicolasLM/sauna,NicolasLM/sauna,bewiwi/sauna
1345fa78e45e6737df63b897f7887ca87290b447
l10n_ar_wsafip/models/__init__.py
l10n_ar_wsafip/models/__init__.py
# -*- coding: utf-8 -*- import wsafip_certificate_alias import wsafip_certificate import wsafip_server import wsafip_connection # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*- import wsafip_certificate_alias import wsafip_certificate import wsafip_server import wsafip_connection import loadcert_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
ADD loadcert_config to make module uninstallable
ADD loadcert_config to make module uninstallable
Python
agpl-3.0
bmya/odoo-argentina,jobiols/odoo-argentina,jobiols/odoo-argentina,adhoc-dev/odoo-argentina,bmya/odoo-argentina,adrianpaesani/odoo-argentina,adrianpaesani/odoo-argentina,adhoc-dev/odoo-argentina,ingadhoc/odoo-argentina
7dffcd1ea4b44decb8abb4e7d60cc07d665b4ce3
subscription/api.py
subscription/api.py
from tastypie import fields from tastypie.resources import ModelResource, ALL from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from subscription.models import Subscription, MessageSet from djcelery.models import PeriodicTask class PeriodicTaskResource(ModelResou...
from tastypie import fields from tastypie.resources import ModelResource, ALL from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from subscription.models import Subscription, MessageSet from djcelery.models import PeriodicTask class PeriodicTaskResource(ModelResou...
Add filter for limiting to one account
Add filter for limiting to one account
Python
bsd-3-clause
praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control
fba405a083b29b08dc3994821ae4ca2feb0e6c49
py3status/modules/taskwarrior.py
py3status/modules/taskwarrior.py
# -*- coding: utf-8 -*- """ Display currently active (started) taskwarrior tasks. Configuration parameters: - cache_timeout : how often we refresh this module in seconds (5s default) Requires - task @author James Smith http://jazmit.github.io/ @license BSD """ # import your useful libs here from time import...
# -*- coding: utf-8 -*- """ Display currently active (started) taskwarrior tasks. Configuration parameters: - cache_timeout : how often we refresh this module in seconds (5s default) Requires - task @author James Smith http://jazmit.github.io/ @license BSD """ # import your useful libs here from time import...
Fix parsing of taskWarrior's output
Fix parsing of taskWarrior's output I don't know for older versions, but the latest stable release already have '[' and ']' when doing an export. This lead to raising an exception because it makes a nested list and you try to access it using a string rather than an integer
Python
bsd-3-clause
valdur55/py3status,ultrabug/py3status,Shir0kamii/py3status,tobes/py3status,Spirotot/py3status,docwalter/py3status,Andrwe/py3status,guiniol/py3status,alexoneill/py3status,ultrabug/py3status,guiniol/py3status,tobes/py3status,ultrabug/py3status,Andrwe/py3status,valdur55/py3status,vvoland/py3status,hburg1234/py3status,vald...
3c0c0e81cb377e38d901a05633dc4f26b820558b
openkamer/management/commands/add_tk_person_ids.py
openkamer/management/commands/add_tk_person_ids.py
import logging from django.core.management.base import BaseCommand from parliament.models import Parliament from openkamer.parliament import add_tk_person_id logger = logging.getLogger(__name__) class Command(BaseCommand): def handle(self, *args, **options): for member in Parliament.get_or_create_twee...
import logging from django.core.management.base import BaseCommand from person.models import Person from openkamer.parliament import add_tk_person_id logger = logging.getLogger(__name__) class Command(BaseCommand): def handle(self, *args, **options): for person in Person.objects.all(): per...
Change command to update all persons
Change command to update all persons
Python
mit
openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer
9d70b1cb1e4f787b2c666d40eac60064b4e5a9f8
payments/management/commands/init_plans.py
payments/management/commands/init_plans.py
import decimal from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in set...
import decimal from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in set...
Break line in an odd place to keep the build from breaking.
Break line in an odd place to keep the build from breaking.
Python
mit
jamespacileo/django-stripe-payments,ZeevG/django-stripe-payments,ZeevG/django-stripe-payments,aibon/django-stripe-payments,grue/django-stripe-payments,jawed123/django-stripe-payments,boxysean/django-stripe-payments,jamespacileo/django-stripe-payments,adi-li/django-stripe-payments,crehana/django-stripe-payments,adi-li/d...
2b3c0b50e5f67ca673f5305ccf0219a4bca6bb7b
luigi/tasks/rgd/__init__.py
luigi/tasks/rgd/__init__.py
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute 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 [2009-2017] EMBL-European Bioinformatics Institute 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...
Correct method to detect known organisms
Correct method to detect known organisms
Python
apache-2.0
RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline
f76901831084c11ec633eb96c310860d15199edd
distutils/__init__.py
distutils/__init__.py
"""distutils The main package for the Python Module Distribution Utilities. Normally used from a setup script as from distutils.core import setup setup (...) """ import sys import importlib __version__ = sys.version[:sys.version.index(' ')] try: # Allow Debian and pkgsrc and Fedora (only) to customize...
"""distutils The main package for the Python Module Distribution Utilities. Normally used from a setup script as from distutils.core import setup setup (...) """ import sys import importlib __version__ = sys.version[:sys.version.index(' ')] try: # Allow Debian and pkgsrc (only) to customize system ...
Revert "Update comment for _distutils_system_mod." as Fedora is not using that hook.
Revert "Update comment for _distutils_system_mod." as Fedora is not using that hook. This reverts commit 8c64fdc8560d9f7b7d3926350bba7702b0906329.
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
72f79bb208fb71e40e10e6dd5a2ee8be2e744336
pvextractor/tests/test_wcspath.py
pvextractor/tests/test_wcspath.py
from .. import pvregions from astropy import wcs from astropy.io import fits import numpy as np import os def data_path(filename): data_dir = os.path.join(os.path.dirname(__file__), 'data') return os.path.join(data_dir, filename) def test_wcspath(): p1,p2 = pvregions.paths_from_regfile(data_path('tests.re...
import os import pytest import numpy as np from astropy import wcs from astropy.io import fits from .. import pvregions def data_path(filename): data_dir = os.path.join(os.path.dirname(__file__), 'data') return os.path.join(data_dir, filename) @pytest.mark.xfail def test_wcspath(): p1,p2 = pvregions.p...
Mark test as xfail since it requires a fork of pyregion
Mark test as xfail since it requires a fork of pyregion
Python
bsd-3-clause
keflavich/pvextractor,radio-astro-tools/pvextractor
d6b74654459d33d3b84c7b6ec474a304a6a65a20
demographics/forms.py
demographics/forms.py
from django.forms import ModelForm from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, Fieldset from . import models class DemographicsForm(ModelForm): class Meta: model = models.Demographics exclude = ['patient', 'creation_date'] def __init__(self, *...
from django.forms import ModelForm from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, Fieldset from . import models class DemographicsForm(ModelForm): class Meta: model = models.Demographics exclude = ['patient', 'creation_date'] def __init__(self, *...
Fix demographics resolve form formatting.
Fix demographics resolve form formatting.
Python
mit
SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools