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
c23553f48652ed3ed65e473c79732dddc6c5341b
sample_code.py
sample_code.py
@commands.command async def my_cmd(): await client.say('hi')
import discord import asyncio client = discord.Client() @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) print('------') @client.event async def on_message(message): if message.content.startswith('!test'): counter = 0 tmp = aw...
Set sample code to discord.py basic example
Set sample code to discord.py basic example
Python
mit
TheTrain2000/async2rewrite
d63302f10bf9972680c189a25f995b713e72562f
demo/apps/catalogue/models.py
demo/apps/catalogue/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailcore.models import Page from wagtail.wagtailimages.edit_handlers import ImageChooserPanel class Category(Page): """ The Oscars Category as a Wagtai...
from django.db import models from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailcore.models import Page from wagtail.wagtailimages.edit_handlers import ImageChooserPanel class Category(Page): """ The Oscars Category as a Wagtai...
Set name field on save
Set name field on save
Python
mit
pgovers/oscar-wagtail-demo,pgovers/oscar-wagtail-demo
50b6778ae43b8945b2073630e351ab759b007a3e
tests/social/youtube/test_tasks.py
tests/social/youtube/test_tasks.py
# -*- coding: utf-8 -*- import pytest from components.social.youtube.factories import ChannelFactory from components.social.youtube.models import Video from components.social.youtube.tasks import (fetch_all_videos, fetch_latest_videos) pytestmark = pytest.mark.django_db def test_fetch_all_videos(): channel ...
# -*- coding: utf-8 -*- import pytest from components.social.youtube.factories import ChannelFactory from components.social.youtube.models import Video from components.social.youtube.tasks import (fetch_all_videos, fetch_latest_videos) pytestmark = pytest.mark.django_db def test_fetch_all_videos(): channel ...
Switch to Jen's channel to (hopefully) make these tests faster.
Switch to Jen's channel to (hopefully) make these tests faster.
Python
apache-2.0
hello-base/web,hello-base/web,hello-base/web,hello-base/web
6666351757c2c2083a88158a132f446112109b9d
tests/test_redshift/test_server.py
tests/test_redshift/test_server.py
from __future__ import unicode_literals import json import sure # noqa import moto.server as server from moto import mock_redshift ''' Test the different server responses ''' @mock_redshift def test_describe_clusters(): backend = server.create_backend_app("redshift") test_client = backend.test_client() ...
from __future__ import unicode_literals import json import sure # noqa import moto.server as server from moto import mock_redshift ''' Test the different server responses ''' @mock_redshift def test_describe_clusters(): backend = server.create_backend_app("redshift") test_client = backend.test_client() ...
Fix redshift server to default to xml.
Fix redshift server to default to xml.
Python
apache-2.0
heddle317/moto,kefo/moto,botify-labs/moto,kefo/moto,Affirm/moto,ZuluPro/moto,Affirm/moto,Brett55/moto,2rs2ts/moto,dbfr3qs/moto,dbfr3qs/moto,okomestudio/moto,heddle317/moto,heddle317/moto,ZuluPro/moto,okomestudio/moto,botify-labs/moto,whummer/moto,william-richard/moto,gjtempleton/moto,dbfr3qs/moto,heddle317/moto,rocky45...
f7059eb02ee93bdd0f998acde385a04ac91c63df
sparrow.py
sparrow.py
#!/usr/bin/env python from ConfigParser import SafeConfigParser from twython import Twython #These values are all pulled from a file called 'config.ini' #You can call yours myawesomebotconfig.ini or whatever else! #Just remember to change it here config_file_name = 'config.ini' #SECURE YOUR CONFIG FILE - Don't put ...
#!/usr/bin/env python import json from twython import Twython #These values are all pulled from a file called 'config.ini' #You can call yours myawesomebotconfig.ini or whatever else! #Just remember to change it here with open('creds.json') as f: credentials = json.loads(f.read()) #SECURE YOUR CONFIG FILE - Don'...
Update method of loading creds
Update method of loading creds Changed the way of loading credentials from config.ini file to a json credentials file.
Python
mit
fmcorey/sparrow,fmcorey/sparrow
c5d656cff3e7ac218cc41805dfb8c19f63cd4250
run_server.py
run_server.py
#!/usr/bin/env python3 from shorter.web import app if __name__ == "__main__": app.run()
#!/usr/bin/env python3 from shorter.database import ( User, db_session, ) from shorter.web import app if __name__ == "__main__": # makes testing easier test_user_created = db_session.query(User).filter_by( username='jimmy').one_or_none() if not test_user_created: db_session.add( ...
Create a testing user on starting the server
Create a testing user on starting the server
Python
agpl-3.0
mapleoin/shorter
108c696d032462ac3cdc00e45ead09136e80634a
tests/foomodulegen-auto.py
tests/foomodulegen-auto.py
#! /usr/bin/env python import sys import re import pybindgen from pybindgen.typehandlers import base as typehandlers from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink) from pybindgen import (CppMethod, CppConstructor, CppClass, Enum) from pybindgen.gccxmlparser import ModuleParser from pyb...
#! /usr/bin/env python import sys import re import pybindgen from pybindgen.typehandlers import base as typehandlers from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink) from pybindgen import (CppMethod, CppConstructor, CppClass, Enum) from pybindgen.gccxmlparser import ModuleParser from pyb...
Add a debug switch (-d) to enable debugger
Add a debug switch (-d) to enable debugger
Python
lgpl-2.1
gjcarneiro/pybindgen,cawka/pybindgen-old,ftalbrecht/pybindgen,gjcarneiro/pybindgen,cawka/pybindgen-old,ftalbrecht/pybindgen,gjcarneiro/pybindgen,ftalbrecht/pybindgen,cawka/pybindgen-old,gjcarneiro/pybindgen,ftalbrecht/pybindgen,cawka/pybindgen-old
4387a8a38664abe86f0ff9d531ab3ba937f9adf7
tests/unit/test_main_views.py
tests/unit/test_main_views.py
import pytest from flask import url_for from pytest_flask import fixtures from mdt_app.models import * @pytest.mark.usefixtures('client_class') class TestIndex: def test_page_load(self): assert self.client.get(url_for('main.index')).status_code == 200 @pytest.mark.usefixtures('client_class') class Test...
import pytest from flask import url_for from pytest_flask import fixtures from mdt_app.models import * @pytest.mark.usefixtures('client_class') class TestIndex: def test_page_load(self): assert self.client.get(url_for('main.index')).status_code == 200 @pytest.mark.usefixtures('client_class') class Test...
Add Unit tests for views
Add Unit tests for views
Python
mit
stefpiatek/mdt-flask-app,stefpiatek/mdt-flask-app
a7a1d513003a65c5c9772ba75631247decff444d
utils/utils.py
utils/utils.py
from django.core.paginator import Paginator, EmptyPage, InvalidPage from django.contrib.syndication.views import add_domain from django.contrib.sites.models import get_current_site def get_site_url(request, path): current_site = get_current_site(request) return add_domain(current_site.domain, path, request.i...
from django.core.paginator import Paginator, EmptyPage, InvalidPage from django.contrib.syndication.views import add_domain from django.contrib.sites.models import get_current_site def get_site_url(request, path): """Retrieve current site site Always returns as http (never https) """ current_site = g...
Make site url be http, not https
Make site url be http, not https
Python
bsd-3-clause
uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam
6d635a94121a9038c7c5b80b9851a086e69728b6
scripts/wiggle_to_binned_array.py
scripts/wiggle_to_binned_array.py
#!/usr/bin/env python """ usage: %prog score_file out_file """ from __future__ import division import sys import psyco_full import bx.wiggle from bx.binned_array import BinnedArray from fpconst import isNaN import cookbook.doc_optparse import misc def read_scores( f ): scores_by_chrom = dict() return score...
#!/usr/bin/env python """ usage: %prog score_file out_file -c, --comp=type: compression type (none, zlib, lzo) """ from __future__ import division import sys import psyco_full import bx.wiggle from bx.binned_array import BinnedArray from fpconst import isNaN import cookbook.doc_optparse import misc def main(): ...
Allow specifying compression type on command line.
Allow specifying compression type on command line.
Python
mit
uhjish/bx-python,uhjish/bx-python,uhjish/bx-python
dc981dbd1b29d9586453f325f99b1c413c494800
account/managers.py
account/managers.py
from __future__ import unicode_literals from django.db import models class EmailAddressManager(models.Manager): def add_email(self, user, email, **kwargs): confirm = kwargs.pop("confirm", False) email_address = self.create(user=user, email=email, **kwargs) if confirm and not email_addres...
from __future__ import unicode_literals from django.db import models class EmailAddressManager(models.Manager): def add_email(self, user, email, **kwargs): confirm = kwargs.pop("confirm", False) email_address, __ = self.get_or_create(user=user, email=email, default=kwargs) if confirm and...
Use get_or_create instead of just create
Use get_or_create instead of just create
Python
mit
gem/geonode-user-accounts,gem/geonode-user-accounts,gem/geonode-user-accounts
80df385acb9f39d0a5f01dc41954b7035ecafb2d
upnp_inspector/__init__.py
upnp_inspector/__init__.py
# -*- coding: utf-8 -*- __version_info__ = (0, 2, 3) __version__ = '%d.%d.%d' % __version_info__[:3]
# -*- coding: utf-8 -*- __version__ = "0.3.dev0"
Switch to PEP 440 compliant version string and update to 0.3.dev0.
Switch to PEP 440 compliant version string and update to 0.3.dev0. Update to 0.3.dev0 since this is the version already stated in the NEWS file.
Python
mit
coherence-project/UPnP-Inspector
16c1352ecf8583615e482c431ec5183fdb718f67
split_file.py
split_file.py
from strip_comments import strip_comments import re __all__ = ["split_coq_file_contents"] def split_coq_file_contents(contents): """Splits the contents of a coq file into multiple statements. This is done by finding one or three periods followed by whitespace. This is a dumb algorithm, but it seems to b...
from strip_comments import strip_comments import re __all__ = ["split_coq_file_contents"] def merge_quotations(statements): """If there are an odd number of "s in a statement, assume that we broke the middle of a string. We recombine that string.""" cur = None for i in statements: if i.count...
Make splitting more robust to periods in strings
Make splitting more robust to periods in strings
Python
mit
JasonGross/coq-tools,JasonGross/coq-tools
5f49fb8c7c0f9e7a05d4f9b730d7f3e872229d60
test/completion/definition.py
test/completion/definition.py
""" Fallback to callee definition when definition not found. - https://github.com/davidhalter/jedi/issues/131 - https://github.com/davidhalter/jedi/pull/149 """ #? isinstance isinstance( ) #? isinstance isinstance(None, ) #? isinstance isinstance(None, )
""" Fallback to callee definition when definition not found. - https://github.com/davidhalter/jedi/issues/131 - https://github.com/davidhalter/jedi/pull/149 """ #? isinstance isinstance( ) #? isinstance isinstance(None, ) #? isinstance isinstance(None, ) # Note: len('isinstance(') == 11 #? 11 isinstance isinstance...
Add blackbox tests using column number
Add blackbox tests using column number
Python
mit
flurischt/jedi,WoLpH/jedi,mfussenegger/jedi,dwillmer/jedi,tjwei/jedi,jonashaag/jedi,jonashaag/jedi,tjwei/jedi,flurischt/jedi,dwillmer/jedi,mfussenegger/jedi,WoLpH/jedi
192e24cdafff2bb780ef9cc87853c48e9e41cb4a
stationspinner/accounting/management/commands/characters.py
stationspinner/accounting/management/commands/characters.py
from django.core.management.base import BaseCommand, CommandError from stationspinner.character.models import CharacterSheet class Command(BaseCommand): help = 'Lists all enabled characterIDs with their APIKey PKs. Handy for sending tasks' def handle(self, *args, **options): characters = CharacterShee...
from django.core.management.base import BaseCommand, CommandError from stationspinner.character.models import CharacterSheet class Command(BaseCommand): help = 'Lists all enabled characterIDs with their APIKey PKs. Handy for sending tasks' def handle(self, *args, **options): characters = CharacterShee...
Simplify the output for copypaste
Simplify the output for copypaste
Python
agpl-3.0
kriberg/stationspinner,kriberg/stationspinner
e0de6546fb58af113d18cf7e836407e3f8a1a985
contrib/bosco/bosco-cluster-remote-hosts.py
contrib/bosco/bosco-cluster-remote-hosts.py
#!/usr/bin/python3 import os import subprocess import sys try: import classad import htcondor except ImportError: sys.exit("ERROR: Could not load HTCondor Python bindings. " "Ensure the 'htcondor' and 'classad' are in PYTHONPATH") jre = classad.parseAds('JOB_ROUTER_ENTRIES') grs = ( x[...
#!/usr/bin/python3 import os import subprocess import sys try: import classad except ImportError: sys.exit("ERROR: Could not load HTCondor Python bindings. " "Ensure the 'htcondor' and 'classad' are in PYTHONPATH") jre = classad.parseAds('JOB_ROUTER_ENTRIES') grs = ( x["GridResource"] for ...
Delete unused import htcondor (SOFTWARE-4687)
Delete unused import htcondor (SOFTWARE-4687)
Python
apache-2.0
brianhlin/htcondor-ce,matyasselmeci/htcondor-ce,matyasselmeci/htcondor-ce,brianhlin/htcondor-ce,matyasselmeci/htcondor-ce,brianhlin/htcondor-ce
ded6f27721e54f2c7dab3016209927678d85b90d
aldryn_faq/forms.py
aldryn_faq/forms.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from parler.forms import TranslatableModelForm from sortedm2m.forms import SortedMultipleChoiceField from .models import Category, QuestionListPlugin, Question class CategoryAdminForm(TranslatableModelForm): class Meta:...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from parler.forms import TranslatableModelForm from sortedm2m.forms import SortedMultipleChoiceField from .models import Category, QuestionListPlugin, Question class CategoryAdminForm(TranslatableModelForm): class Meta:...
Remove no longer used code
Remove no longer used code
Python
bsd-3-clause
czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq
db134f36ae54ef135037d0c912068fc678df54cf
examples/controllers.py
examples/controllers.py
#!/usr/bin/python """ Create a network where different switches are connected to different controllers, by creating a custom Switch() subclass. """ from mininet.net import Mininet from mininet.node import OVSSwitch, Controller, RemoteController from mininet.topolib import TreeTopo from mininet.log import setLogLevel ...
#!/usr/bin/python """ Create a network where different switches are connected to different controllers, by creating a custom Switch() subclass. """ from mininet.net import Mininet from mininet.node import OVSSwitch, Controller, RemoteController from mininet.topolib import TreeTopo from mininet.log import setLogLevel ...
Allow RemoteController to connect to correct port.
Allow RemoteController to connect to correct port. Fixes #584
Python
bsd-3-clause
mininet/mininet,mininet/mininet,mininet/mininet
d9db4735a1c879e967af5fff30c8322ea3f5121a
hackfmi/urls.py
hackfmi/urls.py
from django.conf.urls import patterns, include, url from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin from members import views admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.homepage, name='homepage'), # Examples: # ...
from django.conf.urls import patterns, include, url from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin from members import views admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.homepage, name='homepage'), # Examples: # ...
Add url for searching user by name
Add url for searching user by name
Python
mit
Hackfmi/Diaphanum,Hackfmi/Diaphanum
9dab9c08c57ab0548beaa32765a2f064d2ec6544
tests/app/test_application.py
tests/app/test_application.py
""" Tests for the application infrastructure """ from flask import json from nose.tools import assert_equal from .helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def test_index(self): response = self.client.get('/') assert 200 == response.status_code assert ...
""" Tests for the application infrastructure """ import mock import pytest from flask import json from elasticsearch.exceptions import ConnectionError from nose.tools import assert_equal from .helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def test_index(self): response =...
Add a test to indicate/ ensure that flask is performing retries …
Add a test to indicate/ ensure that flask is performing retries … The retry functionality is buried in the elasticsearch.transport.Transport class and can be effected by passing max_retries to the elasticsearch.client.ElasticSearch object (https://github.com/elastic/elasticsearch-py/blob/master/elasticsearch/client/_...
Python
mit
alphagov/digitalmarketplace-search-api,alphagov/digitalmarketplace-search-api
a2b4b732c15c3cfefb345354bca8fc6de47d4820
appengine_config.py
appengine_config.py
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib')
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') import os # Called only if the current namespace is not set. def namespa...
Enable NDB Shared memory namespace partioning using engine Version ID
Enable NDB Shared memory namespace partioning using engine Version ID
Python
apache-2.0
dbs/schemaorg,vholland/schemaorg,schemaorg/schemaorg,vholland/schemaorg,tfrancart/schemaorg,schemaorg/schemaorg,unor/schemaorg,schemaorg/schemaorg,dbs/schemaorg,vholland/schemaorg,dbs/schemaorg,tfrancart/schemaorg,tfrancart/schemaorg,vholland/schemaorg,schemaorg/schemaorg,dbs/schemaorg,tfrancart/schemaorg,unor/schemaor...
ed6146566d57105af88855c6b8668b4f76e98dbf
xmanager/xm_local/__init__.py
xmanager/xm_local/__init__.py
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
Make `DockerOptions` part of the `xm_local` module
Make `DockerOptions` part of the `xm_local` module PiperOrigin-RevId: 376139511 Change-Id: Ia0ec1337b9ef2c175dea6b0c45e0a99b285d2b31 GitOrigin-RevId: 799d3ef6a98a6e4922b0b60c190c0d82cd538548
Python
apache-2.0
deepmind/xmanager,deepmind/xmanager
55bc355fc97eb5e034e86e7c55919d8cca0edb2b
feincms/context_processors.py
feincms/context_processors.py
from feincms.module.page.models import Page def add_page_if_missing(request): """ If this attribute exists, then a page object has been registered already by some other part of the code. We let it decide which page object it wants to pass into the template """ if hasattr(request, '_feincms_pa...
from feincms.module.page.models import Page def add_page_if_missing(request): """ If this attribute exists, then a page object has been registered already by some other part of the code. We let it decide which page object it wants to pass into the template """ if hasattr(request, '_feincms_pa...
Remove deprecated appcontent_parameters context processor
Remove deprecated appcontent_parameters context processor It did nothing for some time anyway.
Python
bsd-3-clause
matthiask/feincms2-content,mjl/feincms,feincms/feincms,joshuajonah/feincms,matthiask/feincms2-content,matthiask/feincms2-content,joshuajonah/feincms,matthiask/django-content-editor,michaelkuty/feincms,pjdelport/feincms,nickburlett/feincms,michaelkuty/feincms,michaelkuty/feincms,feincms/feincms,feincms/feincms,matthiask...
3170407aaaeffbc76e31e5fc78d4dacd008e27d2
backbone_calendar/ajax/mixins.py
backbone_calendar/ajax/mixins.py
from django import http from django.utils import simplejson as json class JSONResponseMixin(object): context_variable = 'object_list' def render_to_response(self, context): "Returns a JSON response containing 'context' as payload" return self.get_json_response(self.convert_context_to_json(con...
import json from django import http class JSONResponseMixin(object): context_variable = 'object_list' def render_to_response(self, context): "Returns a JSON response containing 'context' as payload" return self.get_json_response(self.convert_context_to_json(context)) def dispatch(self, ...
Use json and not simplejson
Use json and not simplejson
Python
agpl-3.0
rezometz/django-backbone-calendar,rezometz/django-backbone-calendar,rezometz/django-backbone-calendar
52fddb061bf5f282da75df4462dd735d9fdc041a
sgfs/actions/create_structure.py
sgfs/actions/create_structure.py
from sgfs import SGFS from sgactions.utils import notify def run_create(**kwargs): _run(False, **kwargs) def run_preview(**kwargs): _run(True, **kwargs) def _run(dry_run, entity_type, selected_ids, **kwargs): sgfs = SGFS() entities = sgfs.session.merge([dict(type=entity_type, id=id_) for ...
from sgfs import SGFS from sgactions.utils import notify, progress def run_create(**kwargs): _run(False, **kwargs) def run_preview(**kwargs): _run(True, **kwargs) def _run(dry_run, entity_type, selected_ids, **kwargs): title='Preview Folders' if dry_run else 'Creating Folders' progress(title=t...
Use new sgactions progress dialog
Use new sgactions progress dialog
Python
bsd-3-clause
westernx/sgfs,westernx/sgfs
3b15911c669d072bee1a171696636162d23bd07e
spec/openpassword/config_spec.py
spec/openpassword/config_spec.py
from nose.tools import assert_equals from openpassword.config import Config class ConfigSpec: def it_sets_the_path_to_the_keychain(self): cfg = Config() cfg.set_path("path/to/keychain") assert_equals(cfg.get_path(), "path/to/keychain")
from nose.tools import * from openpassword.config import Config class ConfigSpec: def it_sets_the_path_to_the_keychain(self): cfg = Config() cfg.set_path("path/to/keychain") eq_(cfg.get_path(), "path/to/keychain")
Update config test to use eq_ matcher
Update config test to use eq_ matcher
Python
mit
openpassword/blimey,openpassword/blimey
c073131ac4b951affdac454824bb3eed913cd931
huxley/api/tests/committee.py
huxley/api/tests/committee.py
import json from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client from huxley.utils.test import TestCommittees class CommitteeDetailGetTestCase(TestCase): def setUp(self): self.client = Client() def get_url(self, committee_id): r...
# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved. # Use of this source code is governed by a BSD License (see LICENSE). import json from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client from huxley.utils.test import TestCommitt...
Add copyright header to CommitteeDetailGetTestCase.
Add copyright header to CommitteeDetailGetTestCase.
Python
bsd-3-clause
bmun/huxley,ctmunwebmaster/huxley,nathanielparke/huxley,ctmunwebmaster/huxley,bmun/huxley,bmun/huxley,ctmunwebmaster/huxley,nathanielparke/huxley,bmun/huxley,nathanielparke/huxley,nathanielparke/huxley,ctmunwebmaster/huxley
2a68505e36358900e045f74a8b2885486f6a302e
framework/guid/model.py
framework/guid/model.py
from framework import StoredObject, fields class Guid(StoredObject): _id = fields.StringField() referent = fields.AbstractForeignField(backref='guid') _meta = { 'optimistic': True } class GuidStoredObject(StoredObject): # Redirect to content using URL redirect by default redirect_...
from framework import StoredObject, fields class Guid(StoredObject): _id = fields.StringField() referent = fields.AbstractForeignField() _meta = { 'optimistic': True, } class GuidStoredObject(StoredObject): # Redirect to content using URL redirect by default redirect_mode = 'redir...
Remove backref on GUID; factor out _ensure_guid
Remove backref on GUID; factor out _ensure_guid
Python
apache-2.0
arpitar/osf.io,rdhyee/osf.io,lyndsysimon/osf.io,ZobairAlijan/osf.io,caseyrygt/osf.io,abought/osf.io,CenterForOpenScience/osf.io,asanfilippo7/osf.io,emetsger/osf.io,kwierman/osf.io,barbour-em/osf.io,icereval/osf.io,Johnetordoff/osf.io,jolene-esposito/osf.io,RomanZWang/osf.io,haoyuchen1992/osf.io,barbour-em/osf.io,binocu...
21b022362a09c4e408b9375a38505975e8c7f965
comet/utility/test/test_whitelist.py
comet/utility/test/test_whitelist.py
from ipaddr import IPNetwork from twisted.internet.protocol import Protocol from twisted.internet.address import IPv4Address from twisted.trial import unittest from ...test.support import DummyEvent from ..whitelist import WhitelistingFactory WhitelistingFactory.protocol = Protocol class WhitelistingFactoryTestCase...
from ipaddr import IPNetwork from twisted.internet.protocol import Protocol from twisted.internet.address import IPv4Address from twisted.trial import unittest from ...test.support import DummyEvent from ..whitelist import WhitelistingFactory WhitelistingFactory.protocol = Protocol class WhitelistingFactoryTestCase...
Remove assertIsNone for Python 2.6 compatibility
Remove assertIsNone for Python 2.6 compatibility
Python
bsd-2-clause
jdswinbank/Comet,jdswinbank/Comet
40616138673205b3b4f3150a659ab02830b2bbc0
tests/test_player_creation.py
tests/test_player_creation.py
from webtest import TestApp import dropshot def test_create_player(): app = TestApp(dropshot.app) params = {'username': 'chapmang', 'password': 'deadparrot', 'email': 'chapmang@dropshot.com'} expected = {'count': 1, 'offset': 0, 'players': [ ...
from webtest import TestApp import dropshot def test_create_player(): app = TestApp(dropshot.app) params = {'username': 'chapmang', 'password': 'deadparrot', 'email': 'chapmang@dropshot.com'} expected = {'count': 1, 'offset': 0, 'players': [ ...
Update player creation test to verify POST status code.
Update player creation test to verify POST status code.
Python
mit
dropshot/dropshot-server
4921d58775faa65423fac321ef68f065b2499813
experiments/hydrotrend-uq-1/plot_results.py
experiments/hydrotrend-uq-1/plot_results.py
#!/usr/bin/env python # Makes a standard set of plots from Dakota output. # Mark Piper (mark.piper@colorado.edu) # Note that these imports are from the installed version of dakota_utils. from dakota_utils.read import read_tabular from dakota_utils.plot import plot_samples, plot_irregular_surface tab_file = 'dakota.da...
#!/usr/bin/env python # Makes a standard set of plots from Dakota output. # Mark Piper (mark.piper@colorado.edu) # Note that these imports are from the installed version of dakota_utils. from dakota_utils.read import read_tabular from dakota_utils.plot import plot_samples, plot_irregular_surface from dakota_utils.conv...
Update script for Dakota 6.1 tabular output file
Update script for Dakota 6.1 tabular output file
Python
mit
mcflugen/dakota-experiments,mdpiper/dakota-experiments,mdpiper/dakota-experiments,mdpiper/dakota-experiments,mcflugen/dakota-experiments
a263926614a2f9c0c5c41d19282db79ac5e79e7e
gittip/orm/__init__.py
gittip/orm/__init__.py
from __future__ import unicode_literals import os from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class SQLAlchemy(object): def __init__(self): self.session = self.create_session() @property...
from __future__ import unicode_literals import os import pdb from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class Model(object): def __repr__(self): cols = self.__mapper__.c.keys() class...
Remove the convenience functions, reorganize around the SQLAlchemy class
Remove the convenience functions, reorganize around the SQLAlchemy class
Python
mit
eXcomm/gratipay.com,gratipay/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,bountysource/www.gittip.com,MikeFair/www.gittip.com,eXcomm/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,bountysource/www.gittip.com,...
c8779edcb4078c799b7112625b5495f63a00e428
l10n_ro_partner_unique/models/res_partner.py
l10n_ro_partner_unique/models/res_partner.py
# Copyright (C) 2015 Forest and Biomass Romania # Copyright (C) 2020 NextERP Romania # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _g...
# Copyright (C) 2015 Forest and Biomass Romania # Copyright (C) 2020 NextERP Romania # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _g...
Add vat unique per comapny
Add vat unique per comapny
Python
agpl-3.0
OCA/l10n-romania,OCA/l10n-romania
548cfea821bf1b0b92ce09c54405554d264b5395
tests/integration/session/test_timeout.py
tests/integration/session/test_timeout.py
import time from app import settings from tests.integration.integration_test_case import IntegrationTestCase class TestTimeout(IntegrationTestCase): def setUp(self): settings.EQ_SESSION_TIMEOUT_SECONDS = 1 settings.EQ_SESSION_TIMEOUT_GRACE_PERIOD_SECONDS = 0 super().setUp() def test...
import time from app import settings from tests.integration.integration_test_case import IntegrationTestCase class TestTimeout(IntegrationTestCase): def setUp(self): settings.EQ_SESSION_TIMEOUT_SECONDS = 1 settings.EQ_SESSION_TIMEOUT_GRACE_PERIOD_SECONDS = 0 super().setUp() def tear...
Fix CSRF missing errors that happen occasionally in tests
Fix CSRF missing errors that happen occasionally in tests
Python
mit
ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner
36c2e7449b7817a66b60eaff4c8518ae6d4f4a01
categories/tests.py
categories/tests.py
from .models import Category from .serializers import CategorySerializer from employees.models import Employee from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase class CategoryTestCase(APITestCase): def setUp(self): Category.objects.c...
from .models import Category from .serializers import CategorySerializer from employees.models import Employee from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase class CategoryTestCase(APITestCase): def setUp(self): Category.objects.c...
Remove categoy_list test until urls will fixed.
Remove categoy_list test until urls will fixed.
Python
apache-2.0
belatrix/BackendAllStars
40958981df401a898a39ddad45c2b48669a44ee7
setup.py
setup.py
#!/usr/bin/env python import os from distutils.core import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='mammoth', version='0.1.1', description='Convert Word documents to simple and clean HTML', long_description=read("README"), author='...
#!/usr/bin/env python import os import sys from distutils.core import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() _install_requires = [ "parsimonious>=0.5,<0.6", ] if sys.version_info[:2] <= (2, 6): _install_requires.append("argparse==1.2.1") setup( na...
Support CLI on Python 2.6
Support CLI on Python 2.6
Python
bsd-2-clause
mwilliamson/python-mammoth,JoshBarr/python-mammoth
139d09ecd83694dd92d393b64d1d9b0ad05e9f4c
setup.py
setup.py
import distutils.core # Uploading to PyPI # ================= # $ python setup.py register -r pypi # $ python setup.py sdist upload -r pypi version = '1.0' distutils.core.setup( name='nonstdlib', version=version, author='Kale Kundert', author='kale@thekunderts.net', url='https:...
import distutils.core # Uploading to PyPI # ================= # The first time only: # $ python setup.py register -r pypi # # Every version bump: # $ git tag <version>; git push # $ python setup.py sdist upload -r pypi version = '1.0' distutils.core.setup( name='nonstdlib', version=version, au...
Add instructions for bumping the version.
Add instructions for bumping the version.
Python
mit
kalekundert/nonstdlib,KenKundert/nonstdlib,kalekundert/nonstdlib,KenKundert/nonstdlib
1f9bc1b6f9a796458d104c01b9a344cbb0c84a9b
Lib/fontParts/fontshell/groups.py
Lib/fontParts/fontshell/groups.py
import defcon from fontParts.base import BaseGroups from fontParts.fontshell.base import RBaseObject class RGroups(RBaseObject, BaseGroups): wrapClass = defcon.Groups def _items(self): return self.naked().items() def _contains(self, key): return key in self.naked() def _setItem(sel...
import defcon from fontParts.base import BaseGroups from fontParts.fontshell.base import RBaseObject class RGroups(RBaseObject, BaseGroups): wrapClass = defcon.Groups def _get_base_side1KerningGroups(self): return self.naked().getRepresentation("defcon.groups.kerningSide1Groups") def _get_base_...
Add defcon implementation of group lookup methods.
Add defcon implementation of group lookup methods.
Python
mit
robofab-developers/fontParts,robofab-developers/fontParts
fbfd656d0c11bfbc6500fcdffdfae422ab50a08f
lancet/contrib/dploi.py
lancet/contrib/dploi.py
import click @click.command() @click.argument('environment') @click.pass_obj def ssh(lancet, environment): """ SSH into the given environment, based on the dploi configuration. """ namespace = {} with open('deployment.py') as fh: code = compile(fh.read(), 'deployment.py', 'exec') ...
from shlex import quote import click @click.command() @click.option('-p', '--print/--exec', 'print_cmd', default=False, help='Print the command instead of executing it.') @click.argument('environment') @click.pass_obj def ssh(lancet, print_cmd, environment): """ SSH into the given environment, ...
Allow to print the ssh command
Allow to print the ssh command
Python
mit
GaretJax/lancet,GaretJax/lancet
d03657217cfd019bb55a4895a4cc6b0a80068ff0
bluebottle/bb_projects/migrations/0003_auto_20160815_1658.py
bluebottle/bb_projects/migrations/0003_auto_20160815_1658.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-08-15 14:58 from __future__ import unicode_literals from django.db import migrations def update_status_names(apps, schema_editor): ProjectPhase = apps.get_model('bb_projects', 'ProjectPhase') updates = { 'plan-new': 'Plan - Draft', ...
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-08-15 14:58 from __future__ import unicode_literals from django.db import migrations def update_status_names(apps, schema_editor): ProjectPhase = apps.get_model('bb_projects', 'ProjectPhase') updates = { 'plan-new': 'Plan - Draft', ...
Make the status data migration optional
Make the status data migration optional
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
12c833b1097579ca4a0162dca0d789b787f7d237
oscar/core/compat.py
oscar/core/compat.py
from django.conf import settings from django.contrib.auth.models import User def get_user_model(): """ Return the User model Using this function instead of Django 1.5's get_user_model allows backwards compatibility with Django 1.4. """ try: # Django 1.5+ from django.contrib.au...
from django.conf import settings from django.contrib.auth.models import User def get_user_model(): """ Return the User model Using this function instead of Django 1.5's get_user_model allows backwards compatibility with Django 1.4. """ try: # Django 1.5+ from django.contrib.au...
Add two settings related to custom user model
Add two settings related to custom user model
Python
bsd-3-clause
josesanch/django-oscar,binarydud/django-oscar,Idematica/django-oscar,QLGu/django-oscar,dongguangming/django-oscar,kapari/django-oscar,jmt4/django-oscar,amirrpp/django-oscar,WadeYuChen/django-oscar,rocopartners/django-oscar,rocopartners/django-oscar,amirrpp/django-oscar,ka7eh/django-oscar,ahmetdaglarbas/e-commerce,jinny...
04f36fab2168fb9cd34d3c6fc7f31533c90b9149
app/clients/statsd/statsd_client.py
app/clients/statsd/statsd_client.py
from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config.get('NOTIFY_ENVIRONMENT') + ".notifications.api." if self.active: StatsClient.__init__( ...
from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config.get('NOTIFY_ENVIRONMENT') + ".notifications.api." if self.active: StatsClient.__init__( ...
Format the stat name with environmenbt
Format the stat name with environmenbt
Python
mit
alphagov/notifications-api,alphagov/notifications-api
da03ad3386d45d310514f2b5ef3145fbcf5b773d
dashboard/ratings/tests/factories.py
dashboard/ratings/tests/factories.py
""" Contains factory classes for quickly generating test data. It uses the factory_boy package. Please see https://github.com/rbarrois/factory_boy for more info """ import datetime import factory import random from django.utils import timezone from ratings import models class SubmissionFactory(factory.DjangoModelFa...
""" Contains factory classes for quickly generating test data. It uses the factory_boy package. Please see https://github.com/rbarrois/factory_boy for more info """ import datetime import factory import factory.fuzzy import random from django.utils import timezone from ratings import models class SubmissionFactory(...
Make sure seeder creates random values
Make sure seeder creates random values
Python
mit
daltonamitchell/rating-dashboard,daltonamitchell/rating-dashboard,daltonamitchell/rating-dashboard
79b0584887075eb1732770d1732ae07147ec21b6
tests/mpd/protocol/test_status.py
tests/mpd/protocol/test_status.py
from __future__ import absolute_import, unicode_literals from mopidy.models import Track from tests.mpd import protocol class StatusHandlerTest(protocol.BaseTestCase): def test_clearerror(self): self.send_request('clearerror') self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented') ...
from __future__ import absolute_import, unicode_literals from mopidy.models import Track from tests.mpd import protocol class StatusHandlerTest(protocol.BaseTestCase): def test_clearerror(self): self.send_request('clearerror') self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented') ...
Stop using tracklist add tracks in mpd status test
tests: Stop using tracklist add tracks in mpd status test
Python
apache-2.0
ZenithDK/mopidy,quartz55/mopidy,tkem/mopidy,dbrgn/mopidy,rawdlite/mopidy,ali/mopidy,glogiotatidis/mopidy,quartz55/mopidy,bacontext/mopidy,bencevans/mopidy,kingosticks/mopidy,ZenithDK/mopidy,tkem/mopidy,dbrgn/mopidy,tkem/mopidy,jmarsik/mopidy,glogiotatidis/mopidy,adamcik/mopidy,bacontext/mopidy,bacontext/mopidy,pacificI...
31dd9f5ec73db577bf00d7411ecffeba30691d0c
django_lean/lean_analytics/models.py
django_lean/lean_analytics/models.py
from django_lean.experiments.models import GoalRecord from django_lean.experiments.signals import goal_recorded, user_enrolled from django_lean.lean_analytics import get_all_analytics def analytics_goalrecord(sender, goal_record, experiment_user, *args, **kwargs): for analytics in get_all_analytics(): ana...
from django.conf import settings from django_lean.experiments.models import GoalRecord from django_lean.experiments.signals import goal_recorded, user_enrolled from django_lean.lean_analytics import get_all_analytics def analytics_goalrecord(sender, goal_record, experiment_user, *args, **kwargs): if getattr(sett...
Make it possible to disable enrollment and goal record analytics.
Make it possible to disable enrollment and goal record analytics.
Python
bsd-3-clause
e-loue/django-lean,e-loue/django-lean
7da561d7bf3affecce8b10b50818591ccebe0ba2
dog/core/cog.py
dog/core/cog.py
class Cog: """ The Cog baseclass that all cogs should inherit from. """ def __init__(self, bot): self.bot = bot
import logging class Cog: """ The Cog baseclass that all cogs should inherit from. """ def __init__(self, bot): self.bot = bot self.logger = logging.getLogger('cog.' + type(self).__name__.lower())
Add logger attribute in Cog baseclass
Add logger attribute in Cog baseclass I don't feel like refactoring all of my cog code to use this attribute at the moment, so I'll just leave this here for now.
Python
mit
sliceofcode/dogbot,slice/dogbot,slice/dogbot,sliceofcode/dogbot,slice/dogbot
eafafd3d90024c552a6a607871c1441e358eb927
Bar.py
Bar.py
import pylab from matplotlib import pyplot from PlotInfo import * class Bar(PlotInfo): """ A bar chart consisting of a single series of bars. """ def __init__(self): PlotInfo.__init__(self, "bar") self.width=0.8 self.color="black" self.edgeColor=None self.hatch=...
import pylab from matplotlib import pyplot from PlotInfo import * class Bar(PlotInfo): """ A bar chart consisting of a single series of bars. """ def __init__(self): PlotInfo.__init__(self, "bar") self.width=0.8 self.color="black" self.edgeColor=None self.hatch=...
Fix bar graph x-axis centering.
Fix bar graph x-axis centering.
Python
bsd-3-clause
alexras/boomslang
320214ca1636415bc4d677ba9e3b40f0bf24c8f9
openprescribing/frontend/migrations/0008_create_searchbookmark.py
openprescribing/frontend/migrations/0008_create_searchbookmark.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-07-07 11:58 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-07-07 11:58 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
Fix multiple leaf nodes in migrations
Fix multiple leaf nodes in migrations
Python
mit
ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc
106eaf7d22bf4039756c0ae32c125d475eb4c109
utils/html.py
utils/html.py
#coding=UTF-8 __author__ = 'Gareth Coles' from HTMLParser import HTMLParser import htmlentitydefs class HTMLTextExtractor(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.result = [] def handle_data(self, d): self.result.append(d) def handle_charref(self, number):...
#coding=UTF-8 __author__ = 'Gareth Coles' from HTMLParser import HTMLParser import htmlentitydefs class HTMLTextExtractor(HTMLParser): def __init__(self, newlines=True): HTMLParser.__init__(self) self.result = [] self.newlines = newlines def handle_starttag(self, tag, attrs): ...
Add new-line support to HTML text extractor
Add new-line support to HTML text extractor
Python
artistic-2.0
UltrosBot/Ultros,UltrosBot/Ultros
d48fd8b11fe2d9edef0ca7044df8659244a13821
Telegram/Telegram_Harmonbot.py
Telegram/Telegram_Harmonbot.py
import telegram import telegram.ext import os import dotenv version = "0.1.4" # Load credentials from .env dotenv.load_dotenv() token = os.getenv("TELEGRAM_BOT_API_TOKEN") bot = telegram.Bot(token = token) updater = telegram.ext.Updater(token = token) def test(bot, update): bot.sendMessage(chat_id = update.mess...
import telegram import telegram.ext import os import dotenv version = "0.2.0" # Load credentials from .env dotenv.load_dotenv() token = os.getenv("TELEGRAM_BOT_API_TOKEN") bot = telegram.Bot(token = token) updater = telegram.ext.Updater(token = token, use_context = True) def test(update, context): context.bot.s...
Update to context based callbacks
[Telegram] Update to context based callbacks
Python
mit
Harmon758/Harmonbot,Harmon758/Harmonbot
a174b827b36293d90babfcdf557bdbb9c9d0b655
ibei/__init__.py
ibei/__init__.py
# -*- coding: utf-8 -*- """ ========================= Base Library (:mod:`ibei`) ========================= .. currentmodule:: ibei """ from main import uibei, SQSolarcell, DeVosSolarcell
# -*- coding: utf-8 -*- """ ========================= Base Library (:mod:`ibei`) ========================= .. currentmodule:: ibei """ from main import uibei, SQSolarcell, DeVosSolarcell __version__ = "0.0.2"
Add version information in module
Add version information in module
Python
mit
jrsmith3/tec,jrsmith3/ibei,jrsmith3/tec
aeb3ce72205051039e6339f83a2b7dec37f8b8c9
idlk/__init__.py
idlk/__init__.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import sys import idlk.base41 if sys.version_info[0] == 3: _get_byte = lambda c: c else: _get_byte = ord def hash_macroman(data): h = 0 for c in data: h = ((h << 8) + h) + ...
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import sys import unicodedata import idlk.base41 if sys.version_info[0] == 3: _get_byte = lambda c: c else: _get_byte = ord def hash_macroman(data): h = 0 for c in data: h ...
Normalize filename to NFC before computing the hash
Normalize filename to NFC before computing the hash
Python
mit
znerol/py-idlk
9fb8b0a72740ba155c76a5812706612b656980f4
openprocurement/auctions/flash/constants.py
openprocurement/auctions/flash/constants.py
# -*- coding: utf-8 -*- VIEW_LOCATIONS = [ "openprocurement.auctions.flash.views", "openprocurement.auctions.core.plugins", ]
# -*- coding: utf-8 -*- VIEW_LOCATIONS = [ "openprocurement.auctions.flash.views", ]
Add view_locations for plugins in core
Add view_locations for plugins in core
Python
apache-2.0
openprocurement/openprocurement.auctions.flash
8d9f3214cc5663dc29f7dcf3a03bc373a51d010b
core/admin/start.py
core/admin/start.py
#!/usr/bin/python3 import os import logging as log import sys log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "INFO")) os.system("flask mailu advertise") os.system("flask db upgrade") account = os.environ.get("INITIAL_ADMIN_ACCOUNT") domain = os.environ.get("INITIAL_ADMIN_DOMAIN") password = os...
#!/usr/bin/python3 import os import logging as log import sys log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "INFO")) os.system("flask mailu advertise") os.system("flask db upgrade") account = os.environ.get("INITIAL_ADMIN_ACCOUNT") domain = os.environ.get("INITIAL_ADMIN_DOMAIN") password = os...
Use threads in gunicorn rather than processes
Use threads in gunicorn rather than processes This ensures that we share the auth-cache... will enable memory savings and may improve performances when a higher number of cores is available "smarter default"
Python
mit
kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io
e8ac68b33b3b7bf54baa36b89ac90e9e5a666599
magnum/conf/services.py
magnum/conf/services.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
# Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
Use HostAddressOpt for opts that accept IP and hostnames
Use HostAddressOpt for opts that accept IP and hostnames Some configuration options were accepting both IP addresses and hostnames. Since there was no specific OSLO opt type to support this, we were using ``StrOpt``. The change [1] that added support for ``HostAddressOpt`` type was merged in Ocata and became available...
Python
apache-2.0
openstack/magnum,ArchiFleKs/magnum,ArchiFleKs/magnum,openstack/magnum
381cf72695185fda93d0d9685fad887d445b4a72
mesonwrap/inventory.py
mesonwrap/inventory.py
RESTRICTED_PROJECTS = [ 'dubtestproject', 'meson', 'meson-ci', 'mesonbuild.github.io', 'mesonwrap', 'wrapdb', 'wrapdevtools', 'wrapweb', ] ISSUE_TRACKER = 'wrapdb' class Inventory: def __init__(self, organization): self.organization = organization self.restricted_p...
RESTRICTED_PROJECTS = [ 'cidata', 'dubtestproject', 'meson', 'meson-ci', 'mesonbuild.github.io', 'mesonwrap', 'wrapdb', 'wrapdevtools', 'wrapweb', ] ISSUE_TRACKER = 'wrapdb' class Inventory: def __init__(self, organization): self.organization = organization sel...
Add cidata to the list of restricted projects
Add cidata to the list of restricted projects
Python
apache-2.0
mesonbuild/wrapweb,mesonbuild/wrapweb,mesonbuild/wrapweb
8ffd6ffecd7ce713446385b6cd108e50fb041403
__main__.py
__main__.py
from . import * ps1 = '\n% ' ps2 = '| ' try: from blessings import Terminal term = Terminal() ps1 = term.bold_blue(ps1) ps2 = term.bold_blue(ps2) def fancy_movement(): print(term.move_up() + term.clear_eol() + term.move_up()) except ImportError: def fancy_movement(): pass def g...
from . import * import readline ps1 = '\n% ' ps2 = '| ' try: from blessings import Terminal term = Terminal() ps1 = term.bold_blue(ps1) ps2 = term.bold_blue(ps2) def fancy_movement(): print(term.move_up() + term.clear_eol() + term.move_up()) except ImportError: def fancy_movement(): ...
Add readline support for the REPL
Add readline support for the REPL
Python
isc
gvx/isle
c654bc1fdacdb355b7e03c853ebcdc919ac5f91d
tests/capture/test_capture.py
tests/capture/test_capture.py
from pyshark.capture.capture import Capture def test_capture_gets_decoding_parameters(): c = Capture(decode_as={'tcp.port==8888': 'http'}) params = c.get_parameters() decode_index = params.index('-d') assert params[decode_index + 1] == 'tcp.port==8888,http' def test_capture_gets_multiple_decoding_pa...
from pyshark.capture.capture import Capture def test_capture_gets_decoding_parameters(): c = Capture(decode_as={'tcp.port==8888': 'http'}) params = c.get_parameters() decode_index = params.index('-d') assert params[decode_index + 1] == 'tcp.port==8888,http' def test_capture_gets_multiple_decoding_pa...
Fix tests to avoid dict ordering problem
Fix tests to avoid dict ordering problem
Python
mit
KimiNewt/pyshark,eaufavor/pyshark-ssl
3e9a4f27ad05b3ecd2a4c013ff0f3b04e5fe44aa
tests/test_list_generators.py
tests/test_list_generators.py
import unittest import craft_ai from . import settings from .utils import generate_entity_id from .data import valid_data class TestListGenerators(unittest.TestCase): """Checks that the client succeeds when getting an agent with OK input""" @classmethod def setUpClass(cls): cls.client = craft_a...
import unittest import craft_ai from . import settings from .utils import generate_entity_id from .data import valid_data class TestListGenerators(unittest.TestCase): """Checks that the client succeeds when getting an agent with OK input""" @classmethod def setUpClass(cls): cls.client = craft_a...
Fix agent creation configuration to make tests great again
Fix agent creation configuration to make tests great again lint
Python
bsd-3-clause
craft-ai/craft-ai-client-python,craft-ai/craft-ai-client-python
4420eb020d96004c5373584781c7b130de7b90e9
reg/__init__.py
reg/__init__.py
# flake8: noqa from .implicit import implicit, NoImplicitLookupError from .registry import ClassRegistry, Registry, IRegistry, IClassLookup from .lookup import Lookup, ComponentLookupError, Matcher from .predicate import (PredicateRegistry, Predicate, KeyIndex, PredicateRegistryError) from .comp...
# flake8: noqa from .implicit import implicit, NoImplicitLookupError from .registry import ClassRegistry, Registry, IRegistry, IClassLookup from .lookup import Lookup, ComponentLookupError, Matcher from .predicate import (PredicateRegistry, Predicate, KeyIndex, PredicateRegistryError) from .comp...
Make sentinel available to outside.
Make sentinel available to outside.
Python
bsd-3-clause
taschini/reg,morepath/reg
268c4458161ce754a82e3986787f6703f9122e3e
trackmybmi/users/factories.py
trackmybmi/users/factories.py
import factory from django.contrib.auth.hashers import make_password from .models import Friendship, User class UserFactory(factory.django.DjangoModelFactory): """Create users with default attributes.""" class Meta: model = User email = factory.Sequence(lambda n: 'user.{}@test.test'.format(n))...
import factory from django.contrib.auth import get_user_model from django.contrib.auth.hashers import make_password from .models import Friendship User = get_user_model() class UserFactory(factory.django.DjangoModelFactory): """Create users with default attributes.""" class Meta: model = User ...
Replace User import with call to get_user_model()
Replace User import with call to get_user_model()
Python
mit
ojh/trackmybmi
b9ccbb2addd8dcaeb100bb5e95768caa2a97c280
srttools/core/__init__.py
srttools/core/__init__.py
import warnings try: import matplotlib # matplotlib.use('TkAgg') HAS_MPL = True except ImportError: HAS_MPL = False try: import statsmodels.api as sm HAS_STATSM = True except ImportError: HAS_STATSM = False try: from numba import jit, vectorize except ImportError: warnings.warn("N...
import warnings DEFAULT_MPL_BACKEND = 'TkAgg' try: import matplotlib # This is necessary. Random backends might respond incorrectly. matplotlib.use(DEFAULT_MPL_BACKEND) HAS_MPL = True except ImportError: HAS_MPL = False try: import statsmodels.api as sm version = [int(i) for i in sm.versio...
Set default backend, and minimum statsmodels version
Set default backend, and minimum statsmodels version
Python
bsd-3-clause
matteobachetti/srt-single-dish-tools
ab02c54cc713cc10c60f09dde3cae2fca3c2a9a4
conference/management/commands/make_speaker_profiles_public.py
conference/management/commands/make_speaker_profiles_public.py
from django.core.management.base import BaseCommand from conference import models as cmodels def make_speaker_profiles_public_for_conference(conference): # Get speaker records speakers = set() talks = cmodels.Talk.objects.accepted(conference) for t in talks: speakers |= set(t.get_all_speake...
from django.core.management.base import BaseCommand from conference import models as cmodels def make_speaker_profiles_public_for_conference(conference): # Get speaker records speakers = set() talks = cmodels.Talk.objects.accepted(conference) for t in talks: speakers |= set(t.get_all_speake...
Fix script to make speaker profiles public.
Fix script to make speaker profiles public.
Python
bsd-2-clause
EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon
b875f457d7a4926f5028428ead4cecc75af90c2e
examples/launch_cloud_harness.py
examples/launch_cloud_harness.py
import json import os from osgeo import gdal from gbdxtools import Interface from gbdx_task_template import TaskTemplate, Task, InputPort, OutputPort gbdx = Interface() # data = "s3://receiving-dgcs-tdgplatform-com/054813633050_01_003" # WV02 Image over San Francisco # aoptask = gbdx.Task("AOP_Strip_Processor", da...
from gbdxtools import Interface gbdx = Interface() # Create a cloud-harness gbdxtools Task from ch_tasks.cp_task import CopyTask cp_task = gbdx.Task(CopyTask) from ch_tasks.raster_meta import RasterMetaTask ch_task = gbdx.Task(RasterMetaTask) # NOTE: This will override the value in the class definition. ch_task.inp...
Remove the cloud-harness task and add second cloud-harness task for chaining.
Remove the cloud-harness task and add second cloud-harness task for chaining.
Python
mit
michaelconnor00/gbdxtools,michaelconnor00/gbdxtools
4f46fe7abf5efcd93bc161f2cfccc58df4ab1ee4
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
from django.test import TestCase from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class ListPreparationTestCase(TestCase): fixtures = ['test_fixtures'] def test_url_endpoint(self): url = reverse('entry-list-preparat...
from django.test import TestCase from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class ListPreparationTestCase(TestCase): fixtures = ['test_fixtures'] def test_url_endpoint(self): url = reverse('entry-list-preparat...
Rewrite preparations list test to get ID from URL
Rewrite preparations list test to get ID from URL
Python
apache-2.0
iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api
e0d0c9726766dc3281411e265c4d16ff66ecc595
regression/pages/studio/terms_of_service.py
regression/pages/studio/terms_of_service.py
""" Terms of Service page """ from bok_choy.page_object import PageObject from regression.pages.studio import LOGIN_BASE_URL class TermsOfService(PageObject): """ Terms of Service page """ url = LOGIN_BASE_URL + '/edx-terms-service' def is_browser_on_page(self): return "Please read these ...
""" Terms of Service page """ from bok_choy.page_object import PageObject from regression.pages.studio import LOGIN_BASE_URL class TermsOfService(PageObject): """ Terms of Service page """ url = LOGIN_BASE_URL + '/edx-terms-service' def is_browser_on_page(self): return "Please read these ...
Fix target css for TOS page
Fix target css for TOS page
Python
agpl-3.0
edx/edx-e2e-tests,edx/edx-e2e-tests
649c70527ae602512cfa6ea62b60ebc43fc69797
lab/run_trace.py
lab/run_trace.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Run a simple trace function on a file of Python code.""" import os, sys nest = 0 def trace(frame, event, arg): global nest if nest is None: #...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Run a simple trace function on a file of Python code.""" import os, sys nest = 0 def trace(frame, event, arg): global nest if nest is None: #...
Make this useful for py3 also
Make this useful for py3 also
Python
apache-2.0
hugovk/coveragepy,hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy,hugovk/coveragepy,nedbat/coveragepy,nedbat/coveragepy,nedbat/coveragepy,nedbat/coveragepy,hugovk/coveragepy
89bbc555ecf520ee34a9b1292a2bdb5c937b18e2
addons/hw_drivers/iot_handlers/interfaces/PrinterInterface.py
addons/hw_drivers/iot_handlers/interfaces/PrinterInterface.py
from cups import Connection as cups_connection from re import sub from threading import Lock from odoo.addons.hw_drivers.controllers.driver import Interface conn = cups_connection() PPDs = conn.getPPDs() cups_lock = Lock() # We can only make one call to Cups at a time class PrinterInterface(Interface): _loop_de...
from cups import Connection as cups_connection from re import sub from threading import Lock from odoo.addons.hw_drivers.controllers.driver import Interface conn = cups_connection() PPDs = conn.getPPDs() cups_lock = Lock() # We can only make one call to Cups at a time class PrinterInterface(Interface): _loop_de...
Fix issue with printer device-id
[FIX] hw_drivers: Fix issue with printer device-id When we print a ticket status with a thermal printer we need printer's device-id But if we add manually a printer this device-id doesn't exist So now we update de devices list with a supported = True if printer are manually added closes odoo/odoo#53043 Signed-off-by...
Python
agpl-3.0
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
460ed562a64b7aacbd690a2e62f39b11bfcb092f
src/MCPClient/lib/clientScripts/examineContents.py
src/MCPClient/lib/clientScripts/examineContents.py
#!/usr/bin/env python2 import os import subprocess import sys def main(target, output): args = [ 'bulk_extractor', target, '-o', output, '-M', '250', '-q', '-1' ] try: os.makedirs(output) subprocess.call(args) return 0 except Exception as e: return e if...
#!/usr/bin/env python2 import os import subprocess import sys def main(target, output): args = [ 'bulk_extractor', target, '-o', output, '-M', '250', '-q', '-1' ] try: os.makedirs(output) subprocess.call(args) # remove empty BulkExtractor logs for filename i...
Remove empty bulk extractor logs
Remove empty bulk extractor logs Squashed commit of the following: commit c923667809bb5d828144b09d03bd53554229a9bd Author: Aaron Elkiss <aelkiss@umich.edu> Date: Thu Dec 8 09:34:47 2016 -0500 fix spacing & variable name commit df597f69e19c3a3b4210c1131a79550eb147e412 Author: Aaron Daniel Elkiss <aelkiss@umich...
Python
agpl-3.0
artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica
5a15ca8b790dda7b2ea11af5d1c179f9e7d9f2ac
pages/search_indexes.py
pages/search_indexes.py
"""Django haystack `SearchIndex` module.""" from pages.models import Page from django.conf import settings from haystack.indexes import SearchIndex, CharField, DateTimeField, RealTimeSearchIndex from haystack import site class PageIndex(SearchIndex): """Search index for pages content.""" text = CharField(doc...
"""Django haystack `SearchIndex` module.""" from pages.models import Page from gerbi import settings from haystack.indexes import SearchIndex, CharField, DateTimeField, RealTimeSearchIndex from haystack import site class PageIndex(SearchIndex): """Search index for pages content.""" text = CharField(document=...
Use gerbi setting not global settings
Use gerbi setting not global settings
Python
bsd-3-clause
pombredanne/django-page-cms-1,akaihola/django-page-cms,remik/django-page-cms,akaihola/django-page-cms,batiste/django-page-cms,remik/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,batiste/django-page-cms,batiste/django-page-cms,pombredanne/django-page-cms-1,remik/django-page-cms,akaihola/django-page...
6c4c3ac1dde0519d08ab461ab60ccc1d8b9d3d38
CodeFights/createDie.py
CodeFights/createDie.py
#!/usr/local/bin/python # Code Fights Create Die Problem import random def createDie(seed, n): class Die(object): pass class Game(object): die = Die(seed, n) return Game.die def main(): tests = [ [37237, 5, 3], [36706, 12, 9], [21498, 10, 10], [2998...
#!/usr/local/bin/python # Code Fights Create Die Problem import random def createDie(seed, n): class Die(object): def __new__(self, seed, n): random.seed(seed) return int(random.random() * n) + 1 class Game(object): die = Die(seed, n) return Game.die def main()...
Solve Code Fights create die problem
Solve Code Fights create die problem
Python
mit
HKuz/Test_Code
b57a599640c6fa8bf23f081c914b7437e3f04dcd
course_discovery/apps/courses/management/commands/refresh_all_courses.py
course_discovery/apps/courses/management/commands/refresh_all_courses.py
import logging from optparse import make_option from django.core.management import BaseCommand, CommandError from course_discovery.apps.courses.models import Course logger = logging.getLogger(__name__) class Command(BaseCommand): help = 'Refresh course data from external sources.' option_list = BaseComman...
import logging from django.core.management import BaseCommand, CommandError from course_discovery.apps.courses.models import Course logger = logging.getLogger(__name__) class Command(BaseCommand): help = 'Refresh course data from external sources.' def add_arguments(self, parser): parser.add_argum...
Switch to argparse for management command argument parsing
Switch to argparse for management command argument parsing
Python
agpl-3.0
edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery
e321b47a5ee2252ce71fabb992e50e5f455a217f
blaze/tests/test_blfuncs.py
blaze/tests/test_blfuncs.py
from blaze.blfuncs import BlazeFunc from blaze.datashape import double, complex128 as c128 from blaze.blaze_kernels import BlazeElementKernel import blaze def _add(a,b): return a + b def _mul(a,b): return a * b add = BlazeFunc('add',[(_add, 'f8(f8,f8)'), (_add, 'c16(c16,c16)')]) mul =...
from blaze.blfuncs import BlazeFunc from blaze.datashape import double, complex128 as c128 from blaze.blaze_kernels import BlazeElementKernel import blaze def _add(a,b): return a + b def _mul(a,b): return a * b add = BlazeFunc('add',[('f8(f8,f8)', _add), ('c16(c16,c16)', _add)]) mul =...
Fix usage of urlparse. and re-order list of key, value dict specification.
Fix usage of urlparse. and re-order list of key, value dict specification.
Python
bsd-3-clause
ContinuumIO/blaze,dwillmer/blaze,dwillmer/blaze,ContinuumIO/blaze,mwiebe/blaze,markflorisson/blaze-core,AbhiAgarwal/blaze,LiaoPan/blaze,ChinaQuants/blaze,markflorisson/blaze-core,FrancescAlted/blaze,caseyclements/blaze,FrancescAlted/blaze,caseyclements/blaze,jcrist/blaze,mwiebe/blaze,AbhiAgarwal/blaze,jcrist/blaze,cpcl...
9581334db472c8ad8dbff0766ec74ed6dfa20d6f
tests/test_api_request.py
tests/test_api_request.py
#!/usr/bin/env python # coding=utf-8 from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException import pytest import requests_mock client = Client('api_key', 'api_secret') def test_invalid_json(): """Test Invalid response Exception""" with pytest.raises(B...
#!/usr/bin/env python # coding=utf-8 from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException, BinanceWithdrawException import pytest import requests_mock client = Client('api_key', 'api_secret') def test_invalid_json(): """Test Invalid response Exception"""...
Add test for withdraw exception response
Add test for withdraw exception response
Python
mit
sammchardy/python-binance
c73572f2a9b63d35daf8b5935c4a1e6a0422c122
pinax/documents/receivers.py
pinax/documents/receivers.py
from django.db.models.signals import post_save from django.dispatch import receiver from .conf import settings from .models import UserStorage @receiver(post_save, sender=settings.AUTH_USER_MODEL) def ensure_userstorage(sender, **kwargs): if kwargs["created"]: user = kwargs["instance"] UserStorag...
from django.db.models.signals import post_save, pre_delete from django.dispatch import receiver from .conf import settings from .models import UserStorage, Document @receiver(post_save, sender=settings.AUTH_USER_MODEL) def ensure_userstorage(sender, **kwargs): if kwargs["created"]: user = kwargs["instanc...
Implement deletion of file object via Document model pre_save signal.
Implement deletion of file object via Document model pre_save signal.
Python
mit
pinax/pinax-documents
9c48cd08ee0805cfd9a8115d77da139e8c09d7a9
plyer/platforms/linux/cpu.py
plyer/platforms/linux/cpu.py
from subprocess import Popen, PIPE from plyer.facades import CPU from plyer.utils import whereis_exe from os import environ class LinuxProcessors(CPU): def _cpus(self): old_lang = environ.get('LANG', '') environ['LANG'] = 'C' cpus = { 'physical': None, # cores 'l...
from subprocess import Popen, PIPE from plyer.facades import CPU from plyer.utils import whereis_exe from os import environ class LinuxProcessors(CPU): def _cpus(self): old_lang = environ.get('LANG', '') environ['LANG'] = 'C' cpus = { 'physical': None, # cores 'l...
Add CPU count for GNU/Linux
Add CPU count for GNU/Linux
Python
mit
kivy/plyer,KeyWeeUsr/plyer,kivy/plyer,kivy/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer
4c7336fbe1e82bd3d7d091429feda40932d73e67
bin/pear.py
bin/pear.py
""" PEAR task A task to detect whether a specific PEAR package is installed or not """ import os from fabric.api import * from fabric.colors import red, green def pear_detect(package): """ Detect if a pear package is installed. """ if which('pear'): pear_out = local('pear list -a', True) ...
""" PEAR task A task to detect whether a specific PEAR package is installed or not """ import os from fabric.api import * from fabric.colors import red, green import shell def pear_detect(package): """ Detect if a pear package is installed. """ if shell.which('pear'): pear_out = local('pear l...
Add missing import for shell module
Add missing import for shell module
Python
mit
hglattergotz/sfdeploy
60f101e4fc3ac6822c7cf254afa9e98004eb07a1
bot.py
bot.py
#!/usr/bin/python3 import tweepy import random import os from secrets import * auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) twitter = tweepy.API(auth) photo_file = os.path.join("polaroids", os.listdir("polaroids")[0]) comment = random.choice([ ...
#!/usr/bin/python3 """ Copyright (c) 2017 Finn Ellis. Free to use and modify under the terms of the MIT license. See included LICENSE file for details. """ import tweepy import random import os from secrets import * auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access...
Add copyright and license information.
Add copyright and license information.
Python
mit
relsqui/awkward_polaroid,relsqui/awkward_polaroid
cd611cee6843ff9056d98d26d08091188cd20172
app/rest.py
app/rest.py
from flask import Blueprint, jsonify, current_app from app import db from app.errors import register_errors base_blueprint = Blueprint('', __name__) register_errors(base_blueprint) @base_blueprint.route('/') def get_info(): current_app.logger.info('get_info') query = 'SELECT version_num FROM alembic_version...
from flask import Blueprint, jsonify, current_app from app import db from app.errors import register_errors base_blueprint = Blueprint('', __name__) register_errors(base_blueprint) @base_blueprint.route('/') def get_info(): current_app.logger.info('get_info') query = 'SELECT version_num FROM alembic_version...
Handle db exceptions when getting api info
Handle db exceptions when getting api info
Python
mit
NewAcropolis/api,NewAcropolis/api,NewAcropolis/api
f779905c1b7a48a8f49da6ad061ae7d67e677052
cartoframes/viz/legend_list.py
cartoframes/viz/legend_list.py
from .legend import Legend from .constants import SINGLE_LEGEND class LegendList: """LegendList Args: legends (list, Legend): List of legends for a layer. """ def __init__(self, legends=None, default_legend=None, geom_type=None): self._legends = self._init_legends(legends, de...
from .legend import Legend from .constants import SINGLE_LEGEND class LegendList: """LegendList Args: legends (list, Legend): List of legends for a layer. """ def __init__(self, legends=None, default_legend=None, geom_type=None): self._legends = self._init_legends(legends, de...
Fix default legend type detection
Fix default legend type detection
Python
bsd-3-clause
CartoDB/cartoframes,CartoDB/cartoframes
4b3ec77a6e1639dc156135fd42ca215c58c082a3
pyecore/notification.py
pyecore/notification.py
""" This module gives the "listener" classes for the PyEcore notification layer. The main class to create a new listener is "EObserver" which is triggered each time a modification is perfomed on an observed element. """ class ENotifer(object): def notify(self, notification): notification.notifier = notifi...
""" This module gives the "listener" classes for the PyEcore notification layer. The main class to create a new listener is "EObserver" which is triggered each time a modification is perfomed on an observed element. """ try: from enum34 import unique, Enum except ImportError: from enum import unique, Enum cla...
Add conditional import of the enum34 library
Add conditional import of the enum34 library This lib is used to bing enumerations to Python <= 3.3.
Python
bsd-3-clause
aranega/pyecore,pyecore/pyecore
f18ea85f3599e16c60cfc2b652c30ff64997e95b
pytablereader/loadermanager/_base.py
pytablereader/loadermanager/_base.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import from ..interface import TableLoaderInterface class TableLoaderManager(TableLoaderInterface): def __init__(self, loader): self.__loader = loader @property def format...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import from ..interface import TableLoaderInterface class TableLoaderManager(TableLoaderInterface): def __init__(self, loader): self.__loader = loader @property def loader...
Add an interface to get the loader
Add an interface to get the loader
Python
mit
thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader
ddb12a892d42e8a6ffdd8146149ec306dea48a12
pydmrs/pydelphin_interface.py
pydmrs/pydelphin_interface.py
from delphin.interfaces import ace from delphin.mrs import simplemrs, dmrx from pydmrs.core import ListDmrs from pydmrs.utils import load_config, get_config_option DEFAULT_CONFIG_FILE = 'default_interface.conf' config = load_config(DEFAULT_CONFIG_FILE) DEFAULT_ERG_FILE = get_config_option(config, 'Grammar', 'ERG') ...
from delphin.interfaces import ace from delphin.mrs import simplemrs, dmrx from pydmrs.core import ListDmrs from pydmrs.utils import load_config, get_config_option DEFAULT_CONFIG_FILE = 'default_interface.conf' config = load_config(DEFAULT_CONFIG_FILE) DEFAULT_ERG_FILE = get_config_option(config, 'Grammar', 'ERG') ...
Update PyDelphin interface to recent version
Update PyDelphin interface to recent version
Python
mit
delph-in/pydmrs,delph-in/pydmrs,delph-in/pydmrs
c26a7f83b1e9689496b5cf3b5e42fb85611c1ded
ideascube/conf/idb_aus_queensland.py
ideascube/conf/idb_aus_queensland.py
# -*- coding: utf-8 -*- """Queensland box in Australia""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ IDEASCUBE_NAME = u"Queensland" IDEASCUBE_PLACE_NAME = _("the community") COUNTRIES_FIRST = ['AU'] TIME_ZONE = 'Australia/Darwin' LANGUAGE_CODE = 'en' LOAN_DURATION = 14 MONITORIN...
# -*- coding: utf-8 -*- """Queensland box in Australia""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ IDEASCUBE_NAME = u"Queensland" IDEASCUBE_PLACE_NAME = _("the community") COUNTRIES_FIRST = ['AU'] TIME_ZONE = 'Australia/Darwin' LANGUAGE_CODE = 'en' LOAN_DURATION = 14 MONITORIN...
Change cards for the new version
Change cards for the new version We setup a new version of the server and installed the ZIM file with the catalog, so the cards has to change from the old version to the new version to match with the ideascube catalog policy
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
6894bd3cfc010c371478e7ae9e5e0b3ba108e165
plugins/configuration/configurationtype/configuration_registrar.py
plugins/configuration/configurationtype/configuration_registrar.py
#!/usr/bin/env python #-*- coding: utf-8 -*- #This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software. #The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif...
#!/usr/bin/env python #-*- coding: utf-8 -*- #This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software. #The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif...
Implement unregistration of configuration plug-ins
Implement unregistration of configuration plug-ins Perhaps we should not give a warning, but instead an exception, when registering or unregistering fails?
Python
cc0-1.0
Ghostkeeper/Luna
7b83e8fbe8e6a249ab82db38e358774ba78b4ea8
pyflation/analysis/__init__.py
pyflation/analysis/__init__.py
""" analysis package - Provides modules to analyse results from cosmomodels runs. Author: Ian Huston For license and copyright information see LICENSE.txt which was distributed with this file. """ from adiabatic import Pr, Pzeta, scaled_Pr from nonadiabatic import deltaPspectrum, deltaPnadspectrum, deltarhospectrum
""" analysis package - Provides modules to analyse results from cosmomodels runs. Author: Ian Huston For license and copyright information see LICENSE.txt which was distributed with this file. """ from adiabatic import Pr, Pzeta, scaled_Pr, scaled_Pzeta from nonadiabatic import deltaPspectrum, deltaPnadspectrum, delt...
Add new S spectrum functions into package initializer.
Add new S spectrum functions into package initializer.
Python
bsd-3-clause
ihuston/pyflation,ihuston/pyflation
6212f78597dff977a7e7348544d09c7a649aa470
bitbots_transform/src/bitbots_transform/transform_ball.py
bitbots_transform/src/bitbots_transform/transform_ball.py
#!/usr/bin/env python2.7 import rospy from bitbots_transform.transform_helper import transf from humanoid_league_msgs.msg import BallRelative, BallInImage from sensor_msgs.msg import CameraInfo class TransformLines(object): def __init__(self): rospy.Subscriber("ball_in_image", BallInImage, self._callback_...
#!/usr/bin/env python2.7 import rospy from bitbots_transform.transform_helper import transf from humanoid_league_msgs.msg import BallRelative, BallInImage from sensor_msgs.msg import CameraInfo class TransformBall(object): def __init__(self): rospy.Subscriber("ball_in_image", BallInImage, self._callback_b...
Transform Ball: Fixed wrong names
Transform Ball: Fixed wrong names
Python
mit
bit-bots/bitbots_misc,bit-bots/bitbots_misc,bit-bots/bitbots_misc
b28b4bb834d8ab70e8820c43ed8cf11242c1b5b6
keystoneclient/v2_0/endpoints.py
keystoneclient/v2_0/endpoints.py
# Copyright 2012 Canonical Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
# Copyright 2012 Canonical Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Make parameters in EndpointManager optional
Make parameters in EndpointManager optional Change adminurl and internalurl parameters in EndpointManager create() to optional parameters. Change-Id: I490e35b89f7ae7c6cdbced6ba8d3b82d5132c19d Closes-Bug: #1318436
Python
apache-2.0
magic0704/python-keystoneclient,jamielennox/python-keystoneclient,klmitch/python-keystoneclient,ging/python-keystoneclient,alexpilotti/python-keystoneclient,klmitch/python-keystoneclient,darren-wang/ksc,alexpilotti/python-keystoneclient,magic0704/python-keystoneclient,Mercador/python-keystoneclient,ging/python-keystone...
1005a41bd6fb3f854f75bd9d4d6ab69290778ba9
kolibri/core/lessons/viewsets.py
kolibri/core/lessons/viewsets.py
from rest_framework.viewsets import ModelViewSet from .serializers import LessonSerializer from kolibri.core.lessons.models import Lesson class LessonViewset(ModelViewSet): serializer_class = LessonSerializer def get_queryset(self): return Lesson.objects.filter(is_archived=False)
from rest_framework.viewsets import ModelViewSet from .serializers import LessonSerializer from kolibri.core.lessons.models import Lesson class LessonViewset(ModelViewSet): serializer_class = LessonSerializer def get_queryset(self): queryset = Lesson.objects.filter(is_archived=False) classid ...
Add classid filter for Lessons
Add classid filter for Lessons
Python
mit
learningequality/kolibri,mrpau/kolibri,mrpau/kolibri,lyw07/kolibri,christianmemije/kolibri,christianmemije/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,jonboiser/kolibri,benjaoming/kolibri,lyw07/kolibri,jonboiser/kolibri,learningequality/kolibri,christianmemije/kolibri,jonboiser/kolibri,DXCanas/kolibri,mrpau/kol...
bd5844aa6c59c8d34df12e358e5e06eefcb55f9d
qiita_pet/handlers/download.py
qiita_pet/handlers/download.py
from tornado.web import authenticated from os.path import split from .base_handlers import BaseHandler from qiita_pet.exceptions import QiitaPetAuthorizationError from qiita_db.util import filepath_id_to_rel_path from qiita_db.meta_util import get_accessible_filepath_ids class DownloadHandler(BaseHandler): @aut...
from tornado.web import authenticated from os.path import basename from .base_handlers import BaseHandler from qiita_pet.exceptions import QiitaPetAuthorizationError from qiita_db.util import filepath_id_to_rel_path from qiita_db.meta_util import get_accessible_filepath_ids class DownloadHandler(BaseHandler): @...
Use basename instead of os.path.split(...)[-1]
Use basename instead of os.path.split(...)[-1]
Python
bsd-3-clause
ElDeveloper/qiita,josenavas/QiiTa,RNAer/qiita,squirrelo/qiita,RNAer/qiita,ElDeveloper/qiita,antgonza/qiita,adamrp/qiita,wasade/qiita,antgonza/qiita,squirrelo/qiita,biocore/qiita,adamrp/qiita,josenavas/QiiTa,biocore/qiita,ElDeveloper/qiita,adamrp/qiita,antgonza/qiita,RNAer/qiita,squirrelo/qiita,ElDeveloper/qiita,wasade/...
23a3f80d44592d4a86878f29eaa873d727ad31ee
london_commute_alert.py
london_commute_alert.py
import datetime import os import requests def update(): requests.packages.urllib3.disable_warnings() resp = requests.get('http://api.tfl.gov.uk/Line/Mode/tube/Status').json() return {el['id']: el['lineStatuses'][0]['statusSeverityDescription'] for el in resp} def email(lines): with open...
import datetime import os import requests def update(): requests.packages.urllib3.disable_warnings() resp = requests.get('http://api.tfl.gov.uk/Line/Mode/tube/Status').json() return {el['id']: el['lineStatuses'][0]['statusSeverityDescription'] for el in resp} def email(lines): with open('curl_raw_c...
Correct for problem on webfaction
Correct for problem on webfaction
Python
mit
noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit
598e21a7c397c0c429a78f008a36e5800c1b23e3
conftest.py
conftest.py
import os import dj_database_url import pytest from django.conf import settings pytest_plugins = [ "saleor.tests.fixtures", "saleor.plugins.tests.fixtures", "saleor.graphql.tests.fixtures", "saleor.graphql.channel.tests.fixtures", "saleor.graphql.account.tests.benchmark.fixtures", "saleor.grap...
import os import dj_database_url import pytest from django.conf import settings pytest_plugins = [ "saleor.tests.fixtures", "saleor.plugins.tests.fixtures", "saleor.graphql.tests.fixtures", "saleor.graphql.channel.tests.fixtures", "saleor.graphql.account.tests.benchmark.fixtures", "saleor.grap...
Fix picking invalid env variable for tests
Fix picking invalid env variable for tests
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
c265f3a24ba26800a15ddf54ad3aa7515695fb3f
app/__init__.py
app/__init__.py
from flask import Flask from .extensions import db from . import views def create_app(config): """ Create a Flask App base on a config obejct. """ app = Flask(__name__) app.config.from_object(config) register_extensions(app) register_views(app) # @app.route("/") # def index(): # ...
from flask import Flask from flask_user import UserManager from . import views from .extensions import db, mail, toolbar from .models import DataStoreAdapter, UserModel def create_app(config): """ Create a Flask App base on a config obejct. """ app = Flask(__name__) app.config.from_object(config) reg...
Update app init to user flask user, mail and toolbar ext
Update app init to user flask user, mail and toolbar ext
Python
mit
oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog
c109b41dc76c333bda1973fa2a543688f2fd5141
braid/config.py
braid/config.py
""" Support for multiple environments based on python configuration files. """ from __future__ import print_function, absolute_import import imp import os from twisted.python.filepath import FilePath from fabric.api import env, task CONFIG_DIRS = [ '~/.braid', './braidrc.local', ] def loadEnvironmentCon...
""" Support for multiple environments based on python configuration files. """ from __future__ import print_function, absolute_import import imp import os from twisted.python.filepath import FilePath from fabric.api import env, task CONFIG_DIRS = [ '~/.braid', './braidrc.local', ] def loadEnvironmentCon...
Make docstrings more Fabric friendly
Make docstrings more Fabric friendly
Python
mit
alex/braid,alex/braid
97a1e627b682f9aec80134334277b63e81265ddd
tests/test_ircv3.py
tests/test_ircv3.py
import pytest from pydle.features import ircv3 pytestmark = [pytest.mark.unit, pytest.mark.ircv3] @pytest.mark.parametrize( "payload, expected", [ ( rb"@+example=raw+:=,escaped\:\s\\ :irc.example.com NOTICE #channel :Message", {"+example": """raw+:=,escaped; \\"""} ...
import pytest from pydle.features import ircv3 pytestmark = [pytest.mark.unit, pytest.mark.ircv3] @pytest.mark.parametrize( "payload, expected", [ ( rb'@empty=;missing :irc.example.com NOTICE #channel :Message', {'empty': True, 'missing': True} ), ( ...
Add test case for empty and missing IRCv3 tags
Add test case for empty and missing IRCv3 tags
Python
bsd-3-clause
Shizmob/pydle
127a3da0d453785bd9c711d738e20dfdc1876df1
tool/serial_dump.py
tool/serial_dump.py
#!/usr/bin/python import serial import string import io import time import sys if __name__ == '__main__': port = "/dev/ttyUSB0" baudrate = "57600" second = 0.1 if (len(sys.argv) < 3): print("Usage: serial_dump.py /dev/ttyUSB0 57600") exit() elif (len(sys.argv) == 3): port = sys.argv[1] baudrate = sys...
#!/usr/bin/python import serial import string import io import time import sys if __name__ == '__main__': port = "/dev/ttyUSB0" baudrate = "57600" second = 0.001 if (len(sys.argv) < 4 ): print("Usage: \n./serial_dump.py /dev/ttyUSB0 57600 file_name 0.01") exit() elif (len(sys.argv) == 4): port = sys.a...
Change command option, need to specify file name now
Change command option, need to specify file name now
Python
mit
ming6842/firmware-new,fboris/firmware,UrsusPilot/firmware,fboris/firmware,UrsusPilot/firmware,fboris/firmware,UrsusPilot/firmware,ming6842/firmware-new,ming6842/firmware-new
5fb17ccf0311500e5ce14a49e246d1a6cbc427a4
mopidy/frontends/mpd/__init__.py
mopidy/frontends/mpd/__init__.py
import logging from mopidy.frontends.base import BaseFrontend from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.process import MpdProcess from mopidy.utils.process import unpickle_connection logger = logging.getLogger('mopidy.frontends.mpd') class MpdFrontend(BaseFrontend): """ ...
import logging from mopidy.frontends.base import BaseFrontend from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.process import MpdProcess from mopidy.utils.process import unpickle_connection logger = logging.getLogger('mopidy.frontends.mpd') class MpdFrontend(BaseFrontend): """ ...
Make MpdFrontend ignore unknown messages
Make MpdFrontend ignore unknown messages
Python
apache-2.0
diandiankan/mopidy,rawdlite/mopidy,adamcik/mopidy,ZenithDK/mopidy,SuperStarPL/mopidy,bencevans/mopidy,abarisain/mopidy,pacificIT/mopidy,bacontext/mopidy,jodal/mopidy,adamcik/mopidy,jcass77/mopidy,jmarsik/mopidy,quartz55/mopidy,quartz55/mopidy,kingosticks/mopidy,SuperStarPL/mopidy,ali/mopidy,bencevans/mopidy,adamcik/mop...
076ef01bd3334d2a1941df369286e4972223901e
PyramidSort.py
PyramidSort.py
import sublime, sublime_plugin def pyramid_sort(txt): txt = list(filter(lambda s: s.strip(), txt)) txt.sort(key = lambda s: len(s)) return txt class PyramidSortCommand(sublime_plugin.TextCommand): def run(self, edit): regions = [s for s in self.view.sel() if not s.empty()] if regions: for r in regions: ...
# # 123 # 12 # 1 import sublime, sublime_plugin def pyramid_sort(txt): txt = list(filter(lambda s: s.strip(), txt)) txt.sort(key = lambda s: len(s)) return txt class PyramidSortCommand(sublime_plugin.TextCommand): def run(self, edit): regions = [s for s in self.view.sel() if not s.empty()] if regions: ...
Revert "removed grab line from region, gives some unexpected behaviour. Instead just replace exactly what is marked"
Revert "removed grab line from region, gives some unexpected behaviour. Instead just replace exactly what is marked" This reverts commit 9c944db3affc8181146fa27d8483a58d2731756b.
Python
apache-2.0
kenglxn/PyramidSortSublimeTextPlugin,kenglxn/PyramidSortSublimeTextPlugin
69b0e1c60eafff596ebb494a7e79a22c6bea374b
polling_stations/apps/data_collection/management/commands/import_hart.py
polling_stations/apps/data_collection/management/commands/import_hart.py
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E07000089' addresses_name = 'parl.2017-06-08/Version 1/Hart DC General Election polling place 120517.TSV' stations_name = 'parl.2017-06-08/Version 1/Hart DC Ge...
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E07000089' addresses_name = 'parl.2017-06-08/Version 1/Hart DC General Election polling place 120517.TSV' stations_name = 'parl.2017-06-08/Version 1/Hart DC Ge...
Fix dodgy point in Hart
Fix dodgy point in Hart
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
1ac2e2b03048cf89c8df36c838130212f4ac63d3
server/src/weblab/__init__.py
server/src/weblab/__init__.py
import os import json from .util import data_filename version_filename = data_filename(os.path.join("weblab", "version.json")) base_version = "5.0" __version__ = base_version if version_filename: try: git_version = json.loads(open(version_filename).read()) except: git_version = None if git_v...
import os import json from .util import data_filename version_filename = data_filename(os.path.join("weblab", "version.json")) base_version = "5.0" __version__ = base_version if version_filename: try: git_version = json.loads(open(version_filename).read()) except: git_version = None if git_v...
Add date to the version
Add date to the version
Python
bsd-2-clause
morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,pordun...