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
594923a44d80a2879eb1ed5b9b0a6be11e13c88f
tests/Epsilon_tests/ImportTest.py
tests/Epsilon_tests/ImportTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import EPS from grammpy import EPSILON class ImportTest(TestCase): def test_idSame(self): self.assertEqual(id(EPS),id(EPSILON)...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import EPS from grammpy import EPSILON class ImportTest(TestCase): def test_idSame(self): self.assertEqual(id(EPS), id(EPSILON))...
Revert "Revert "Add tests to compare epsilon with another objects""
Revert "Revert "Add tests to compare epsilon with another objects"" This reverts commit d13b3d89124d03f563c2ee2143ae16eec7d0b191.
Python
mit
PatrikValkovic/grammpy
957047b0ba6be692b2b8385ffb41ae9d626bfe7b
tests/basics/OverflowFunctions.py
tests/basics/OverflowFunctions.py
# Copyright 2012, Kay Hayen, mailto:kayhayen@gmx.de # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
# Copyright 2012, Kay Hayen, mailto:kayhayen@gmx.de # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
Make the test robust against usage for comparisons between minor Python versions.
Make the test robust against usage for comparisons between minor Python versions. Typically, for Wine, I have an older version installed, than my Debian has, and this then fails the test without strict need.
Python
apache-2.0
tempbottle/Nuitka,kayhayen/Nuitka,wfxiang08/Nuitka,tempbottle/Nuitka,wfxiang08/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,tempbottle/Nuitka,wfxiang08/Nuitka,kayhayen/Nuitka,wfxiang08/Nuitka,tempbottle/Nuitka
34fda0b20a87b94d7413054bfcfc81dad0ecde19
utils/get_message.py
utils/get_message.py
import amqp from contextlib import closing def get_message(queue): """ Get the first message from a queue. The first message from a queue is retrieved. If there is no such message, the function exits quietly. :param queue: The name of the queue from which to get the message. Usage:: >>> from ...
import amqp from contextlib import closing def __get_channel(connection): return connection.channel() def __get_message_from_queue(channel, queue): return channel.basic_get(queue=queue) def get_message(queue): """ Get the first message from a queue. The first message from a queue is retrieved. If t...
Revert "Remove redundant functions (one too many levels of abstraction)@"
Revert "Remove redundant functions (one too many levels of abstraction)@" This reverts commit 9c5bf06d1427db9839b1531aa08e66574c7b4582.
Python
mit
jdgillespie91/trackerSpend,jdgillespie91/trackerSpend
7eb8da13a873604f12dd9a4b9e890be7447115c4
tests/services/authorization/test_service.py
tests/services/authorization/test_service.py
""" :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.authorization import service as authorization_service from tests.base import AbstractAppTestCase class AuthorizationServiceTestCase(AbstractAppTestCase): def test_get_permission_ids_for_user...
""" :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.authorization import service as authorization_service from tests.base import AbstractAppTestCase from tests.helpers import assign_permissions_to_user class AuthorizationServiceTestCase(AbstractAp...
Use existing test helper to create and assign permissions and roles
Use existing test helper to create and assign permissions and roles
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps
2b6f3687c5203364ce3d935e10a05fbcc1b16ed5
tests/messenger/messaging_test.py
tests/messenger/messaging_test.py
import os import vcr_unittest from app.messenger import messaging class MessagingTestCase(vcr_unittest.VCRTestCase): def setUp(self): self.access_token = os.environ['ACCESS_TOKEN'] self.user_id = '100011269503253' def test_send_main_menu(self): response = messaging.send_main_me...
import os import vcr_unittest from app.messenger import messaging class MessagingTestCase(vcr_unittest.VCRTestCase): def setUp(self): self.access_token = os.environ['ACCESS_TOKEN'] self.user_id = '474276666029691' def test_send_main_menu(self): response = messaging.send_main_me...
Replace test user_id with a correct one
Replace test user_id with a correct one
Python
mit
Stark-Mountain/meetup-facebook-bot,Stark-Mountain/meetup-facebook-bot
bfed3c6b45810d2dacfbf71e499e450a0c762ad7
django_rq/decorators.py
django_rq/decorators.py
from rq.decorators import job from .queues import get_queue class job(job): """ The same as RQ's job decorator, but it works automatically works out the ``connection`` argument from RQ_QUEUES. """ def __init__(self, queue, connection=None, *args, **kwargs): if isinstance(queue, b...
from rq.decorators import job as _rq_job from .queues import get_queue def job(func_or_queue, connection=None, *args, **kwargs): """ The same as RQ's job decorator, but it works automatically works out the ``connection`` argument from RQ_QUEUES. And also, it allows simplified ``@job`` syntax to put ...
Allow simple syntax for `job` decorator.
Allow simple syntax for `job` decorator. It is nice to use simple syntax: @job def some_func(): pass in cases, when you have only 'default' queue.
Python
mit
mjec/django-rq,ui/django-rq,sbussetti/django-rq,meteozond/django-rq,viaregio/django-rq,1024inc/django-rq,lechup/django-rq,ryanisnan/django-rq,sbussetti/django-rq,lechup/django-rq,ryanisnan/django-rq,1024inc/django-rq,meteozond/django-rq,ui/django-rq,mjec/django-rq,viaregio/django-rq
748a9ebf425f7ff4b28c34bc371735d2a892ec58
snoop/ipython.py
snoop/ipython.py
import ast from snoop import snoop from IPython import get_ipython from IPython.core.magic import Magics, cell_magic, magics_class @magics_class class SnoopMagics(Magics): @cell_magic def snoop(self, _line, cell): shell = get_ipython() filename = shell.compile.cache(cell) code = shell...
import ast from snoop import snoop from IPython.core.magic import Magics, cell_magic, magics_class @magics_class class SnoopMagics(Magics): @cell_magic def snoop(self, _line, cell): filename = self.shell.compile.cache(cell) code = self.shell.compile(cell, filename, 'exec') tracer = sn...
Use shell attribute of magics class
Use shell attribute of magics class
Python
mit
alexmojaki/snoop,alexmojaki/snoop
e5876287aacda81bac2d9937e285d132c7133094
test/tests/python-imports/container.py
test/tests/python-imports/container.py
import platform isWindows = platform.system() == 'Windows' isNotPypy = platform.python_implementation() != 'PyPy' isCaveman = platform.python_version_tuple()[0] == '2' if not isWindows: import curses import readline if isCaveman: import gdbm else: import dbm.gnu if isNotPypy:...
import platform isWindows = platform.system() == 'Windows' isNotPypy = platform.python_implementation() != 'PyPy' isCaveman = platform.python_version_tuple()[0] == '2' if not isWindows: import curses import readline if isCaveman: import gdbm else: import dbm.gnu if isNotPypy:...
Add "lzma" to "python-imports" test
Add "lzma" to "python-imports" test
Python
apache-2.0
docker-library/official-images,infosiftr/stackbrew,31z4/official-images,dinogun/official-images,docker-library/official-images,docker-solr/official-images,docker-library/official-images,docker-library/official-images,neo-technology/docker-official-images,neo-technology/docker-official-images,thresheek/official-images,3...
a5791ea2a229b13eb84cc92bd20d87df93687d5e
cactus/skeleton/plugins/sprites.disabled.py
cactus/skeleton/plugins/sprites.disabled.py
import os import sys import pipes import shutil import subprocess """ This plugin uses glue to sprite images: http://glue.readthedocs.org/en/latest/quickstart.html Install: (Only if you want to sprite jpg too) brew install libjpeg (Only if you want to optimize pngs with optipng) brew install optipng sudo easy_inst...
import os import sys import pipes import shutil import subprocess """ This plugin uses glue to sprite images: http://glue.readthedocs.org/en/latest/quickstart.html Install: (Only if you want to sprite jpg too) brew install libjpeg sudo easy_install pip sudo pip uninstall pil sudo pip install pil sudo pip install gl...
Remove deprecated --optipng from glue options
Remove deprecated --optipng from glue options Optipng is now deprecated in glue, so including that option in Cactus doesn't really make sense. https://github.com/jorgebastida/glue/blob/master/docs/changelog.rst#09
Python
bsd-3-clause
dreadatour/Cactus,fjxhkj/Cactus,juvham/Cactus,andyzsf/Cactus-,Knownly/Cactus,danielmorosan/Cactus,ibarria0/Cactus,danielmorosan/Cactus,page-io/Cactus,koobs/Cactus,andyzsf/Cactus-,PegasusWang/Cactus,chaudum/Cactus,danielmorosan/Cactus,dreadatour/Cactus,juvham/Cactus,eudicots/Cactus,page-io/Cactus,koobs/Cactus,dreadatour...
e2f2fbc0df695102c4d51bdf0e633798c3ae8417
yawf/messages/submessage.py
yawf/messages/submessage.py
from . import Message class Submessage(object): need_lock_object = True def __init__(self, obj, message_id, sender, raw_params, need_lock_object=True): self.obj = obj self.sender = sender self.message_id = message_id self.raw_params = raw_params self.need_lock_object =...
from . import Message class Submessage(object): need_lock_object = True def __init__(self, obj, message_id, sender, raw_params=None, need_lock_object=True): self.obj = obj self.sender = sender self.message_id = message_id self.raw_params = raw_params self.need_lock_obj...
Make raw_params an optional argument in Submessage
Make raw_params an optional argument in Submessage
Python
mit
freevoid/yawf
49ea86d93d75afb1c3a3f95dd72a78b6d78f04cc
sitecustomize.py
sitecustomize.py
import sys import os from combinator.branchmgr import theBranchManager theBranchManager.addPaths() for key in sys.modules.keys(): # Unload all Combinator modules that had to be loaded in order to call # addPaths(). Although the very very beginning of this script needs to # load the trunk combinator (or ...
import sys import os from combinator.branchmgr import theBranchManager theBranchManager.addPaths() for key in sys.modules.keys(): # Unload all Combinator modules that had to be loaded in order to call # addPaths(). Although the very very beginning of this script needs to # load the trunk combinator (or ...
Remove distutils-mangling code from Combinator which breaks setuptools.
Remove distutils-mangling code from Combinator which breaks setuptools. After this change, Combinator will no longer attempt to force 'python setup.py install' to put things into your home directory. Use `setup.py --prefix ~/.local`, or, if your package is trying to use setuptools, `python setup.py --site-dirs ~/.loc...
Python
mit
habnabit/Combinator,habnabit/Combinator
7525ddcd1a0c668045f37e87cbafa4a598b10148
apps/__init__.py
apps/__init__.py
## module loader, goes to see which submodules have 'html' directories ## and declares them at the toplevel import os,importlib def find_module_dirs(): curdir = os.path.dirname(os.path.abspath(__file__)) subdirs = [o for o in os.listdir(curdir) if os.path.exists(os.path.sep.join([curdir,o,'__init__.py']))] ...
## module loader, goes to see which submodules have 'html' directories ## and declares them at the toplevel import os,importlib def find_module_dirs(): curdir = os.path.dirname(os.path.abspath(__file__)) subdirs = [o for o in os.listdir(curdir) if os.path.exists(os.path.sep.join([curdir,o,'__init__.py']))] ...
Handle application erroring to not break the server
Handle application erroring to not break the server
Python
agpl-3.0
indx/indx-core,indx/indx-core,indx/indx-core,indx/indx-core,indx/indx-core
72fb6ca12b685809bd5de0c5df9f051eef1163c4
test/TestBaseUtils.py
test/TestBaseUtils.py
import unittest import sys sys.path.append('../src') import BaseUtils class TestBaseUtils(unittest.TestCase): def test_word_segmenter(self): segments = BaseUtils.get_words('this is a random sentence') self.assertEqual(segments, ['this', 'is', 'a', 'random', 'sentence']) def test_word_segmente...
''' Tests for BaseUtils ''' import unittest import sys sys.path.append('../src') import BaseUtils class TestBaseUtils(unittest.TestCase): ''' Main test class for the BaseUtils ''' def test_word_segmenter_with_empty(self): ''' For an empty string, the segmenter returns just an empty list ''' ...
Add test for empty string; cleanup
Add test for empty string; cleanup
Python
bsd-2-clause
ambidextrousTx/RNLTK
2b8208e2f6ba8554aefc8e984132a0d4084c26ec
open_folder.py
open_folder.py
import os, platform # I intend to hide the Operating Specific details of opening a folder # here in this module. # # On Mac OS X you do this with "open" # e.g. "open '\Users\golliher\Documents\Tickler File'" # On Windows you do this with "explorer" # e.g. "explorer c:\Documents and Settings\Tickler File" # On Lin...
import os, platform, subprocess # I intend to hide the Operating Specific details of opening a folder # here in this module. # # On Mac OS X you do this with "open" # e.g. "open '\Users\golliher\Documents\Tickler File'" # On Windows you do this with "explorer" # e.g. "explorer c:\Documents and Settings\Tickler Fi...
Raise exception if path not found, os not found, or command execution fails.
Raise exception if path not found, os not found, or command execution fails.
Python
mit
golliher/dg-tickler-file
6ed5d899d8c2fbef8c4b40180c497421b9f8e6c4
map_service/serializers.py
map_service/serializers.py
from map_service.models import LkState from map_service.models import SpatialObjects from rest_framework_mongoengine import serializers class LkStateSerializer(serializers.DocumentSerializer): class Meta: model = LkState class SpatialObjectsSerializer(serializers.DocumentSerializer): class Meta: ...
from map_service.models import LkState from map_service.models import SpatialObjects from rest_framework_mongoengine import serializers class LkStateSerializer(serializers.DocumentSerializer): class Meta: model = LkState fields = '__all__' class SpatialObjectsSerializer(serializers.DocumentSerial...
Fix Compatibility issue with django 1.8+
Fix Compatibility issue with django 1.8+
Python
apache-2.0
tmkasun/Knnect,tmkasun/Knnect,tmkasun/Knnect,tmkasun/Knnect
5ffb645e36fdbb3feae52ac6dfedb1b492f45b8f
examples/list.py
examples/list.py
# Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com> # See LICENSE for details. import sys, os sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from active_redis import ActiveRedis redis = ActiveRedis() # Create an unnamed list. mylist = redis.list() # Append items to the list. mylist.app...
# Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com> # See LICENSE for details. import sys, os sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from active_redis import ActiveRedis redis = ActiveRedis() # Create an unnamed list. mylist = redis.list() # Append items to the list. mylist.app...
Update dict and set examples.
Update dict and set examples.
Python
mit
kuujo/active-redis
ce4bb4b0868e45459771531b9008f492f920c406
project/commands/main.py
project/commands/main.py
"""The ``main`` function chooses and runs a subcommand.""" from __future__ import absolute_import, print_function from argparse import ArgumentParser, RawDescriptionHelpFormatter import project.commands.launch as launch import project.commands.prepare as prepare import project.commands.activate as activate def _run...
"""The ``main`` function chooses and runs a subcommand.""" from __future__ import absolute_import, print_function import sys from argparse import ArgumentParser, RawDescriptionHelpFormatter import project.commands.launch as launch import project.commands.prepare as prepare import project.commands.activate as activate...
Revert "remove unecessary sys.exit call"
Revert "remove unecessary sys.exit call" This reverts commit 50b79fec1e96c1e5e5cc17f58f2c4ccfba16d6d6.
Python
bsd-3-clause
conda/kapsel,conda/kapsel
f808dbbd28e750a7be440394865e708c78938c6c
test/test_compiled.py
test/test_compiled.py
""" Test compiled module """ import os import platform import sys import jedi from .helpers import cwd_at @cwd_at('extensions') def test_compiled(): if platform.architecture()[0] == '64bit': package_name = "compiled%s%s" % sys.version_info[:2] if os.path.exists(package_name): s = jedi...
""" Test compiled module """ import os import platform import sys import jedi from .helpers import cwd_at @cwd_at('extensions') def test_compiled(): if platform.architecture()[0] == '64bit': package_name = "compiled%s%s" % sys.version_info[:2] sys.path.insert(0, os.getcwd()) if os.path.ex...
Change sys.path for the test to succeed.
Change sys.path for the test to succeed. Tested locally with a python3 extension module (in /extensions/compiled33). Also tested that reverting a75773cf9f7a9fde2a7b2c77b9846b4f0dd5b711 make the test fail.
Python
mit
flurischt/jedi,tjwei/jedi,jonashaag/jedi,dwillmer/jedi,tjwei/jedi,WoLpH/jedi,flurischt/jedi,dwillmer/jedi,mfussenegger/jedi,jonashaag/jedi,WoLpH/jedi,mfussenegger/jedi
df227a375c1cf5fdd0ad23505799e7c6f7177b9c
InvenTree/InvenTree/validators.py
InvenTree/InvenTree/validators.py
""" Custom field validators for InvenTree """ from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ def validate_part_name(value): # Prevent some illegal characters in part names for c in ['/', '\\', '|', '#', '$']: if c in str(value): r...
""" Custom field validators for InvenTree """ from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ def validate_part_name(value): # Prevent some illegal characters in part names for c in ['|', '#', '$']: if c in str(value): raise Valida...
Allow some more chars in part names
Allow some more chars in part names
Python
mit
inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree
33496a58852bcdb2ef9f3cbe1881b06efd48b624
script/sample/submitshell.py
script/sample/submitshell.py
#!/usr/bin/env python import multyvac multyvac.config.set_key(api_key='admin', api_secret_key='12345', api_url='http://docker:8000/api') jid = multyvac.shell_submit(cmd='for i in {1..10}; do echo $i && sleep 10; done') print("Submitted job [{}].".format(jid)) job = multyvac.get(jid) result = job.get_result() print(...
#!/usr/bin/env python from __future__ import print_function import multyvac import sys multyvac.config.set_key(api_key='admin', api_secret_key='12345', api_url='http://docker:8000/api') jobs = { "stdout result": { "cmd": 'echo "success"', }, "file result": { "cmd": 'echo "success" > /tmp...
Test different mechanisms for job submission.
Test different mechanisms for job submission.
Python
bsd-3-clause
cloudpipe/cloudpipe,cloudpipe/cloudpipe,cloudpipe/cloudpipe
ca138dac13d032ac8f55ca0a5ebf4e1ffe2cab72
fuckit_commit.py
fuckit_commit.py
''' This module will send SMS reminders periodically, using Twilio. The aim is to encourage user to code, commit and push to GitHub everyday ''' import requests from twilio.rest import TwilioRestClient from datetime import datetime, date def send_sms(): ''' Send SMS reminder ''' config = {'account_sid...
''' This module will send SMS reminders periodically, using Twilio. The aim is to encourage user to code, commit and push to GitHub everyday ''' import requests from twilio.rest import TwilioRestClient from datetime import datetime, date def send_sms(): ''' Send SMS reminder ''' config = {'account_sid...
Add condition to check for latest commit activity
Add condition to check for latest commit activity
Python
mit
ueg1990/fuckit_commit
fd9f9bb2f471a8c14e7d34276060be953795538f
nightreads/emails/admin.py
nightreads/emails/admin.py
from django.contrib import admin from django.conf.urls import url from .models import Email, Tag from .views import SendEmailAdminView, UpdateTargetCountView from .forms import EmailAdminForm class EmailAdmin(admin.ModelAdmin): form = EmailAdminForm readonly_fields = ('targetted_users', 'is_sent',) add_f...
from django.contrib import admin from django.conf.urls import url from .models import Email, Tag from .views import SendEmailAdminView, UpdateTargetCountView from .forms import EmailAdminForm class EmailAdmin(admin.ModelAdmin): list_display = ['__str__', 'is_sent'] list_filter = ['is_sent'] form = EmailA...
Add filters to Email Admin List View
Add filters to Email Admin List View
Python
mit
avinassh/nightreads,avinassh/nightreads
7ba23ab480df92025c3d76c4afa6d56987088899
serialenum.py
serialenum.py
import os import os.path import sys def enumerate(): ports = [] if sys.platform == 'win32': # Iterate through registry because WMI does not show virtual serial ports import _winreg key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'HARDWARE\DEVICEMAP\SERIALCOMM') i = 0 ...
import os import os.path import sys def enumerate(): ports = [] if sys.platform == 'win32': # Iterate through registry because WMI does not show virtual serial ports import _winreg key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'HARDWARE\DEVICEMAP\SERIALCOMM') i = 0 ...
Return None for unsupported platforms
Return None for unsupported platforms
Python
bsd-2-clause
djs/serialenum
8fa895189696e83e6120875886bc8888e0509195
bin/confluent-server.py
bin/confluent-server.py
import sys import os path = os.path.dirname(os.path.realpath(__file__)) path = os.path.realpath(os.path.join(path, '..')) sys.path.append(path) from confluent import main main.run()
import sys import os path = os.path.dirname(os.path.realpath(__file__)) path = os.path.realpath(os.path.join(path, '..')) sys.path.append(path) from confluent import main #import cProfile #import time #p = cProfile.Profile(time.clock) #p.enable() #try: main.run() #except: # pass #p.disable() #p.print_stats(sort='cum...
Put comments in to hint a decent strategy to profile runtime performance
Put comments in to hint a decent strategy to profile runtime performance To do performance optimization in this sort of application, this is about as well as I have been able to manage in python. I will say perl with NYTProf seems to be significantly better for data, but this is servicable. I tried yappi, but it goe...
Python
apache-2.0
chenglch/confluent,whowutwut/confluent,jufm/confluent,jufm/confluent,michaelfardu/thinkconfluent,xcat2/confluent,jjohnson42/confluent,jjohnson42/confluent,whowutwut/confluent,chenglch/confluent,michaelfardu/thinkconfluent,jufm/confluent,michaelfardu/thinkconfluent,xcat2/confluent,xcat2/confluent,xcat2/confluent,jjohnso...
5b681f55896af1aec9f71bc86c1f17f60a66e4bd
pyfr/syutil.py
pyfr/syutil.py
# -*- coding: utf-8 -*- import sympy as sy def lagrange_basis(points, sym): """Generates a basis of polynomials, :math:`l_i(x)`, such that .. math:: l_i(x) = \delta^x_{p_i} where :math:`p_i` is the i'th entry in *points* and :math:`x \in p`. """ n = len(points) lagrange_poly = sy.inter...
# -*- coding: utf-8 -*- import sympy as sy def lagrange_basis(points, sym): """Generates a basis of polynomials, :math:`l_i(x)`, such that .. math:: l_i(x) = \delta^x_{p_i} where :math:`p_i` is the i'th entry in *points* and :math:`x \in p`. """ n = len(points) lagrange_poly = sy.inter...
Add a function for generating normalised Jacobi polynomials.
Add a function for generating normalised Jacobi polynomials.
Python
bsd-3-clause
BrianVermeire/PyFR,tjcorona/PyFR,iyer-arvind/PyFR,tjcorona/PyFR,tjcorona/PyFR,Aerojspark/PyFR
2714cf4ff5639761273c91fd360f3b0c7cbf1f8b
github_ebooks.py
github_ebooks.py
#!/usr/bin/python import sys def main(argv): return 0 if __name__ == "__main__": sys.exit(main(sys.argv))
#!/usr/bin/python import sys import argparse import codecs from Database import Database def readFromFile(path, db): f = codecs.open(path, 'r', 'utf-8') commits = [] for line in f: line = line.strip() commits.append((hash(line), line)) db.addCommits(commits) def printCommits(db): for (hash, msg) ...
Add a way to scrape commits from a file.
Add a way to scrape commits from a file.
Python
mit
Fifty-Nine/github_ebooks
26b587086ad4e3eb3c9e15c2c3d96d6f7e5dba21
compshop/urls.py
compshop/urls.py
"""compshop URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
"""compshop URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
Move catalogue to products URL namespace
Move catalogue to products URL namespace
Python
bsd-3-clause
kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,andela-kndungu/compshop,kevgathuku/compshop
e8ba913722218c86b2b705d8351795a409a514ac
pale/arguments/__init__.py
pale/arguments/__init__.py
from .base import BaseArgument, ListArgument from .boolean import BooleanArgument from .number import IntegerArgument from .scope import ScopeArgument from .string import StringArgument, StringListArgument from .url import URLArgument
from .base import BaseArgument, ListArgument from .boolean import BooleanArgument from .number import FloatArgument, IntegerArgument from .scope import ScopeArgument from .string import StringArgument, StringListArgument from .url import URLArgument
Add FloatArgument to arguments module
Add FloatArgument to arguments module
Python
mit
Loudr/pale
330c90c9bc8b4c6d8df4d15f503e9a483513e5db
install/setup_pi_box.py
install/setup_pi_box.py
import os import sys import shutil if not os.path.exists('/opt/Pi-Box'): os.makedirs('/opt/Pi-Box') shutil.copy('./main.py', '/opt/Pi-Box') if not os.path.exists('/opt/Pi-Box/dropbox.txt'): print('Dropbox token file (dropbox.txt) not found.') print('Authorize Pi-Box and obtain the token file: blah, blah, blah') ...
import os import sys import shutil if not os.path.exists('/opt/Pi-Box'): os.makedirs('/opt/Pi-Box') shutil.copy('./main.py', '/opt/Pi-Box') if not os.path.exists('/opt/Pi-Box/dropbox.txt'): print('Authorize Pi-Box and obtain the token file: http://raspberry-pi-box.herokuapp.com/') print('Copy Dropbox token file (...
Add URL to setup script
Add URL to setup script
Python
mit
projectweekend/Pi-Box,projectweekend/Pi-Box
69cd2732bb629a52da81b865497089c19f29407a
examples/juniper/get-interface-status.py
examples/juniper/get-interface-status.py
#!/usr/bin/env python # Python script to fetch interface name and their operation status from ncclient import manager def connect(host, port, user, password): conn = manager.connect(host=host, port=port, username=user, password=password, timeout=10, dev...
#!/usr/bin/env python # Python script to fetch interface name and their operation status from ncclient import manager def connect(host, port, user, password): conn = manager.connect(host=host, port=port, username=user, password=password, timeout=10, dev...
Remove unused statement & format for python3
Remove unused statement & format for python3
Python
apache-2.0
GIC-de/ncclient,leopoul/ncclient,earies/ncclient,einarnn/ncclient,vnitinv/ncclient,ncclient/ncclient,nwautomator/ncclient
91865fc50b66dc261cf05bba21a371e1130b25f5
integration-test/605-crosswalk-sidewalk.py
integration-test/605-crosswalk-sidewalk.py
# http://www.openstreetmap.org/way/367477828 assert_has_feature( 16, 10471, 25331, 'roads', { 'id': 367477828, 'kind': 'path', 'crossing': 'zebra' }) # Way: The Embarcadero (397140734) # http://www.openstreetmap.org/way/397140734 assert_has_feature( 16, 10486, 25326, 'roads', { 'id': 397140734, 'kind':...
# http://www.openstreetmap.org/way/444491374 assert_has_feature( 16, 10475, 25332, 'roads', { 'id': 444491374, 'kind': 'path', 'crossing': 'traffic_signals' }) # Way: The Embarcadero (397140734) # http://www.openstreetmap.org/way/397140734 assert_has_feature( 16, 10486, 25326, 'roads', { 'id': 39714073...
Update osm way used due to data change
Update osm way used due to data change
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
71db89cad06dc0aa81e0a7178712e8beb7e7cb01
turbustat/tests/test_cramer.py
turbustat/tests/test_cramer.py
# Licensed under an MIT open source license - see LICENSE ''' Test functions for Cramer ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import Cramer_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testCramer...
# Licensed under an MIT open source license - see LICENSE ''' Test functions for Cramer ''' import numpy.testing as npt from ..statistics import Cramer_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances def test_cramer(): tester = \ Cramer_Distance(dataset1...
Remove importing UnitCase from Cramer tests
Remove importing UnitCase from Cramer tests
Python
mit
Astroua/TurbuStat,e-koch/TurbuStat
b4525469d227e1878e9ded3f541577b3487b7d9e
run_game.py
run_game.py
#!/usr/bin/env python """Point of execution for play. Configures module path and libraries and then calls lib.main.main. """ import sys sys.path.insert(0, 'pyglet-c9188efc2e30') import getopt import os import ookoobah.main def run(): ookoobah.main.main() if __name__ == "__main__": # Change to the game dir...
#!/usr/bin/env python """Point of execution for play. Configures module path and libraries and then calls lib.main.main. """ import os import sys import getopt if __name__ == "__main__": # Change to the game directory os.chdir(os.path.dirname(os.path.join(".", sys.argv[0]))) sys.path.insert(0, 'pyglet-c...
Fix pyglet and game loading.
Fix pyglet and game loading.
Python
mit
vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah
10ec59777c0b364e05dc022ac3178d0c6d0ca916
plugin/formatters.py
plugin/formatters.py
import json from collections import OrderedDict def format_json(input, settings=None): indent = 4 if settings: indent = settings.get('tab_size', indent) try: data = json.loads(input, object_pairs_hook=OrderedDict) return json.dumps(data, indent=indent, separators=(',', ': ')), None...
import json from collections import OrderedDict def format_json(input, settings=None): indent = 4 if settings: indent = settings.get('tab_size', indent) try: data = json.loads(input, object_pairs_hook=OrderedDict) return True, json.dumps(data, indent=indent, separators=(',', ': '))...
Fix parsing of JSON formatting errors
Fix parsing of JSON formatting errors
Python
mit
Rypac/sublime-format
ac571170c4ba8db7899c0323778933edc46dd025
salt/runners/pillar.py
salt/runners/pillar.py
# -*- coding: utf-8 -*- ''' Functions to interact with the pillar compiler on the master ''' # Import salt libs import salt.pillar import salt.utils.minions def show_top(minion=None, saltenv='base'): ''' Returns the compiled top data for pillar for a specific minion. If no minion is specified, we use th...
# -*- coding: utf-8 -*- ''' Functions to interact with the pillar compiler on the master ''' # Import salt libs import salt.pillar import salt.utils.minions def show_top(minion=None, saltenv='base'): ''' Returns the compiled top data for pillar for a specific minion. If no minion is specified, we use th...
Use the new get_minion_data function
Use the new get_minion_data function
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
e70856cb18fa86f955dda6cb18cddbdc431a5577
chipy_org/libs/social_auth_pipelines.py
chipy_org/libs/social_auth_pipelines.py
from django.utils.translation import ugettext from django.contrib.auth.models import User from social_auth.backends.pipeline.user import create_user as social_auth_create_user from social_auth.exceptions import AuthAlreadyAssociated def create_user(backend, details, response, uid, username, user = None, is_new = Fals...
from django.utils.translation import ugettext from django.contrib.auth.models import User from social_auth.backends.pipeline.user import create_user as social_auth_create_user from social_auth.exceptions import AuthAlreadyAssociated def create_user(backend, details, response, uid, username, user = None, is_new = Fals...
Revert "Fixes to the create_user pipeline"
Revert "Fixes to the create_user pipeline" This reverts commit 49dd1b5205498425f7af247f7c390a48a423db4c.
Python
mit
chicagopython/chipy.org,brianray/chipy.org,brianray/chipy.org,bharathelangovan/chipy.org,bharathelangovan/chipy.org,chicagopython/chipy.org,agfor/chipy.org,tanyaschlusser/chipy.org,tanyaschlusser/chipy.org,chicagopython/chipy.org,tanyaschlusser/chipy.org,agfor/chipy.org,chicagopython/chipy.org,brianray/chipy.org,bharat...
e09af91b45355294c16249bcd3c0bf07982cd39c
websaver/parsed_data/models.py
websaver/parsed_data/models.py
from django.db import models # Create your models here. class RatingData(models.Model): userName = models.CharField(max_length=30) solofpp = models.CharField(max_length=5, null=True) duofpp = models.CharField(max_length=5, null=True) squadfpp = models.CharField(max_length=5, null=True) solo = model...
from django.db import models # Create your models here. class RatingData(models.Model): userName = models.CharField(max_length=30) solofpp = models.CharField(max_length=5, null=True) duofpp = models.CharField(max_length=5, null=True) squadfpp = models.CharField(max_length=5, null=True) solo =...
Add fpp k/d data to the model.
Add fpp k/d data to the model.
Python
mit
aiirohituzi/myWebCrawler,aiirohituzi/myWebCrawler,aiirohituzi/myWebCrawler
1ee8f9dcb74d65e22bf785692a696ec743bcb932
pyatmlab/__init__.py
pyatmlab/__init__.py
#!/usr/bin/env python from . import meta __version__ = "0.1.0+" __doc__ = """This is pyatmlab """ from pint import UnitRegistry ureg = UnitRegistry()
#!/usr/bin/env python from . import meta __version__ = "0.1.0+" __doc__ = """This is pyatmlab """ from pint import UnitRegistry ureg = UnitRegistry() ureg.define("micro- = 1e-6 = µ-")
Use µ- prefix rather than u-
Use µ- prefix rather than u-
Python
bsd-3-clause
olemke/pyatmlab,gerritholl/pyatmlab
fe547c93a476b5093930ff08fef8fe48a16dc930
examples/monitoring/ligier_mirror.py
examples/monitoring/ligier_mirror.py
#!/usr/bin/env python # coding=utf-8 # vim: ts=4 sw=4 et """ ============= Ligier Mirror ============= Subscribes to given tag(s) and sends them to another Ligier. """ # Author: Tamas Gal <tgal@km3net.de> # License: MIT from __future__ import division import socket from km3pipe import Pipeline, Module from km3pipe....
#!/usr/bin/env python # coding=utf-8 # vim: ts=4 sw=4 et """ ============= Ligier Mirror ============= Subscribes to given tag(s) and sends them to another Ligier. This script is also available as a command line utility in km3pipe, which can be accessed by the command ``ligiermirror``. """ # Author: Tamas Gal <tgal@k...
Add ref to ligiermirror CLU
Add ref to ligiermirror CLU
Python
mit
tamasgal/km3pipe,tamasgal/km3pipe
8e5a84a62662779cbf3965f5460b320f68d66c6a
alg_strongly_connected_graph.py
alg_strongly_connected_graph.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division def dfs_recur(): pass def traverse_dfs_recur(): pass def transpose_graph(): pass def strongly_connected_graph(): """Find strongly connected graph by Kosaraju's Algorithm.""" def main(): pass i...
from __future__ import absolute_import from __future__ import print_function from __future__ import division def dfs_recur(): pass def traverse_dfs_recur(): pass def transpose_graph(): pass def strongly_connected_graph(): """Find strongly connected graphs by Kosaraju's Algorithm.""" def main(): adjace...
Add adjacency_dict for strongly connected graphs
Add adjacency_dict for strongly connected graphs
Python
bsd-2-clause
bowen0701/algorithms_data_structures
201863f214e54feca811185151bf953d1eedca6d
app/ml_models/affect_ai_test.py
app/ml_models/affect_ai_test.py
import affect_ai import pytest # words: foo, bar, baz, goo, car, caz, hoo, dar, daz, ioo, ear, eaz, loo, far, faz; corpora: happiness 1, satisfaction 2, elation 2, 3 # Test that an affect_AI object gets created correctly def test_creation(): # We create an affect_ai object with some parameters # We make sure ...
import affect_ai import pytest # words: foo, bar, baz, goo, car, caz, hoo, dar, daz, ioo, ear, eaz, loo, far, faz; corpora: happiness 1, satisfaction 2, elation 2, 3 ai = affect_ai.affect_AI(15, 5) # Test that an affect_AI object gets created correctly def test_creation(): # We create an affect_ai object with som...
Write part of a test
chore: Write part of a test
Python
mit
OmegaHorizonResearch/agile-analyst
6c3f869150e5797c06b5f63758280b60e296d658
core/admin.py
core/admin.py
from django.contrib import admin from django.contrib.admin.forms import AdminAuthenticationForm from django import forms class NavigatorLoginForm(AdminAuthenticationForm): username = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'off'})) admin.site.login_form = NavigatorLoginForm
from django.contrib import admin from django.contrib.admin.forms import AdminAuthenticationForm from django import forms class NavigatorLoginForm(AdminAuthenticationForm): username = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'off'})) admin.site.login_form = NavigatorLoginForm def get_actio...
Remove the bulk delete action if the user does not have delete permissions on the model being viewed
Remove the bulk delete action if the user does not have delete permissions on the model being viewed
Python
mit
uktrade/navigator,uktrade/navigator,uktrade/navigator,uktrade/navigator
8b51c9904fd09354ff5385fc1740d9270da8287c
should-I-boot-this.py
should-I-boot-this.py
#!/usr/bin/env python3 # -*- coding:utf-8 -* # import os import sys import configparser """ To test the script, just export those variables and play with their values export LAB=lab-free-electrons export TREE=mainline """ config = configparser.ConfigParser() config.read('labs.ini') # Check if we need to stop here ...
#!/usr/bin/env python3 # -*- coding:utf-8 -* # import os import sys import configparser """ To test the script, just export those variables and play with their values export LAB=lab-free-electrons export TREE=mainline """ config = configparser.ConfigParser() config.read('labs.ini') # Is the lab existing? if os.env...
Allow boots for unknown labs
jenkins: Allow boots for unknown labs Signed-off-by: Florent Jacquet <692930aa2e4df70616939784b5b6c25eb1f2335c@free-electrons.com>
Python
lgpl-2.1
kernelci/lava-ci-staging,kernelci/lava-ci-staging,kernelci/lava-ci-staging
2434c06d806fd10832ebae73408021dbc1470269
test_settings.py
test_settings.py
from os.path import expanduser from foundry.settings import * # Postgis because we want to test full functionality DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'jmbo_spatial', 'USER': 'postgres', 'PASSWORD': '', 'HOST': '', ...
from os.path import expanduser from foundry.settings import * # Postgis because we want to test full functionality DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'jmbo_spatial', 'USER': 'postgres', 'PASSWORD': '', 'HOST': '', ...
Test all the Jmbo content types
Test all the Jmbo content types
Python
bsd-3-clause
praekelt/jmbo-foundry,praekelt/jmbo-foundry,praekelt/jmbo-foundry
038a905e58c42881c12d53911eb70926cfbc76f2
nsq/util.py
nsq/util.py
'''Some utilities used around town''' import struct def pack(message): '''Pack the provided message''' if isinstance(message, basestring): # Return # [ 4-byte message size ][ N-byte binary data ] return struct.pack('>l', len(message)) + message else: # Return # [ 4...
'''Some utilities used around town''' import struct def pack_string(message): '''Pack a single message in the TCP protocol format''' # [ 4-byte message size ][ N-byte binary data ] return struct.pack('>l', len(message)) + message def pack_iterable(messages): '''Pack an iterable of messages in the T...
Fix failing test about passing nested iterables to pack
Fix failing test about passing nested iterables to pack
Python
mit
dlecocq/nsq-py,dlecocq/nsq-py
513560a051d9388cd39384860ddce6a938501080
bad.py
bad.py
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver = webdriver.Chrome() driver.get("http://clickingbad.nullism.com/") num_cooks = 100 num_sells = 50 cook = driver.find_element_by_id('make_btn') sell = driver.find_element_by_id('sell_btn') while True: try: c...
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver = webdriver.Chrome() driver.get("http://clickingbad.nullism.com/") # Amount you'd like to have in terms of cash and # drugs to start the game init_drugs = 10000 init_cash = 10000 # Number of cooks and sells to do in a r...
Allow user to set their initial amount of cash and drugs
Allow user to set their initial amount of cash and drugs
Python
apache-2.0
brint/cheating_bad
428e1e669e8b5e59da2c4d87716ffd329b4a084a
test/bluezutils.py
test/bluezutils.py
import dbus SERVICE_NAME = "org.bluez" ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter" def get_managed_objects(): bus = dbus.SystemBus() manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") return manager.GetManagedObjects() def find_adapter(pattern=None): return fin...
import dbus SERVICE_NAME = "org.bluez" ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter" DEVICE_INTERFACE = SERVICE_NAME + ".Device" def get_managed_objects(): bus = dbus.SystemBus() manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") return manager.GetManagedObjects() ...
Add helper function to find devices
test: Add helper function to find devices Add a helper function to the utility library as an alternative to the convenience method Adapter.FindDevice() in the D-Bus API.
Python
lgpl-2.1
silent-snowman/bluez,pstglia/external-bluetooth-bluez,ComputeCycles/bluez,mapfau/bluez,ComputeCycles/bluez,mapfau/bluez,pstglia/external-bluetooth-bluez,pkarasev3/bluez,pkarasev3/bluez,pkarasev3/bluez,pstglia/external-bluetooth-bluez,pkarasev3/bluez,ComputeCycles/bluez,mapfau/bluez,ComputeCycles/bluez,silent-snowman/bl...
8cd193b9e842918c03aa25ce0eaf1cca1c843c95
rrsm/StateMachine.py
rrsm/StateMachine.py
class StateMachine(object): def __init__(self,RequiredStates,InitialState=0): self.States = RequiredStates self.StateCodes = dict([(v,k) for k,v in RequiredStates.iteritems()]) # This is done for speed of the rest of the class self.SwitchTo(InitialState) ...
class StateMachine(object): def __init__(self,RequiredStates,InitialState=0): if type(RequiredStates) is dict: self.States = RequiredStates self.StateCodes = dict([(code,state) for state,code in RequiredStates.iteritems()]) # This is done for speed of the rest of the class ...
Enable Dictionaries or Lists to create the Machine
Enable Dictionaries or Lists to create the Machine
Python
mit
jnmclarty/rrsm
6d5eaee8b1c13eb08cbf48b4c72c5b2d8f0d96b4
test/runner.py
test/runner.py
import sys import os import test.cache as tc import test.dateandtime as td import test.nagios as tn import test.generaloption as tg import unittest suite = unittest.TestSuite([x.suite() for x in (tc, td, tn, tg)]) try: import xmlrunner rs = xmlrunner.XMLTestRunner(output="test-reports").run(suite) except Imp...
# -*- encoding: utf-8 -*- import sys import os import test.cache as tc import test.dateandtime as td import test.nagios as tn import test.generaloption as tg import test.nagios_results as tr import unittest suite = unittest.TestSuite([x.suite() for x in (tc, td, tn, tg, tr)]) try: import xmlrunner rs = xmlru...
Rename the nagios-results test suite into a valid identifier.
Rename the nagios-results test suite into a valid identifier. This way, we can run its tests from within a test.runner module.
Python
lgpl-2.1
hpcugent/vsc-processcontrol,hpcugent/vsc-processcontrol
90a724313902e3d95f1a37d9102af1544c9bc61d
segments/set_term_title.py
segments/set_term_title.py
def add_term_title_segment(): term = os.getenv('TERM') if not (('xterm' in term) or ('rxvt' in term)): return if powerline.args.shell == 'bash': set_title = '\\[\\e]0;\\u@\\h: \\w\\a\\]' elif powerline.args.shell == 'zsh': set_title = '\\e]0;%n@%m: %~\\a' else: impor...
def add_term_title_segment(): term = os.getenv('TERM') if not (('xterm' in term) or ('rxvt' in term)): return if powerline.args.shell == 'bash': set_title = '\\[\\e]0;\\u@\\h: \\w\\a\\]' elif powerline.args.shell == 'zsh': set_title = '\033]0;%n@%m: %~\007' else: imp...
Fix use of escape characters in "set terminal title" segment.
Fix use of escape characters in "set terminal title" segment. Escape characters were incorrect for non-BASH shells.
Python
mit
nicholascapo/powerline-shell,b-ryan/powerline-shell,junix/powerline-shell,wrgoldstein/powerline-shell,rbanffy/powerline-shell,b-ryan/powerline-shell,mart-e/powerline-shell,blieque/powerline-shell,paulhybryant/powerline-shell,tswsl1989/powerline-shell,torbjornvatn/powerline-shell,MartinWetterwald/powerline-shell,iKrishn...
680679ed2b05bd5131016d13f66f73249e51a102
tests/utils.py
tests/utils.py
from uuid import uuid4 from valohai_cli.utils import get_random_string def get_project_data(n_projects): return { 'results': [ {'id': str(uuid4()), 'name': get_random_string()} for i in range(n_projects) ], }
from uuid import uuid4 from valohai_cli.utils import get_random_string def get_project_data(n_projects): return { 'results': [ {'id': str(uuid4()), 'name': get_random_string()} for i in range(n_projects) ], } def make_call_stub(retval=None): calls = [] def c...
Add generic monkeypatch call stub
Add generic monkeypatch call stub
Python
mit
valohai/valohai-cli
035ff2c50c5611406af172c6215f712086b75335
tfr/sklearn.py
tfr/sklearn.py
from sklearn.base import BaseEstimator, TransformerMixin from .signal import SignalFrames from .reassignment import pitchgram class PitchgramTransformer(BaseEstimator, TransformerMixin): def __init__(self, sample_rate=44100, frame_size=4096, hop_size=2048, bin_range=[-48, 67], bin_division=1): se...
from sklearn.base import BaseEstimator, TransformerMixin from .signal import SignalFrames from .reassignment import pitchgram class PitchgramTransformer(BaseEstimator, TransformerMixin): def __init__(self, sample_rate=44100, frame_size=4096, hop_size=2048, output_frame_size=None, bin_range=[-48, ...
Add the output_frame_size parameter to PitchgramTransformer.
Add the output_frame_size parameter to PitchgramTransformer. Without it the deserialization via jsonpickle fails.
Python
mit
bzamecnik/tfr,bzamecnik/tfr
eab1de115f010922531a5a2c5f023bf2294f2af4
sendgrid/__init__.py
sendgrid/__init__.py
"""A small django app around sendgrid and its webhooks""" from utils import SendgridEmailMessage, SendgridEmailMultiAlternatives from models import Email from signals import email_event __version__ = '0.1.0' __all__ = ('SendgridEmailMessage', 'SendgridEmailMultiAlternatives', 'Email', 'email_event')
"""A small django app around sendgrid and its webhooks""" __version__ = '0.1.0'
Revert "add __all__ parameter to main module"
Revert "add __all__ parameter to main module" This reverts commit bc9e574206e75b1a50bd1b8eb4bd56f96a18cf51.
Python
bsd-2-clause
resmio/django-sendgrid
fcdc3974015499f822d9e3355a6fe937c18eaf9a
src/nodeconductor_assembly_waldur/slurm_invoices/models.py
src/nodeconductor_assembly_waldur/slurm_invoices/models.py
from decimal import Decimal from django.db import models from django.core.validators import MinValueValidator from django.utils.translation import ugettext_lazy as _ from nodeconductor.structure import models as structure_models from nodeconductor_assembly_waldur.common import mixins as common_mixins class SlurmPac...
from decimal import Decimal from django.db import models from django.core.validators import MinValueValidator from django.utils.translation import ugettext_lazy as _ from nodeconductor.structure import models as structure_models from nodeconductor_assembly_waldur.common import mixins as common_mixins class SlurmPac...
Add verbose name for SLURM package
Add verbose name for SLURM package [WAL-1141]
Python
mit
opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind
d6acda58c696c5b348da8c6a4fef3bf06cea0e58
weight/models.py
weight/models.py
# This file is part of Workout Manager. # # Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Workout Manage...
# This file is part of Workout Manager. # # Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Workout Manage...
Add default ordering to weight entries
Add default ordering to weight entries
Python
agpl-3.0
kjagoo/wger_stark,wger-project/wger,wger-project/wger,wger-project/wger,kjagoo/wger_stark,wger-project/wger,rolandgeider/wger,petervanderdoes/wger,petervanderdoes/wger,petervanderdoes/wger,kjagoo/wger_stark,petervanderdoes/wger,DeveloperMal/wger,DeveloperMal/wger,DeveloperMal/wger,rolandgeider/wger,DeveloperMal/wger,kj...
9c24683e9594e62f9ba901481c66e40c39a20b4a
tools/metrics/histograms/validate_format.py
tools/metrics/histograms/validate_format.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Verifies that the histograms XML file is well-formatted.""" import extract_histograms def main(): # This will raise an exception if the file is not w...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Verifies that the histograms XML file is well-formatted.""" import extract_histograms import os.path def main(): # This will raise an exception if th...
Make it possible to run the histograms XML validator from directories other than tools/metrics/histograms.
Make it possible to run the histograms XML validator from directories other than tools/metrics/histograms. Review URL: https://codereview.chromium.org/80433003 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@236508 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,anirudhSK/chromium,anirudhSK/chromium,hgl888/chromium-crosswalk,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,bright-sparks/chromium-spacewalk,cr...
40c97fa33c8739bd27b03891782b542217534904
ognskylines/commands/database.py
ognskylines/commands/database.py
from ognskylines.dbutils import engine from ognskylines.model import Base from manager import Manager manager = Manager() @manager.command def init(): """Initialize the database.""" Base.metadata.create_all(engine) print('Done.') @manager.command def drop(sure=0): """Drop all tables.""" if sure...
from ognskylines.dbutils import engine from ognskylines.model import Base from manager import Manager manager = Manager() @manager.command def init(): """Initialize the database.""" Base.metadata.create_all(engine) print('Done.') @manager.command def drop(sure='n'): """Drop all tables.""" if su...
Change confirmation flag to '--sure y'
CLI: Change confirmation flag to '--sure y'
Python
agpl-3.0
kerel-fs/ogn-skylines-gateway,kerel-fs/ogn-skylines-gateway
335f1de1120e658f4e87dcbbcaf882146df895bb
zounds/__init__.py
zounds/__init__.py
from node.duration import \ Hours, Minutes, Seconds, Milliseconds, Microseconds, Picoseconds from node.audio_metadata import MetaData, AudioMetaDataEncoder from node.ogg_vorbis import \ OggVorbis, OggVorbisDecoder, OggVorbisEncoder, OggVorbisFeature, \ OggVorbisWrapper from node.audiostream import AudioS...
from node.duration import \ Hours, Minutes, Seconds, Milliseconds, Microseconds, Picoseconds from node.audio_metadata import MetaData, AudioMetaDataEncoder from node.ogg_vorbis import \ OggVorbis, OggVorbisDecoder, OggVorbisEncoder, OggVorbisFeature, \ OggVorbisWrapper from node.audiostream import AudioS...
Add onset detection processing node to top-level exports
Add onset detection processing node to top-level exports
Python
mit
JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds
3c25f2802f70a16869e93fb301428c31452c00f0
plyer/platforms/macosx/uniqueid.py
plyer/platforms/macosx/uniqueid.py
from subprocess import Popen, PIPE from plyer.facades import UniqueID from plyer.utils import whereis_exe from os import environ class OSXUniqueID(UniqueID): def _get_uid(self): old_lang = environ.get('LANG') environ['LANG'] = 'C' ioreg_process = Popen(["ioreg", "-l"], stdout=PIPE) ...
from subprocess import Popen, PIPE from plyer.facades import UniqueID from plyer.utils import whereis_exe from os import environ class OSXUniqueID(UniqueID): def _get_uid(self): old_lang = environ.get('LANG') environ['LANG'] = 'C' ioreg_process = Popen(["ioreg", "-l"], stdout=PIPE) ...
Fix TypeError if `LANG` is not set in on osx
Fix TypeError if `LANG` is not set in on osx In macosx.uniqueid, `$LANG` is retrieved with `old_lang = environ.get('LANG')`. This means that if `LANG` is not set, `old_lang` will be none. When plyer later tries to restore the original value of lang, `putenv` will complain that we're not supplying a string. I've corre...
Python
mit
kivy/plyer,kived/plyer,KeyWeeUsr/plyer,johnbolia/plyer,johnbolia/plyer,kivy/plyer,KeyWeeUsr/plyer,kived/plyer,KeyWeeUsr/plyer,kivy/plyer
844e63b78df318e88fe9d262c7e0a09fcfef8c76
handroll/tests/test_configuration.py
handroll/tests/test_configuration.py
# Copyright (c) 2014, Matt Layman import inspect import tempfile import unittest from handroll import configuration class FakeArgs(object): def __init__(self): self.outdir = None self.timing = None class TestConfiguration(unittest.TestCase): def test_loads_from_outdir_argument(self): ...
# Copyright (c) 2014, Matt Layman import inspect import tempfile import unittest from handroll import configuration class FakeArgs(object): def __init__(self): self.outdir = None self.timing = None class TestConfiguration(unittest.TestCase): def test_loads_from_outdir_argument(self): ...
Delete a stray Python 2 print statement.
Delete a stray Python 2 print statement.
Python
bsd-2-clause
handroll/handroll
076aa11e353440b0c61a763c4b1bb2e4b57b9a30
custom/enikshay/ucr/views.py
custom/enikshay/ucr/views.py
from __future__ import absolute_import from __future__ import division from datetime import datetime from django.db.models import Min from corehq.apps.userreports.models import AsyncIndicator from corehq.apps.userreports.reports.view import CustomConfigurableReport class MonitoredReport(CustomConfigurableReport): ...
from __future__ import absolute_import from __future__ import division from datetime import datetime from django.db.models import Min from corehq.apps.userreports.models import AsyncIndicator from corehq.apps.userreports.reports.view import CustomConfigurableReport class MonitoredReport(CustomConfigurableReport): ...
Use implicit ordering of AsyncIndicator model
Use implicit ordering of AsyncIndicator model
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
efcb8603251514286388427277a4ab4e22c9b0e5
main.py
main.py
#!/usr/bin/env python from generateSymbolTable import generate_default_symbol_table from scanner import scan_source_files from glob import glob filenames = ["symbolScanner.c"] filenames = glob("/Users/hortont/Desktop/particles/*.c") symbolTable = generate_default_symbol_table() (wantSymbols, haveSymbols) = scan_sour...
#!/usr/bin/env python from generateSymbolTable import generate_default_symbol_table, Library, Framework from scanner import scan_source_files from glob import glob filenames = ["symbolScanner.c"] filenames = glob("/Users/hortont/Desktop/particles/*.c") symbolTable = generate_default_symbol_table() (wantSymbols, have...
Choose one when there are multiple options, preferring (for now) System
Choose one when there are multiple options, preferring (for now) System
Python
bsd-2-clause
hortont424/guesscc,hortont424/guesscc
0ec6bebb4665185854ccf58c99229bae41ef74d4
pybtex/tests/bibtex_parser_test.py
pybtex/tests/bibtex_parser_test.py
from pybtex.database import BibliographyData from pybtex.core import Entry from pybtex.database.input.bibtex import Parser from cStringIO import StringIO test_data = [ ( ''' ''', BibliographyData(), ), ( '''@ARTICLE{ test, title={Polluted ...
from pybtex.database import BibliographyData from pybtex.core import Entry from pybtex.database.input.bibtex import Parser from cStringIO import StringIO test_data = [ ( ''' ''', BibliographyData(), ), ( '''@ARTICLE{ test, title={Polluted ...
Add a test for quoted strings with {"quotes"} in .bib files.
Add a test for quoted strings with {"quotes"} in .bib files.
Python
mit
live-clones/pybtex
48f1d12f97be8a7bca60809967b88f77ba7d6393
setup.py
setup.py
from distutils.core import setup distobj = setup( name="Axiom", version="0.1", maintainer="Divmod, Inc.", maintainer_email="support@divmod.org", url="http://divmod.org/trac/wiki/AxiomProject", license="MIT", platforms=["any"], description="An in-process object-relational database", ...
from distutils.core import setup import axiom distobj = setup( name="Axiom", version=axiom.version.short(), maintainer="Divmod, Inc.", maintainer_email="support@divmod.org", url="http://divmod.org/trac/wiki/DivmodAxiom", license="MIT", platforms=["any"], description="An in-process obje...
Use new Epsilon versioned feature.
Use new Epsilon versioned feature.
Python
mit
twisted/axiom,hawkowl/axiom
0a88885f322f49c9f4cc990a3147f1ee162e8fe4
cellcounter/statistics/views.py
cellcounter/statistics/views.py
from rest_framework.generics import ListCreateAPIView from rest_framework.permissions import BasePermission from rest_framework.throttling import AnonRateThrottle from .serializers import CountInstanceSerializer from .models import CountInstance SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS'] class OpenPostStaffGet(BasePe...
from rest_framework import status from rest_framework.generics import ListCreateAPIView from rest_framework.permissions import BasePermission from rest_framework.throttling import AnonRateThrottle from rest_framework.response import Response from .serializers import CountInstanceSerializer from .models import CountIns...
Update create() method of view to include extra data
Update create() method of view to include extra data
Python
mit
haematologic/cellcounter,cellcounter/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter
cfe6638194d477968689f3062af398630170fd80
foodsaving/conversations/serializers.py
foodsaving/conversations/serializers.py
from rest_framework import serializers from foodsaving.conversations.models import Conversation, ConversationMessage class ConversationSerializer(serializers.ModelSerializer): class Meta: model = Conversation fields = [ 'id', 'participants', 'created_at' ...
from rest_framework import serializers from foodsaving.conversations.models import Conversation, ConversationMessage class ConversationSerializer(serializers.ModelSerializer): class Meta: model = Conversation fields = [ 'id', 'participants', 'created_at' ...
Validate user is in conversation on create message
Validate user is in conversation on create message
Python
agpl-3.0
yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend
4f94e7bc314e31f322c912762339fda047d04688
src/gpio-shutdown.py
src/gpio-shutdown.py
#!/usr/bin/env python3 import RPIO import subprocess PIN_MODE = RPIO.BCM SHUTDOWN_BTN_PIN = 4 PIN_PULL = RPIO.PUD_DOWN EDGE_DETECT = 'rising' def main(): RPIO.setmode(PIN_MODE) RPIO.setup(SHUTDOWN_BTN_PIN, RPIO.IN, pull_up_down=PIN_PULL) RPIO.add_interrupt_callback(SHUTDOWN_BTN_PIN, ...
#!/usr/bin/env python3 import RPIO import subprocess import time PIN_MODE = RPIO.BCM SHUTDOWN_BTN_PIN = 4 PIN_PULL = RPIO.PUD_DOWN EDGE_DETECT = 'rising' def main(): RPIO.setmode(PIN_MODE) RPIO.setup(SHUTDOWN_BTN_PIN, RPIO.IN, pull_up_down=PIN_PULL) RPIO.add_interrupt_callback(SHUTDOWN_BTN_PIN, ...
Add sleeping spin-wait to listener script
Add sleeping spin-wait to listener script This will prevent the script from exiting, thus defeating the entire purpose of using a separate GPIO button to shutdown
Python
epl-1.0
MSOE-Supermileage/datacollector,MSOE-Supermileage/datacollector,MSOE-Supermileage/datacollector
cf18a3141f6b9d618cd35adc2f574965fba29c92
tests/testcases.py
tests/testcases.py
from __future__ import unicode_literals from __future__ import absolute_import from fig.packages.docker import Client from fig.service import Service from fig.cli.utils import docker_url from . import unittest class DockerClientTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.client ...
from __future__ import unicode_literals from __future__ import absolute_import from fig.packages.docker import Client from fig.service import Service from fig.cli.utils import docker_url from . import unittest class DockerClientTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.client ...
Remove images created by tests
Remove images created by tests
Python
apache-2.0
anweiss/docker.github.io,ekristen/compose,dilgerma/compose,aduermael/docker.github.io,Yelp/docker-compose,bsmr-docker/compose,bfirsh/fig,jgrowl/compose,nerro/compose,londoncalling/docker.github.io,ChrisChinchilla/compose,shubheksha/docker.github.io,prologic/compose,shubheksha/docker.github.io,danix800/docker.github.io,...
e51087bf04f56ae79a8af8ae059a2dbe28fb1d74
src/oscar/core/decorators.py
src/oscar/core/decorators.py
try: from types import ClassType except ImportError: # Python 3 CHECK_TYPES = (type,) else: # Python 2: new and old-style classes CHECK_TYPES = (type, ClassType) import warnings def deprecated(obj): if isinstance(obj, CHECK_TYPES): return _deprecated_cls(cls=obj) else: retu...
try: from types import ClassType except ImportError: # Python 3 CHECK_TYPES = (type,) else: # Python 2: new and old-style classes CHECK_TYPES = (type, ClassType) import warnings from oscar.utils.deprecation import RemovedInOscar15Warning def deprecated(obj): if isinstance(obj, CHECK_TYPES): ...
Set RemovedInOscar15Warning for existing deprecation warnings
Set RemovedInOscar15Warning for existing deprecation warnings
Python
bsd-3-clause
solarissmoke/django-oscar,django-oscar/django-oscar,sonofatailor/django-oscar,solarissmoke/django-oscar,django-oscar/django-oscar,sasha0/django-oscar,sasha0/django-oscar,sonofatailor/django-oscar,sasha0/django-oscar,django-oscar/django-oscar,sonofatailor/django-oscar,django-oscar/django-oscar,sonofatailor/django-oscar,...
864f10669895ac28f17167a2be84bcab7fd9e389
conf/jupyter_notebook_config.py
conf/jupyter_notebook_config.py
import os c.NotebookApp.ip = '*' c.MultiKernelManager.kernel_manager_class = 'lc_wrapper.LCWrapperKernelManager' c.KernelManager.shutdown_wait_time = 10.0 if 'PASSWORD' in os.environ: from notebook.auth import passwd c.NotebookApp.password = passwd(os.environ['PASSWORD']) del os.environ['PASSWORD']
import os c.NotebookApp.ip = '*' c.MultiKernelManager.kernel_manager_class = 'lc_wrapper.LCWrapperKernelManager' c.KernelManager.shutdown_wait_time = 10.0 c.FileContentsManager.delete_to_trash = False if 'PASSWORD' in os.environ: from notebook.auth import passwd c.NotebookApp.password = passwd(os.environ['PASS...
Disable delete_to_trash to prevent an error while deleting
Disable delete_to_trash to prevent an error while deleting
Python
bsd-3-clause
NII-cloud-operation/Jupyter-LC_docker,NII-cloud-operation/Jupyter-LC_docker
5fc4af3039caec0f245e04e5a219451dfb73fb9c
distarray/localapi/tests/test_format.py
distarray/localapi/tests/test_format.py
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- im...
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- im...
Add a test for read_magic.
Add a test for read_magic.
Python
bsd-3-clause
enthought/distarray,enthought/distarray
b75e3646ccd1b61868a47017f14f25960e52578c
bot/action/standard/info/action.py
bot/action/standard/info/action.py
from bot.action.core.action import Action from bot.action.standard.info.formatter.chat import ChatInfoFormatter from bot.action.standard.info.formatter.user import UserInfoFormatter class MeInfoAction(Action): def process(self, event): formatter = UserInfoFormatter(self.api, event.message.from_, event.cha...
from bot.action.core.action import Action from bot.action.standard.info.formatter.chat import ChatInfoFormatter from bot.action.standard.info.formatter.user import UserInfoFormatter class MeInfoAction(Action): def process(self, event): formatter = UserInfoFormatter(self.api, event.message.from_, event.cha...
Create UserInfoAction that shows the info of the user which the message replies to, or the current user if there is no reply
Create UserInfoAction that shows the info of the user which the message replies to, or the current user if there is no reply
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
a0f030cd03d28d97924a3277722d7a51cf3a3e92
cms/test_utils/project/extensionapp/models.py
cms/test_utils/project/extensionapp/models.py
# -*- coding: utf-8 -*- from cms.extensions import PageExtension, TitleExtension from cms.extensions.extension_pool import extension_pool from django.db import models class MyPageExtension(PageExtension): extra = models.CharField(blank=True, default='', max_length=255) extension_pool.register(MyPageExtension) ...
# -*- coding: utf-8 -*- from cms.extensions import PageExtension, TitleExtension from cms.extensions.extension_pool import extension_pool from django.contrib.auth.models import User from django.db import models class MyPageExtension(PageExtension): extra = models.CharField(blank=True, default='', max_length=255) ...
Update extension app to include a M2M
Update extension app to include a M2M
Python
bsd-3-clause
kk9599/django-cms,jrclaramunt/django-cms,farhaadila/django-cms,FinalAngel/django-cms,leture/django-cms,yakky/django-cms,wuzhihui1123/django-cms,czpython/django-cms,jproffitt/django-cms,astagi/django-cms,DylannCordel/django-cms,evildmp/django-cms,jrclaramunt/django-cms,SachaMPS/django-cms,netzkolchose/django-cms,donce/d...
eef768a538c82629073b360618d8b39bcbf4c474
tests/dojo_test.py
tests/dojo_test.py
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def setUp(self): self.dojo = Dojo() self.test_office = self.dojo.create_room("office", "test") self.test_living_space = self.dojo.create_room("living_space", "test living space") def test_create_room_...
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def setUp(self): self.dojo = Dojo() self.test_office = self.dojo.create_room("office", "test") self.test_living_space = self.dojo.create_room("living_space", "test living space") def test_create_room_...
Implement test for duplicate rooms
Implement test for duplicate rooms
Python
mit
EdwinKato/Space-Allocator,EdwinKato/Space-Allocator
4e4ff0e235600b1b06bf607004538bd5ff6e5d30
listener.py
listener.py
import asynchat import asyncore import socket class Handler(asynchat.async_chat): def __init__(self, server, (conn, addr)): asynchat.async_chat.__init__(self, conn) self.set_terminator('\n') self.server = server self.buffer = '' def collect_incoming_data(self, data): s...
import asynchat import asyncore import socket class Reciver(asynchat.async_chat): def __init__(self, server, (conn, addr)): asynchat.async_chat.__init__(self, conn) self.set_terminator('\n') self.server = server self.buffer = '' def collect_incoming_data(self, data): s...
Fix naming of Handler to Reciever
Fix naming of Handler to Reciever
Python
mit
adamcik/pycat,adamcik/pycat
eeb23b7fde3f728355efcc446912b7c8357c0c08
util.py
util.py
def format_cols(cols): widths = [0] * len(cols[0]) for i in cols: for idx, val in enumerate(i): widths[idx] = max(len(val), widths[idx]) f = "" t = [] for i in widths: t.append("%%-0%ds" % (i,)) return " ".join(t) def column_report(title, fields, cols): l ...
import sys def format_cols(cols): widths = [0] * len(cols[0]) for i in cols: for idx, val in enumerate(i): widths[idx] = max(len(val), widths[idx]) f = "" t = [] for i in widths: t.append("%%-0%ds" % (i,)) return " ".join(t) def column_report(title, fields, c...
Use sys in error cases.
Use sys in error cases.
Python
mit
lightcrest/kahu-api-demo
78bebaa2902636e33409591675b1bede6c359aad
telepyth/__init__.py
telepyth/__init__.py
# encoding: utf8 # __init__.py from telepyth.client import TelePythClient from telepyth.utils import is_interactive if is_interactive(): from telepyth.magics import TelePythMagics
# encoding: utf8 # __init__.py from telepyth.client import TelePythClient from telepyth.utils import is_interactive TelepythClient = TelePythClient # make alias to origin definition if is_interactive(): from telepyth.magics import TelePythMagics
Add alias to TelePythClient which will be deprecated in the future.
Add alias to TelePythClient which will be deprecated in the future.
Python
mit
daskol/telepyth,daskol/telepyth
fd4c62b157cfb4f5814e01640cd5d29837092cfc
pronto/parsers/base.py
pronto/parsers/base.py
import abc import os import typing import urllib.parse if typing.TYPE_CHECKING: from ..ontology import Ontology class BaseParser(abc.ABC): def __init__(self, ont: 'Ontology'): self.ont = ont @classmethod @abc.abstractmethod def can_parse(cls, path: str, buffer: bytes): """Return...
import abc import os import typing import urllib.parse if typing.TYPE_CHECKING: from ..ontology import Ontology class BaseParser(abc.ABC): def __init__(self, ont: 'Ontology'): self.ont = ont @classmethod @abc.abstractmethod def can_parse(cls, path: str, buffer: bytes): """Return...
Improve local import detection in `BaseParser.process_imports`
Improve local import detection in `BaseParser.process_imports`
Python
mit
althonos/pronto
f78be67a4efec7f343f51418410e9d73b358df19
tatooine.py
tatooine.py
from flask import Flask import consul import socket import pprint import redis # Consul key CONSUL_REDIS_KEY = "redis" app = Flask(__name__) def GetRedisFromConsul(): MyConsul = consul.Consul(host='172.17.42.1', port=8500) Index, ConsulRetObj = MyConsul.catalog.service(CONSUL_REDIS_KEY) pprint.pprint(C...
from flask import Flask import consul import socket import pprint import redis # Consul key CONSUL_REDIS_KEY = "redis" app = Flask(__name__) def GetRedisFromConsul(): MyConsul = consul.Consul(host='172.17.42.1', port=8500) Index, ConsulRetObj = MyConsul.catalog.service(CONSUL_REDIS_KEY) pprint.pprint(C...
Convert binary string to UTF-8
Convert binary string to UTF-8
Python
mit
skale-5/tatooine
5b554752aaabd59b8248f9eecfc03458dd9f07d0
coding/admin.py
coding/admin.py
from django.contrib import admin from coding.models import ( Sample, AssignmentTag, CodingAssignment, CodingAssignmentActivity) class SampleAdmin(admin.ModelAdmin): filter_horizontal = ("pieces",) admin.site.register(Sample, SampleAdmin) class AssignmentTagAdmin(admin.ModelAdmin): list_filter = ("...
from django.contrib import admin from coding.models import ( Sample, AssignmentTag, CodingAssignment, CodingAssignmentActivity) class SampleAdmin(admin.ModelAdmin): filter_horizontal = ("pieces",) admin.site.register(Sample, SampleAdmin) class AssignmentTagAdmin(admin.ModelAdmin): list_filter = ("...
Add date drill down to coding assignment activity list
Add date drill down to coding assignment activity list
Python
mit
inducer/codery,inducer/codery
72e5b32a0306ad608b32eaaa4817b0e5b5ef3c8d
project/asylum/utils.py
project/asylum/utils.py
# -*- coding: utf-8 -*- import importlib import random from django.conf import settings def get_handler_instance(setting): """Gets instance of class defined in the given setting""" try: setting_value = getattr(settings, setting) except AttributeError: return None if not setting_value:...
# -*- coding: utf-8 -*- import calendar import datetime import importlib import random from django.conf import settings def get_handler_instance(setting): """Gets instance of class defined in the given setting""" try: setting_value = getattr(settings, setting) except AttributeError: retur...
Add helper for iterating over months and move date proxy here
Add helper for iterating over months and move date proxy here the proxy is now needed by two commands
Python
mit
rambo/asylum,hacklab-fi/asylum,HelsinkiHacklab/asylum,jautero/asylum,hacklab-fi/asylum,rambo/asylum,HelsinkiHacklab/asylum,jautero/asylum,rambo/asylum,hacklab-fi/asylum,hacklab-fi/asylum,jautero/asylum,rambo/asylum,jautero/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum
5af9f2cd214f12e2d16b696a0c62856e389b1397
test/test_doc.py
test/test_doc.py
import types from mpi4py import MPI import mpiunittest as unittest ModuleType = type(MPI) ClassType = type(MPI.Comm) FunctionType = type(MPI.Init) MethodDescrType = type(MPI.Comm.Get_rank) GetSetDescrType = type(MPI.Comm.rank) def getdocstr(mc, docstrings): if type(mc) in (ModuleType, ClassType): name = g...
import types from mpi4py import MPI import mpiunittest as unittest ModuleType = type(MPI) ClassType = type(MPI.Comm) FunctionType = type(MPI.Init) MethodDescrType = type(MPI.Comm.Get_rank) GetSetDescrType = type(MPI.Comm.rank) def getdocstr(mc, docstrings, namespace=None): name = getattr(mc, '__name__', None) ...
Improve test script, report namespaces for stuff missing docstrings
Improve test script, report namespaces for stuff missing docstrings
Python
bsd-2-clause
pressel/mpi4py,pressel/mpi4py,pressel/mpi4py,mpi4py/mpi4py,pressel/mpi4py,mpi4py/mpi4py,mpi4py/mpi4py
07d113e4604994bf1857b3ae7201571776b65154
etl/make_feature_tsv.py
etl/make_feature_tsv.py
# Graciously adopted from https://github.com/ucscXena/xenaH5 # # Generates a tsv compatible for making a create table statement from a # 10xgenomics HDF5 file. # # Usage # # python maketsv.py fname 0 # # Will generate a tsv file with the 0th slice of the h5 file named # `out0.tsv`. import string, sys import h5py impor...
# Graciously adopted from https://github.com/ucscXena/xenaH5 # # Generates a tsv compatible for making a create table statement from a # 10xgenomics HDF5 file. # # Usage # # python maketsv.py fname 0 # # Will generate a tsv file with the 0th slice of the h5 file named # `out0.tsv`. import string, sys import h5py impor...
Make a tsv instead of a long string
Make a tsv instead of a long string
Python
apache-2.0
david4096/celldb
37d7656019d11b3b05d59f184d72e1dd6d4ccaf7
contones/srs.py
contones/srs.py
"""Spatial reference systems""" from osgeo import osr class BaseSpatialReference(osr.SpatialReference): """Base class for extending osr.SpatialReference.""" def __repr__(self): return self.wkt @property def srid(self): """Returns the EPSG ID as int if it exists.""" epsg_id = ...
"""Spatial reference systems""" __all__ = ['SpatialReference'] from osgeo import osr class BaseSpatialReference(osr.SpatialReference): """Base class for extending osr.SpatialReference.""" def __repr__(self): return self.wkt def __eq__(self, another): return bool(self.IsSame(another)) ...
Add equality methods to SpatialReference
Add equality methods to SpatialReference
Python
bsd-3-clause
bkg/greenwich
9a5b0f08dfc6fe74965e1576697697a71ece4934
dit/utils/tests/test_context.py
dit/utils/tests/test_context.py
from __future__ import unicode_literals from nose.tools import * import os import time from dit.utils import cd, named_tempfile, tempdir def test_cd(): with cd('/'): assert_equal(os.getcwd(), '/') def test_named_tempfile(): name = None with named_tempfile() as tempfile: name = tempfile.na...
from __future__ import unicode_literals from nose.tools import * import os import time from dit.utils import cd, named_tempfile, tempdir def test_cd(): with cd('/'): assert_equal(os.getcwd(), '/') def test_named_tempfile1(): name = None with named_tempfile() as tempfile: name = tempfile.n...
Add test to verify that named_tempfile() overrides the `delete` parameter.
Add test to verify that named_tempfile() overrides the `delete` parameter.
Python
bsd-3-clause
dit/dit,chebee7i/dit,dit/dit,dit/dit,chebee7i/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,chebee7i/dit,Autoplectic/dit,Autoplectic/dit,chebee7i/dit,Autoplectic/dit,dit/dit
366d7abd63d3f70ad206336a0278a0968b04b678
panoptes_aggregation/extractors/poly_line_text_extractor.py
panoptes_aggregation/extractors/poly_line_text_extractor.py
from collections import OrderedDict def classification_to_extract(classification): extract = OrderedDict([ ('points', OrderedDict([('x', []), ('y', [])])), ('text', []), ('frame', []) ]) annotation = classification['annotations'][0] for value in annotation['value']: tex...
from collections import OrderedDict def classification_to_extract(classification): extract = OrderedDict([ ('points', OrderedDict([('x', []), ('y', [])])), ('text', []), ('frame', []) ]) annotation = classification['annotations'][0] for value in annotation['value']: tex...
Add clarification comment to extractor
Add clarification comment to extractor Add a comment about the behavior of the extractor when the length of the `words` list does not match the lenght of the `points` list. The extract will only contain the *shorter* of the two lists and assume they match from the front.
Python
apache-2.0
CKrawczyk/python-reducers-for-caesar
94e70a0958f0db737ca82c5ea09528bf4e5e4fef
voteswap/wsgi.py
voteswap/wsgi.py
""" WSGI config for voteswap project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
""" WSGI config for voteswap project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
Add vendor dir to path
Add vendor dir to path
Python
mit
sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap
1fde16891508179e5f3774d4624b9a0b48c39903
script/jsonify-book.py
script/jsonify-book.py
import sys from glob import glob from os.path import basename import json book_dir, out_dir = sys.argv[1:3] files = [basename(x).rstrip(".xhtml") for x in glob(f"{book_dir}/*.xhtml")] json_data = {} for path in files: with open(f"{book_dir}/{path}-metadata.json", "r") as meta_part: json_data = json.load...
import sys from glob import glob from os.path import basename import json book_dir, out_dir = sys.argv[1:3] files = [basename(x).rstrip(".xhtml") for x in glob(f"{book_dir}/*.xhtml")] json_data = {} for path in files: with open(f"{book_dir}/{path}.json", "r") as meta_part: json_data = json.load(meta_par...
Remove metadata from jsonify output name
Remove metadata from jsonify output name
Python
lgpl-2.1
Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cnx-recipes,Connexions/cnx-rulesets,Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cte,Connexions/cte,Connexions/cnx-recipes,Connexions/cnx-rulesets,Connexions/cnx-recipes
0c0190c9505197bd8e9671580bd6aa776bc8b04a
utils/get_message.py
utils/get_message.py
import amqp from contextlib import closing def __get_channel(connection): return connection.channel() def __get_message_from_queue(channel, queue): return channel.basic_get(queue=queue) def get_message(queue): """ Get the first message from a queue. The first message from a queue is retrieved. If t...
import amqp from contextlib import closing def get_message(queue): """ Get the first message from a queue. The first message from a queue is retrieved. If there is no such message, the function exits quietly. :param queue: The name of the queue from which to get the message. Usage:: >>> from ...
Revert "Revert "Remove redundant functions (one too many levels of abstraction)@""
Revert "Revert "Remove redundant functions (one too many levels of abstraction)@"" This reverts commit 34fda0b20a87b94d7413054bfcfc81dad0ecde19.
Python
mit
jdgillespie91/trackerSpend,jdgillespie91/trackerSpend
f6154cceaeb9d9be718df8f21153b09052bd597c
stix/ttp/victim_targeting.py
stix/ttp/victim_targeting.py
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # external from cybox.core import Observables # internal import stix import stix.bindings.ttp as ttp_binding from stix.common import vocabs, VocabString from stix.common.identity import Identity, IdentityFactory fr...
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # external from cybox.core import Observables # internal import stix import stix.bindings.ttp as ttp_binding from stix.common import vocabs from stix.common.identity import Identity, IdentityFactory from mixbox imp...
Add 'targeted_technical_details' TypedField to VictimTargeting
Add 'targeted_technical_details' TypedField to VictimTargeting
Python
bsd-3-clause
STIXProject/python-stix
e9f3efcc1d9a3372e97e396160ea2ecbdee778c6
rfmodbuslib/__init__.py
rfmodbuslib/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015 Legrand Group # # 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015 Legrand Group # # 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...
Add a .__version__ attribute to package
Add a .__version__ attribute to package
Python
apache-2.0
Legrandgroup/robotframework-modbuslibrary
388d8413f0df3cb6069cf393e033b3d23f4b63c7
features/environment.py
features/environment.py
from behave import * import server def before_all(context): context.app = server.app.test_client() server.initialize_mysql(test=True) server.initialize_index() context.server = server
from behave import * import server def before_all(context): context.app = server.app.test_client() server.initialize_mysql(test=True) context.server = server
Remove troublesome function from behave's environ.
Remove troublesome function from behave's environ.
Python
apache-2.0
nyu-delta-squad-s17/recommendation-service
2f063f6dd9d10dabd967554bfcf7f6a63c979911
OpenSearchInNewTab.py
OpenSearchInNewTab.py
import sublime_plugin DEFAULT_NAME = 'Find Results' ALT_NAME = 'Find Results ' class OpenSearchInNewTab(sublime_plugin.EventListener): # set a bit changed name # so the tab won't be bothered # during new search def on_activated(self, view): if self.is_search_view(view): self.appl...
import sublime_plugin from threading import Timer DEFAULT_NAME = 'Find Results' ALT_NAME = 'Find Results ' class OpenSearchInNewTab(sublime_plugin.EventListener): # set a bit changed name # so the tab won't be bothered # during new search def on_activated(self, view): if self.is_search_view(...
Make plugin more stable by introducing async renaming to alternative name
Make plugin more stable by introducing async renaming to alternative name
Python
mit
everyonesdesign/OpenSearchInNewTab
e5f4627845a6874aa983d2d8ea02d5bea0fab8e2
meetings/osf_oauth2_adapter/provider.py
meetings/osf_oauth2_adapter/provider.py
from .apps import OsfOauth2AdapterConfig from allauth.socialaccount import providers from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class OSFAccount(ProviderAccount): def to_str(self): # default ... reserved word...
from .apps import OsfOauth2AdapterConfig from allauth.socialaccount import providers from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class OSFAccount(ProviderAccount): def to_str(self): # default ... reserved word...
Change username to osf uid
Change username to osf uid
Python
apache-2.0
jnayak1/osf-meetings,leodomingo/osf-meetings,jnayak1/osf-meetings,leodomingo/osf-meetings,jnayak1/osf-meetings,jnayak1/osf-meetings,leodomingo/osf-meetings,leodomingo/osf-meetings
fbc5e2d52549452c2adbe58644358cf3c4eeb526
testsuite/test_util.py
testsuite/test_util.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest import pep8 class UtilTestCase(unittest.TestCase): def test_normalize_paths(self): cwd = os.getcwd() self.assertEquals(pep8.normalize_paths(''), []) self.assertEquals(pep8.normalize_paths(['foo']), ['foo']) s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest import pep8 class UtilTestCase(unittest.TestCase): def test_normalize_paths(self): cwd = os.getcwd() self.assertEquals(pep8.normalize_paths(''), []) self.assertEquals(pep8.normalize_paths([]), []) self.assert...
Add a few more cases of "not value"
Add a few more cases of "not value"
Python
mit
ojengwa/pep8,pedros/pep8,asandyz/pep8,jayvdb/pep8,doismellburning/pep8,pandeesh/pep8,jayvdb/pep8,PyCQA/pep8,ABaldwinHunter/pep8,codeclimate/pep8,ABaldwinHunter/pep8-clone-classic,zevnux/pep8,MeteorAdminz/pep8
03f74920a56afcbc4dbdb0370c3fab84a27bc299
openacademy/model/openacademy_course.py
openacademy/model/openacademy_course.py
from openerp import models, fields, api ''' This module is to create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # Field reserved to identified name rec ...
from openerp import api, fields, models ''' This module is to create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # Field reserved to identified name rec ...
Modify copy method into inherit
[REF] openacademy: Modify copy method into inherit
Python
apache-2.0
glizek/openacademy-project
c775df0af114a332077771609d4b24a04bd6bfd2
bin/parsers/DeploysServiceLookup.py
bin/parsers/DeploysServiceLookup.py
if alert['resource'].startswith('R1'): alert['service'] = [ 'R1' ] elif alert['resource'].startswith('R2'): alert['service'] = [ 'R2' ] elif 'content-api' in alert['resource'].lower(): alert['service'] = [ 'ContentAPI' ] elif alert['resource'].startswith('frontend'): alert['service'] = [ 'Frontend' ] ...
if alert['resource'].startswith('R1'): alert['service'] = [ 'R1' ] elif alert['resource'].startswith('R2'): alert['service'] = [ 'R2' ] elif 'content-api' in alert['resource'].lower(): alert['service'] = [ 'ContentAPI' ] elif alert['resource'].startswith('frontend'): alert['service'] = [ 'Frontend' ] ...
Add email tag to fronted deploy failures
Add email tag to fronted deploy failures
Python
apache-2.0
skob/alerta,mrkeng/alerta,0312birdzhang/alerta,skob/alerta,mrkeng/alerta,0312birdzhang/alerta,skob/alerta,0312birdzhang/alerta,mrkeng/alerta,guardian/alerta,guardian/alerta,guardian/alerta,guardian/alerta,skob/alerta,mrkeng/alerta
b7bafa86cf6e2f568e99335fa6aeb6d8f3509170
dont_tread_on_memes/__init__.py
dont_tread_on_memes/__init__.py
#!python3 import os from PIL import Image, ImageDraw, ImageFont localdir = os.path.dirname(__file__) BLANK_FLAG = Image.open(os.path.join(localdir, "dont-tread-on-blank.png")) LORA_FONT = ImageFont.truetype( os.path.join(localdir, "../fonts/Lora-Regular.ttf"), 120 ) def tread_on(caption, color="black"): ""...
#!python3 import os from PIL import Image, ImageDraw, ImageFont localdir = os.path.dirname(__file__) BLANK_FLAG = Image.open(os.path.join(localdir, "dont-tread-on-blank.png")) LORA_FONT = ImageFont.truetype( os.path.join(localdir, "../fonts/Lora-Regular.ttf"), 120 ) def tread_on(caption, color="black"): ""...
Allow passing arguments through dont_me to tread_on
Allow passing arguments through dont_me to tread_on
Python
mit
controversial/dont-tread-on-memes
3ff4aef8d130cdcbf149328d93337fa984a9a94b
dont_tread_on_memes/__main__.py
dont_tread_on_memes/__main__.py
import dont_tread_on_memes import click @click.command() @click.option("--message", prompt="Don't _____ me: ", help=("The word or phrase to substitute for 'tread' in 'don't " "tread on me'")) def tread(message): dont_tread_on_memes.tread_on(message).show() if __name__ == "__mai...
import dont_tread_on_memes import click @click.command() @click.option("--message", prompt="Don't _____ me: ", help=("The word or phrase to substitute for 'tread' in 'don't " "tread on me'")) @click.option("--save", default=None, help="Where to save the image") def tread(message, sav...
Allow saving via --save CLI parameter
Allow saving via --save CLI parameter
Python
mit
controversial/dont-tread-on-memes
4fbec4f4c0741edb6207d762cc92e48c6f249eec
dragonflow/common/extensions.py
dragonflow/common/extensions.py
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
Disable L3 agents scheduler extension in Tempest
Disable L3 agents scheduler extension in Tempest Change-Id: Ibc2d85bce9abb821e897693ebdade66d3b9199c3 Closes-Bug: #1707496
Python
apache-2.0
openstack/dragonflow,openstack/dragonflow,openstack/dragonflow