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
329e74f280537aab41d5b810f8650bfd8d6d81f5
tests/test_generate_files.py
tests/test_generate_files.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_generate_files ------------------- Test formerly known from a unittest residing in test_generate.py named TestGenerateFiles.test_generate_files_nontemplated_exception """ import pytest from cookiecutter import generate from cookiecutter import exceptions @pyte...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_generate_files ------------------- Test formerly known from a unittest residing in test_generate.py named TestGenerateFiles.test_generate_files_nontemplated_exception """ from __future__ import unicode_literals import os import pytest from cookiecutter import g...
Add teardown specific to the former TestCase class
Add teardown specific to the former TestCase class
Python
bsd-3-clause
michaeljoseph/cookiecutter,christabor/cookiecutter,cguardia/cookiecutter,janusnic/cookiecutter,michaeljoseph/cookiecutter,cguardia/cookiecutter,vincentbernat/cookiecutter,drgarcia1986/cookiecutter,Vauxoo/cookiecutter,cichm/cookiecutter,benthomasson/cookiecutter,0k/cookiecutter,terryjbates/cookiecutter,atlassian/cookiec...
56bc9c79522fd534f2a756bd5a18193635e2adae
tests/test_default_security_groups.py
tests/test_default_security_groups.py
"""Test default Security Groups.""" from unittest import mock from foremast.securitygroup.create_securitygroup import SpinnakerSecurityGroup @mock.patch('foremast.securitygroup.create_securitygroup.get_properties') def test_default_security_groups(mock_properties): """Make sure default Security Groups are added ...
"""Test default Security Groups.""" from unittest import mock from foremast.securitygroup.create_securitygroup import SpinnakerSecurityGroup @mock.patch('foremast.securitygroup.create_securitygroup.get_details') @mock.patch('foremast.securitygroup.create_securitygroup.get_properties') def test_default_security_group...
Fix missing mock and rename variable
tests: Fix missing mock and rename variable
Python
apache-2.0
gogoair/foremast,gogoair/foremast
84929e01bfb9236fd0f51d82ee514d513d018408
triangle/triangle.py
triangle/triangle.py
class TriangleError(Exception): pass class Triangle(object): def __init__(self, *dims): if not self.is_valid(dims): raise TriangleError("Invalid dimensions: {}".format(dims)) self.dims = dims def kind(self): a, b, c = self.dims if a == b and b == c: ...
class TriangleError(Exception): pass class Triangle(object): def __init__(self, *dims): if not self.is_valid(dims): raise TriangleError("Invalid dimensions: {}".format(dims)) self.dims = sorted(dims) def kind(self): a, b, c = self.dims if a == b and b == c: # i...
Sort dimensins to reduce code
Sort dimensins to reduce code
Python
agpl-3.0
CubicComet/exercism-python-solutions
3dd23df07d7d1f84e361c87345aafcfefeff636a
jsk_2016_01_baxter_apc/node_scripts/control_vacuum_gripper.py
jsk_2016_01_baxter_apc/node_scripts/control_vacuum_gripper.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import rospy from std_msgs.msg import Bool def main(): parser = argparse.ArgumentParser() parser.add_argument('action', type=str, choices=['start', 'stop']) ...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import rospy from std_msgs.msg import Bool def main(): parser = argparse.ArgumentParser() parser.add_argument('-l', '--left', action='store_true', ...
Order agonistic options to control vacuum gripper
Order agonistic options to control vacuum gripper
Python
bsd-3-clause
pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc
27b0a5b95e188a5bd77ae662bbb43e06dfde4749
slack/views.py
slack/views.py
from flask import Flask, request import requests from urllib import unquote app = Flask(__name__) @app.route("/") def meme(): domain = request.args["team_domain"] slackbot = request.args["slackbot"] text = request.args["text"] channel = request.args["channel_name"] text = text[:-1] if text[-1] ==...
from flask import Flask, request import requests from urllib import unquote app = Flask(__name__) @app.route("/") def meme(): domain = request.args["team_domain"] slackbot = request.args["slackbot"] text = request.args["text"] channel = request.args["channel_id"] text = unquote(text) text = t...
Use the id of the channel and unquote all of the text first.
Use the id of the channel and unquote all of the text first.
Python
mit
DuaneGarber/slack-meme,joeynebula/slack-meme,tezzutezzu/slack-meme,nicolewhite/slack-meme
ddd45afa0708682bb11d606e03e38aed111d7b9c
fireplace/cards/game/all.py
fireplace/cards/game/all.py
""" GAME set and other special cards """ from ..utils import * # The Coin class GAME_005: play = ManaThisTurn(CONTROLLER, 1)
""" GAME set and other special cards """ from ..utils import * # The Coin class GAME_005: play = ManaThisTurn(CONTROLLER, 1) # Big Banana class TB_006: play = Buff(TARGET, "TB_006e") # Deviate Banana class TB_007: play = Buff(TARGET, "TB_007e") # Rotten Banana class TB_008: play = Hit(TARGET, 1)
Implement Big Banana, Deviate Banana, Rotten Banana
Implement Big Banana, Deviate Banana, Rotten Banana
Python
agpl-3.0
liujimj/fireplace,Ragowit/fireplace,butozerca/fireplace,butozerca/fireplace,smallnamespace/fireplace,amw2104/fireplace,smallnamespace/fireplace,beheh/fireplace,NightKev/fireplace,Meerkov/fireplace,Meerkov/fireplace,liujimj/fireplace,oftc-ftw/fireplace,Ragowit/fireplace,amw2104/fireplace,jleclanche/fireplace,oftc-ftw/fi...
b0bde22e3ff0d2df2773f41aeaf8eb0ba6d0fa3f
tools/getapifield.py
tools/getapifield.py
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Allow a default value to be specified when fetching a field value
Allow a default value to be specified when fetching a field value
Python
apache-2.0
jskeet/gcloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet
f51915a6c373de39785d8273b2a9f6e11ff67b9e
test_dimuon.py
test_dimuon.py
from dimuon import find_pairs def test_find_pairs(): particles = None pairs = find_pairs(particles) def test_no_particles(): particles = [] pairs = find_pairs(particles) assert len(pairs) == 0
from dimuon import find_pairs def test_find_pairs(): particles = None pairs = find_pairs(particles) def test_no_particles(): particles = [] pairs = find_pairs(particles) assert len(pairs) == 0 def test_one_particle(): particles = [None] pairs = find_pairs(particles) assert len(pairs) ...
Test for no pairs from one particle
Test for no pairs from one particle
Python
mit
benwaugh/dimuon
7f06cb8ceff3f2515f01662622e3c5149bcb8646
xm/main.py
xm/main.py
#!/usr/bin/env python2 # -*- coding: UTF-8 -*- from __future__ import print_function from __future__ import unicode_literals import argparse DEFAULT_CONFIG_FILE = '~/.config/xmrc' def _new_argument_parser(): parser = argparse.ArgumentParser( description='Build the appropriate make command' ) ...
#!/usr/bin/env python2 # -*- coding: UTF-8 -*- from __future__ import print_function from __future__ import unicode_literals import argparse DEFAULT_CONFIG_FILE = '~/.config/xmrc' def _new_argument_parser(): parser = argparse.ArgumentParser( description='Build the appropriate make command' ) ...
Add a --target argument and make trailling arguments context dependant
Add a --target argument and make trailling arguments context dependant
Python
bsd-2-clause
pcadottemichaud/xm,pc-m/xm,pcadottemichaud/xm,pc-m/xm
ab802204d84511765a701cad48e9e22dc4e84be1
tests/rules/conftest.py
tests/rules/conftest.py
import pytest from fmn.rules.cache import cache @pytest.fixture(autouse=True, scope="session") def configured_cache(): cache.configure()
import pytest from fmn.rules.cache import cache @pytest.fixture(autouse=True) def configured_cache(): if not cache.region.is_configured: cache.configure() yield cache.region.invalidate()
Fix intermittent failures of test_guard_http_exception
Fix intermittent failures of test_guard_http_exception Signed-off-by: Ryan Lerch <e809e25f3c554b2b195ccd768cd9a485288f896f@redhat.com>
Python
lgpl-2.1
fedora-infra/fmn,fedora-infra/fmn,fedora-infra/fmn,fedora-infra/fmn,fedora-infra/fmn
f5463ae38c4cd46af043f30d0e7d28cf5d1727db
flow/commands/update_software_command.py
flow/commands/update_software_command.py
import subprocess from command import Command from . import ListVersionsCommand from ..git_tools import git_base_command class UpdateSoftwareCommand(Command): def __init__(self, flow, cmd_name, params): Command.__init__(self, flow, cmd_name, params) def exec_impl(self): ...
import subprocess from command import Command from list_versions_command import ListVersionsCommand from ..git_tools import git_base_command class UpdateSoftwareCommand(Command): def __init__(self, flow, cmd_name, params): Command.__init__(self, flow, cmd_name, params) de...
Fix version list validation check.
Fix version list validation check. [#152092418]
Python
mit
manylabs/flow,manylabs/flow
2fc23ca753ca68d3c0531cf9c58d5864adfc373f
tests/test_short_url.py
tests/test_short_url.py
# -*- coding: utf-8 -*- import unittest from random import randrange import short_url class TestShortUrl(unittest.TestCase): def test_one(self): url = short_url.encode_url(12) self.assertEqual(url, 'jy7yj') key = short_url.decode_url(url) self.assertEqual(key, 12) def test_1...
# -*- coding: utf-8 -*- from random import randrange from pytest import raises import short_url def test_custom_alphabet(): encoder = short_url.UrlEncoder(alphabet='ab') url = encoder.encode_url(12) assert url == 'bbaaaaaaaaaaaaaaaaaaaa' key = encoder.decode_url('bbaaaaaaaaaaaaaaaaaaaa') ass...
Use simple test functions and remove too special tests
Use simple test functions and remove too special tests
Python
mit
Alir3z4/python-short_url
8653159dcf6a078bc2193293b93457388e7799d3
tests/tests.py
tests/tests.py
import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): return [ spur.LocalShell(), _cr...
import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): return [ spur.LocalShell(), _cr...
Add test for output that doesn't end in a newline
Add test for output that doesn't end in a newline
Python
bsd-2-clause
mwilliamson/spur.py
f4e07b93ab81fd0a0dc59ec77fca596a2fcca738
froide/helper/form_utils.py
froide/helper/form_utils.py
import json from django.db import models class DjangoJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, models.Model) and hasattr(obj, 'as_data'): return obj.as_data() return json.JSONEncoder.default(self, obj) class JSONMixin(object): def as_json(self): ...
import json from django.db import models class DjangoJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, models.Model) and hasattr(obj, 'as_data'): return obj.as_data() return json.JSONEncoder.default(self, obj) def get_data(error): if isinstance(error, (di...
Fix serialization of form errors
Fix serialization of form errors
Python
mit
fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide
e8092ec82ff8ee9c0104b507751e45555c08685b
tests/tests.py
tests/tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django.test import TestCase from tags.models import Tag from .models import Food class TestFoodModel(TestCase): def test_create_food(self): food = Food.objects.create( name="nacho", tags="tort...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django.test import TestCase from tags.models import Tag from .models import Food class TestFoodModel(TestCase): def test_create_food(self): food = Food.objects.create( name="nacho", tags="tort...
Fix test on python 3.3
Fix test on python 3.3
Python
mit
avelino/django-tags
eae8053398c26ede98c4e253caf7f29f930b2f97
compile.py
compile.py
from compileall import compile_dir from distutils.sysconfig import get_python_lib import os import os.path import sys EXCLUDES = [ 'gunicorn/workers/_gaiohttp.py', 'pymysql/_socketio.py', ] def compile_files(path): return compile_dir(path, maxlevels=50, quiet=True) def remove_python3_files(path): f...
from compileall import compile_dir from distutils.sysconfig import get_python_lib import os import os.path import sys EXCLUDES_27 = [ 'pymysql/_socketio.py', ] EXCLUDES_34 = [ 'gunicorn/workers/_gaiohttp.py', ] def compile_files(path): return compile_dir(path, maxlevels=50, quiet=True) def remove_pytho...
Split the Python specific version exludes between 2.7/3.4 specific syntax.
Split the Python specific version exludes between 2.7/3.4 specific syntax.
Python
apache-2.0
therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea
ca74738e9241230fd0cc843aa9b76f67494d02eb
python/intermediate/create_inter_python_data.py
python/intermediate/create_inter_python_data.py
"""Create the data for the Software Carpentry Intermediate Python lectures""" import numpy as np import pandas as pd np.random.seed(26) years = np.arange(1960, 2011) temps = np.random.uniform(70, 90, len(years)) rainfalls = np.random.uniform(100, 300, len(years)) noise = 2 * np.random.randn(len(years)) mosquitos = 0....
"""Create the data for the Software Carpentry Intermediate Python lectures""" import numpy as np import pandas as pd np.random.seed(26) datasets = {'A1': [0, 0.5, 0.7, 10], 'A2': [0, 0.5, 0.7, 50], 'A3': [0, 0.5, 0.3, 50], 'B1': [3, 0.7, 0.2, 50], 'B2': [3, 0.7, 0.7, 50...
Allow creation of multiple example data files for Inter Python
Allow creation of multiple example data files for Inter Python Generalizes the script for creating data files to allow for the easy generation of larger numbers of data files.
Python
bsd-2-clause
selimnairb/2014-02-25-swctest,selimnairb/2014-02-25-swctest,selimnairb/2014-02-25-swctest,selimnairb/2014-02-25-swctest,selimnairb/2014-02-25-swctest,selimnairb/2014-02-25-swctest
9b6a22a9cb908d1fbfa5f9b5081f6c96644115b0
tests/test_tags.py
tests/test_tags.py
from unittest import TestCase from django.test.utils import setup_test_template_loader, override_settings from django.template import Context from django.template.loader import get_template TEMPLATES = { 'basetag': '''{% load damn %}{% assets %}''', 'test2': ''' <!doctype html>{% load damn %} <html> <head> {%...
#from unittest import TestCase from django.test import TestCase from django.test.utils import setup_test_template_loader, override_settings from django.template import Context from django.template.loader import get_template TEMPLATES = { 'basetag': '''{% load damn %}{% assets %}''', 'test2': ''' <!doctype ht...
Use TestCase from Django Set STATIC_URL
Use TestCase from Django Set STATIC_URL
Python
bsd-2-clause
funkybob/django-amn
b245bdcf9a494297ef816c56a98d0477dfbd3d89
partner_industry_secondary/models/res_partner.py
partner_industry_secondary/models/res_partner.py
# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta # Copyright 2016 Tecnativa S.L. - Vicent Cubells # Copyright 2018 Eficent Business and IT Consulting Services, S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, exceptions, fields, models, _ class ResPartner(models...
# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta # Copyright 2016 Tecnativa S.L. - Vicent Cubells # Copyright 2018 Eficent Business and IT Consulting Services, S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, exceptions, fields, models, _ class ResPartner(models...
Make api constrains multi to avoid error when create a company with 2 contacts
partner_industry_Secondary: Make api constrains multi to avoid error when create a company with 2 contacts
Python
agpl-3.0
BT-rmartin/partner-contact,OCA/partner-contact,OCA/partner-contact,BT-rmartin/partner-contact
6336e8e13c01b6a81b8586499e7a3e8fc8b532a8
launch_control/commands/interface.py
launch_control/commands/interface.py
""" Interface for all launch-control-tool commands """ from launch_control.utils.registry import RegistryBase class Command(RegistryBase): """ Base class for all command line tool sub-commands. """ def __init__(self, parser, args): """ Prepare instance for executing commands. ...
""" Interface for all launch-control-tool commands """ import inspect from launch_control.utils.registry import RegistryBase class Command(RegistryBase): """ Base class for all command line tool sub-commands. """ def __init__(self, parser, args): """ Prepare instance for executing co...
Use inspect.getdoc() instead of plain __doc__
Use inspect.getdoc() instead of plain __doc__
Python
agpl-3.0
Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server
6fa0131dc85a94833310c4f1a24fac348ff90c7d
tools/makefiles.py
tools/makefiles.py
#!/usr/bin/env python from os import listdir import re #reads in old makefile from folder #parses for compiler arguments #creates cmake lists file with parsed arguments as parent-scope variables def readAndMake(folder): inStream = open(folder+"/Makefile", "r") oldMake = inStream.readlines() inStream.close...
#!/usr/bin/env python from os import listdir import re #reads in old makefile from folder #parses for compiler arguments #creates cmake lists file with parsed arguments as parent-scope variables def readAndMake(folder): inStream = open(folder+"/Makefile", "r") oldMake = inStream.readlines() inStream.close...
Add -Wno-writable-strings to clean up output
Add -Wno-writable-strings to clean up output
Python
mit
f0rki/cb-multios,f0rki/cb-multios,f0rki/cb-multios,f0rki/cb-multios,f0rki/cb-multios
612e253d0234e1852db61c589418edbb4add4b00
gunicorn.conf.py
gunicorn.conf.py
preload_app = True worker_class = "gunicorn.workers.gthread.ThreadWorker"
forwarded_allow_ips = '*' preload_app = True worker_class = "gunicorn.workers.gthread.ThreadWorker"
Disable checking of Front-end IPs
Disable checking of Front-end IPs
Python
agpl-3.0
City-of-Helsinki/kuulemma,fastmonkeys/kuulemma,City-of-Helsinki/kuulemma,fastmonkeys/kuulemma,City-of-Helsinki/kuulemma,fastmonkeys/kuulemma
37c1d6ae1345fbab7aea4404933d78d4b939bbc2
hoomd/filters.py
hoomd/filters.py
import hoomd._hoomd as _hoomd class ParticleFilterID: def __init__(self, *args, **kwargs): args_str = ''.join([str(arg) for arg in args]) kwargs_str = ''.join([str(value)for value in kwargs.values()]) self.args_str = args_str self.kwargs_str = kwargs_str _id = hash(self.__...
import hoomd._hoomd as _hoomd import numpy as np class ParticleFilter: def __init__(self, *args, **kwargs): args_str = ''.join([repr(arg) if not isinstance(arg, np.ndarray) else repr(list(arg)) for arg in args]) kwargs_str = ''.join([repr(value) if not isinstance(value...
Change hashing for ParticleFilter python class
Change hashing for ParticleFilter python class
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
f5e36391c253a52fe2bd434caf59c0f5c389cc64
tests/base.py
tests/base.py
import unittest import os os.environ['OGN_CONFIG_MODULE'] = 'config/test.py' from ogn_python import db # noqa: E402 class TestBaseDB(unittest.TestCase): @classmethod def setUpClass(cls): db.session.execute('CREATE EXTENSION IF NOT EXISTS postgis;') db.session.commit() db.create_all...
import unittest import os os.environ['OGN_CONFIG_MODULE'] = 'config/test.py' from ogn_python import db # noqa: E402 class TestBaseDB(unittest.TestCase): @classmethod def setUpClass(cls): db.drop_all() db.session.execute('CREATE EXTENSION IF NOT EXISTS postgis;') db.session.commit()...
Drop db before each test
Drop db before each test
Python
agpl-3.0
Meisterschueler/ogn-python,glidernet/ogn-python,glidernet/ogn-python,Meisterschueler/ogn-python,glidernet/ogn-python,glidernet/ogn-python,Meisterschueler/ogn-python,Meisterschueler/ogn-python
f1008dc6573661c41361cfe5f3c61a3ee719d6be
marketpulse/auth/models.py
marketpulse/auth/models.py
from django.contrib.auth.models import AbstractUser from django.db.models import fields class User(AbstractUser): mozillians_url = fields.URLField() mozillians_username = fields.CharField(max_length=30, blank=True)
from django.contrib.auth.models import AbstractUser from django.db.models import fields class User(AbstractUser): mozillians_url = fields.URLField() mozillians_username = fields.CharField(max_length=30, blank=True) def __unicode__(self): username = self.mozillians_username or self.username ...
Use mozillians_username for unicode representation.
Use mozillians_username for unicode representation.
Python
mpl-2.0
akatsoulas/marketpulse,mozilla/marketpulse,mozilla/marketpulse,akatsoulas/marketpulse,mozilla/marketpulse,mozilla/marketpulse,akatsoulas/marketpulse,akatsoulas/marketpulse
50305f63fda1127530650e030f23e92e8a725b8a
cgi-bin/user_register.py
cgi-bin/user_register.py
#!/usr/bin/python from MySQLdb import Error from util import connect_db, dump_response_and_exit import cgi import hashlib import json import re import sys print "Content-type:applicaion/json\r\n\r\n" form = cgi.FieldStorage() username = form.getvalue('username') password = form.getvalue('password') if username is N...
#!/usr/bin/python from MySQLdb import Error from util import connect_db, dump_response_and_exit import cgi import hashlib import json import re import sys print "Content-type:applicaion/json\r\n\r\n" form = cgi.FieldStorage() username = form.getvalue('username') password = form.getvalue('password') if username is N...
Fix bug when inserting user.
Fix bug when inserting user. Scheme of table: User has changed.
Python
mit
zhchbin/Yagra,zhchbin/Yagra,zhchbin/Yagra
46245254cdf9c3f2f6a9c27fe7e089867b4f394f
cloudbio/custom/versioncheck.py
cloudbio/custom/versioncheck.py
"""Tool specific version checking to identify out of date dependencies. This provides infrastructure to check version strings against installed tools, enabling re-installation if a version doesn't match. This is a lightweight way to avoid out of date dependencies. """ from distutils.version import LooseVersion from f...
"""Tool specific version checking to identify out of date dependencies. This provides infrastructure to check version strings against installed tools, enabling re-installation if a version doesn't match. This is a lightweight way to avoid out of date dependencies. """ from distutils.version import LooseVersion from f...
Include env.system_install PATH as part of version checking to work with installed software not on the global PATH. Thanks to James Cuff
Include env.system_install PATH as part of version checking to work with installed software not on the global PATH. Thanks to James Cuff
Python
mit
chapmanb/cloudbiolinux,elkingtonmcb/cloudbiolinux,kdaily/cloudbiolinux,elkingtonmcb/cloudbiolinux,kdaily/cloudbiolinux,averagehat/cloudbiolinux,kdaily/cloudbiolinux,chapmanb/cloudbiolinux,joemphilips/cloudbiolinux,AICIDNN/cloudbiolinux,joemphilips/cloudbiolinux,pjotrp/cloudbiolinux,pjotrp/cloudbiolinux,elkingtonmcb/clo...
e728d6ebdd101b393f3d87fdfbade2c4c52c5ef1
cdent/emitter/perl.py
cdent/emitter/perl.py
"""\ Perl code emitter for C'Dent """ from __future__ import absolute_import from cdent.emitter import Emitter as Base class Emitter(Base): LANGUAGE_ID = 'pm' def emit_includecdent(self, includecdent): self.writeln('use CDent::Run;') def emit_class(self, class_): name = class_.name ...
"""\ Perl code emitter for C'Dent """ from __future__ import absolute_import from cdent.emitter import Emitter as Base class Emitter(Base): LANGUAGE_ID = 'pm' def emit_includecdent(self, includecdent): self.writeln('use CDent::Run;') def emit_class(self, class_): name = class_.name ...
Use Moose for Perl 5
Use Moose for Perl 5
Python
bsd-2-clause
ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py,ingydotnet/cdent-py
8e4fca866590b4f7aa308d2cc1948b999bb1de8c
filebrowser_safe/urls.py
filebrowser_safe/urls.py
from __future__ import unicode_literals from django.conf.urls import * urlpatterns = patterns('', # filebrowser urls url(r'^browse/$', 'filebrowser_safe.views.browse', name="fb_browse"), url(r'^mkdir/', 'filebrowser_safe.views.mkdir', name="fb_mkdir"), url(r'^upload/', 'filebrowser_safe.views.upload'...
from __future__ import unicode_literals from django.conf.urls import url from filebrowser_safe import views urlpatterns = [ url(r'^browse/$', views.browse, name="fb_browse"), url(r'^mkdir/', views.mkdir, name="fb_mkdir"), url(r'^upload/', views.upload, name="fb_upload"), url(r'^rename/$', views.rena...
Update from deprecated features of urlpatterns.
Update from deprecated features of urlpatterns.
Python
bsd-3-clause
ryneeverett/filebrowser-safe,ryneeverett/filebrowser-safe,ryneeverett/filebrowser-safe,ryneeverett/filebrowser-safe
5a09b88399b34ea8a5185fe1bcdff5f3f7ac7619
invoke_pytest.py
invoke_pytest.py
#!/usr/bin/env python3 """ Unit tests at Windows environments required to invoke from py module, because of multiprocessing: https://py.rtfd.io/en/latest/faq.html?highlight=cmdline#issues-with-py-test-multiprocess-and-setuptools """ import sys import py if __name__ == "__main__": sys.exit(py.test.cmdline.main(...
#!/usr/bin/env python3 """ Unit tests at Windows environments required to invoke from py module, because of multiprocessing: https://py.rtfd.io/en/latest/faq.html?highlight=cmdline#issues-with-py-test-multiprocess-and-setuptools """ import os import sys import py if __name__ == "__main__": os.environ["PYTEST_M...
Add PYTEST_MD_REPORT_COLOR environment variable setting
Add PYTEST_MD_REPORT_COLOR environment variable setting
Python
mit
thombashi/pingparsing,thombashi/pingparsing
4a2d59375a94c3863431cbf62638c83c2cc70cfb
spec/openpassword/keychain_spec.py
spec/openpassword/keychain_spec.py
from nose.tools import * from openpassword import EncryptionKey from openpassword import Keychain from openpassword.exceptions import InvalidPasswordException import fudge import time class KeychainSpec: def it_unlocks_the_keychain_with_the_right_password(self): EncryptionKey = fudge.Fake('encryption_ke...
from nose.tools import * from openpassword import EncryptionKey from openpassword import Keychain from openpassword.exceptions import InvalidPasswordException import fudge class KeychainSpec: def it_unlocks_the_keychain_with_the_right_password(self): EncryptionKey = fudge.Fake('encryption_key') ...
Remove leftover from deleted examples
Remove leftover from deleted examples
Python
mit
openpassword/blimey,openpassword/blimey
419e06b36c63e8c7fbfdd64dfb7ee5d5654ca3af
studentvoice/urls.py
studentvoice/urls.py
from django.conf.urls import patterns, url from django.views.generic import TemplateView from studentvoice import views urlpatterns = patterns('', url(r'^$', views.home, name='home'), url(r'^create/$', views.create, name='create'), url(r'^search/', views.search, name='search'), url(r'^(?P<voice_id>\d+...
from django.conf.urls import patterns, url from django.views.generic import TemplateView from studentvoice import views urlpatterns = patterns('', url(r'^$', views.home, name='home'), url(r'^about/$', views.about, name='about'), url(r'^create/$', views.create, name='create'), url(r'^search/', views.sea...
Add the about page to url.py
Add the about page to url.py
Python
agpl-3.0
osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz
fe41aabf073ce3a02b5af117120d62ffc0324655
linked-list/linked-list.py
linked-list/linked-list.py
# LINKED LIST # define constructor class Node(object): def __init__(self, data): self.data = data self.next = None class LinkedList(object): def __init__(self, head=None): self.head = head def add(self, new_node): current_node = self.head if self.head: while current_node.next: current_node = curr...
# LINKED LIST # define constructor class Node(object): def __init__(self, data): self.data = data self.next = None class LinkedList(object): def __init__(self, head=None): self.head = head def add(self, new_node): current_node = self.head if self.head: while current_node.next: current_node = curr...
Add search method for python linked list implementation
Add search method for python linked list implementation
Python
mit
derekmpham/interview-prep,derekmpham/interview-prep
2f4ace9d1d1489cac1a8ace8b431eec376a02060
corehq/apps/couch_sql_migration/management/commands/show_started_migrations.py
corehq/apps/couch_sql_migration/management/commands/show_started_migrations.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from operator import attrgetter from django.core.management.base import BaseCommand import six from corehq.apps.domain_migration_flags.api import get_uncompleted_migrations from ...progress import C...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from operator import attrgetter from django.core.management.base import BaseCommand import six from corehq.apps.domain_migration_flags.api import get_uncompleted_migrations from ...progress import C...
Handle error in get diff stats
Handle error in get diff stats
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
a88d8f6de5e7135b9fdc2ad75a386579bebde07f
lcad_to_ldraw.py
lcad_to_ldraw.py
#!/usr/bin/env python """ .. module:: lcad_to_ldraw :synopsis: Generates a ldraw format file from a lcad model. .. moduleauthor:: Hazen Babcock """ import os import sys import lcad_language.interpreter as interpreter if (len(sys.argv)<2): print "usage: <lcad file> <ldraw file (optional)>" exit() # Gener...
#!/usr/bin/env python """ .. module:: lcad_to_ldraw :synopsis: Generates a ldraw format file from a lcad model. .. moduleauthor:: Hazen Babcock """ import os import sys import lcad_language.interpreter as interpreter if (len(sys.argv)<2): print "usage: <lcad file> <ldraw file (optional)>" exit() # Gener...
Fix to work correctly if we are already in the directory of the lcad file.
Fix to work correctly if we are already in the directory of the lcad file.
Python
mit
HazenBabcock/opensdraw
3a8d7ff5f047c7b3476b8dcffa0e6850e952a645
docs/examples/http_proxy/set_http_proxy_method.py
docs/examples/http_proxy/set_http_proxy_method.py
from pprint import pprint from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver PROXY_URL = 'http://<proxy hostname>:<proxy port>' cls = get_driver(Provider.RACKSPACE) driver = cls('username', 'api key', region='ord') driver.set_http_proxy(proxy_url=PROXY_URL) pprint(driver.l...
from pprint import pprint from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver PROXY_URL = 'http://<proxy hostname>:<proxy port>' cls = get_driver(Provider.RACKSPACE) driver = cls('username', 'api key', region='ord') driver.connection.set_http_proxy(proxy_url=PROXY_URL) ppri...
Fix a typo in the example.
Fix a typo in the example.
Python
apache-2.0
kater169/libcloud,DimensionDataCBUSydney/libcloud,t-tran/libcloud,Scalr/libcloud,MrBasset/libcloud,watermelo/libcloud,curoverse/libcloud,Kami/libcloud,SecurityCompass/libcloud,Kami/libcloud,pantheon-systems/libcloud,andrewsomething/libcloud,schaubl/libcloud,pantheon-systems/libcloud,jimbobhickville/libcloud,munkiat/lib...
f7b471858e89fe07b78dd3853d4351dfa83cac49
placidity/plugin_loader.py
placidity/plugin_loader.py
class PluginLoader: def load(self, directory): ret = [] for plugin in directory.children: plugin_file = plugin.find(name=plugin.name, type='py') if not plugin_file: continue plugin_class = plugin_file.classes[plugin.name] ...
class PluginLoader: def load(self, directory): ret = [] for plugin in directory.children: plugin_file = plugin.find(name=plugin.name, type='py') if not plugin_file: continue plugin_class = plugin_file.classes.get(plugin.name) if n...
Make plugin loader more robust
Make plugin loader more robust
Python
mit
bebraw/Placidity
ba4eace22eb2379a5a0d8a79615892edd58b1f49
mezzanine/core/sitemaps.py
mezzanine/core/sitemaps.py
from django.contrib.sitemaps import Sitemap from django.db.models import get_models from mezzanine.core.models import Displayable class DisplayableSitemap(Sitemap): """ Sitemap class for Django's sitemaps framework that returns all published items for models that subclass ``Displayable``. """ d...
from django.contrib.sitemaps import Sitemap from django.db.models import get_models from mezzanine.core.models import Displayable class DisplayableSitemap(Sitemap): """ Sitemap class for Django's sitemaps framework that returns all published items for models that subclass ``Displayable``. """ d...
Clean up sitemap URL handling.
Clean up sitemap URL handling.
Python
bsd-2-clause
Cajoline/mezzanine,guibernardino/mezzanine,agepoly/mezzanine,sjuxax/mezzanine,vladir/mezzanine,Cicero-Zhao/mezzanine,stbarnabas/mezzanine,sjdines/mezzanine,viaregio/mezzanine,wbtuomela/mezzanine,biomassives/mezzanine,frankchin/mezzanine,orlenko/plei,dekomote/mezzanine-modeltranslation-backport,batpad/mezzanine,mush42/m...
d1da755f10d4287d1cfbec3a6d29d9961125bbce
plugins/tff_backend/plugin_consts.py
plugins/tff_backend/plugin_consts.py
# -*- coding: utf-8 -*- # Copyright 2017 GIG Technology NV # # 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...
# -*- coding: utf-8 -*- # Copyright 2017 GIG Technology NV # # 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...
Add BTC to possible currencies
Add BTC to possible currencies
Python
bsd-3-clause
threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend
9c8dbde9b39f6fcd713a7d118dcd613cc48cf54e
astropy/tests/tests/test_run_tests.py
astropy/tests/tests/test_run_tests.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) # test helper.run_tests function import sys from .. import helper from ... import _get_test_runner from .. helper import pytest # run_tests sho...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) # test helper.run_tests function import warnings from .. import helper from ... import _get_test_runner from .. helper import pytest # run_test...
Test that deprecation exceptions are working differently, after suggestion by @embray
Test that deprecation exceptions are working differently, after suggestion by @embray
Python
bsd-3-clause
larrybradley/astropy,aleksandr-bakanov/astropy,DougBurke/astropy,stargaser/astropy,DougBurke/astropy,joergdietrich/astropy,kelle/astropy,mhvk/astropy,funbaker/astropy,saimn/astropy,lpsinger/astropy,pllim/astropy,dhomeier/astropy,StuartLittlefair/astropy,lpsinger/astropy,larrybradley/astropy,aleksandr-bakanov/astropy,dh...
24093369bb1dbd2e9034db9425920ffdc14ee070
abusehelper/bots/abusech/feodoccbot.py
abusehelper/bots/abusech/feodoccbot.py
""" abuse.ch Feodo RSS feed bot. Maintainer: AbuseSA team <contact@abusesa.com> """ from abusehelper.core import bot from . import host_or_ip, split_description, AbuseCHFeedBot class FeodoCcBot(AbuseCHFeedBot): feed_type = "c&c" feed_name = "feodo c&c" feeds = bot.ListParam(default=["https://feodotrac...
""" abuse.ch Feodo RSS feed bot. Maintainer: AbuseSA team <contact@abusesa.com> """ from abusehelper.core import bot from . import host_or_ip, split_description, AbuseCHFeedBot class FeodoCcBot(AbuseCHFeedBot): feed_type = "c&c" feed_name = "feodo c&c" feeds = bot.ListParam(default=["https://feodotrac...
Include status information in abuse.ch's Feodo C&C feed
Include status information in abuse.ch's Feodo C&C feed
Python
mit
abusesa/abusehelper
efd1841fb904e30ac0b87b7c7d019f2745452cb2
test_output.py
test_output.py
#!/usr/bin/env python # -*- encoding: utf-8 """ These are tests of the external behaviour -- feature tests, if you like. They run the compiled binaries, and make assertions about the return code, stdout and stderr. """ import unittest from conftest import BaseTest class TestSafariRS(BaseTest): def test_urls_al...
#!/usr/bin/env python # -*- encoding: utf-8 """ These are tests of the external behaviour -- feature tests, if you like. They run the compiled binaries, and make assertions about the return code, stdout and stderr. """ import unittest from conftest import BaseTest class TestSafariRS(BaseTest): def test_urls_al...
Add some tests for the URL resolver
Add some tests for the URL resolver
Python
mit
alexwlchan/safari.rs,alexwlchan/safari.rs
153c832f083e8ec801ecb8dbddd2f8e79b735eed
utilities.py
utilities.py
# Function to return a list of pvs from a given file import pkg_resources pkg_resources.require('aphla') import aphla as ap def get_pv_names(mode): ''' Given a certain ring mode as a string, return all available pvs ''' ap.machines.load(mode) result = set() elements = ap.getElements('*') for ele...
# Function to return a list of pvs from a given file import pkg_resources pkg_resources.require('aphla') import aphla as ap def get_pv_names(mode): ''' Given a certain ring mode as a string, return all available pvs ''' ap.machines.load(mode) result = set() elements = ap.getElements('*') for el...
Add utility function to write pvs to file
Add utility function to write pvs to file
Python
apache-2.0
razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects
69a94173a48d04bc9e409278574844ebbc43af8b
dadd/worker/__init__.py
dadd/worker/__init__.py
import os from functools import partial import click from flask import Flask from dadd import server app = Flask(__name__) app.config.from_object('dadd.worker.settings') import dadd.worker.handlers # noqa @click.command() @click.pass_context def run(ctx): if os.environ.get('DEBUG') or (ctx.obj and ctx.obj...
from functools import partial import click from flask import Flask from dadd import server from dadd.master.utils import update_config app = Flask(__name__) app.config.from_object('dadd.worker.settings') import dadd.worker.handlers # noqa @click.command() @click.pass_context def run(ctx): if ctx.obj: ...
Allow worker to use APP_SETTINGS_YAML correctly.
Allow worker to use APP_SETTINGS_YAML correctly.
Python
bsd-3-clause
ionrock/dadd,ionrock/dadd,ionrock/dadd,ionrock/dadd
a499f5fbe63f03a3c404a28e0c1286af74382e09
tests/utils.py
tests/utils.py
import os from django.core.files.base import ContentFile from imagekit.lib import Image, StringIO from .models import Photo import pickle def get_image_file(): """ See also: http://en.wikipedia.org/wiki/Lenna http://sipi.usc.edu/database/database.php?volume=misc&image=12 """ path = os.path...
import os from django.core.files.base import ContentFile from imagekit.lib import Image, StringIO from tempfile import NamedTemporaryFile from .models import Photo import pickle def _get_image_file(file_factory): """ See also: http://en.wikipedia.org/wiki/Lenna http://sipi.usc.edu/database/database...
Add util for generating named image file
Add util for generating named image file
Python
bsd-3-clause
FundedByMe/django-imagekit,tawanda/django-imagekit,tawanda/django-imagekit,FundedByMe/django-imagekit
87007360cc7ddc0c5d40882bd2f8107db64d1bdf
tools/po2js.py
tools/po2js.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os.path import codecs import dfstrings import time def make_js_from_po(path): strings = [] for po in [p for p in dfstrings.get_po_strings(path) if "scope" in p and "dragonfly" in p["scope"] ]: strings.append(u"""ui_strings.%s="%s";""...
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os.path import codecs import dfstrings import time def make_js_from_po(path): strings = [] for po in [p for p in dfstrings.get_po_strings(path) if "scope" in p and "dragonfly" in p["scope"] ]: strings.append(u"""ui_strings.%s="%s";""...
Add the language code to the translated file
Add the language code to the translated file
Python
apache-2.0
operasoftware/dragonfly-build-tools,operasoftware/dragonfly-build-tools
8004590503914d9674a0b17f412c8d1836f5e1a1
testScript.py
testScript.py
from elsapy import * conFile = open("config.json") config = json.load(conFile) myCl = elsClient(config['apikey']) myAuth = elsAuthor('http://api.elsevier.com/content/author/AUTHOR_ID:7004367821') myAuth.read(myCl) print ("myAuth.fullName: ", myAuth.fullName) myAff = elsAffil('http://api.elsevier.com/content/affili...
from elsapy import * conFile = open("config.json") config = json.load(conFile) myCl = elsClient(config['apikey']) myAuth = elsAuthor('http://api.elsevier.com/content/author/AUTHOR_ID:7004367821') ## author with more than 25 docs ##myAuth = elsAuthor('http://api.elsevier.com/content/author/AUTHOR_ID:5593402650...
Add second author for testing purposes
Add second author for testing purposes
Python
bsd-3-clause
ElsevierDev/elsapy
5b64a272d0830c3a85fe540a82d6ff8b62bd0ea8
livinglots_organize/templatetags/organize_tags.py
livinglots_organize/templatetags/organize_tags.py
""" Template tags for the organize app, loosely based on django.contrib.comments. """ from django import template from livinglots import get_organizer_model from livinglots_generictags.tags import (GetGenericRelationList, RenderGenericRelationList, ...
""" Template tags for the organize app, loosely based on django.contrib.comments. """ from django import template from django.contrib.contenttypes.models import ContentType from classytags.arguments import Argument, KeywordArgument from classytags.core import Options from livinglots import get_organizer_model from l...
Add `public` keyword to render_organizer_list
Add `public` keyword to render_organizer_list
Python
agpl-3.0
596acres/django-livinglots-organize,596acres/django-livinglots-organize
1105dfb75bf373b38e2f12579843af54f7a78c6f
DataModelAdapter.py
DataModelAdapter.py
class DataModelAdapter(object) : def __init__(self, data) : self._data = data self._children = set() self._parent = None pass def numChildren(self) : return len(self._children) def hasData(self) : return self._data is not None def getData(self, key) :...
class DataModelAdapter(object) : def __init__(self, data) : self._data = data self._children = set() self._parent = None pass def numChildren(self) : return len(self._children) def hasData(self) : return self._data is not None def getData(self, key) :...
Add child(); TODO: test this
Add child(); TODO: test this
Python
apache-2.0
mattdeckard/wherewithal
b53a6fb45934856fcf1aca419b4022241fc7fcbc
tests/t_all.py
tests/t_all.py
#!/usr/bin/env python # # Copyright 2011, Toru Maesaka # # Redistribution and use of this source code is licensed under # the BSD license. See COPYING file for license description. # # USAGE: # $ python t_all.py # $ python t_all.py ExpireTestCase import os import re import unittest _TEST_MODULE_PATTERN = re.compi...
#!/usr/bin/env python # # Copyright 2011, Toru Maesaka # # Redistribution and use of this source code is licensed under # the BSD license. See COPYING file for license description. # # USAGE: # $ python t_all.py # $ python t_all.py ExpireTestCase # $ python t_all.py MultiTestCase # $ python t_all.py ScriptTestC...
Exclude the play script test case from the default test suite.
Exclude the play script test case from the default test suite.
Python
bsd-3-clause
sapo/python-kyototycoon,sapo/python-kyototycoon-ng
be73d527c87ce94e4e4d4c80c6ef797aad803f50
opps/__init__.py
opps/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pkg_resources pkg_resources.declare_namespace(__name__) trans_app_label = _('Opps') VERSION = (0, 1, 4) __version__ = ".".join(map(str, VERSION)) __status__ = "Development" __description__ = u"Opps CMS websites magazines and high-traffic" __author__ = u"Thiago Av...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pkg_resources pkg_resources.declare_namespace(__name__) VERSION = (0, 1, 4) __version__ = ".".join(map(str, VERSION)) __status__ = "Development" __description__ = u"Opps CMS websites magazines and high-traffic" __author__ = u"Thiago Avelino" __credits__ = [] __em...
Remove trans app label on opps init
Remove trans app label on opps init
Python
mit
jeanmask/opps,jeanmask/opps,opps/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,YACOWS/opps,williamroot/opps,opps/opps,jeanmask/opps,williamroot/opps
4e8c84bf36250d7e61b585fc5db545206cab9730
perfkitbenchmarker/scripts/spark_table.py
perfkitbenchmarker/scripts/spark_table.py
# Lint as: python2, python3 """A PySpark driver that creates Spark tables for Spark SQL benchmark. It takes an HCFS directory and a list of the names of the subdirectories of that root directory. The subdirectories each hold Parquet data and are to be converted into a table of the same name. The subdirectories are exp...
# Lint as: python2, python3 """A PySpark driver that creates Spark tables for Spark SQL benchmark. It takes an HCFS directory and a list of the names of the subdirectories of that root directory. The subdirectories each hold Parquet data and are to be converted into a table of the same name. The subdirectories are exp...
Support creating Hive tables with partitioned data.
Support creating Hive tables with partitioned data. PiperOrigin-RevId: 335539022
Python
apache-2.0
GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker
35f45d3fcee5a1fe9d6d5ce71b708d0bc68db3fc
python/matasano/set1/c7.py
python/matasano/set1/c7.py
from matasano.util.converters import base64_to_bytes from Crypto.Cipher import AES import base64 if __name__ == "__main__": chal_file = open("matasano/data/c7.txt", 'r'); key = "YELLOW SUBMARINE" # Instantiate the cipher cipher = AES.new(key, AES.MODE_ECB) # Covert from base64 to bytes and enco...
from matasano.util.converters import base64_to_bytes from Crypto.Cipher import AES import base64 if __name__ == "__main__": chal_file = open("matasano/data/c7.txt", 'r'); key = "YELLOW SUBMARINE" # Instantiate the cipher cipher = AES.new(key, AES.MODE_ECB) # Covert from base64 to bytes and enco...
Switch to using base64 builtin decoder for simplicity.
Switch to using base64 builtin decoder for simplicity.
Python
mit
TheLunchtimeAttack/matasano-challenges,TheLunchtimeAttack/matasano-challenges
0da81b53b521c22368899211dc851d6147e1a30d
common_components/static_renderers.py
common_components/static_renderers.py
from os.path import join, splitext, basename from bricks.staticfiles import StaticCss, StaticJs, StaticFile class _BuiltStatic(StaticFile): has_build_stage = True def __init__(self, *args): StaticFile.__init__(self, *args) self.url = self.url.rsplit('.', 1)[0] + '.' + self.target_type class S...
from os.path import join, splitext, basename from bricks.staticfiles import StaticCss, StaticJs, StaticFile class _BuiltStatic(StaticFile): has_build_stage = True def __init__(self, *args): StaticFile.__init__(self, *args) self.url = self.url.rsplit('.', 1)[0] + '.' + self.target_type class S...
Revert "fixed rendering of Sass and Coffee"
Revert "fixed rendering of Sass and Coffee" This reverts commit b21834c9d439603f666d17aea338934bae063ef4.
Python
mpl-2.0
Zer0-/common_components
61de7c1827867cea3385c5db3862e5e68caa98fd
Puli/src/octopus/dispatcher/rules/graphview.py
Puli/src/octopus/dispatcher/rules/graphview.py
from octopus.dispatcher.model import TaskNode, FolderNode, TaskGroup from octopus.dispatcher import rules import logging logger = logging.getLogger("dispatcher") class RuleError(rules.RuleError): '''Base class for GraphViewBuilder related exceptions.''' pass class TaskNodeHasNoChildrenError(RuleError): ...
from octopus.dispatcher.model import TaskNode, FolderNode, TaskGroup from octopus.dispatcher import rules import logging logger = logging.getLogger("dispatcher") class RuleError(rules.RuleError): '''Base class for GraphViewBuilder related exceptions.''' pass class TaskNodeHasNoChildrenError(RuleError): ...
Add a representation of GraphView object
Add a representation of GraphView object
Python
bsd-3-clause
mikrosimage/OpenRenderManagement,mikrosimage/OpenRenderManagement,smaragden/OpenRenderManagement,smaragden/OpenRenderManagement,smaragden/OpenRenderManagement,mikrosimage/OpenRenderManagement
f32ab8ebd509df7e815fb96189974e7db44af3e3
plugins/owner.py
plugins/owner.py
import inspect import traceback from curious import commands from curious.commands.context import Context from curious.commands.plugin import Plugin class Owner(Plugin): """ Owner-only commands. """ @commands.command(name="eval") async def _eval(self, ctx: Context, *, eval_str: str): msg ...
import inspect import traceback from curious import commands from curious.commands.context import Context from curious.commands.plugin import Plugin def is_owner(self, ctx: Context): return ctx.author.id == 141545699442425856 or ctx.message.author.id == ctx.bot.application_info.owner.id class Owner(Plugin): ...
Add load and unload commands.
Add load and unload commands.
Python
mit
SunDwarf/curiosity
f5b1975aebf50af78d41b8f192dabc128ad78b2a
sc2reader/engine/plugins/__init__.py
sc2reader/engine/plugins/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals, division from sc2reader.engine.plugins.apm import APMTracker from sc2reader.engine.plugins.selection import SelectionTracker from sc2reader.engine.plugins.context import ContextLoader from sc2reader.engine.plugins.supply ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals, division from sc2reader.engine.plugins.apm import APMTracker from sc2reader.engine.plugins.selection import SelectionTracker from sc2reader.engine.plugins.context import ContextLoader from sc2reader.engine.plugins.supply ...
Fix a small rebase error, my bad.
Fix a small rebase error, my bad.
Python
mit
StoicLoofah/sc2reader,ggtracker/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader
fb39b3ffc6fcd3df0f89cd3978796a4377335075
tests/primitives/utils.py
tests/primitives/utils.py
import binascii import os import pytest from cryptography.bindings import _ALL_APIS from cryptography.primitives.block import BlockCipher def generate_encrypt_test(param_loader, path, file_names, cipher_factory, mode_factory, only_if=lambda api: True, skip_message...
import binascii import os import pytest from cryptography.bindings import _ALL_APIS from cryptography.primitives.block import BlockCipher def generate_encrypt_test(param_loader, path, file_names, cipher_factory, mode_factory, only_if=lambda api: True, skip_message...
Rewrite to avoid capitalization issues
Rewrite to avoid capitalization issues
Python
bsd-3-clause
kimvais/cryptography,Ayrx/cryptography,dstufft/cryptography,sholsapp/cryptography,dstufft/cryptography,bwhmather/cryptography,sholsapp/cryptography,kimvais/cryptography,kimvais/cryptography,Lukasa/cryptography,skeuomorf/cryptography,sholsapp/cryptography,Hasimir/cryptography,skeuomorf/cryptography,Lukasa/cryptography,d...
010040a8f7cb6a7a60b88ae80c43198fc46594d9
tests/test_integration.py
tests/test_integration.py
import os from unittest import TestCase from yoconfigurator.base import read_config from yoconfig import configure_services from pycloudflare.services import CloudFlareService app_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) conf = read_config(app_dir) class ZonesTest(TestCase): def set...
import os import types from unittest import TestCase from yoconfigurator.base import read_config from yoconfig import configure_services from pycloudflare.services import CloudFlareService app_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) conf = read_config(app_dir) class ZonesTest(TestCase)...
Test iter_zones instead of get_zones
Test iter_zones instead of get_zones
Python
mit
yola/pycloudflare,gnowxilef/pycloudflare
582da24725e03a159aa47cdf730915cddab52c5d
workflows/cp-leaveout/scripts/print-node-info.py
workflows/cp-leaveout/scripts/print-node-info.py
# EXTRACT NODE INFO PY import argparse, os, pickle, sys from Node import Node from utils import abort parser = argparse.ArgumentParser(description='Parse all log files') parser.add_argument('directory', help='The experiment directory (EXPID)') args = parser.parse_args() node_pkl = args.directo...
# EXTRACT NODE INFO PY import argparse, os, pickle, sys from Node import Node from utils import fail parser = argparse.ArgumentParser(description='Parse all log files') parser.add_argument('directory', help='The experiment directory (EXPID)') args = parser.parse_args() node_pkl = args.director...
Replace abort() with fail() again
Replace abort() with fail() again
Python
mit
ECP-CANDLE/Supervisor,ECP-CANDLE/Supervisor,ECP-CANDLE/Supervisor,ECP-CANDLE/Supervisor,ECP-CANDLE/Supervisor,ECP-CANDLE/Supervisor
c40d63852807645a39bb1e3316a10e5f2a3ad650
syntacticframes_project/loadmapping/management/commands/save_correspondances.py
syntacticframes_project/loadmapping/management/commands/save_correspondances.py
import csv from os import path from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.conf import settings from syntacticframes.models import VerbNetClass class Command(BaseCommand): def handle(self, *args, **options): with open(path.join(settings.SITE...
import csv from os import path from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.conf import settings from syntacticframes.models import VerbNetClass class Command(BaseCommand): def handle(self, *args, **options): with open(path.join(settings.SITE...
Save LVF before LADL in CSV to be similar to website
Save LVF before LADL in CSV to be similar to website
Python
mit
aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor
9a57f2493a8e7561a053077c793cdd998c9a28c9
bucketeer/test/test_commit.py
bucketeer/test/test_commit.py
import unittest from bucketeer import commit class BuckeeterTest(unittest.TestCase): def setUp(self): # 1 bucket with 1 file return def tearDown(self): # Remove all test-created buckets and files return def testMain(self): self.assertTrue(commit) if __name__ == '__main__': unittest....
import unittest import boto from bucketeer import commit class BuckeeterTest(unittest.TestCase): def setUp(self): # Create a bucket with one file connection = boto.connect_s3() bucket = connection.create_bucket('bucket.exists') return def tearDown(self): # Remove all test-created buckets and...
Add setUp and tearDown of a test bucket
Add setUp and tearDown of a test bucket
Python
mit
mgarbacz/bucketeer
84af44868ea742bb5f6d08991526a98c8c78a931
tellurium/teconverters/__init__.py
tellurium/teconverters/__init__.py
from __future__ import absolute_import # converts Antimony to/from SBML from .convert_antimony import antimonyConverter from .convert_omex import inlineOmexImporter, OmexFormatDetector try: from .convert_phrasedml import phrasedmlImporter except: pass from .antimony_sbo import SBOError from .inline_omex i...
from __future__ import absolute_import # converts Antimony to/from SBML from .convert_antimony import antimonyConverter from .convert_omex import inlineOmexImporter, OmexFormatDetector try: from .convert_phrasedml import phrasedmlImporter from .inline_omex import inlineOmex, saveInlineOMEX except: pass ...
Drop inline omex if it fails.
Drop inline omex if it fails.
Python
apache-2.0
sys-bio/tellurium,sys-bio/tellurium
69b262f502bbc48204db70815476aa256bd7db6e
rmgpy/tools/canteraTest.py
rmgpy/tools/canteraTest.py
import unittest import os import numpy from rmgpy.tools.canteraModel import * class CanteraTest(unittest.TestCase): def testIgnitionDelay(self): """ Test that findIgnitionDelay() works. """ t = numpy.arange(0,5,0.5) P = numpy.array([0,0.33,0.5,0.9,2,4,15,16,16.1,16.2]) ...
import unittest import os import numpy from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera from rmgpy.quantity import Quantity class CanteraTest(unittest.TestCase): def testIgnitionDelay(self): """ Test that findIgnitionDelay() works. """ t = numpy.ara...
Add unit test for CanteraCondition that tests that the repr() function works
Add unit test for CanteraCondition that tests that the repr() function works
Python
mit
nyee/RMG-Py,nickvandewiele/RMG-Py,chatelak/RMG-Py,nickvandewiele/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,pierrelb/RMG-Py
7e7f9da097563d8fbd407268093b56c2f10464a5
radar/radar/tests/validation/test_reset_password_validation.py
radar/radar/tests/validation/test_reset_password_validation.py
import pytest from radar.validation.reset_password import ResetPasswordValidation from radar.validation.core import ValidationError from radar.tests.validation.helpers import validation_runner def test_valid(): obj = valid({ 'token': '12345', 'username': 'hello', 'password': 'password', ...
import pytest from radar.validation.reset_password import ResetPasswordValidation from radar.validation.core import ValidationError from radar.tests.validation.helpers import validation_runner def test_valid(): obj = valid({ 'token': '12345', 'username': 'hello', 'password': '2irPtfNUURf8...
Use stronger password in reset password test
Use stronger password in reset password test
Python
agpl-3.0
renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar
002d1ac1d2fcf88a7df46681ef7b3969f08e9a8f
qual/calendar.py
qual/calendar.py
from datetime import date class DateWithCalendar(object): def __init__(self, calendar_class, date): self.calendar = calendar_class self.date = date class ProlepticGregorianCalendar(object): def date(self, year, month, day): d = date(year, month, day) return DateWithCalendar(Pro...
from datetime import date, timedelta class DateWithCalendar(object): def __init__(self, calendar_class, date): self.calendar = calendar_class self.date = date def convert_to(self, calendar): return calendar.from_date(self.date) def __eq__(self, other): return self.calendar...
Allow conversion from Julian to ProlepticGregorian, also comparison of dates.
Allow conversion from Julian to ProlepticGregorian, also comparison of dates.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
99c8473b0d1f778830c642c0f0e2b6c5bc1f3c80
plugins/plugin_count_ip.py
plugins/plugin_count_ip.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys sys.path.insert(0, "..") from libs.manager import Plugin class CountIPNew(Plugin): def __init__(self, **kwargs): self.keywords = ['counter', 'ip'] self.total_ip = 0 self.ip_dict = {} def __process_doc(self, **kwargs): i...
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys sys.path.insert(0, "..") from libs.manager import Plugin from bson.code import Code class CountIPNew(Plugin): def __init__(self, **kwargs): self.keywords = ['counter', 'ip'] self.result = {} def process(self, **kwargs): collect...
Add plugin count ip using mongo aggregation framework
Add plugin count ip using mongo aggregation framework
Python
apache-2.0
keepzero/fluent-mongo-parser
fa1f148b33c61e91044c19a88737abd2ec86c6bf
yunity/api/public/auth.py
yunity/api/public/auth.py
from django.contrib.auth import logout from django.middleware.csrf import get_token as generate_csrf_token_for_frontend from rest_framework import status, viewsets from rest_framework.decorators import list_route from rest_framework.response import Response from yunity.api.serializers import UserSerializer, AuthLoginSe...
from django.contrib.auth import logout from django.middleware.csrf import get_token as generate_csrf_token_for_frontend from rest_framework import status, viewsets from rest_framework.decorators import list_route from rest_framework.response import Response from yunity.api.serializers import UserSerializer, AuthLoginSe...
Enable easy login through browsable API (discovery through serializer_class)
Enable easy login through browsable API (discovery through serializer_class)
Python
agpl-3.0
yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core
e49e7484987e3b508802adbd9e05b2b156eb6bdd
manage.py
manage.py
import os import coverage from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand from config import basedir from app import create_app, db from app.models import User, Dictionary app = create_app(os.getenv("MYDICTIONARY_CONFIG") or "default") migrate = Migrate(app, db) manager = Ma...
import os import coverage from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand from config import basedir from app import create_app, db from app.models import User, Dictionary, Word app = create_app(os.getenv("MYDICTIONARY_CONFIG") or "default") migrate = Migrate(app, db) manage...
Add Word model to shell context
Add Word model to shell context
Python
mit
Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary
d883a0fd09a42ff84ebb2ccf331692167370444b
ESLog/esloghandler.py
ESLog/esloghandler.py
# -*- coding: utf-8 -*- from datetime import datetime import logging import os import json import urllib.request import urllib.parse class ESLogHandler(logging.Handler): def __init__(self, url, index=None, doc_type="log", level=logging.NOTSET): logging.Handler.__init__(self, level=level) ...
# -*- coding: utf-8 -*- from datetime import datetime import logging import os import json import urllib.request import urllib.parse class ESLogHandler(logging.Handler): def __init__(self, url, index=None, doc_type="log", level=logging.NOTSET): logging.Handler.__init__(self, level=level) # Parse...
Revert "trying to simplefy __init__"
Revert "trying to simplefy __init__" This reverts commit f2e3887bcd53b1c35af2d9dfe2363ea9e2a407f5.
Python
mit
Rio/ESLog
ad8cdf0ed4f2b6f3e2586dc5c6dd0f922a556972
ExpandRegion.py
ExpandRegion.py
import sublime_plugin from basic_expansions import foo class ExpandRegionCommand(sublime_plugin.TextCommand): def run(self, edit): foo();
import sublime, sublime_plugin, re class ExpandRegionCommand(sublime_plugin.TextCommand): def run(self, edit): region = self.view.sel()[0] string = self.view.substr(sublime.Region(0, self.view.size())) start = region.begin() end = region.end() if self.expand_to_word(string, start, end) is None: ...
Add expand selection to word
Add expand selection to word
Python
mit
aronwoost/sublime-expand-region,johyphenel/sublime-expand-region,johyphenel/sublime-expand-region
3e45f7d71fbd154a1039836228098efb62457f1b
tests/app/dvla_organisation/test_rest.py
tests/app/dvla_organisation/test_rest.py
from flask import json from tests import create_authorization_header def test_get_dvla_organisations(client): auth_header = create_authorization_header() response = client.get('/dvla_organisations', headers=[auth_header]) assert response.status_code == 200 dvla_organisations = json.loads(response.g...
from flask import json from tests import create_authorization_header def test_get_dvla_organisations(client): auth_header = create_authorization_header() response = client.get('/dvla_organisations', headers=[auth_header]) assert response.status_code == 200 dvla_organisations = json.loads(response.g...
Refactor test so that it does not have to change every time we add a new organisation.
Refactor test so that it does not have to change every time we add a new organisation.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
e3c840567fae974b2a1f169b05b86de97b60c8d0
gitcms/publications/urls.py
gitcms/publications/urls.py
from django.conf.urls.defaults import * import settings import views urlpatterns = patterns('', (r'^papers/(?P<paper>.+)$', views.papers), (r'^publications/?$', views.publications, { 'collection' : 'luispedro' }), (r'^publications/(?P<collection>.+)$', views.publications), (r'^publications/files/(?P<fi...
from django.conf.urls.defaults import * import settings import views urlpatterns = patterns('', (r'^papers/(?P<paper>.+)$', views.papers), (r'^publications/?$', views.publications, { 'collection' : 'luispedro' }), (r'^publications/(?P<collection>.+)$', views.publications), (r'^publications/files/(?P<fi...
Remove stay mention to BASE_URL
Remove stay mention to BASE_URL
Python
agpl-3.0
luispedro/django-gitcms,luispedro/django-gitcms
99906c1d0db30454f1d3c12d2076abe05939ab0d
redash/cli/organization.py
redash/cli/organization.py
from flask_script import Manager from redash import models manager = Manager(help="Organization management commands.") @manager.option('domains', help="comma separated list of domains to allow") def set_google_apps_domains(domains): organization = models.Organization.select().first() organization.settings[m...
from flask_script import Manager from redash import models manager = Manager(help="Organization management commands.") @manager.option('domains', help="comma separated list of domains to allow") def set_google_apps_domains(domains): organization = models.Organization.select().first() organization.settings[m...
Add 'manage.py org list' command
Add 'manage.py org list' command 'org list' simply prints out the organizations.
Python
bsd-2-clause
getredash/redash,easytaxibr/redash,EverlyWell/redash,ninneko/redash,alexanderlz/redash,chriszs/redash,imsally/redash,stefanseifert/redash,easytaxibr/redash,vishesh92/redash,crowdworks/redash,guaguadev/redash,vishesh92/redash,stefanseifert/redash,denisov-vlad/redash,denisov-vlad/redash,rockwotj/redash,hudl/redash,hudl/r...
0037017e5d496127df10385ef5cd28fd0149aa76
account_payment_include_draft_move/__openerp__.py
account_payment_include_draft_move/__openerp__.py
# -*- coding: utf-8 -*- # ############################################################################## # # Authors: Adrien Peiffer # Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Gener...
# -*- coding: utf-8 -*- # ############################################################################## # # Authors: Adrien Peiffer # Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Gener...
Move maintainer key out of the manifest
[IMP] Move maintainer key out of the manifest
Python
agpl-3.0
ndtran/bank-payment,syci/bank-payment,sergio-incaser/bank-payment,Antiun/bank-payment,syci/bank-payment,hbrunn/bank-payment,diagramsoftware/bank-payment,CompassionCH/bank-payment,damdam-s/bank-payment,sergio-teruel/bank-payment,CompassionCH/bank-payment,Antiun/bank-payment,David-Amaro/bank-payment,sergiocorato/bank-pay...
cc85fdf3b44b7a69b8d0406c170d409783687d2d
__TEMPLATE__.py
__TEMPLATE__.py
"""Module docstring. This talks about the module.""" # -*- coding: utf-8 -*- __author__ = """Chris Tabor (dxdstudio@gmail.com)""" IS_MAIN = True if __name__ == '__main__' else False if IS_MAIN: from os import getcwd from os import sys sys.path.append(getcwd()) from MOAL.helpers.display import Section ...
"""Module docstring. This talks about the module.""" # -*- coding: utf-8 -*- __author__ = """Chris Tabor (dxdstudio@gmail.com)""" IS_MAIN = True if __name__ == '__main__' else False if IS_MAIN: from os import getcwd from os import sys sys.path.append(getcwd()) from MOAL.helpers.display import Section ...
Use Docstring as default title value.
Use Docstring as default title value.
Python
apache-2.0
christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL
58d11644b08a91ab1e71f697741197f1b697d817
tests/request/test_request_header.py
tests/request/test_request_header.py
def test_multiple_same_headers(): pass def test_header_case_insensitivity(): pass def test_header_with_continuation_lines(): pass def test_request_without_headers(): pass def test_invalid_header_syntax(): pass
from httoop import Headers, InvalidHeader def test_multiple_same_headers(): pass def test_header_case_insensitivity(): pass def test_header_with_continuation_lines(): h = Headers() h.parse('Foo: bar\r\n baz') h.parse('Foo2: bar\r\n\tbaz') h.parse('Foo3: bar\r\n baz') h.parse('Foo4: bar\r\n\t baz') assert h[...
Add test case for invalid headers and continuation lines
Add test case for invalid headers and continuation lines
Python
mit
spaceone/httoop,spaceone/httoop,spaceone/httoop
c45d872be07fd58981580372a2c32f0b1993c1e2
example/user_timeline.py
example/user_timeline.py
#!/usr/bin/env python """ Copyright (c) 2008 Dustin Sallings <dustin@spy.net> """ import os import sys sys.path.append(os.path.join(sys.path[0], '..', 'lib')) sys.path.append('lib') from twisted.internet import reactor, protocol, defer, task import twitter fetchCount = 0 @defer.deferredGenerator def getSome(tw,...
#!/usr/bin/env python """ Copyright (c) 2008 Dustin Sallings <dustin@spy.net> """ import os import sys sys.path.append(os.path.join(sys.path[0], '..', 'lib')) sys.path.append('lib') from twisted.internet import reactor, protocol, defer, task import twitter fetchCount = 0 @defer.deferredGenerator def getSome(tw,...
Normalize case in my assertion.
Normalize case in my assertion.
Python
mit
praekelt/twitty-twister,dustin/twitty-twister
86e52da3cfe7e230ac935b7aa35dcab4b7b23402
web/control/views.py
web/control/views.py
import json from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from vehicles.models import Vehicle import control.tasks #@api_view(['POST']) @csrf_exempt def handle_control(request, vehicle_vin='-1'): print 'vehicle: ', vehicle_vin try: vehicle = Vehicle.obje...
import json from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from vehicles.models import Vehicle import control.tasks #@api_view(['POST']) @csrf_exempt def handle_control(request, vehicle_vin='-1'): print 'vehicle: ', vehicle_vin try: vehicle = Vehicle.obje...
Improve the error handling and error response message.
Improve the error handling and error response message.
Python
mpl-2.0
klooer/rvi_backend,klooer/rvi_backend,klooer/rvi_backend,klooer/rvi_backend
f6429a3c4b413231ad480f2768d47b78ec0c690b
great_expectations/cli/cli_logging.py
great_expectations/cli/cli_logging.py
import logging import warnings warnings.filterwarnings("ignore") ### # REVIEWER NOTE: THE ORIGINAL IMPLEMENTATION WAS HEAVY HANDED AND I BELIEVE WAS A TEMPORARY WORKAROUND. # PLEASE CAREFULLY REVIEW TO ENSURE REMOVING THIS DOES NOT AFFECT DESIRED BEHAVIOR ### logger = logging.getLogger("great_expectations.cli") de...
import logging import warnings warnings.filterwarnings("ignore") ### # REVIEWER NOTE: THE ORIGINAL IMPLEMENTATION WAS HEAVY HANDED AND I BELIEVE WAS A TEMPORARY WORKAROUND. # PLEASE CAREFULLY REVIEW TO ENSURE REMOVING THIS DOES NOT AFFECT DESIRED BEHAVIOR ### logger = logging.getLogger("great_expectations.cli") de...
Set level on module logger instead
Set level on module logger instead
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
323a92afd125bd97c960ab71c64f78601ec4b000
aioinotify/watch.py
aioinotify/watch.py
import asyncio class Watch: """Represents an inotify watch as added by InotifyProtocol.watch()""" def __init__(self, watch_descriptor, callback, protocol): """ :param int watch_descriptor: The watch descriptor as returned by inotify_add_watch :param callback: A function with one posit...
import asyncio class Watch: """Represents an inotify watch as added by InotifyProtocol.watch()""" def __init__(self, watch_descriptor, callback, protocol): """ :param int watch_descriptor: The watch descriptor as returned by inotify_add_watch :param callback: A function with one posit...
Make Watch also a context manager
Make Watch also a context manager
Python
apache-2.0
mwfrojdman/aioinotify
aa77e74c02ec7276c233454806d55fdb32899a13
__init__.py
__init__.py
# import subpackages from . import advection from . import cascade from . import io from . import noise from . import nowcasts from . import optflow from . import postprocessing from . import timeseries from . import utils from . import verification from . import visualization
# import subpackages from . import advection from . import cascade from . import io from . import noise from . import nowcasts from . import optflow from . import postprocessing from . import timeseries from . import utils from . import verification as vf from . import visualization as plt
Use namespaces plt and vf for visualization and verification modules
Use namespaces plt and vf for visualization and verification modules
Python
bsd-3-clause
pySTEPS/pysteps
b1153bc6e8b8b132c146076aeeb6b86ec4f54365
__init__.py
__init__.py
if 'loaded' in locals(): import imp imp.reload(blendergltf) from .blendergltf import * else: loaded = True from .blendergltf import *
bl_info = { "name": "glTF format", "author": "Daniel Stokes", "version": (0, 1, 0), "blender": (2, 76, 0), "location": "File > Import-Export", "description": "Export glTF", "warning": "", "wiki_url": "" "", "support": 'TESTING', "category": "Import-Export"} # Tr...
Add experimental support to run module as Blender addon
Add experimental support to run module as Blender addon
Python
apache-2.0
Kupoman/blendergltf,lukesanantonio/blendergltf
8c81f606499ebadddaf2a362bc8845eb69a21e8d
lds-gen.py
lds-gen.py
#!/usr/bin/env python # # # Generate linker script to only expose symbols of the public API # import sys import re if __name__ == '__main__': funcs = list() last_line = '' for line in sys.stdin: m = re.match(r'^(\S+.*\s+\**)?(rd_kafka_\S+)\s*\(', line) if m: sym = m.group(2)...
#!/usr/bin/env python # # # Generate linker script to only expose symbols of the public API # import sys import re if __name__ == '__main__': funcs = list() last_line = '' for line in sys.stdin: m = re.match(r'^(\S+.*\s+\**)?(rd_kafka_\S+)\s*\(', line) if m: sym = m.group(2)...
Stop exporting internal symbols from the shared libraries.
Stop exporting internal symbols from the shared libraries.
Python
bsd-2-clause
orthrus/librdkafka,klonikar/librdkafka,klonikar/librdkafka,senior7515/librdkafka,janmejay/librdkafka,senior7515/librdkafka,orthrus/librdkafka,klonikar/librdkafka,janmejay/librdkafka,orthrus/librdkafka,janmejay/librdkafka,senior7515/librdkafka,senior7515/librdkafka,klonikar/librdkafka,orthrus/librdkafka,janmejay/librdka...
b07d74f99338165f8bb83ac0599452b021b96a8f
django_boolean_sum.py
django_boolean_sum.py
from django.conf import settings from django.db.models.aggregates import Sum from django.db.models.sql.aggregates import Sum as BaseSQLSum class SQLSum(BaseSQLSum): @property def sql_template(self): if settings.DATABASES['default']['ENGINE'] == \ 'django.db.backends.postgresql_psycopg2...
from django.conf import settings from django.db.models.aggregates import Sum class SQLSum(Sum): @property def sql_template(self): if settings.DATABASES['default']['ENGINE'] == \ 'django.db.backends.postgresql_psycopg2': return '%(function)s(%(field)s::int)' return '...
Add support for Django 1.10+
Add support for Django 1.10+
Python
bsd-2-clause
Mibou/django-boolean-sum
fdf559007b9596e8d075d3de7f6e9f27e8a24ed6
rippl/legislature/api.py
rippl/legislature/api.py
from django.http import JsonResponse, HttpResponseBadRequest from legislature.sunlight.district import DistrictMatcher def find_district(request): try: latitude = request.GET['lat'] longitude = request.GET['lng'] except KeyError: return HttpResponseBadRequest('Need both "lat" and "lng...
from django.http import JsonResponse, HttpResponseBadRequest from legislature.sunlight.district import DistrictMatcher def find_district(request): try: latitude = request.GET['lat'] longitude = request.GET['lng'] except KeyError: return HttpResponseBadRequest('Need both "lat" and "lng...
Add district id to find_district response
Add district id to find_district response
Python
mit
gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl
1849a7ce4e706c8f81a6f3f5b01e0f16c3beb35d
sahgutils/io/__init__.py
sahgutils/io/__init__.py
"""Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't stable yet so be prepared to upda...
"""Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't stable yet so be prepared to update your...
Change to Unix line endings
REF: Change to Unix line endings
Python
bsd-3-clause
sahg/SAHGutils
eaff795bddb0e07f4ad4e4c9277c5c0f6f199380
salt/beacons/__init__.py
salt/beacons/__init__.py
# -*- coding: utf-8 -*- ''' This package contains the loader modules for the salt streams system ''' # Import salt libs import salt.loader class Beacon(object): ''' This class is used to eveluate and execute on the beacon system ''' def __init__(self, opts): self.opts = opts self.beaco...
# -*- coding: utf-8 -*- ''' This package contains the loader modules for the salt streams system ''' # Import salt libs import salt.loader class Beacon(object): ''' This class is used to eveluate and execute on the beacon system ''' def __init__(self, opts): self.opts = opts self.beaco...
Add id tot he beacon event dataset
Add id tot he beacon event dataset
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
309439f65bb668aba85a31a46b2633a46ee55777
apps/careeropportunity/migrations/0001_initial.py
apps/careeropportunity/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('companyprofile', '0001_squashed_0003_company_image'), ] operations = [ migrations.CreateModel( name='CareerOppor...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('companyprofile', '0001_initial'), ] operations = [ migrations.CreateModel( name='CareerOpportunity', ...
Revert "Change careeropportunity migration dep"
Revert "Change careeropportunity migration dep" This reverts commit 60fdfab7e3b557e46276c225ff159f5773930525.
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
437623aee55fd68683126bd6852df52379837eaa
bash_command.py
bash_command.py
import sublime, sublime_plugin import os from .common.utils import run_bash_for_output from .common.utils import git_path_for_window last_command = "" class RunBash(sublime_plugin.WindowCommand): def run(self): global last_command window = self.window view = window.active_view() i...
import sublime, sublime_plugin import os from .common.utils import run_bash_for_output from .common.utils import git_path_for_window last_command = "" class RunBash(sublime_plugin.WindowCommand): def run(self): global last_command window = self.window view = window.active_view() i...
Print both output + error for bash command
Print both output + error for bash command
Python
mit
ktuan89/sublimeplugins
6a0c619d743d57a1ff1684144c148c9b8cc9a0be
day-10/solution.py
day-10/solution.py
def lookandsay(line): p = None n = 0 result = [] for c in line: if n > 0 and p is not c: result.append(str(n)) result.append(p) n = 0 p = c n += 1 result.append(str(n)) result.append(p) return ''.join(result) line = "1321131112...
import itertools def lookandsay(line): return ''.join([str(len(list(it))) + c for c, it in itertools.groupby(line)]) line = "1321131112" for x in range(40): line = lookandsay(line) print "40:", len(line) for x in range(10): line = lookandsay(line) print "50:", len(line)
Reimplement day 10 using itertools combine.
Reimplement day 10 using itertools combine. Now it DOES run using pypy, and is faster again.
Python
mit
bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adventofcode,bertptrs/adv...
53681ae30bdaccce2321601f1ebab09b4c572cc9
sqlalchemy_mptt/__init__.py
sqlalchemy_mptt/__init__.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 uralbash <root@uralbash.ru> # # Distributed under terms of the MIT license. from .mixins import BaseNestedSets __version__ = "0.0.8" __mixins__ = [BaseNestedSets]
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 uralbash <root@uralbash.ru> # # Distributed under terms of the MIT license. from sqlalchemy.orm import mapper from .mixins import BaseNestedSets from .events import TreesManager __version__ = "0.0.8" __mixins__ = [BaseNestedSets] __a...
Make a default tree manager importable from the package.
Make a default tree manager importable from the package.
Python
mit
uralbash/sqlalchemy_mptt,ITCase/sqlalchemy_mptt,ITCase/sqlalchemy_mptt,uralbash/sqlalchemy_mptt
f032501126e7bb6d86441e38112c6bdf5035c62e
icekit/search_indexes.py
icekit/search_indexes.py
from fluent_pages.pagetypes.flatpage.models import FlatPage from fluent_pages.pagetypes.fluentpage.models import FluentPage from haystack import indexes class FluentPageIndex(indexes.SearchIndex, indexes.Indexable): """ Search index for a fluent page. """ text = indexes.CharField(document=True, use_te...
from fluent_pages.pagetypes.flatpage.models import FlatPage from fluent_pages.pagetypes.fluentpage.models import FluentPage from haystack import indexes from django.conf import settings # Optional search indexes which can be used with the default FluentPage and FlatPage models. if getattr(settings, 'ICEKIT_USE_SEARCH...
Add setting to turn of search indexes.
Add setting to turn of search indexes.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
08dc0ce7c44d0149b443261ff6d3708e28a928e7
src/meshparser/__init__.py
src/meshparser/__init__.py
from pkg_resources import resource_string version = resource_string(__name__, 'version.txt').strip() __version__ = version
from pkg_resources import resource_string version = resource_string(__name__, 'version.txt').strip() __version__ = version.decode('utf-8')
Add decode to version read from pkg_resources.
Add decode to version read from pkg_resources.
Python
apache-2.0
ABI-Software/MeshParser
670bbf8758e63cfeafc1de6f9330403dec2517c2
astrobin_apps_platesolving/utils.py
astrobin_apps_platesolving/utils.py
# Python import urllib2 # Django from django.conf import settings from django.core.files import File from django.core.files.temp import NamedTemporaryFile def getFromStorage(image, alias): def encoded(path): return urllib2.quote(path.encode('utf-8')) url = image.thumbnail(alias) if "://" in url...
# Python import urllib2 # Django from django.conf import settings from django.core.files import File from django.core.files.temp import NamedTemporaryFile def getFromStorage(image, alias): url = image.thumbnail(alias) if "://" in url: url = url.split('://')[1] else: url = settings.BASE_UR...
Revert "Fix plate-solving on local development mode"
Revert "Fix plate-solving on local development mode" This reverts commit 40897be402bd05ed5fb53e116f03d2d954720245.
Python
agpl-3.0
astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin
aaa6b6683e4ce46ec672899802c035c592d50b0e
app/initial_tables.py
app/initial_tables.py
from tables import engine def create_tables(): """ Create tables the lazy way... with raw SQL. """ conn = engine.raw_connection() cur = conn.cursor() cur.execute( """ CREATE TABLE file_upload( document_name TEXT , time_uploaded TEXT DEFAULT now() , filename TEXT NOT NULL , word_...
from tables import engine def create_tables(): """ Create tables the lazy way... with raw SQL. """ conn = engine.raw_connection() cur = conn.cursor() cur.execute( """ CREATE TABLE file_upload_meta( document_name TEXT NOT NULL , document_slug TEXT NOT NULL , time_uploaded TEXT NOT NU...
Add slug field to file upload meta table, rename table
Add slug field to file upload meta table, rename table
Python
mit
sprin/heroku-tut
5559e9f429e9019959f1c79fbc2a7f82c12f91c4
src/hpp/utils.py
src/hpp/utils.py
# Copyright (c) 2020, CNRS # Authors: Guilhem Saurel <guilhem.saurel@laas.fr> import os import subprocess import time try: from subprocess import DEVNULL, run except ImportError: # Python2 fallback DEVNULL = os.open(os.devnull, os.O_RDWR) def run(*args): subprocess.Popen(*args).wait() class Se...
# Copyright (c) 2020, CNRS # Authors: Guilhem Saurel <guilhem.saurel@laas.fr> import os import subprocess import time import hpp.corbaserver try: from subprocess import DEVNULL, run except ImportError: # Python2 fallback DEVNULL = os.open(os.devnull, os.O_RDWR) def run(*args): subprocess.Popen(*...
Fix how hppcorbaserver is killed in ServerManager
Fix how hppcorbaserver is killed in ServerManager
Python
bsd-2-clause
humanoid-path-planner/hpp-corbaserver,humanoid-path-planner/hpp-corbaserver
c0a74ce4110d295b3662066e4d08c4ab65fb0905
bills/views.py
bills/views.py
from django.shortcuts import render, redirect from bills.utils import get_all_subjects, get_all_locations from opencivicdata.models import Bill def bill_list(request): subjects = get_all_subjects() if request.POST.getlist('bill_subjects'): filter_subjects = request.POST.getlist('bill_subjects') ...
from django.db import transaction from django.shortcuts import render, redirect from preferences.views import _mark_selected from bills.utils import get_all_subjects, get_all_locations from opencivicdata.models import Bill def bill_list(request): subjects = get_all_subjects() if request.POST.getlist('bill...
Mark pre-selected topics on form
Mark pre-selected topics on form
Python
mit
jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot
c5496fddccffd2f16c0b4a140506b9d577d50b61
eventlog/models.py
eventlog/models.py
from django.conf import settings from django.db import models from django.utils import timezone import jsonfield from .signals import event_logged class Log(models.Model): user = models.ForeignKey( getattr(settings, "AUTH_USER_MODEL", "auth.User"), null=True, on_delete=models.SET_NULL ...
from django.conf import settings from django.db import models from django.utils import timezone import jsonfield from .signals import event_logged class Log(models.Model): user = models.ForeignKey( getattr(settings, "AUTH_USER_MODEL", "auth.User"), null=True, on_delete=models.SET_NULL ...
Add property to provide template fragment name
Add property to provide template fragment name
Python
mit
jawed123/pinax-eventlog,pinax/pinax-eventlog,KleeTaurus/pinax-eventlog,rosscdh/pinax-eventlog
5a45840e81d612e1f743ad063fd32da4d19354d4
cacheops/signals.py
cacheops/signals.py
import django.dispatch cache_read = django.dispatch.Signal(providing_args=["func", "hit"]) cache_invalidated = django.dispatch.Signal(providing_args=["obj_dict"])
import django.dispatch cache_read = django.dispatch.Signal() # args: func, hit cache_invalidated = django.dispatch.Signal() # args: obj_dict
Stop using Signal(providing_args) deprected in Django 4.0
Stop using Signal(providing_args) deprected in Django 4.0 Closes #393
Python
bsd-3-clause
Suor/django-cacheops