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
bf557dc589a776b432c1a43a96a09d93aa2b0a1e
tca/chat/serializers.py
tca/chat/serializers.py
from rest_framework import serializers from rest_framework.reverse import reverse from chat.models import Member from chat.models import Message from chat.models import ChatRoom class MemberSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Member class ChatRoomSerializer(serialize...
from rest_framework import serializers from rest_framework.reverse import reverse from chat.models import Member from chat.models import Message from chat.models import ChatRoom class MemberSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Member class ChatRoomSerializer(serialize...
Add a link to the messages of a ChatRoom in its representation
Add a link to the messages of a ChatRoom in its representation The ChatRoom resource should provide a way for clients to access its subordinate resource ``Message``.
Python
bsd-3-clause
mlalic/TumCampusAppBackend,mlalic/TumCampusAppBackend
7d4f345443575974825ebc9bac8a274632ccb99d
python/brica1/__init__.py
python/brica1/__init__.py
# -*- coding: utf-8 -*- """ BriCA ===== Brain-inspired Cognitive Architecture A scalable, general purpose computing platform for cognitive architectures. """ __all__ = ["component", "connection", "module", "port", "ros", "scheduler", "unit", "utils"] from .component import * from .connection import * from .module...
# -*- coding: utf-8 -*- """ BriCA ===== Brain-inspired Cognitive Architecture A scalable, general purpose computing platform for cognitive architectures. """ __all__ = ["component", "connection", "module", "port", "ros", "scheduler", "supervisor", "unit", "utils"] from .component import * from .connection import ...
Add supervisor to default modules
Add supervisor to default modules
Python
apache-2.0
wbap/BriCA1
9516621f2b4cfc5b541c3328df95b62111e77463
app/main/__init__.py
app/main/__init__.py
from flask import Blueprint main = Blueprint('main', __name__) from . import errors from .views import ( crown_hosting, digital_services_framework, g_cloud, login, marketplace, suppliers, digital_outcomes_and_specialists )
from flask import Blueprint main = Blueprint('main', __name__) from . import errors from .views import ( crown_hosting, g_cloud, login, marketplace, suppliers, digital_outcomes_and_specialists )
Delete reference to removed view
Delete reference to removed view
Python
mit
alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend
a0f31dc83ce36823022b5e26c85ad03fe639e79f
src/main/python/alppaca/compat.py
src/main/python/alppaca/compat.py
from __future__ import print_function, absolute_import, unicode_literals, division """ Compatability module for different Python versions. """ try: import unittest2 as unittest except ImportError: # pragma: no cover import unittest try: from ordereddict import OrderedDict except ImportError: # pragma: n...
""" Compatability module for different Python versions. """ from __future__ import print_function, absolute_import, unicode_literals, division try: import unittest2 as unittest except ImportError: # pragma: no cover import unittest try: from ordereddict import OrderedDict except ImportError: # pragma: n...
Move string above the import so it becomes a docstring
Move string above the import so it becomes a docstring
Python
apache-2.0
ImmobilienScout24/afp-alppaca,ImmobilienScout24/afp-alppaca,ImmobilienScout24/alppaca,ImmobilienScout24/alppaca
34d10f364518805f7e7918e62d4f7aecc4f472dc
corehq/apps/change_feed/connection.py
corehq/apps/change_feed/connection.py
from django.conf import settings from corehq.util.io import ClosingContextProxy from kafka import KafkaConsumer from kafka.client import KafkaClient, SimpleClient GENERIC_KAFKA_CLIENT_ID = 'cchq-kafka-client' def get_simple_kafka_client(client_id=GENERIC_KAFKA_CLIENT_ID): # this uses the old SimpleClient becaus...
from django.conf import settings from corehq.util.io import ClosingContextProxy from kafka import KafkaConsumer from kafka.client import KafkaClient, SimpleClient GENERIC_KAFKA_CLIENT_ID = 'cchq-kafka-client' def get_simple_kafka_client(client_id=GENERIC_KAFKA_CLIENT_ID): # this uses the old SimpleClient becaus...
Remove hard request timeout on kafka consumer
Remove hard request timeout on kafka consumer
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
907a09311718859184a8e4015b35bde62efe47f7
graphene/types/datetime.py
graphene/types/datetime.py
from __future__ import absolute_import import datetime try: import iso8601 except: raise ImportError("iso8601 package is required for DateTime Scalar.\nYou can install it using: pip install iso8601.") from graphql.language import ast from .scalars import Scalar class DateTime(Scalar): @staticmethod ...
from __future__ import absolute_import import datetime try: import iso8601 except: raise ImportError("iso8601 package is required for DateTime Scalar.\nYou can install it using: pip install iso8601.") from graphql.language import ast from .scalars import Scalar class DateTime(Scalar): @staticmethod ...
Allow dates in Datetime scalar
Allow dates in Datetime scalar
Python
mit
graphql-python/graphene,graphql-python/graphene,Globegitter/graphene,Globegitter/graphene,sjhewitt/graphene,sjhewitt/graphene
301f23067dde512f56ba5bf2201b666d125ffc96
setup.py
setup.py
import sys import os from cx_Freeze import setup, Executable paths = [] paths.extend(sys.path) paths.append('whacked4') build_exe_options = { 'packages': [], 'path': paths, 'include_files': ['res', 'cfg', 'docs', 'LICENSE', 'README.md'], 'optimize': 2, 'include_msvcr': True } build_exe_options['path'].append('sr...
import sys import os from cx_Freeze import setup, Executable paths = [] paths.extend(sys.path) paths.append('src') build_exe_options = { 'path': paths, 'packages': ['whacked4'], 'include_files': ['res', 'cfg', 'docs', 'LICENSE', 'README.md'], 'optimize': 2, 'include_msvcr': True } base = None if sys.platform ==...
Update distutils script. Release builds still twice the size though...
Update distutils script. Release builds still twice the size though...
Python
bsd-2-clause
GitExl/WhackEd4,GitExl/WhackEd4
ca3366bfdec91797c0a5406a5ba8094c4d13a233
comics/feedback/forms.py
comics/feedback/forms.py
from bootstrap.forms import BootstrapForm from django import forms class FeedbackForm(BootstrapForm): message = forms.CharField(label="What's on your heart", help_text='Remember to sign with you mail address if you want a reply.', widget=forms.Textarea(attrs={'rows': 5, 'cols': 100}))
from bootstrap.forms import BootstrapForm from django import forms class FeedbackForm(BootstrapForm): message = forms.CharField(label="What's on your heart", help_text='Sign with your email address if you want a reply.', widget=forms.Textarea(attrs={'rows': 5, 'cols': 100}))
Fix typo in feedback form help text
Fix typo in feedback form help text
Python
agpl-3.0
datagutten/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics
431d3e960962543fd162770475a488bd9e21217e
setup.py
setup.py
from distutils.core import setup version=__import__('sendfile').__version__ setup( name='django-sendfile', version=version, description='Abstraction to offload file uploads to web-server (e.g. Apache with mod_xsendfile) once Django has checked permissions etc.', long_description=open('README.rst').re...
from distutils.core import setup version=__import__('sendfile').__version__ setup( name='django-sendfile', version=version, description='Abstraction to offload file uploads to web-server (e.g. Apache with mod_xsendfile) once Django has checked permissions etc.', long_description=open('README.rst').re...
Fix requirements so pip correctly installs Django and Unidecode.
Fix requirements so pip correctly installs Django and Unidecode.
Python
bsd-3-clause
karyon/django-sendfile,nathanielvarona/django-sendfile,joshcartme/django-sendfile,NotSqrt/django-sendfile,johnsensible/django-sendfile,joshcartme/django-sendfile
fda08d81e3b6a4aae5610973053890bf8b283bf0
buffer/tests/test_profile.py
buffer/tests/test_profile.py
import json from nose.tools import eq_, raises from mock import MagicMock, patch from buffer.models.profile import Profile, PATHS mocked_response = { 'name': 'me', 'service': 'twiter', 'id': 1 } def test_profile_schedules_getter(): ''' Test schedules gettering from buffer api ''' mocked_api = Magic...
import json from nose.tools import eq_, raises from mock import MagicMock, patch from buffer.models.profile import Profile, PATHS mocked_response = { 'name': 'me', 'service': 'twiter', 'id': 1 } def test_profile_schedules_getter(): ''' Test schedules gettering from buffer api ''' mocked_api = Magic...
Test profile's relationship with updates
Test profile's relationship with updates
Python
mit
vtemian/buffpy,bufferapp/buffer-python
232bffd6e41b87b05d9e0c65401ace3163bfc799
djedi/templatetags/djedi_admin.py
djedi/templatetags/djedi_admin.py
import json import logging from django import template from django.template.loader import render_to_string from cio.pipeline import pipeline from ..auth import has_permission register = template.Library() logger = logging.getLogger(__name__) @register.simple_tag(takes_context=True) def djedi_admin(context): outp...
import json import logging from django import template from django.template.loader import render_to_string from cio.pipeline import pipeline from ..auth import has_permission register = template.Library() logger = logging.getLogger(__name__) @register.simple_tag(takes_context=True) def djedi_admin(context): outp...
Clear content-io pipeline after rendering admin panel
Clear content-io pipeline after rendering admin panel
Python
bsd-3-clause
joar/djedi-cms,andreif/djedi-cms,joar/djedi-cms,5monkeys/djedi-cms,andreif/djedi-cms,5monkeys/djedi-cms,joar/djedi-cms,andreif/djedi-cms,5monkeys/djedi-cms
54d06439fd21f58208ddcf8583d070aba2674243
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Robin Deits # Copyright (c) 2014 Robin Deits # # License: MIT # """This module exports the Mlint plugin class.""" from SublimeLinter.lint import Linter, util, highlight class Mlint(Linter): """Provides an int...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Robin Deits # Copyright (c) 2014 Robin Deits # # License: MIT # """This module exports the Mlint plugin class.""" from SublimeLinter.lint import Linter, util, highlight class Mlint(Linter): """Provides an int...
Remove unnecessary '@' flag from command
Remove unnecessary '@' flag from command
Python
mit
rdeits/SublimeLinter-contrib-mlint
d600cea1c86c3c3e56b41a7b57191ae35fea51b9
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ilya Akhmadullin # Copyright (c) 2013 Ilya Akhmadullin # # License: MIT # """This module exports the jscs plugin class.""" from SublimeLinter.lint import Linter class Jscs(Linter): """Provides an interface to...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ilya Akhmadullin # Copyright (c) 2013 Ilya Akhmadullin # # License: MIT # """This module exports the jscs plugin class.""" from SublimeLinter.lint import Linter class Jscs(Linter): """Provides an interface to...
Enable plugin for inline js in html files
Enable plugin for inline js in html files
Python
mit
SublimeLinter/SublimeLinter-jscs,roberthoog/SublimeLinter-jscs
4346c52d8ec3497279fa4ce16b4ab2e4e51c82bd
Demo/parser/test_parser.py
Demo/parser/test_parser.py
#! /usr/bin/env python # (Force the script to use the latest build.) # # test_parser.py import parser, traceback _numFailed = 0 def testChunk(t, fileName): global _numFailed print '----', fileName, try: ast = parser.suite(t) tup = parser.ast2tuple(ast) # this discards the first ...
#! /usr/bin/env python # (Force the script to use the latest build.) # # test_parser.py import parser, traceback _numFailed = 0 def testChunk(t, fileName): global _numFailed print '----', fileName, try: ast = parser.suite(t) tup = parser.ast2tuple(ast) # this discards the first ...
Sort the list of files processed before running the test on each.
Sort the list of files processed before running the test on each.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
5f64b609b621626e04516cac1c3313a3f948f19e
main.py
main.py
import logging import telebot import timer import bot import os logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logging.info("Begin start server.") tgBot = telebot.TeleBot(os.getenv("BOT_ID", "")) bot.getTracker(tgBot, logging)() timer.getT...
import logging import telebot import timer import bot import os logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logging.info("Begin start server.") tgBot = telebot.TeleBot(os.getenv("BOT_ID", "")) bot.getTracker(tgBot, logging)() timer.getTi...
Change While True Try to none_stop=True
Change While True Try to none_stop=True
Python
mit
ITelegramBot/PackageTrackerBot
c7761a3b8a090e24b68b1318f1451752e34078e9
alexandria/decorators.py
alexandria/decorators.py
from functools import wraps from flask import session, redirect, url_for, request, abort from alexandria import mongo def not_even_one(f): @wraps(f) def decorated_function(*args, **kwargs): if mongo.Books.find_one() is None: return redirect(url_for('upload')) return f(*args, **kwarg...
from functools import wraps from flask import session, redirect, url_for, request, abort from alexandria import mongo def not_even_one(f): @wraps(f) def decorated_function(*args, **kwargs): if mongo.Books.find_one() is None: return redirect(url_for('upload')) return f(*args, **kwarg...
Abort with appropriate status codes in the decorator
Abort with appropriate status codes in the decorator
Python
mit
citruspi/Alexandria,citruspi/Alexandria
5dd81b09db46927cb7710b21ab682a6c3ecc182e
esios/__init__.py
esios/__init__.py
try: VERSION = __import__('pkg_resources') \ .get_distribution(__name__).version except Exception as e: VERSION = 'unknown' from .service import Esios
from __future__ import absolute_import try: VERSION = __import__('pkg_resources') \ .get_distribution(__name__).version except Exception as e: VERSION = 'unknown' from .service import Esios
Enforce absolute imports through __future__
Enforce absolute imports through __future__
Python
mit
gisce/esios
5fbcce3feffb63dbd50623f8d6cb0e354bce7add
fedora/release.py
fedora/release.py
''' Information about this python-fedora release ''' NAME = 'python-fedora' VERSION = '0.10.0' DESCRIPTION = 'Python modules for interacting with Fedora Services' LONG_DESCRIPTION = ''' The Fedora Project runs many different services. These services help us to package software, develop new programs, and generally pu...
''' Information about this python-fedora release ''' NAME = 'python-fedora' VERSION = '0.10.0' DESCRIPTION = 'Python modules for interacting with Fedora Services' LONG_DESCRIPTION = ''' The Fedora Project runs many different services. These services help us to package software, develop new programs, and generally pu...
Fix the URL in the metadata of the package
Fix the URL in the metadata of the package Signed-off-by: Pierre-Yves Chibon <0e23e1aa25183634677db757f9f5e912e5bb8b8c@pingoured.fr>
Python
lgpl-2.1
fedora-infra/python-fedora
ddc184cdced8c393822ce4ec14900db7fe16a492
pucas/management/commands/createcasuser.py
pucas/management/commands/createcasuser.py
from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand from pucas.ldap import LDAPSearch, LDAPSearchException, \ user_info_from_ldap class Command(BaseCommand): help = 'Initialize a new CAS user account' def add_arguments(self, parser): parser.add_argu...
from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand from pucas.ldap import LDAPSearch, LDAPSearchException, \ user_info_from_ldap class Command(BaseCommand): help = 'Initialize a new CAS user account' def add_arguments(self, parser): parser.add_argu...
Add --admin flag to create superusers from cas
Add --admin flag to create superusers from cas
Python
apache-2.0
Princeton-CDH/django-pucas,Princeton-CDH/django-pucas
c0169c5073e4a83120f4d6860258c3085b4c1cf5
setup.py
setup.py
import subprocess as sp print('Warning: this setup.py uses flit, not setuptools.') print('Behavior may not be exactly what you expect. Use at your own risk!') sp.check_call(['flit', 'install', '--deps', 'production'])
import subprocess as sp import sys import os print('Warning: this setup.py uses flit, not setuptools.') print('Behavior may not be exactly what you expect. Use at your own risk!') flit = os.path.join(os.path.dirname(sys.executable), 'flit') cmd = [flit, 'install', '--deps', 'production'] print(" ".join(cmd)) sp.check...
Use flit that's been installed in the virtualenv
Use flit that's been installed in the virtualenv
Python
bsd-3-clause
jupyter/nbgrader,jupyter/nbgrader,ellisonbg/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,EdwardJKim/nbgrader,dementrock/nbgrader,jupyter/nbgrader,MatKallada/nbgrader,MatKallada/nbgrader,jupyter/nbgrader,ellisonbg/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,ellisonbg/nbgrader,jup...
e6c4d40f0eaa6c93cac88582d862aa8393a3cc10
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name='screenplain', version='0.7.0', description='Convert text file to viewable screenplay.', author='Martin Vilcans', author_email='screenplain@librador.com', url='http://www.screenplain.com/', extras_require={ 'PDF': '...
#!/usr/bin/env python from distutils.core import setup setup( name='screenplain', version='0.7.0', description='Convert text file to viewable screenplay.', author='Martin Vilcans', author_email='screenplain@librador.com', url='http://www.screenplain.com/', install_requires=[ 'six',...
Add install_requires six for universal Python support
Add install_requires six for universal Python support
Python
mit
vilcans/screenplain,vilcans/screenplain,vilcans/screenplain
7bdf12d0b54b0b6c628acfee1a2fadda2ba542af
setup.py
setup.py
#!/usr/bin/env python '''FiscalHr Setup''' from distutils.core import setup import fiscalhr setup( name=fiscalhr.__title__, version=fiscalhr.__version__, author=fiscalhr.__author__, author_email=fiscalhr.__author_email__, url=fiscalhr.__url__, license=fiscalhr.__license__, description=fi...
#!/usr/bin/env python '''FiscalHr Setup''' from distutils.core import setup import fiscalhr setup( name=fiscalhr.__title__, version=fiscalhr.__version__, author=fiscalhr.__author__, author_email=fiscalhr.__author_email__, url=fiscalhr.__url__, license=fiscalhr.__license__, description=fi...
Change dependency to libxml2-python-2.7.8 (github).
Change dependency to libxml2-python-2.7.8 (github).
Python
mit
vingd/fiscal-hr-python
6ba8e942edaf424c7b20983a5e829736c38b8110
froide/foiidea/tasks.py
froide/foiidea/tasks.py
import sys from celery.task import task from django.conf import settings from django.utils import translation from django.db import transaction from .crawler import crawl_source_by_id from .models import Article @task def fetch_articles(source_id): translation.activate(settings.LANGUAGE_CODE) def run(sour...
from celery.task import task from django.conf import settings from django.utils import translation from .crawler import crawl_source_by_id from .models import Article @task def fetch_articles(source_id): translation.activate(settings.LANGUAGE_CODE) crawl_source_by_id(int(source_id)) @task def recalculate_...
Remove complex exception mechanism for celery task
Remove complex exception mechanism for celery task
Python
mit
ryankanno/froide,stefanw/froide,ryankanno/froide,CodeforHawaii/froide,LilithWittmann/froide,ryankanno/froide,CodeforHawaii/froide,stefanw/froide,LilithWittmann/froide,fin/froide,LilithWittmann/froide,catcosmo/froide,catcosmo/froide,stefanw/froide,CodeforHawaii/froide,ryankanno/froide,fin/froide,stefanw/froide,catcosmo/...
f0f8652f67f0b09a1133f477b27b6d399621790f
pywxsb.py
pywxsb.py
import PyWXSB.XMLSchema as xs import sys import traceback from xml.dom import minidom from xml.dom import Node files = sys.argv[1:] if 0 == len(files): files = [ 'schemas/XMLSchema.xsd' ] for file in files: wxs = xs.schema() try: wxs.processDocument(minidom.parse(file)) except Exception, e: ...
import PyWXSB.XMLSchema as xs import sys import traceback from xml.dom import minidom from xml.dom import Node files = sys.argv[1:] if 0 == len(files): files = [ 'schemas/XMLSchema.xsd' ] for file in files: wxs = xs.schema() try: wxs.processDocument(minidom.parse(file)) except Exception, e: ...
Put whole message out to stderr, not just part of it
Put whole message out to stderr, not just part of it
Python
apache-2.0
jonfoster/pyxb2,CantemoInternal/pyxb,jonfoster/pyxb-upstream-mirror,balanced/PyXB,jonfoster/pyxb2,CantemoInternal/pyxb,pabigot/pyxb,balanced/PyXB,CantemoInternal/pyxb,jonfoster/pyxb1,balanced/PyXB,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb1,pabigot/pyxb,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb2
9f0618d39dad2438a29964e706d916953a96a5fb
shivyc.py
shivyc.py
#!/usr/bin/env python3 """Main executable for ShivyC compiler """ import argparse def get_arguments(): """Set up the argument parser and return an object storing the argument values. return - An object storing argument values, as returned by argparse.parse_args() """ parser = argparse.Arg...
#!/usr/bin/env python3 """Main executable for ShivyC compiler For usage, run "./shivyc.py --help". """ import argparse def get_arguments(): """Set up the argument parser and return an object storing the argument values. return - An object storing argument values, as returned by argparse.parse_args...
Add usage info to comment
Add usage info to comment
Python
mit
ShivamSarodia/ShivyC,ShivamSarodia/ShivyC,ShivamSarodia/ShivyC
c544afed5c8d961db0d34b7f73313699ce3bf656
test/ocookie_test.py
test/ocookie_test.py
import unittest, time import ocookie class OcookieTest(unittest.TestCase): def test_foo(self): pass class CookieParserTest(unittest.TestCase): def test_parsing(self): text = 'foo=bar' cookie = ocookie.CookieParser.parse_set_cookie_value(text) self.assertEquals('foo', cookie.na...
import unittest, time import ocookie class CookieTest(unittest.TestCase): def test_construction(self): cookie = ocookie.Cookie('foo', 'bar', httponly=True) self.assertEquals('foo', cookie.name) self.assertEquals('bar', cookie.value) self.assertTrue(cookie.httponly) self.ass...
Add a cookie class test
Add a cookie class test
Python
bsd-2-clause
p/ocookie
edd4783d5f277e8bc456f662e66ac65eb62419b7
base/components/views.py
base/components/views.py
from django.views.generic import View from django.views.generic.base import TemplateView from braces.views import AjaxResponseMixin, JSONResponseMixin from haystack.query import SearchQuerySet class SiteView(TemplateView): template_name = 'landings/home_site.html' class AutocompleteView(JSONResponseMixin, View...
from django.views.generic import View from django.views.generic.base import TemplateView from braces.views import AjaxResponseMixin, JSONResponseMixin from haystack.query import SearchQuerySet from haystack.inputs import AutoQuery, Exact, Clean class SiteView(TemplateView): template_name = 'landings/home_site.ht...
Throw more data into the autocomplete view.
Throw more data into the autocomplete view.
Python
apache-2.0
hello-base/web,hello-base/web,hello-base/web,hello-base/web
c89e9cee709790d99013d77889bac208a8bdeb12
tests/test_arpreq.py
tests/test_arpreq.py
import sys from socket import htonl, inet_ntoa import pytest from arpreq import arpreq def test_localhost(): assert arpreq('127.0.0.1') == '00:00:00:00:00:00' def decode_address(value): return inet_ntoa(htonl(int(value, base=16)).to_bytes(4, 'big')) def decode_flags(value): return int(value, base=16...
import sys from socket import htonl, inet_ntoa from struct import pack import pytest from arpreq import arpreq def test_localhost(): assert arpreq('127.0.0.1') == '00:00:00:00:00:00' def decode_address(value): return inet_ntoa(pack(">I", htonl(int(value, base=16)))) def decode_flags(value): return i...
Use struct.pack instead of int.to_bytes
Use struct.pack instead of int.to_bytes int.to_bytes is not available on Python 2
Python
mit
sebschrader/python-arpreq,sebschrader/python-arpreq,sebschrader/python-arpreq,sebschrader/python-arpreq
67f3d3db568921f8deca0f68447498b84077e13c
tests/test_runner.py
tests/test_runner.py
from pytest import mark, raises from oshino.run import main from mock import patch @mark.integration @patch("oshino.core.heart.forever", lambda: False) def test_startup(): with raises(SystemExit): main(("--config", "tests/data/test_config.yml", ))
import asyncio from pytest import mark, raises from oshino.run import main from mock import patch def create_loop(): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) return loop @mark.integration @patch("oshino.core.heart.forever", lambda: False) @patch("oshino.core.heart.create_loop", crea...
Make event loop work for runner
Make event loop work for runner
Python
mit
CodersOfTheNight/oshino
4c20c2137eb1cee69511ecd8a83a499147b42373
tests/thread-test.py
tests/thread-test.py
#!/usr/bin/python2 import pstack import json threads, text = pstack.JSON(["tests/thread"]) result = json.loads(text) # we have 10 threads + main assert len(threads) == 11 entryThreads = 0 for thread in threads: assert thread["ti_lid"] in result["lwps"], "LWP %d not in %s" % (thread["ti_lid"], result["lwps"]) ...
#!/usr/bin/python2 import pstack import json pstack, text = pstack.JSON(["tests/thread"]) result = json.loads(text) threads = result["threads"] lwps = result["lwps"] assert_at = result["assert_at"] # we have 10 threads + main assert len(threads) == 11 for thread in pstack: # this will throw an error if the threa...
Clean up changes to thread test
Clean up changes to thread test
Python
bsd-2-clause
peadar/pstack,peadar/pstack,peadar/pstack,peadar/pstack
20b1505a316fc47049470f998741f00569df818f
rail-fence-cipher/rail_fence_cipher.py
rail-fence-cipher/rail_fence_cipher.py
# File: rail_fence_cipher.py # Purpose: Implement encoding and decoding for the rail fence cipher. # Programmer: Amal Shehu # Course: Exercism # Date: Friday 30 September 2016, 08:35 PM
# File: rail_fence_cipher.py # Purpose: Implement encoding and decoding for the rail fence cipher. # Programmer: Amal Shehu # Course: Exercism # Date: Friday 30 September 2016, 08:35 PM class Rail(): """Implementation of Rail Fence Cipher.""" def __init__(self, text, rail_count): ...
Add imaginary fence list comprehension
Add imaginary fence list comprehension
Python
mit
amalshehu/exercism-python
9d2d41f8450f6f3735b8ff9a0041f9bf5d80e5ec
config/template.py
config/template.py
DB_USER = '' DB_HOST = '' DB_PASSWORD = '' DB_NAME = ''
DB_USER = '' DB_HOST = '' DB_PASSWORD = '' DB_NAME = '' TWILIO_NUMBERS = ['']
Allow for representative view display with sample configuration
Allow for representative view display with sample configuration
Python
mit
PeterTheOne/ueberwachungspaket.at,PeterTheOne/ueberwachungspaket.at,PeterTheOne/ueberwachungspaket.at
426521115d62c664dc9139956f092a92705f7795
events.py
events.py
class ListenerRegister(object): def __init__(self): self._register = {} def add_listener(self, event, listener): event = event.upper() listeners = self._register.get(event, set()) listeners.add(listener) self._register[event] = listeners def remove_listener(self, ev...
class ListenerRegister(object): def __init__(self): self._register = {} def add_listener(self, event, listener): event = event.upper() listeners = self._register.get(event, set()) listeners.add(listener) self._register[event] = listeners def remove_listener(self, ev...
Add an example for event usage
Add an example for event usage
Python
mit
kashifrazzaqui/again
dfbebf26f52db94c9fc8e1056c39013d8cdb2656
name/context_processors.py
name/context_processors.py
def baseurl(request): """ Return a BASE_URL template context for the current request """ if request.is_secure(): scheme = 'https://' else: scheme = 'http://' return { 'BASE_URL': scheme + request.get_host(), }
from name.models import NAME_TYPE_CHOICES def baseurl(request): """ Return a BASE_URL template context for the current request """ if request.is_secure(): scheme = 'https://' else: scheme = 'http://' return { 'BASE_URL': scheme + request.get_host(), } def name_ty...
Add a new context processor to include the NAME_TYPE_CHOICES in every request context.
Add a new context processor to include the NAME_TYPE_CHOICES in every request context.
Python
bsd-3-clause
unt-libraries/django-name,damonkelley/django-name,unt-libraries/django-name,damonkelley/django-name,unt-libraries/django-name,damonkelley/django-name
f33bf5a99b9bb814fe6da6b7713e87014aae5fdf
src/journal/migrations/0035_journal_xsl.py
src/journal/migrations/0035_journal_xsl.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2019-11-03 20:56 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import journal.models class Migration(migrations.Migration): dependencies = [ ('journal', '0034_migrate_issue_types'...
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2019-11-03 20:56 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import journal.models class Migration(migrations.Migration): dependencies = [ ('journal', '0034_migrate_issue_types'...
Fix migration tree for journal 0035
Fix migration tree for journal 0035
Python
agpl-3.0
BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway
0904d8f5ca4f10b4cc7121e60c35f7560e37019c
boardinghouse/templatetags/boardinghouse.py
boardinghouse/templatetags/boardinghouse.py
from django import template from ..schema import is_shared_model as _is_shared_model from ..schema import get_schema_model Schema = get_schema_model() register = template.Library() @register.filter def is_schema_aware(obj): return obj and not _is_shared_model(obj) @register.filter def is_shared_model(obj): ...
from django import template from ..schema import is_shared_model as _is_shared_model from ..schema import _get_schema register = template.Library() @register.filter def is_schema_aware(obj): return obj and not _is_shared_model(obj) @register.filter def is_shared_model(obj): return obj and _is_shared_model(o...
Remove a database access from the template tag.
Remove a database access from the template tag.
Python
bsd-3-clause
luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse
4b448c704f69b951d19229c85debfdb5a2e122c1
citeproc/py2compat.py
citeproc/py2compat.py
from __future__ import (absolute_import, division, print_function, unicode_literals) import locale import sys __all__ = ['PY2'] PY2 = sys.version_info < (3, 0) if PY2: __all__ += ['str', 'print', 'open'] from io import open str = unicode std_print = print def print(*o...
from __future__ import (absolute_import, division, print_function, unicode_literals) import locale import sys __all__ = ['PY2'] PY2 = sys.version_info < (3, 0) if PY2: __all__ += ['str', 'print', 'open'] from io import open str = unicode std_print = print def print(*o...
Fix Tox/Travis testing on Python 2.7
Fix Tox/Travis testing on Python 2.7
Python
bsd-2-clause
jayvdb/citeproc-py
2436f1a00021baa39f3d3dfece1d44a2d3351dfd
bin/create_test_user.py
bin/create_test_user.py
# Create a dummy user for the app store review testing # This needs to be done every time we switch to a new database import sys from dao.user import User def create_fake_JWT_token(userEmail): """ Creates a fake JWT token for the specified user. This has two major benefits. 1. It allows us to finally writ...
# Create a dummy user for the app store review testing # This needs to be done every time we switch to a new database import sys from emission.core.wrapper.user import User def create_fake_JWT_token(userEmail): """ Creates a fake JWT token for the specified user. This has two major benefits. 1. It allows ...
Fix import to match the new directory structure
Fix import to match the new directory structure
Python
bsd-3-clause
yw374cornell/e-mission-server,joshzarrabi/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,yw374cornell/...
6e3d24b0594434577de6950190f0f103e08a2fbe
Source/Perforce/wb_p4_credential_dialogs.py
Source/Perforce/wb_p4_credential_dialogs.py
''' ==================================================================== Copyright (c) 2018 Barry A Scott. All rights reserved. This software is licensed as described in the file LICENSE.txt, which you should have received as part of this distribution. ===========================================================...
''' ==================================================================== Copyright (c) 2018 Barry A Scott. All rights reserved. This software is licensed as described in the file LICENSE.txt, which you should have received as part of this distribution. ===========================================================...
Update the crential dialog for perforce - untested
Update the crential dialog for perforce - untested
Python
apache-2.0
barry-scott/git-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench,barry-scott/git-workbench
2e6267c7b283fd579395fc3faac2b253ddb032fe
src/midonet/auth/keystone.py
src/midonet/auth/keystone.py
from keystoneclient.v2_0 import client as keystone_client from datetime import datetime from datetime import timedelta class KeystoneAuth: def __init__(self, uri, username, password, tenant_id=None, tenant_name=None): self.uri = uri self.username = username self.password...
from keystoneclient.v2_0 import client as keystone_client from datetime import datetime from datetime import timedelta class KeystoneAuth: def __init__(self, uri, username, password, tenant_id=None, tenant_name=None): self.uri = uri self.username = username self.password...
Add public method to get token.
Add public method to get token. Signed-off-by: Tomoe Sugihara <6015414ca332492cf0bb4dbbac212276d1c110a7@midokura.com>
Python
apache-2.0
midonet/python-midonetclient,midonet/python-midonetclient,midokura/python-midonetclient,midokura/python-midonetclient
7895b0a39694e88ed1bdd425c69fb747b7531c59
indico/testing/mocks.py
indico/testing/mocks.py
# This file is part of Indico. # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
# This file is part of Indico. # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Fix str/int usage in MockConferenceHolder
Fix str/int usage in MockConferenceHolder
Python
mit
indico/indico,ThiefMaster/indico,indico/indico,OmeGak/indico,ThiefMaster/indico,OmeGak/indico,mic4ael/indico,DirkHoffmann/indico,mvidalgarcia/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,ThiefMaster/indico,mic4ael/indico,pferreir/indico,DirkHoffmann/indico,ThiefMaster/indico,OmeGak/indico,mic4ael/indico,ind...
06b6b2fa0d8f7d8e4ef35068c3aa32cd39ac04c3
accountant/functional_tests/test_homepage.py
accountant/functional_tests/test_homepage.py
# -*- coding: utf-8 -*- from .base import FunctionalTestCase from .pages import game class HomePageTest(FunctionalTestCase): def test_create_game(self): # Alice is a user who visits the website self.browser.get(self.live_server_url) # She sees that the title of the browser contains '18xx Ac...
# -*- coding: utf-8 -*- import unittest from .base import FunctionalTestCase from .pages import game class HomePageTest(FunctionalTestCase): @unittest.skip def test_create_game(self): # Alice is a user who visits the website self.browser.get(self.live_server_url) # She sees that the tit...
Add FT to test if angular is loaded
Add FT to test if angular is loaded
Python
mit
XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant
ba3544fc18d5c5e827b1c1777b7811201545a8c5
boto/pyami/scriptbase.py
boto/pyami/scriptbase.py
import os, sys, time, traceback import smtplib from boto.utils import ShellCommand, get_ts import boto import boto.utils class ScriptBase: def __init__(self, config_file=None): self.instance_id = boto.config.get('Instance', 'instance-id', 'default') self.name = self.__class__.__name__ self...
import os, sys, time, traceback import smtplib from boto.utils import ShellCommand, get_ts import boto import boto.utils class ScriptBase: def __init__(self, config_file=None): self.instance_id = boto.config.get('Instance', 'instance-id', 'default') self.name = self.__class__.__name__ self...
Add the command that failed to the error log and the error email to help debug problems where the error produces no output.
Add the command that failed to the error log and the error email to help debug problems where the error produces no output.
Python
mit
appneta/boto,dimdung/boto,j-carl/boto,ekalosak/boto,drbild/boto,acourtney2015/boto,bryx-inc/boto,darjus-amzn/boto,ddzialak/boto,alfredodeza/boto,vijaylbais/boto,clouddocx/boto,israelbenatar/boto,alex/boto,podhmo/boto,cyclecomputing/boto,shipci/boto,kouk/boto,jindongh/boto,felix-d/boto,Timus1712/boto,alex/boto,lochiicon...
2872d4f34dbcfe4b212ca7c72a7b9ec725cfcc20
pyQuantuccia/tests/test_get_holiday_date.py
pyQuantuccia/tests/test_get_holiday_date.py
from pyQuantuccia import quantuccia def test_get_holiday_date(): """ At the moment the only thing this function can do is return NULL. """ assert(quantuccia.get_holiday_date() is None)
# from pyQuantuccia import quantuccia def test_get_holiday_date(): """ At the moment the only thing this function can do is return NULL. """ # assert(quantuccia.get_holiday_date() is None) pass
Comment out the tests so that the diagnostic test can run.
Comment out the tests so that the diagnostic test can run.
Python
bsd-3-clause
jwg4/pyQuantuccia,jwg4/pyQuantuccia
d0b56873b40acd3932f450293c363b01b5a709b9
jinja2_time/__init__.py
jinja2_time/__init__.py
# -*- coding: utf-8 -*- __author__ = 'Raphael Pierzina' __email__ = 'raphael@hackebrot.de' __version__ = '0.1.0' from .jinja2_time import TimeExtension __all__ = ['TimeExtension']
# -*- coding: utf-8 -*- from .jinja2_time import TimeExtension __author__ = 'Raphael Pierzina' __email__ = 'raphael@hackebrot.de' __version__ = '0.1.0' __all__ = ['TimeExtension']
Fix flake8 issue in init
Fix flake8 issue in init
Python
mit
hackebrot/jinja2-time
7e5221a65bd644cc86003f67daa3148f22b4a530
hash_table.py
hash_table.py
#!/usr/bin/env python '''Implementation of a simple hash table. The table has `hash`, `get` and `set` methods. The hash function uses a very basic hash algorithm to insert the value into the table. ''' class HashItem(object): def __init__(self): pass class Hash(object): def __init__(self, size=1024...
#!/usr/bin/env python '''Implementation of a simple hash table. The table has `hash`, `get` and `set` methods. The hash function uses a very basic hash algorithm to insert the value into the table. ''' class HashItem(object): def __init__(self, key, value): self.key = key self.value = value cla...
Build out hash item class
Build out hash item class
Python
mit
jwarren116/data-structures-deux
ca8556584876adfea9f9f1f1042ebb2704933f34
addons/product/__terp__.py
addons/product/__terp__.py
{ "name" : "Products & Pricelists", "version" : "1.0", "author" : "Tiny", "category" : "Generic Modules/Inventory Control", "depends" : ["base"], "init_xml" : [], "demo_xml" : ["product_demo.xml"], "description": """ This is the base module to manage products and pricelists in Tiny ERP. Products support vari...
{ "name" : "Products & Pricelists", "version" : "1.0", "author" : "Tiny", "category" : "Generic Modules/Inventory Control", "depends" : ["base"], "init_xml" : [], "demo_xml" : ["product_demo.xml"], "description": """ This is the base module to manage products and pricelists in Tiny ERP. Products support vari...
Add product_security.xml file entry in update_xml section
Add product_security.xml file entry in update_xml section bzr revid: mga@tinyerp.com-c1c968b6c0a6dd356a1ae7bc971a2daa2356a46d
Python
agpl-3.0
hbrunn/OpenUpgrade,jeasoft/odoo,FlorianLudwig/odoo,colinnewell/odoo,alhashash/odoo,jesramirez/odoo,lsinfo/odoo,rowemoore/odoo,sysadminmatmoz/OCB,JGarcia-Panach/odoo,dariemp/odoo,fgesora/odoo,takis/odoo,kirca/OpenUpgrade,tinkerthaler/odoo,Antiun/odoo,factorlibre/OCB,stonegithubs/odoo,matrixise/odoo,dllsf/odootest,Endika...
a3ee55cf4d9182247dcc7a42b0336c467dce9e3e
linter.py
linter.py
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ( 'cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', '${file}' ) regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+):((?P<col>\...
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ( 'cppcheck', '--template={file}:{line}:{column}:{severity}:{id}:{message}', '--inline-suppr', '--quiet', '${args}', '${file}' ) regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+...
Add cppcheck issue id as code field
Add cppcheck issue id as code field
Python
mit
SublimeLinter/SublimeLinter-cppcheck
336fbbd82a09469a7ac7d0eb850daa6a55f42669
ctypescrypto/__init__.py
ctypescrypto/__init__.py
""" Interface to some libcrypto functions """ from ctypes import CDLL, c_char_p def config(filename=None): """ Loads OpenSSL Config file. If none are specified, loads default (compiled in) one """ libcrypto.OPENSSL_config(filename) __all__ = ['config'] libcrypto = CDLL("libcrypto.s...
""" Interface to some libcrypto functions """ from ctypes import CDLL, c_char_p from ctypes.util import find_library import sys def config(filename=None): """ Loads OpenSSL Config file. If none are specified, loads default (compiled in) one """ libcrypto.OPENSSL_config(filename) __a...
Use find_library to search for openssl libs
Use find_library to search for openssl libs
Python
mit
vbwagner/ctypescrypto
694651b5c143e4ce1fd3de25500909c1a16faf95
api/podcasts/controller.py
api/podcasts/controller.py
from django.core.cache import cache from .models import PodcastProvider from .remote.interface import PodcastDetails from .remote.timbre import fetch_podcasts, fetch_podcast __all__ = ['fetch_cached_podcasts', 'fetch_cached_podcast'] CACHE_KEY = "76_timbre_feeds" def fetch_cached_podcasts() -> list[PodcastDetails]:...
from typing import List from django.core.cache import cache from .models import PodcastProvider from .remote.interface import PodcastDetails from .remote.timbre import fetch_podcasts, fetch_podcast __all__ = ['fetch_cached_podcasts', 'fetch_cached_podcast'] CACHE_KEY = "76_timbre_feeds" def fetch_cached_podcasts()...
Fix typehint that is invalid in python 3.8
Fix typehint that is invalid in python 3.8
Python
mit
urfonline/api,urfonline/api,urfonline/api
3a7e87be0cc42b47375baec22ffdb978cb21847c
main.py
main.py
#!/usr/bin/env python3 import requests AUTH_TOKEN = open("config/auth_token").read().strip() USER_ID = open("config/user_id").read().strip() BASE_URL = "https://api.telegram.org/bot" + AUTH_TOKEN + "/" def send_request(command, **params): requests.get(BASE_URL + command, params=params) def send_message(chat_...
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class TelegramBotApi: def __init__(self, auth_token): self.base_url = "https://api.telegram.org/bot" + auth_token + "/" def send_message(self, chat_id, text): self.__send_request("sendMessage", chat_id=chat_id, text=text) def...
Create TelegramBotApi and Config classes
Create TelegramBotApi and Config classes To clean up code
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
46fc845f76cfc244e6dff98a152221f7c3044386
config/test/__init__.py
config/test/__init__.py
from SCons.Script import * import inspect def run_tests(env): import shlex import subprocess import sys cmd = shlex.split(env.get('TEST_COMMAND')) print('Executing:', cmd) sys.exit(subprocess.call(cmd)) def generate(env): import os import distutils.spawn python = distutils.spaw...
from SCons.Script import * import shlex def run_tests(env): import shlex import subprocess import sys cmd = shlex.split(env.get('TEST_COMMAND')) print('Executing:', cmd) sys.exit(subprocess.call(cmd)) def generate(env): import os import distutils.spawn python = distutils.spawn....
Fix testHarness call for Windows
Fix testHarness call for Windows
Python
lgpl-2.1
CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang
709e1562e61110ba94ae7581952bc5233ee1035e
main.py
main.py
import argparse import logging from create_dataset import * if __name__ == '__main__': logging.basicConfig(format='%(asctime)s %(message)s', datefmt='[%Y/%m/%d][%I:%M:%S %p] ', level=logging.INFO) parser = argparse.ArgumentParser(description='Data Loader') parser.add_argument('--type', help='pickle or lmd...
import argparse import logging from create_dataset import * if __name__ == '__main__': logging.basicConfig(format='%(asctime)s %(message)s', datefmt='[%Y/%m/%d][%I:%M:%S %p] ', level=logging.INFO) parser = argparse.ArgumentParser(description='Data Loader') parser.add_argument('-type', help='pickle or lmdb...
Adjust the interface for split function
Adjust the interface for split function
Python
mit
CorcovadoMing/DataLoader,CorcovadoMing/DataLoader
6d03be0c21ac21e9d5ed826c5fe4991fa01743cb
main.py
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import Tool import time from Tieba import Tieba def main(): print("Local Time:", time.asctime(time.localtime())) # Read Cookies cookies = Tool.load_cookies_path(".") for cookie in cookies: # Login user = Tieba(cookie) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import Tool import time from Tieba import Tieba def main(): print("Local Time:", time.asctime(time.localtime())) # Read Cookies cookies = Tool.load_cookies_path(".") for cookie in cookies: # Login user = Tieba(cookie) # List Likes ...
Change newline character to LF
Change newline character to LF
Python
apache-2.0
jiangzc/TiebaSign
9dc068f947cbd5ca29b324436496d2d78f55edf7
src/trajectory/trajectory.py
src/trajectory/trajectory.py
#!/usr/bin/env python import math from geometry_msgs.msg import Point class NegativeTimeException(Exception): pass class Trajectory: def __init__(self): self.position = Point() def get_position_at(self, t): if t < 0: raise NegativeTimeException()
#!/usr/bin/env python import math from twisted.conch.insults.insults import Vector from geometry_msgs.msg import Point class NegativeTimeException(Exception): pass class Trajectory: def __init__(self): self.position = Point() def get_position_at(self, t): if t < 0: raise Neg...
Implement __abs__ and __sub__ dunder methods
feat: Implement __abs__ and __sub__ dunder methods Implement methods which are required to apply assertEqual and assertAlmostEqual to points.
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
1923fdf26f2df092a52318dfcc91825fa10fac40
mesh.py
mesh.py
#!/usr/bin/env python3 import os import shutil import sys import traceback builtin_cmds = {'cd', 'pwd', 'exit',} def prompt(): print('%s $ ' % os.getcwd(), end='', flush=True) def read_command(): return sys.stdin.readline() def parse_command(cmd_text): return (cmd_text, cmd_text.strip().split()) def r...
#!/usr/bin/env python3 import os import shutil import sys import readline import traceback readline.parse_and_bind('tab: complete') readline.parse_and_bind('set editing-mode vi') builtin_cmds = {'cd', 'pwd', 'exit',} def prompt(): return '%s $ ' % os.getcwd() def read_command(): line = input(prompt()) ...
Add readline support with vi keybindings
Add readline support with vi keybindings
Python
mit
mmichie/mesh
bd5223af36fc167ce48bfa5c97f8a3fd79a7995a
camera_selection/scripts/camera_selection.py
camera_selection/scripts/camera_selection.py
#!/usr/bin/env python import rospy import Adafruit_BBIO.GPIO as GPIO from vortex_msgs.msg import CameraFeedSelection PIN_MAP_FEED0 = rospy.get_param('/camera/pin_map_feed0') PIN_MAP_FEED1 = rospy.get_param('/camera/pin_map_feed1') PIN_MAP_FEED2 = rospy.get_param('/camera/pin_map_feed2') PIN_MAP_LIST = [PIN_MAP_FEED0,P...
#!/usr/bin/env python import rospy import Adafruit_BBIO.GPIO as GPIO from vortex_msgs.msg import CameraFeedSelection PIN_MAP_FEED0 = rospy.get_param('/camera/pin_map_feed0') PIN_MAP_FEED1 = rospy.get_param('/camera/pin_map_feed1') PIN_MAP_FEED2 = rospy.get_param('/camera/pin_map_feed2') PIN_MAP_LIST = [PIN_MAP_FEED0,P...
Add camera selection based on desired feed and camera number
Add camera selection based on desired feed and camera number
Python
mit
vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control
daac5f26c07045ad162a481d035359dd17227c91
Lib/test/test_imaplib.py
Lib/test/test_imaplib.py
from test_support import verify,verbose import imaplib import time # We can check only that it successfully produces a result, # not the correctness of the result itself, since the result # depends on the timezone the machine is in. timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), "18...
import imaplib import time # We can check only that it successfully produces a result, # not the correctness of the result itself, since the result # depends on the timezone the machine is in. timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), "18-May-2033 05:33:20 +0200"] for t in tim...
Remove unused imports, clean up trailing whitespace.
Remove unused imports, clean up trailing whitespace.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
6dd523e0d92c39f1a3e4c9be2dac0442535bb88f
changes/backends/jenkins/generic_builder.py
changes/backends/jenkins/generic_builder.py
from .builder import JenkinsBuilder class JenkinsGenericBuilder(JenkinsBuilder): def __init__(self, *args, **kwargs): self.script = kwargs.pop('script') self.cluster = kwargs.pop('cluster') super(JenkinsGenericBuilder, self).__init__(*args, **kwargs) def get_job_parameters(self, job, ...
from .builder import JenkinsBuilder class JenkinsGenericBuilder(JenkinsBuilder): def __init__(self, *args, **kwargs): self.script = kwargs.pop('script') self.cluster = kwargs.pop('cluster') super(JenkinsGenericBuilder, self).__init__(*args, **kwargs) def get_job_parameters(self, job, ...
Fix target_id support in JenkinsGenericBuilder
Fix target_id support in JenkinsGenericBuilder
Python
apache-2.0
wfxiang08/changes,dropbox/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes
7b6c3b4af18746ad02169a93270fc13579c60829
pycket/targetpycket.py
pycket/targetpycket.py
from pycket.expand import load_json_ast_rpython from pycket.interpreter import interpret_one from pycket.error import SchemeException from rpython.rlib import jit def main(argv): jit.set_param(None, "trace_limit", 20000) # XXX crappy argument handling try: index = argv.index("--jit") except Va...
from pycket.expand import load_json_ast_rpython from pycket.interpreter import interpret_one from pycket.error import SchemeException from rpython.rlib import jit from rpython.rlib.objectmodel import we_are_translated def main(argv): jit.set_param(None, "trace_limit", 20000) # XXX crappy argument handling ...
Add auto-pdb fallback when not in translated mode for target
Add auto-pdb fallback when not in translated mode for target
Python
mit
pycket/pycket,pycket/pycket,samth/pycket,krono/pycket,samth/pycket,vishesh/pycket,samth/pycket,magnusmorton/pycket,pycket/pycket,krono/pycket,magnusmorton/pycket,magnusmorton/pycket,krono/pycket,cderici/pycket,cderici/pycket,vishesh/pycket,vishesh/pycket,cderici/pycket
ad73c91d4e2b2d5faed35420a1393d016af84e40
tests/test_event_manager/test_attribute.py
tests/test_event_manager/test_attribute.py
import uuid from datetime import datetime from dateutil.tz import UTC from event_manager.event import Attribute from tests.utils import BaseTest class TestAttribute(BaseTest): def test_props(self): attr = Attribute(name='test') assert attr.name == 'test' assert attr.attr_type == str ...
import uuid from datetime import datetime from dateutil.tz import UTC from event_manager.event import Attribute from tests.utils import BaseTest class TestAttribute(BaseTest): def test_name_should_not_be_instance(self): with self.assertRaises(AssertionError): Attribute(name='instance') ...
Add test for attribute instance assertion
Add test for attribute instance assertion
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
b5cab8fe05899891e4508cb686d40d88e3c5b955
tests/unit/geometry/GenericGeometryTest.py
tests/unit/geometry/GenericGeometryTest.py
import openpnm as op class GenericGeometryTest: def setup_class(self): self.net = op.network.Cubic(shape=[3, 3, 3]) self.geo = op.geometry.StickAndBall(network=self.net, pores=self.net.Ps, throats=self.net.Ts)...
import openpnm as op class GenericGeometryTest: def setup_class(self): self.net = op.network.Cubic(shape=[3, 3, 3]) self.geo = op.geometry.StickAndBall(network=self.net, pores=self.net.Ps, throats=self.net.Ts)...
Augment unit test for show_hist
Augment unit test for show_hist
Python
mit
PMEAL/OpenPNM
2c73d919273b1660af40053afa198a42278c07a9
tests/qtgui/qdatastream_gui_operators_test.py
tests/qtgui/qdatastream_gui_operators_test.py
# -*- coding: utf-8 -*- import unittest import sys from PySide import QtGui, QtCore class QAppPresence(unittest.TestCase): def testQPixmap(self): ds = QtCore.QDataStream() p = QtGui.QPixmap() ds << p ds >> p if __name__ == '__main__': app = QtGui.QApplication([]) unitte...
# -*- coding: utf-8 -*- import unittest import sys from PySide.QtCore import QDataStream, QByteArray, QIODevice, Qt from PySide.QtGui import QPixmap, QColor from helper import UsesQApplication class QPixmapQDatastream(UsesQApplication): '''QDataStream <<>> QPixmap''' def setUp(self): super(QPixmapQ...
Fix QDataStream <</>> QPixmap test
Fix QDataStream <</>> QPixmap test
Python
lgpl-2.1
BadSingleton/pyside2,IronManMark20/pyside2,qtproject/pyside-pyside,M4rtinK/pyside-android,gbaty/pyside2,RobinD42/pyside,enthought/pyside,M4rtinK/pyside-bb10,enthought/pyside,enthought/pyside,qtproject/pyside-pyside,enthought/pyside,BadSingleton/pyside2,IronManMark20/pyside2,IronManMark20/pyside2,enthought/pyside,IronMa...
6129a57ab8b7de1a4189706a966b32174182c086
server.py
server.py
from flask import Flask # Create Flask application app = Flask(__name__) @app.route('/inventory') def index(): """ Intro page of the inventory API This method will only return some welcome words. Returns: response: welcome words in json format and status 200 Todo: * Finish the implementations. ...
from flask import Flask # Create Flask application app = Flask(__name__) @app.route('/inventory') def index(): """ Intro page of the inventory API This method will only return some welcome words. Returns: response: welcome words in json format and status 200 Todo: * Finish the implementations. ...
Create a GET products method
Create a GET products method
Python
mit
devops-foxtrot-s17/inventory,devops-foxtrot-s17/inventory
ee2ecf60ea2fdbfe7f6c4f9ccc7275d534eeeacf
test_proj/urls.py
test_proj/urls.py
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), url(r'^admin_tools/', include('admin_tools.urls')), (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'do...
try: from django.conf.urls import patterns, url, include except ImportError: # django < 1.4 from django.conf.urls.defaults import patterns, url, include from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)),...
Support for Django > 1.4 for test proj
Support for Django > 1.4 for test proj
Python
mit
glic3rinu/django-admin-tools,artscoop/django-admin-tools,artscoop/django-admin-tools,artscoop/django-admin-tools,glic3rinu/django-admin-tools,glic3rinu/django-admin-tools,glic3rinu/django-admin-tools,artscoop/django-admin-tools
eaa85b0fe69e4ff020cd269007fa1a5c7f864b53
admin/common_auth/models.py
admin/common_auth/models.py
from django.db import models class AdminProfile(models.Model): user = models.OneToOneField('osf.OSFUser', related_name='admin_profile') desk_token = models.CharField(max_length=45, blank=True) desk_token_secret = models.CharField(max_length=45, blank=True)
from django.db import models class AdminProfile(models.Model): user = models.OneToOneField('osf.OSFUser', related_name='admin_profile') desk_token = models.CharField(max_length=45, blank=True) desk_token_secret = models.CharField(max_length=45, blank=True) class Meta: # custom permissions ...
Add custom permissions to admin profile for spam, metrics, and prereg
Add custom permissions to admin profile for spam, metrics, and prereg
Python
apache-2.0
mattclark/osf.io,crcresearch/osf.io,acshi/osf.io,HalcyonChimera/osf.io,Nesiehr/osf.io,caneruguz/osf.io,binoculars/osf.io,caneruguz/osf.io,cslzchen/osf.io,felliott/osf.io,crcresearch/osf.io,hmoco/osf.io,baylee-d/osf.io,caseyrollins/osf.io,acshi/osf.io,leb2dg/osf.io,erinspace/osf.io,Johnetordoff/osf.io,chennan47/osf.io,s...
8a509fd2b6bfa5114986df5548132ab41eefff13
lightstep/util.py
lightstep/util.py
""" Utility functions """ import random import time from . import constants def _service_url_from_hostport(secure, host, port): """ Create an appropriate service URL given the parameters. `secure` should be a bool. """ if secure: protocol = 'https://' else: protocol = 'http://'...
""" Utility functions """ import random import time from . import constants guid_rng = random.Random() # Uses urandom seed def _service_url_from_hostport(secure, host, port): """ Create an appropriate service URL given the parameters. `secure` should be a bool. """ if secure: protocol =...
Use a private RNG for guids. Avoids potential for trouble w/ the global instance.
Use a private RNG for guids. Avoids potential for trouble w/ the global instance.
Python
mit
lightstephq/lightstep-tracer-python
64db9a503322ce1ee61c64afbdc38f367c3d6627
guardian/testapp/tests/management_test.py
guardian/testapp/tests/management_test.py
from __future__ import absolute_import from __future__ import unicode_literals from django.test import SimpleTestCase from guardian.compat import get_user_model from guardian.compat import mock from guardian.management import create_anonymous_user mocked_get_init_anon = mock.Mock() class TestGetAnonymousUser(Simpl...
from __future__ import absolute_import from __future__ import unicode_literals from guardian.compat import get_user_model from guardian.compat import mock from guardian.compat import unittest from guardian.management import create_anonymous_user import django mocked_get_init_anon = mock.Mock() class TestGetAnonymo...
Use unit test.TestCase instead of SimpleTestCase
Use unit test.TestCase instead of SimpleTestCase
Python
bsd-2-clause
calvinpy/django-guardian,vovanbo/django-guardian,loop0/django-guardian,frwickst/django-guardian,thedrow/django-guardian,emperorcezar/django-guardian,alexshin/django-guardian,calvinpy/django-guardian,flisky/django-guardian,vitan/django-guardian,sustainingtechnologies/django-guardian,rfleschenberg/django-guardian,frwicks...
c10badab9b93eb021b1942475c681042292c182c
scrapi/harvesters/boise_state.py
scrapi/harvesters/boise_state.py
''' Harvester for the ScholarWorks for the SHARE project Example API call: http://scholarworks.boisestate.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class Boise_stateHarvester(OAIHarvester): short_name = 'boise_state' l...
''' Harvester for the ScholarWorks for the SHARE project Example API call: http://scholarworks.boisestate.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class Boise_stateHarvester(OAIHarvester): short_name = 'boise_state' l...
Update longname for Boise state
Update longname for Boise state
Python
apache-2.0
CenterForOpenScience/scrapi,CenterForOpenScience/scrapi
ac4f5451baaefd67392d9b908c9ccffc4083a9ad
fluidsynth/fluidsynth.py
fluidsynth/fluidsynth.py
from cffi import FFI ffi = FFI() ffi.cdef(""" typedef struct _fluid_hashtable_t fluid_settings_t; typedef struct _fluid_synth_t fluid_synth_t; typedef struct _fluid_audio_driver_t fluid_audio_driver_t; fluid_settings_t* new_fluid_settings(void); fluid_synth_t* new_fluid_synth(fluid_settings_t* settings); fluid_audio_...
from cffi import FFI ffi = FFI() ffi.cdef(""" typedef struct _fluid_hashtable_t fluid_settings_t; typedef struct _fluid_synth_t fluid_synth_t; typedef struct _fluid_audio_driver_t fluid_audio_driver_t; fluid_settings_t* new_fluid_settings(void); fluid_synth_t* new_fluid_synth(fluid_settings_t* settings); fluid_audio_...
Change the LD search path
Change the LD search path
Python
mit
paultag/python-fluidsynth
894060b4e4a59d1626cf2b9d80b5184371d79fb9
mopidy/mixers/alsa.py
mopidy/mixers/alsa.py
import alsaaudio from mopidy.mixers import BaseMixer class AlsaMixer(BaseMixer): """ Mixer which uses the Advanced Linux Sound Architecture (ALSA) to control volume. """ def __init__(self, *args, **kwargs): super(AlsaMixer, self).__init__(*args, **kwargs) self._mixer = alsaaudio.M...
import alsaaudio import logging from mopidy.mixers import BaseMixer logger = logging.getLogger('mopidy.mixers.alsa') class AlsaMixer(BaseMixer): """ Mixer which uses the Advanced Linux Sound Architecture (ALSA) to control volume. """ def __init__(self, *args, **kwargs): super(AlsaMixer, ...
Make AlsaMixer work on hosts without a mixer named 'Master'
Make AlsaMixer work on hosts without a mixer named 'Master'
Python
apache-2.0
tkem/mopidy,SuperStarPL/mopidy,ZenithDK/mopidy,vrs01/mopidy,dbrgn/mopidy,adamcik/mopidy,ali/mopidy,dbrgn/mopidy,hkariti/mopidy,bencevans/mopidy,mopidy/mopidy,swak/mopidy,glogiotatidis/mopidy,priestd09/mopidy,tkem/mopidy,abarisain/mopidy,pacificIT/mopidy,SuperStarPL/mopidy,priestd09/mopidy,jodal/mopidy,hkariti/mopidy,db...
ffc3bec9d488135ba2331386cec3279283927217
bamp/helpers/ui.py
bamp/helpers/ui.py
import sys from functools import partial, wraps import click def verify_response(func): """Decorator verifies response from the function. It expects function to return (bool, []), when bool is False content of list is printed out and program exits with error code. With successful execution results ar...
import sys from functools import partial, wraps import click def verify_response(func): """Decorator verifies response from the function. It expects function to return (bool, []), when bool is False content of list is printed out and program exits with error code. With successful execution results ar...
Enable passing str to echo
Enable passing str to echo
Python
mit
inirudebwoy/bamp
3504b4f3687fdf3ac52d6d7df9306519762900a7
ndaparser/__init__.py
ndaparser/__init__.py
import ndaparser if __name__ == "__main__" : trns = ndaparser.parseLine("T10188000060SCTSZFW3GT3WU1B 1501131501131501121710Viitemaksu +000000000000002800 HAKKERI HEIKKI HOKSAAVA A 00000000000000111012 ") print(trns)
import ndaparser if __name__ == "__main__" : transactions = []; with open("./testdata.nda") as f: for line in f: transaction = ndaparser.parseLine(line) if transaction is not None: transactions.append(transaction) for transaction in transactions: pri...
Read testdata from file, print valid transactions
Read testdata from file, print valid transactions
Python
mit
rambo/asylum,hacklab-fi/asylum,ojousima/asylum,HelsinkiHacklab/asylum,hacklab-fi/asylum,ojousima/asylum,ojousima/asylum,jautero/asylum,rambo/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,rambo/asylum,jautero/asylum,HelsinkiHacklab/asylum,ojousima/asylum,jautero/asylum,jautero/asylum,hacklab-fi/asylum,hacklab-fi/...
087925b336794b71675b31b70f845042e1f635fb
metro_accounts/metro_account.py
metro_accounts/metro_account.py
# -*- coding: utf-8 -*- import time from openerp.report import report_sxw from openerp.osv import fields, osv class account_account(osv.osv): _inherit = "account.account" _columns={ 'name': fields.char('Name', size=256, required=True, select=True, translate=True), 'bal_direct': fields.selec...
# -*- coding: utf-8 -*- import time from openerp.report import report_sxw from openerp.osv import fields, osv class account_account(osv.osv): _inherit = "account.account" _columns={ 'name': fields.char('Name', size=256, required=True, select=True, translate=True), 'bal_direct': fields.selec...
Add the SQL to update account balance direction field bal_direct
Add the SQL to update account balance direction field bal_direct
Python
agpl-3.0
837278709/metro-openerp,john-wang-metro/metro-openerp,john-wang-metro/metro-openerp,837278709/metro-openerp,837278709/metro-openerp,john-wang-metro/metro-openerp
82b78ed248f28709b6603315bd673337e4997c4e
pseudorandom.py
pseudorandom.py
#!/usr/bin/env python import os from flask import Flask, render_template, request, make_response from names import get_full_name app = Flask(__name__) @app.route("/") def index(): if (request.headers.get('User-Agent', '')[:4].lower() == 'curl' or request.headers['Content-Type'] == 'text/plain'): ...
#!/usr/bin/env python import os from flask import Flask, render_template, request, make_response from names import get_full_name app = Flask(__name__) @app.route("/") def index(): content_type = request.headers.get('Content-Type', '') browser = request.headers.get('User-Agent', '').lower() if browser[:4...
Send text to wget/curl unless html content-type
Send text to wget/curl unless html content-type
Python
mit
treyhunner/pseudorandom.name,treyhunner/pseudorandom.name
7b9233c157630733da688abb7c0f3fffecddd0e7
scripts/lib/getUserPath.py
scripts/lib/getUserPath.py
def getUserPath(filename, is_command): import lib.app, os # Places quotation marks around the full path, to handle cases where the user-specified path / file name contains spaces # However, this should only occur in situations where the output is being interpreted as part of a full command string; # if the ex...
def getUserPath(filename, is_command): import lib.app, os # Places quotation marks around the full path, to handle cases where the user-specified path / file name contains spaces # However, this should only occur in situations where the output is being interpreted as part of a full command string; # if the ex...
Fix for working directory containing whitespace
Scripts: Fix for working directory containing whitespace
Python
mpl-2.0
MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3
4c4fd3021931e2203088a2ec578eb479a622e2c5
blogsite/models.py
blogsite/models.py
"""Collection of Models used in blogsite.""" from . import db class Post(db.Model): """Model representing a blog post. Attributes ---------- id : SQLAlchemy.Column Autogenerated primary key title : SQLAlchemy.Column body : SQLAlchemy.Column """ # Columns id = db.Column(db...
"""Collection of Models used in blogsite.""" from . import db from datetime import datetime class Post(db.Model): """Model representing a blog post. Attributes ---------- id : SQLAlchemy.Column Autogenerated primary key title : SQLAlchemy.Column body : SQLAlchemy.Column pub_date :...
Add Category model and expanding Post model.
Add Category model and expanding Post model. Post model now contains a publish date and a foreign key reference to the Category model.
Python
mit
paulaylingdev/blogsite,paulaylingdev/blogsite
d7621f5bf2e1ae30f79d1701fe5e34ee60da1a53
go/api/go_api/tests/test_client.py
go/api/go_api/tests/test_client.py
import json from django.conf import settings from django.test import TestCase from go.api.go_api import client from mock import patch class ClientTestCase(TestCase): @patch('requests.request') def test_request(self, mock_req): client.request('123', 'lorem ipsum', 'GET') mock_req.assert_cal...
import json from django.conf import settings from django.test import TestCase from go.api.go_api import client from mock import patch class ClientTestCase(TestCase): @patch('requests.request') def test_rpc(self, mock_req): client.rpc('123', 'do_something', ['foo', 'bar'], id='abc') mock_re...
Remove a test that is no longer relevant
Remove a test that is no longer relevant
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
279f0b984209f27743791aca9cf3da7941e5d520
zephyr/lib/minify.py
zephyr/lib/minify.py
from django.conf import settings from hashlib import sha1 from os import path from pipeline.compressors import SubProcessCompressor class ClosureSourceMapCompressor(SubProcessCompressor): def compress_js(self, js): # js is the full text of the JavaScript source, and we can't # easily ...
from django.conf import settings from hashlib import sha1 from os import path from pipeline.compressors import SubProcessCompressor class ClosureSourceMapCompressor(SubProcessCompressor): def compress_js(self, js): # js is the full text of the JavaScript source, and we can't # easily ...
Make it easier to find the source map for app.js
Make it easier to find the source map for app.js (imported from commit bca27c9838573fb4b74e2d269b253a48702c9e1c)
Python
apache-2.0
gigawhitlocks/zulip,hayderimran7/zulip,dhcrzf/zulip,jackrzhang/zulip,MariaFaBella85/zulip,verma-varsha/zulip,esander91/zulip,jonesgithub/zulip,johnnygaddarr/zulip,hackerkid/zulip,joshisa/zulip,Frouk/zulip,arpitpanwar/zulip,qq1012803704/zulip,dawran6/zulip,RobotCaleb/zulip,wavelets/zulip,qq1012803704/zulip,jerryge/zulip...
0a5e4194fe06b20b4eaacaa9452403f70076ccd3
base_solver.py
base_solver.py
#!/usr/bin/env python # encoding: utf-8 from datetime import datetime class BaseSolver(object): task = None best_solution = None best_distance = float('inf') search_time = None cycles = 0 def __init__(self, task): self.task = task def run(self): start_time = datetime.now...
#!/usr/bin/env python # encoding: utf-8 from datetime import datetime class RunSolverFirst(Exception): pass class BaseSolver(object): task = None best_solution = None best_distance = float('inf') search_time = None cycles = 0 def __init__(self, task): self.task = task def ...
Add run solver first exception type
Add run solver first exception type
Python
mit
Cosiek/KombiVojager
1069565b596d3bc13b99bcae4ec831c2228e7946
PrinterApplication.py
PrinterApplication.py
from Cura.WxApplication import WxApplication import wx class PrinterApplication(WxApplication): def __init__(self): super(PrinterApplication, self).__init__() def run(self): frame = wx.Frame(None, wx.ID_ANY, "Hello World") frame.Show(True) super(PrinterApplication, sel...
from Cura.Wx.WxApplication import WxApplication class PrinterApplication(WxApplication): def __init__(self): super(PrinterApplication, self).__init__() def run(self): super(PrinterApplication, self).run()
Move WxApplication into its own Wx submodule
Move WxApplication into its own Wx submodule
Python
agpl-3.0
lo0ol/Ultimaker-Cura,Curahelper/Cura,senttech/Cura,DeskboxBrazil/Cura,lo0ol/Ultimaker-Cura,bq/Ultimaker-Cura,fxtentacle/Cura,totalretribution/Cura,derekhe/Cura,ad1217/Cura,ad1217/Cura,derekhe/Cura,Curahelper/Cura,ynotstartups/Wanhao,hmflash/Cura,markwal/Cura,fieldOfView/Cura,fxtentacle/Cura,hmflash/Cura,quillford/Cura,...
4b10355d256f1a0bf6b7cc8eae1eda4b8794cb09
indra/sources/omnipath/__init__.py
indra/sources/omnipath/__init__.py
from .api import process_from_web from .processor import OmniPathProcessor
""" The OmniPath module accesses biomolecular interaction data from various curated databases using the OmniPath API (see https://saezlab.github.io/pypath/html/index.html#webservice) and processes the returned data into statements using the OmniPathProcessor. Currently, the following data is collected: - Modificatio...
Write short blurb about module and its usage
Write short blurb about module and its usage
Python
bsd-2-clause
sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/belpy,sorgerlab/indra,bgyori/indra,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,bgyori/indra,sorgerlab/indra
ad74a2d02b109308b79b5629920a23b85748e439
photutils/conftest.py
photutils/conftest.py
# this contains imports plugins that configure py.test for astropy tests. # by importing them here in conftest.py they are discoverable by py.test # no matter how it is invoked within the source tree. from astropy.tests.pytest_plugins import * ## Uncomment the following line to treat all DeprecationWarnings as ## exc...
# this contains imports plugins that configure py.test for astropy tests. # by importing them here in conftest.py they are discoverable by py.test # no matter how it is invoked within the source tree. from astropy.tests.pytest_plugins import * ## Uncomment the following line to treat all DeprecationWarnings as ## exc...
Add scikit-image to test header information
Add scikit-image to test header information
Python
bsd-3-clause
larrybradley/photutils,astropy/photutils
da90ddfd697da5be7e0c01f183e733bbc981fe85
app.py
app.py
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run()
from flask import Flask app = Flask(__name__) @app.route('/') @app.route('/index') def index(): return 'Hello World!' if __name__ == '__main__': app.run()
Index action ready with "Hello, World!" message
Index action ready with "Hello, World!" message
Python
mit
alexander-emelyanov/microblog,alexander-emelyanov/microblog
a9892cc1fcb7d2911f6afba52a06a6f1c1ed9b25
tests/test_wrap_modes.py
tests/test_wrap_modes.py
from hypothesis_auto import auto_pytest_magic from isort import wrap_modes auto_pytest_magic(wrap_modes.grid, auto_allow_exceptions_=(ValueError,)) auto_pytest_magic(wrap_modes.vertical, auto_allow_exceptions_=(ValueError,)) auto_pytest_magic(wrap_modes.hanging_indent, auto_allow_exceptions_=(ValueError,)) auto_pytes...
from hypothesis_auto import auto_pytest_magic from isort import wrap_modes auto_pytest_magic(wrap_modes.grid, auto_allow_exceptions_=(ValueError,)) auto_pytest_magic(wrap_modes.vertical, auto_allow_exceptions_=(ValueError,)) auto_pytest_magic(wrap_modes.hanging_indent, auto_allow_exceptions_=(ValueError,)) auto_pytes...
Increase wrap mode test coverage
Increase wrap mode test coverage
Python
mit
PyCQA/isort,PyCQA/isort
da2f01c6fbeba6a0df3d6bb2c6dcf6a6ae659a76
opentreemap/registration_backend/urls.py
opentreemap/registration_backend/urls.py
from django.conf.urls import patterns from django.conf.urls import include from django.conf.urls import url from django.views.generic.base import TemplateView from views import RegistrationView, ActivationView urlpatterns = patterns('', url(r'^activate/complete/$', TemplateView.as_view(template_name='regi...
from django.conf.urls import patterns from django.conf.urls import include from django.conf.urls import url from django.views.generic.base import TemplateView from registration.forms import RegistrationFormUniqueEmail from views import RegistrationView, ActivationView urlpatterns = patterns('', url(r'^activate/...
Use registration form to prevent duplicate emails
Use registration form to prevent duplicate emails Fixes #725. We enforce this both at the database level, and here, using django registration's ready-made form class.
Python
agpl-3.0
clever-crow-consulting/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,RickMohr/otm-core,recklessromeo/otm-core,maurizi/otm-core,maurizi/otm-core,RickMohr/otm-core,RickMohr/otm-core,recklessromeo/otm-core,recklessromeo/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,clever-crow-consulting/otm-core,...
6c3621aa5d3936953da027efde9dd3622da50d38
virtool/indexes/models.py
virtool/indexes/models.py
import enum from sqlalchemy import Column, Integer, String, Enum from virtool.pg.utils import Base, SQLEnum class IndexType(str, SQLEnum): """ Enumerated type for index file types """ json = "json" fasta = "fasta" bowtie2 = "bowtie2" class IndexFile(Base): """ SQL model to store n...
from sqlalchemy import Column, Enum, Integer, String from virtool.pg.utils import Base, SQLEnum class IndexType(str, SQLEnum): """ Enumerated type for index file types """ json = "json" fasta = "fasta" bowtie2 = "bowtie2" class IndexFile(Base): """ SQL model to store new index fil...
Fix incorrect column in IndexFile model
Fix incorrect column in IndexFile model * Change `reference` to `index`. * Removed unused import of `enum`
Python
mit
igboyes/virtool,virtool/virtool,virtool/virtool,igboyes/virtool
ba2913658e3770ef73d0e7972435def32199cc08
test.py
test.py
import random from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np def generate_data(size): """" x_train = [] y_train = [] for i in range(size): x = random.randint(0, 100) y = 2*x x_train.append(x) y_train.append(y) return...
import random from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np def generate_data(size): """" x_train = [] y_train = [] for i in range(size): x = random.randint(0, 100) y = 2*x x_train.append(x) y_train.append(y) return...
Fix lirear regression model loss calculation
Fix lirear regression model loss calculation
Python
apache-2.0
alexkorep/dogs-vs-cats
e1dffa732ab0a2f9468e16c026a392e3d35cdd9c
main.py
main.py
import slackclient import time import os
import slackclient import time import os slackClient = slackClient.SLackClient(os.environ["SLACK_TOKEN"]) slackClient.rtm_connect() while True: print(slackClient.rtm_read()) time.sleep(5)
Add test of slack rtm read
Add test of slack rtm read
Python
mit
ollien/Slack-Welcome-Bot
7d6c60898dd2708df07847253bca86049a33ed78
SigmaPi/SigmaPi/urls.py
SigmaPi/SigmaPi/urls.py
from django.conf.urls import include, url from django.conf import settings from django.conf.urls.static import static # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = [ # Examples: # url(r'^$', 'SigmaPi.views.home', name='home'), # ur...
import warnings from django.conf.urls import include, url from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() # Turns deprecation warnings into errors warnings.simplefilter('error', DeprecationWarning) urlpatterns = [ # Examples: ...
Fix admin URLs; turn deprecation warnings into errors
Fix admin URLs; turn deprecation warnings into errors
Python
mit
sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web
56c173a9f1bd1f22448a33b044283ad0d7bcf16e
tests/test_views.py
tests/test_views.py
from django.test import LiveServerTestCase try: from django.urls import reverse except ImportError: # django < 1.10 from django.core.urlresolvers import reverse from tusclient import client class TestUploadView(LiveServerTestCase): def test_get_is_not_allowed(self): response = self.client.get(...
try: from django.urls import reverse except ImportError: # django < 1.10 from django.core.urlresolvers import reverse from tusclient.client import TusClient class TestUploadView(object): def test_get_is_not_allowed(self, client): response = client.get(reverse('tus_upload')) assert respo...
Refactor view to use fixtures from `pytest-django`.
Refactor view to use fixtures from `pytest-django`.
Python
mit
alican/django-tus
4b3428bca7bf9afd448d8c8da1633756a2e540fe
app/models.py
app/models.py
from app import db from hashlib import md5 class User(db.Model): id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(64), index=True, unique=True) email = db.Column(db.String(120), index=True, unique=True) posts = db.relationship('Post', backref='author', lazy='dynamic') d...
from app import db from hashlib import md5 class User(db.Model): id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(64), index=True, unique=True) email = db.Column(db.String(120), index=True, unique=True) posts = db.relationship('Post', backref='author', lazy='dynamic') ab...
Add more attributes for User, update db
Add more attributes for User, update db
Python
mit
ddayguerrero/blogme,ddayguerrero/blogme,ddayguerrero/blogme,ddayguerrero/blogme,ddayguerrero/blogme
e165143ff629c193a2e9c31874b66c0925de3c60
sgpublish/io/maya.py
sgpublish/io/maya.py
from __future__ import absolute_import from . import base from maya import cmds __also_reload__ = ['.base'] class Exporter(base.Exporter): def get_previous_publish_ids(self): ids = cmds.fileInfo('sgpublish_%s_ids' % self.publish_type, query=True) return set(int(x.strip()) for x in ids[0].s...
from __future__ import absolute_import import os from . import base from maya import cmds __also_reload__ = ['.base'] class Exporter(base.Exporter): def __init__(self, *args, **kwargs): super(Exporter, self).__init__(*args, **kwargs) @property def filename_hint(self): return ...
Add more defaults to Maya exporter
Add more defaults to Maya exporter
Python
bsd-3-clause
westernx/sgpublish
429d701cce7ad2cf8fb77f169c4af6f2f27562fd
db_mutex/models.py
db_mutex/models.py
from django.db import models class DBMutex(models.Model): """ Models a mutex lock with a ``lock_id`` and a ``creation_time``. :type lock_id: str :param lock_id: A unique CharField with a max length of 256 :type creation_time: datetime :param creation_time: The creation time of the mutex lock...
from django.db import models class DBMutex(models.Model): """ Models a mutex lock with a ``lock_id`` and a ``creation_time``. :type lock_id: str :param lock_id: A unique CharField with a max length of 256 :type creation_time: datetime :param creation_time: The creation time of the mutex lock...
Declare app_label in model Meta class to work with Django 1.9
Declare app_label in model Meta class to work with Django 1.9 Fixes RemovedInDjango19Warning: Model class db_mutex.models.DBMutex doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Djan...
Python
mit
minervaproject/django-db-mutex
77d4f2bfcab2cb3ca1b8d1736c51018d69fe0940
rpe/resources/base.py
rpe/resources/base.py
# Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
# Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
Remove generic factory method from Resource
Remove generic factory method from Resource
Python
apache-2.0
forseti-security/resource-policy-evaluation-library
9e013b6123e3eefec64e9e479741a16fe4727ad6
plugins/python/org.eclipse.eclipsemonkey.lang.python.examples/samples/scripts/Views__Web_View.py
plugins/python/org.eclipse.eclipsemonkey.lang.python.examples/samples/scripts/Views__Web_View.py
# # Menu: Examples > Views > Py > Google Web View # Kudos: Paul Colton # License: EPL 1.0 # from org.eclipse.swt.browser import LocationListener from org.eclipse.eclipsemonkey.ui.scriptableView import GenericScriptableView from org.eclipse.ui import IWorkbenchPage class MyLocationListener(LocationListener): def ch...
# # Menu: Examples > Views > Py > Google Web View # Kudos: Paul Colton # License: EPL 1.0 # from org.eclipse.swt.browser import LocationListener from org.eclipse.eclipsemonkey.ui.views import GenericScriptableView from org.eclipse.ui import IWorkbenchPage class MyLocationListener(LocationListener): def changing(se...
Correct sample with new qualified name of the class
Correct sample with new qualified name of the class
Python
epl-1.0
adaussy/eclipse-monkey-revival,adaussy/eclipse-monkey-revival,adaussy/eclipse-monkey-revival
1db1dfe35a97080286577b78f4708cc9afd82232
rx/checkedobserver.py
rx/checkedobserver.py
from rx import Observer from rx.internal.exceptions import ReEntracyException, CompletedException class CheckedObserver(Observer): def __init__(self, observer): self._observer = observer self._state = 0 # 0 - idle, 1 - busy, 2 - done def on_next(self, value): self.check_access() ...
from six import add_metaclass from rx import Observer from rx.internal import ExtensionMethod from rx.internal.exceptions import ReEntracyException, CompletedException class CheckedObserver(Observer): def __init__(self, observer): self._observer = observer self._state = 0 # 0 - idle, 1 - busy, 2 -...
Use extension method for Observer.checked
Use extension method for Observer.checked
Python
mit
dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY
f65f18ceec8abf468b1426cf819c806f2d1d7ff8
auslib/migrate/versions/009_add_rule_alias.py
auslib/migrate/versions/009_add_rule_alias.py
from sqlalchemy import Column, String, MetaData, Table def upgrade(migrate_engine): metadata = MetaData(bind=migrate_engine) def add_alias(table): alias = Column('alias', String(50), unique=True) alias.create(table) add_alias(Table('rules', metadata, autoload=True)) add_alias(Table('r...
from sqlalchemy import Column, String, MetaData, Table def upgrade(migrate_engine): metadata = MetaData(bind=migrate_engine) alias = Column("alias", String(50), unique=True) alias.create(Table("rules", metadata, autoload=True), unique_name="alias_unique") history_alias = Column("alias", String(50)) ...
Fix migration script to make column unique+add index.
Fix migration script to make column unique+add index.
Python
mpl-2.0
testbhearsum/balrog,nurav/balrog,aksareen/balrog,testbhearsum/balrog,tieu/balrog,aksareen/balrog,aksareen/balrog,tieu/balrog,nurav/balrog,nurav/balrog,testbhearsum/balrog,tieu/balrog,mozbhearsum/balrog,mozbhearsum/balrog,aksareen/balrog,mozbhearsum/balrog,nurav/balrog,testbhearsum/balrog,mozbhearsum/balrog,tieu/balrog
6bdec176a7a43b3e6eb65a2c7e639c09a89d43bc
data_models/data_refinery_models/models.py
data_models/data_refinery_models/models.py
from django.db import models from django.utils import timezone class TimeTrackedModel(models.Model): created_at = models.DateTimeField(editable=False) updated_at = models.DateTimeField() def save(self, *args, **kwargs): ''' On save, update timestamps ''' if not self.id: self.c...
from django.db import models from django.utils import timezone class TimeTrackedModel(models.Model): created_at = models.DateTimeField(editable=False) updated_at = models.DateTimeField() def save(self, *args, **kwargs): ''' On save, update timestamps ''' if not self.id: self.c...
Change a comment to mention the organism taxonomy ID from NCBI.
Change a comment to mention the organism taxonomy ID from NCBI.
Python
bsd-3-clause
data-refinery/data_refinery,data-refinery/data_refinery,data-refinery/data_refinery
10e040890f5dd1297aa4fa04ce2cf9e9db447d09
sample/sample/urls.py
sample/sample/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', url(r'^$', 'mini.views.index'), url(r'^about$', 'mini.views.about'), # Examples: # url(r'^$', 'sample.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/...
from django.conf.urls import patterns, include, url from django.contrib import admin from django.views.generic import TemplateView urlpatterns = patterns('', url(r'^$', 'mini.views.index', name='index'), url(r'^about$', TemplateView.as_view(template_name='about.html'), name='about'), # Examples: # url(...
Use a generic TemplateView for the sample's about page
Use a generic TemplateView for the sample's about page
Python
bsd-3-clause
tamarackapp/tamarack-collector-py