commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
1e931e9aac18f393de786894d9e26ecccc251135 | server/models/_generate_superpixels.py | server/models/_generate_superpixels.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | ###############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | Fix girder_work script bug: PEP 263 is not compatible with exec | Fix girder_work script bug: PEP 263 is not compatible with exec
| Python | apache-2.0 | ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive | ---
+++
@@ -1,6 +1,3 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
###############################################################################
# Copyright Kitware Inc.
# |
a79a3f7c42c858ae42c618479654cd7589de05b9 | zeeko/utils/tests/test_hmap.py | zeeko/utils/tests/test_hmap.py | # -*- coding: utf-8 -*-
import pytest
from ..hmap import HashMap
@pytest.fixture(params=[0,1,5,9])
def n(request):
"""Number of items"""
return request.param
@pytest.fixture
def items(n):
"""A list of strings."""
return ["item{0:d}".format(i) for i in range(n)]
@pytest.mark.skip
def test_hmap(items)... | # -*- coding: utf-8 -*-
import pytest
from ..hmap import HashMap
@pytest.fixture(params=[0,1,5,9])
def n(request):
"""Number of items"""
return request.param
@pytest.fixture
def items(n):
"""A list of strings."""
return ["item{0:d}".format(i) for i in range(n)]
| Remove unused tests for hash map | Remove unused tests for hash map
| Python | bsd-3-clause | alexrudy/Zeeko,alexrudy/Zeeko | ---
+++
@@ -13,26 +13,4 @@
"""A list of strings."""
return ["item{0:d}".format(i) for i in range(n)]
-@pytest.mark.skip
-def test_hmap(items):
- """docstring for test"""
- h = HashMap(10)
- if len(items):
- with pytest.raises(KeyError):
- h[items[0]]
-
- for item in items... |
311a858ecbe7d34f9f68a18a3735db9da8b0e692 | tests/utils.py | tests/utils.py | import atexit
import tempfile
import sys
import mock
from selenium import webdriver
import os
def build_mock_mapping(name):
mock_driver = mock.Mock()
browser_mapping = {name: mock_driver}
mock_driver.return_value.name = name
return browser_mapping
test_driver = None
def get_driver():
global te... | import atexit
import tempfile
import sys
import mock
from selenium import webdriver
import os
def build_mock_mapping(name):
mock_driver = mock.Mock()
browser_mapping = {name: mock_driver}
mock_driver.return_value.name = name
return browser_mapping
test_driver = None
def get_driver():
global te... | Fix global test driver initialization | Fix global test driver initialization
| Python | mit | alisaifee/holmium.core,alisaifee/holmium.core,alisaifee/holmium.core,alisaifee/holmium.core | ---
+++
@@ -21,11 +21,11 @@
if not test_driver:
options = webdriver.ChromeOptions()
options.add_argument('headless')
- chrome = webdriver.Chrome(chrome_options=options)
- atexit.register(chrome.quit)
- chrome.delete_all_cookies()
- chrome.switch_to.default_content()
- ret... |
e8da41193238a7c677ec7ff8339095ec3e71be3b | track_count.py | track_count.py | from report import *
def show_track_count(S):
print "Track Count\t\tSubmission Count"
for (track, count) in S.track_count().items():
if track:
print "%s\t\t%s" % (track.ljust(20), count)
if __name__ == "__main__":
# S = ALL.standard().vote_cutoff(4.0)
S = ALL.standard().filter(... | from report import *
def show_track_count(S):
print "Track Count".ljust(40) + "\t\tSubmission Count"
items = S.track_count().items()
total = sum([count for (track, count) in items])
for (track, count) in sorted(items, cmp=lambda (a_track, a_count), (b_track, b_count): cmp(b_count, a_count)):
... | Fix formatting, show total and sort | Fix formatting, show total and sort | Python | epl-1.0 | tracymiranda/pc-scripts,tracymiranda/pc-scripts | ---
+++
@@ -1,13 +1,16 @@
from report import *
def show_track_count(S):
- print "Track Count\t\tSubmission Count"
+ print "Track Count".ljust(40) + "\t\tSubmission Count"
- for (track, count) in S.track_count().items():
+ items = S.track_count().items()
+ total = sum([count for (track, count)... |
17015ecf48ec37909de6de2c299454fc89b592e9 | tests/test_gmaps.py | tests/test_gmaps.py | # -*- coding: UTF-8 -*-
from base import TestCase
from jinja2_maps.gmaps import gmaps_url
class TestGmaps(TestCase):
def test_url_dict(self):
url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,42z"
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.... | # -*- coding: UTF-8 -*-
from base import TestCase
from jinja2_maps.gmaps import gmaps_url
class TestGmaps(TestCase):
def test_url_dict(self):
url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,42z"
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.... | Add failing test for URL without zoom | Add failing test for URL without zoom
| Python | mit | bfontaine/jinja2_maps | ---
+++
@@ -11,3 +11,8 @@
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.78), zoom=42))
+ def test_url_dict_no_zoom(self):
+ url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,16z"
+ self.assertEquals(url,
+ gmaps_url(dict(... |
73673598e1998252b16b48d31b800ab0fb441392 | pml/cs.py | pml/cs.py | """
Template module to define control systems.
"""
class ControlSystem(object):
""" Define a control system to be used with a device
It uses channel access to comunicate over the network with
the hardware.
"""
def __init__(self):
raise NotImplementedError()
def get(self, pv):
... | """
Template module to define control systems.
"""
class ControlSystem(object):
""" Define a control system to be used with a device.
It uses channel access to comunicate over the network with
the hardware.
"""
def __init__(self):
raise NotImplementedError()
def get(self, pv):
... | Add documentation for the control system | Add documentation for the control system
| Python | apache-2.0 | willrogers/pml,willrogers/pml | ---
+++
@@ -4,7 +4,7 @@
class ControlSystem(object):
- """ Define a control system to be used with a device
+ """ Define a control system to be used with a device.
It uses channel access to comunicate over the network with
the hardware.
@@ -13,19 +13,47 @@
raise NotImplementedError()
... |
3c735d18bdcff28bbdd765b131649ba57fb612b0 | hy/models/string.py | hy/models/string.py | # Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modif... | # Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modif... | Revert "Revert "Remove useless code"" | Revert "Revert "Remove useless code""
This reverts commit 262da59c7790cdadd60ea9612bc9e3c1616863fd.
Conflicts:
hy/models/string.py
| Python | mit | ALSchwalm/hy,aisk/hy,paultag/hy,tianon/hy,hcarvalhoalves/hy,Foxboron/hy,Tritlo/hy,mtmiller/hy,michel-slm/hy,farhaven/hy,freezas/hy,zackmdavis/hy,tianon/hy,gilch/hy,aisk/hy,larme/hy,tuturto/hy,timmartin/hy,farhaven/hy,kirbyfan64/hy,farhaven/hy,algernon/hy,Foxboron/hy,hcarvalhoalves/hy,kirbyfan64/hy,adamfeuer/hy,jakirkha... | ---
+++
@@ -34,7 +34,4 @@
scripts. It's either a ``str`` or a ``unicode``, depending on the
Python version.
"""
-
- def __new__(cls, value):
- obj = str_type.__new__(cls, value)
- return obj
+ pass |
60870a3e471637d44da32f3aac74064e4ca60208 | pyplot.py | pyplot.py | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Module to bundle plotting scripts
`activate-global-python-argcomplete` must be run to enable auto completion """
import argparse
import argcomplete
import plotter
def parse_arguments():
"""Argument Parser, providing available scripts"""
parser = argparse.Argum... | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Module to bundle plotting scripts
`activate-global-python-argcomplete` must be run to enable auto completion """
import argparse
import argcomplete
import plotter
def parse_arguments():
"""Argument Parser, providing available scripts"""
parser = argparse.Argum... | Use `set_defaults` of subparser to launch scripts | Use `set_defaults` of subparser to launch scripts
| Python | mit | DerWeh/pyplot | ---
+++
@@ -13,15 +13,17 @@
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(
title = 'plotter',
- description = 'available plotting scripts'
+ description = 'available plotting scripts',
+ dest='used_subparser',
)
module_subparser = {}
for m... |
aac598d64fc0fa50cc068fc50173068e5d89b3fd | segpy/ext/numpyext.py | segpy/ext/numpyext.py | """Optional interoperability with Numpy."""
import numpy
NUMPY_DTYPES = {'ibm': numpy.dtype('f4'),
'l': numpy.dtype('i4'),
'h': numpy.dtype('i2'),
'f': numpy.dtype('f4'),
'b': numpy.dtype('i1')}
def make_dtype(data_sample_format):
"""Conver... | """Optional interoperability with Numpy."""
import numpy
NUMPY_DTYPES = {'ibm': numpy.dtype('f4'),
'int32': numpy.dtype('i4'),
'int16': numpy.dtype('i2'),
'float32': numpy.dtype('f4'),
'int8': numpy.dtype('i1')}
def make_dtype(data_sample_fo... | Update numpy dtypes extension for correct type codes. | Update numpy dtypes extension for correct type codes.
| Python | agpl-3.0 | hohogpb/segpy,stevejpurves/segpy,abingham/segpy,asbjorn/segpy,kjellkongsvik/segpy,Kramer477/segpy,kwinkunks/segpy | ---
+++
@@ -2,11 +2,11 @@
import numpy
-NUMPY_DTYPES = {'ibm': numpy.dtype('f4'),
- 'l': numpy.dtype('i4'),
- 'h': numpy.dtype('i2'),
- 'f': numpy.dtype('f4'),
- 'b': numpy.dtype('i1')}
+NUMPY_DTYPES = {'ibm': numpy.dtype('f4'),
+ ... |
2ba28c83de33ebc75f386d127d0c55e17248a94b | mapclientplugins/meshgeneratorstep/__init__.py | mapclientplugins/meshgeneratorstep/__init__.py |
"""
MAP Client Plugin
"""
__version__ = '0.2.0'
__author__ = 'Richard Christie'
__stepname__ = 'Mesh Generator'
__location__ = ''
# import class that derives itself from the step mountpoint.
from mapclientplugins.meshgeneratorstep import step
# Import the resource file when the module is loaded,
# this enables the ... |
"""
MAP Client Plugin
"""
__version__ = '0.2.0'
__author__ = 'Richard Christie'
__stepname__ = 'Mesh Generator'
__location__ = 'https://github.com/ABI-Software/mapclientplugins.meshgeneratorstep'
# import class that derives itself from the step mountpoint.
from mapclientplugins.meshgeneratorstep import step
# Impor... | Add location to step metadata. | Add location to step metadata.
| Python | apache-2.0 | rchristie/mapclientplugins.meshgeneratorstep | ---
+++
@@ -6,7 +6,7 @@
__version__ = '0.2.0'
__author__ = 'Richard Christie'
__stepname__ = 'Mesh Generator'
-__location__ = ''
+__location__ = 'https://github.com/ABI-Software/mapclientplugins.meshgeneratorstep'
# import class that derives itself from the step mountpoint.
from mapclientplugins.meshgenerators... |
fb8c2fb065449a436dd8ffa11b469bb2f22a9ad1 | spider.py | spider.py | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
class DatasetSpider(CrawlSpider):
name = 'dataset'
allowed_domains = ['data.gc.ca/data/en']
start_urls = ['http://data.gc.ca/data/en/dataset?page=1']
| from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
class DatasetSpider(CrawlSpider):
name = 'dataset'
allowed_domains = ['data.gc.ca/data/en']
start_urls = ['http://data.gc.ca/data/en/dataset?page=1']
... | Add web crawling rule and dataset url regex exp | Add web crawling rule and dataset url regex exp
| Python | mit | MaxLikelihood/CODE | ---
+++
@@ -7,4 +7,5 @@
name = 'dataset'
allowed_domains = ['data.gc.ca/data/en']
start_urls = ['http://data.gc.ca/data/en/dataset?page=1']
-
+ rules = [Rule(SgmlLinkExtractor(allow=['/dataset/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}']),
+ 'parse_dataset')] |
7c69dc5bddc7136c274f039223686a92cffd693a | tomviz/python/setup.py | tomviz/python/setup.py | from setuptools import setup, find_packages
setup(
name='tomviz-pipeline',
version='0.0.1',
description='Tomviz python external pipeline execution infrastructure.',
author='Kitware, Inc.',
author_email='kitware@kitware.com',
url='https://www.tomviz.org/',
license='BSD 3-Clause',
classif... | from setuptools import setup, find_packages
jsonpatch_uri \
= 'jsonpatch@https://github.com/cjh1/python-json-patch/archive/tomviz.zip'
setup(
name='tomviz-pipeline',
version='0.0.1',
description='Tomviz python external pipeline execution infrastructure.',
author='Kitware, Inc.',
author_email='... | Fix flake8 line length issue | Fix flake8 line length issue
Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>
| Python | bsd-3-clause | OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz | ---
+++
@@ -1,4 +1,7 @@
from setuptools import setup, find_packages
+
+jsonpatch_uri \
+ = 'jsonpatch@https://github.com/cjh1/python-json-patch/archive/tomviz.zip'
setup(
name='tomviz-pipeline',
@@ -21,7 +24,8 @@
packages=find_packages(),
install_requires=['tqdm', 'h5py', 'numpy==1.16.4', 'click... |
a8283f5d2c1d970b7b676d491ad8c9472abfe667 | boardinghouse/tests/test_template_tag.py | boardinghouse/tests/test_template_tag.py | from django.test import TestCase
from .models import AwareModel, NaiveModel
from ..templatetags.boardinghouse import *
class TestTemplateTags(TestCase):
def test_is_schema_aware_filter(self):
self.assertTrue(is_schema_aware(AwareModel()))
self.assertFalse(is_schema_aware(NaiveModel()))
de... | from django.test import TestCase
from .models import AwareModel, NaiveModel
from ..templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
from ..models import Schema
class TestTemplateTags(TestCase):
def test_is_schema_aware_filter(self):
self.assertTrue(is_schema_aware(AwareModel... | Fix tests since we changed imports. | Fix tests since we changed imports.
--HG--
branch : schema-invitations
| Python | bsd-3-clause | schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse | ---
+++
@@ -1,7 +1,8 @@
from django.test import TestCase
from .models import AwareModel, NaiveModel
-from ..templatetags.boardinghouse import *
+from ..templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
+from ..models import Schema
class TestTemplateTags(TestCase):
def test_is... |
7ce419de1f39050940b8399401a77b2096b74ca2 | dthm4kaiako/config/__init__.py | dthm4kaiako/config/__init__.py | """Configuration for Django system."""
__version__ = "0.10.1"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| """Configuration for Django system."""
__version__ = "0.11.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| Increment version number to 0.11.0 | Increment version number to 0.11.0
| Python | mit | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | ---
+++
@@ -1,6 +1,6 @@
"""Configuration for Django system."""
-__version__ = "0.10.1"
+__version__ = "0.11.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num |
0f49230309ac115ff78eddd36bcd153d7f3b75ea | data_aggregator/threads.py | data_aggregator/threads.py | import queue
import threading
from multiprocessing import Queue
class ThreadPool():
def __init__(self, processes=20):
self.processes = processes
self.threads = [Thread() for _ in range(0, processes)]
self.mp_queue = Queue()
def yield_dead_threads(self):
for thread in self.thr... | import queue
import threading
from multiprocessing import Queue
class ThreadPool():
def __init__(self, processes=20):
self.processes = processes
self.threads = [Thread() for _ in range(0, processes)]
self.mp_queue = Queue()
def yield_dead_threads(self):
for thread in self.thr... | Remove reference to "job" from ThreadPool | Remove reference to "job" from ThreadPool
| Python | apache-2.0 | uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics | ---
+++
@@ -26,9 +26,9 @@
pass
for thread in self.yield_dead_threads():
try:
- # run next job
- job = next(values_iter)
- thread.run(func, job, self.mp_queue)
+ # run thread with the next value
+... |
f9ca473abf7aea3cc146badf2d45ae715f635aac | kqueen_ui/server.py | kqueen_ui/server.py | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | Use correct parameter for HOST and PORT | Use correct parameter for HOST and PORT
| Python | mit | atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui | ---
+++
@@ -43,6 +43,6 @@
def run():
logger.debug('kqueen_ui starting')
app.run(
- host=app.config.get('KQUEEN_UI_HOST'),
- port=int(app.config.get('KQUEEN_UI_PORT'))
+ host=app.config.get('HOST'),
+ port=int(app.config.get('PORT'))
) |
de962f504db139500573457264a3dd1e257e8cc0 | wagtail_mvc/decorators.py | wagtail_mvc/decorators.py | # -*- coding: utf-8 -*-
"""
wagtail_mvc decorators
"""
from __future__ import unicode_literals
def wagtail_mvc_url(func):
"""
Decorates an existing method responsible for generating a url
prepends the parent url to the generated url to account for
:param func: The method to decorate
:return: Full... | # -*- coding: utf-8 -*-
"""
wagtail_mvc decorators
"""
from __future__ import unicode_literals
def wagtail_mvc_url(*decorator_args, **decorator_kwargs):
"""
Decorates an existing method responsible for generating a url
prepends the parent url to the generated url to account for
:param func: The metho... | Allow decorator to be called with optional args | Allow decorator to be called with optional args
| Python | mit | fatboystring/Wagtail-MVC,fatboystring/Wagtail-MVC | ---
+++
@@ -5,7 +5,7 @@
from __future__ import unicode_literals
-def wagtail_mvc_url(func):
+def wagtail_mvc_url(*decorator_args, **decorator_kwargs):
"""
Decorates an existing method responsible for generating a url
prepends the parent url to the generated url to account for
@@ -13,8 +13,23 @@
... |
232bc2bb83190482c1125ca5879ffb6f11d67b40 | puzzlehunt_server/settings/travis_settings.py | puzzlehunt_server/settings/travis_settings.py | from .base_settings import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
SECRET_KEY = '$1B&VUf$OdUEfMJXd40qdakA36@%2NE_41Dz9tFs6l=z4v_3P-'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'puzzlehunt_db',
'HOST': '127.0.0.1',
... | from .base_settings import *
import os
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
SECRET_KEY = '$1B&VUf$OdUEfMJXd40qdakA36@%2NE_41Dz9tFs6l=z4v_3P-'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'puzzlehunt_db',
'HOST': '127.0.... | Fix logging for testing environment | Fix logging for testing environment
| Python | mit | dlareau/puzzlehunt_server,dlareau/puzzlehunt_server,dlareau/puzzlehunt_server,dlareau/puzzlehunt_server | ---
+++
@@ -1,4 +1,5 @@
from .base_settings import *
+import os
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
@@ -18,3 +19,19 @@
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
ALLOWED_HOSTS = ['*']
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ ... |
fe676a041b793f55d33bfd27eb2b4fdfe7d93bb6 | twilio/rest/resources/pricing/__init__.py | twilio/rest/resources/pricing/__init__.py | from .voice import (
Voice,
VoiceCountry,
VoiceCountries,
VoiceNumber,
VoiceNumbers,
)
from .phone_numbers import (
PhoneNumberCountries,
PhoneNumberCountry,
PhoneNumbers,
)
| from twilio.rest.pricing.voice import (
Voice,
VoiceCountry,
VoiceCountries,
VoiceNumber,
VoiceNumbers,
)
from twilio.rest.pricing.phone_number import (
PhoneNumberCountries,
PhoneNumberCountry,
PhoneNumber,
)
| Change import path for pricing | Change import path for pricing
| Python | mit | tysonholub/twilio-python,twilio/twilio-python | ---
+++
@@ -1,4 +1,4 @@
-from .voice import (
+from twilio.rest.pricing.voice import (
Voice,
VoiceCountry,
VoiceCountries,
@@ -6,8 +6,8 @@
VoiceNumbers,
)
-from .phone_numbers import (
+from twilio.rest.pricing.phone_number import (
PhoneNumberCountries,
PhoneNumberCountry,
- Phon... |
0e779581be648ca80eea6b97f9963606d85659b9 | opensfm/commands/__init__.py | opensfm/commands/__init__.py |
import extract_metadata
import detect_features
import match_features
import create_tracks
import reconstruct
import mesh
import undistort
import compute_depthmaps
import export_ply
import export_openmvs
opensfm_commands = [
extract_metadata,
detect_features,
match_features,
create_tracks,
reconstr... |
import extract_metadata
import detect_features
import match_features
import create_tracks
import reconstruct
import mesh
import undistort
import compute_depthmaps
import export_ply
import export_openmvs
import export_visualsfm
opensfm_commands = [
extract_metadata,
detect_features,
match_features,
cre... | Add exporter to VisualSfM format | Add exporter to VisualSfM format
| Python | bsd-2-clause | BrookRoberts/OpenSfM,mapillary/OpenSfM,sunbingfengPI/OpenSFM_Test,BrookRoberts/OpenSfM,sunbingfengPI/OpenSFM_Test,sunbingfengPI/OpenSFM_Test,sunbingfengPI/OpenSFM_Test,oscarlorentzon/OpenSfM,BrookRoberts/OpenSfM,oscarlorentzon/OpenSfM,oscarlorentzon/OpenSfM,oscarlorentzon/OpenSfM,mapillary/OpenSfM,mapillary/OpenSfM,Bro... | ---
+++
@@ -9,6 +9,7 @@
import compute_depthmaps
import export_ply
import export_openmvs
+import export_visualsfm
opensfm_commands = [
extract_metadata,
@@ -21,4 +22,5 @@
compute_depthmaps,
export_ply,
export_openmvs,
+ export_visualsfm,
] |
416575ca3cc684925be0391b43b98a9fa1d9f909 | ObjectTracking/testTrack.py | ObjectTracking/testTrack.py |
from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display
# Open reference video
cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteControl-Qt/videos/kiteFlying.avi','video')
# Select reference image
img=cam.getFrame(50)
modelImage = img.crop(255, 180... |
from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display, Color
# Open reference video
cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteControl-Qt/videos/kiteFlying.avi','video')
# Select reference image
img=cam.getFrame(50)
modelImage = img.crop(2... | Save the image of the selection (to be able to reinitialise later) | Save the image of the selection (to be able to reinitialise later)
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -1,5 +1,5 @@
-from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display
+from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display, Color
# Open reference video
cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteCo... |
a0ac251bec891a6c511ea1c0b11faa6525b81545 | bfg9000/languages.py | bfg9000/languages.py | ext2lang = {
'.cpp': 'c++',
'.c': 'c',
}
| ext2lang = {
'.c' : 'c',
'.cpp': 'c++',
'.cc' : 'c++',
'.cp' : 'c++',
'.cxx': 'c++',
'.CPP': 'c++',
'.c++': 'c++',
'.C' : 'c++',
}
| Support more C++ extensions by default | Support more C++ extensions by default
| Python | bsd-3-clause | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | ---
+++
@@ -1,4 +1,10 @@
ext2lang = {
+ '.c' : 'c',
'.cpp': 'c++',
- '.c': 'c',
+ '.cc' : 'c++',
+ '.cp' : 'c++',
+ '.cxx': 'c++',
+ '.CPP': 'c++',
+ '.c++': 'c++',
+ '.C' : 'c++',
} |
a41a76b7e4cdf4a8cbc533550963921839dcd998 | mopidy_pandora/rpc.py | mopidy_pandora/rpc.py | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = { 'method': method, 'jsonrpc': '2.0', 'id'... | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = {'method': method, 'jsonrpc': '2.0', 'id':... | Fix formatting errors reported by flake8. | Fix formatting errors reported by flake8.
| Python | apache-2.0 | rectalogic/mopidy-pandora,jcass77/mopidy-pandora | ---
+++
@@ -12,7 +12,7 @@
def _do_rpc(self, method, params=None):
self.id += 1
- data = { 'method': method, 'jsonrpc': '2.0', 'id': self.id }
+ data = {'method': method, 'jsonrpc': '2.0', 'id': self.id}
if params is not None:
data['params'] = params
@@ -26,4 +26,3... |
0788aaf316a2b200c5283fe9f5f902a8da701403 | calexicon/internal/tests/test_julian.py | calexicon/internal/tests/test_julian.py | import unittest
from calexicon.internal.julian import distant_julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
| import unittest
from calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
def test_julian_to_gregorian(self):
... | Add a test for julian_to_gregorian. | Add a test for julian_to_gregorian.
| Python | apache-2.0 | jwg4/qual,jwg4/calexicon | ---
+++
@@ -1,8 +1,11 @@
import unittest
-from calexicon.internal.julian import distant_julian_to_gregorian
+from calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(di... |
7f1542bc52438e6c9796e776603553d7f5a9df7f | pySpatialTools/utils/util_classes/__init__.py | pySpatialTools/utils/util_classes/__init__.py |
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
from spdesc_mapper import Sp_DescriptorMapper
from spatialelements import SpatialElementsCollection, Locations
from Membership import Membership
from general_mapper import General1_1Mapper
from mapper_vals_i i... |
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
from spdesc_mapper import Sp_DescriptorMapper
from spatialelements import SpatialElementsCollection, Locations
from Membership import Membership
from mapper_vals_i import Map_Vals_i, create_mapper_vals_i
| Debug in importing deleted module. | Debug in importing deleted module.
| Python | mit | tgquintela/pySpatialTools,tgquintela/pySpatialTools | ---
+++
@@ -9,5 +9,4 @@
from spdesc_mapper import Sp_DescriptorMapper
from spatialelements import SpatialElementsCollection, Locations
from Membership import Membership
-from general_mapper import General1_1Mapper
from mapper_vals_i import Map_Vals_i, create_mapper_vals_i |
62a76827ecf7c148101b62925dea04f63709012a | sublime/User/update_user_settings.py | sublime/User/update_user_settings.py | import json
import urllib2
import sublime
import sublime_plugin
GIST_URL = u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa
class UpdateUserSettingsCommand(sublime_plugin.TextCommand):
def run(self, edit):
gist_settings = self._g... | import json
import urllib
import sublime
import sublime_plugin
GIST_URL = 'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa
class UpdateUserSettingsCommand(sublime_plugin.TextCommand):
def run(self, edit):
gist_settings = self._get_set... | Update command to work with sublime 3 | Update command to work with sublime 3
| Python | apache-2.0 | RomuloOliveira/dot-files,RomuloOliveira/unix-files,RomuloOliveira/dot-files | ---
+++
@@ -1,14 +1,14 @@
import json
-import urllib2
+import urllib
import sublime
import sublime_plugin
-GIST_URL = u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa
+GIST_URL = 'https://raw.githubusercontent.com/RomuloOliveira/dot-files/ma... |
48fab607b1152b8b93cdb0cc0dc5c300dafecf4c | common/hil_slurm_settings.py | common/hil_slurm_settings.py | """
MassOpenCloud / Hardware Isolation Layer (HIL)
Slurm / HIL Control Settings
May 2017, Tim Donahue tpd001@gmail.com
"""
DEBUG = True
SLURM_INSTALL_DIR = '/usr/local/bin/'
HIL_SLURMCTLD_PROLOG_LOGFILE = '/var/log/moc_hil_ulsr/hil_prolog.log'
HIL_MONITOR_LOGFILE = '/var/log/moc_hil_ulsr/hil_monitor.log'
HIL_ENDP... | """
MassOpenCloud / Hardware Isolation Layer (HIL)
Slurm / HIL Control Settings
May 2017, Tim Donahue tpd001@gmail.com
"""
DEBUG = True
SLURM_INSTALL_DIR = '/usr/bin/'
HIL_SLURMCTLD_PROLOG_LOGFILE = '/var/log/moc_hil_ulsr/hil_prolog.log'
HIL_MONITOR_LOGFILE = '/var/log/moc_hil_ulsr/hil_monitor.log'
HIL_ENDPOINT =... | Update default settings to match Slurm 17.X / CentOS installation | Update default settings to match Slurm 17.X / CentOS installation
| Python | mit | mghpcc-projects/user_level_slurm_reservations,mghpcc-projects/user_level_slurm_reservations | ---
+++
@@ -8,7 +8,7 @@
DEBUG = True
-SLURM_INSTALL_DIR = '/usr/local/bin/'
+SLURM_INSTALL_DIR = '/usr/bin/'
HIL_SLURMCTLD_PROLOG_LOGFILE = '/var/log/moc_hil_ulsr/hil_prolog.log'
HIL_MONITOR_LOGFILE = '/var/log/moc_hil_ulsr/hil_monitor.log'
@@ -19,7 +19,6 @@
HIL_SLURM_PROJECT = 'slurm'
HIL_PARTITION_PREF... |
0ba9fa847a8b605363b298ecad40cb2fc5870cbb | build_modules.py | build_modules.py | import os, sys, subprocess, shutil
def check_for_module_builder():
if os.path.exists("voxel_native/scripts/"):
return
print("Downloading P3DModuleBuilder...")
cmd = [sys.executable, "-B", "voxel_native/download_P3DModuleBuilder.py"]
try:
output = subprocess.check_output(cmd, stderr=sy... | import os, sys, subprocess, shutil
def check_for_module_builder():
if os.path.exists("voxel_native/scripts/"):
return
print("Downloading P3DModuleBuilder...")
cmd = [sys.executable, "-B", "voxel_native/download_P3DModuleBuilder.py"]
try:
output = subprocess.check_output(cmd, stderr=sy... | Update build script to work correctly on macOS and linux. | Update build script to work correctly on macOS and linux.
| Python | mit | treamology/panda3d-voxels,treamology/panda3d-voxels,treamology/panda3d-voxels | ---
+++
@@ -27,8 +27,11 @@
print("Error building the native modules.")
sys.exit(-1)
- shutil.move("voxel_native/voxel_native.pyd", "voxel/voxel_native.pyd")
-
+ from voxel_native.scripts.common import is_macos, is_windows, is_linux
+ if is_windows():
+ shutil.move("voxel_native/vox... |
115a71995f2ceae667c05114da8e8ba21c25c402 | syncplay/__init__.py | syncplay/__init__.py | version = '1.6.5'
revision = ' release'
milestone = 'Yoitsu'
release_number = '86'
projectURL = 'https://syncplay.pl/'
| version = '1.6.6'
revision = ' development'
milestone = 'Yoitsu'
release_number = '87'
projectURL = 'https://syncplay.pl/'
| Move to 1.6.6 dev for further development | Move to 1.6.6 dev for further development | Python | apache-2.0 | alby128/syncplay,alby128/syncplay,Syncplay/syncplay,Syncplay/syncplay | ---
+++
@@ -1,5 +1,5 @@
-version = '1.6.5'
-revision = ' release'
+version = '1.6.6'
+revision = ' development'
milestone = 'Yoitsu'
-release_number = '86'
+release_number = '87'
projectURL = 'https://syncplay.pl/' |
d6b1f7c03ec2b32823fe2c4214e6521e8074cd9f | commands/join.py | commands/join.py | from CommandTemplate import CommandTemplate
from IrcMessage import IrcMessage
class Command(CommandTemplate):
triggers = ['join']
helptext = "Makes me join another channel, if I'm allowed to at least"
def execute(self, message):
"""
:type message: IrcMessage
"""
replytext = u""
if message.messageParts... | from CommandTemplate import CommandTemplate
from IrcMessage import IrcMessage
class Command(CommandTemplate):
triggers = ['join']
helptext = "Makes me join another channel, if I'm allowed to at least"
def execute(self, message):
"""
:type message: IrcMessage
"""
replytext = u""
if message.messageParts... | Make sure the 'channel' argument is not Unicode when we send it, because Twisted doesn't like that | [Join] Make sure the 'channel' argument is not Unicode when we send it, because Twisted doesn't like that
| Python | mit | Didero/DideRobot | ---
+++
@@ -17,7 +17,7 @@
else:
allowedChannels = message.bot.factory.settings.get('connection', 'allowedChannels').split(',')
- channel = message.messageParts[0]
+ channel = message.messageParts[0].encode('utf8') #Make sure it's a str and not unicode, otherwise Twisted chokes on it
if channel.st... |
521e24fa115e69bca39d7cca89ce42e8efa3b077 | tools/perf_expectations/PRESUBMIT.py | tools/perf_expectations/PRESUBMIT.py | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Presubmit script for perf_expectations.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on ... | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Presubmit script for perf_expectations.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on ... | Use full pathname to perf_expectations in test. | Use full pathname to perf_expectations in test.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/266055
git-svn-id: http://src.chromium.org/svn/trunk/src@28770 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Former-commit-id: f9d8e0a8dae19e482d3c435a76b4e38403e646b5 | Python | bsd-3-clause | meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-u... | ---
+++
@@ -13,12 +13,12 @@
'tests.perf_expectations_unittest',
]
-PERF_EXPECTATIONS = 'perf_expectations.json'
+PERF_EXPECTATIONS = 'tools/perf_expectations/perf_expectations.json'
def CheckChangeOnUpload(input_api, output_api):
run_tests = False
for path in input_api.LocalPaths():
- if PERF_EXPECT... |
9dd71fe94b57d56a422e784c10c463c22add90c3 | configuration/development.py | configuration/development.py | import pathlib
_basedir = pathlib.Path(__file__).parents[1]
SQLALCHEMY_DATABASE_URI = (
'sqlite:///' + str(_basedir.joinpath(pathlib.PurePath('app.db')).resolve())
)
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECRET_KEY = 'INSECURE'
MAIL_SERVER = 'localhost'
MAIL_PORT = '25'
MAIL_DEFAULT_SENDER = 'no-reply@localhos... | import pathlib
_basedir = pathlib.Path(__file__).parents[1]
SQLALCHEMY_DATABASE_URI = (
'sqlite:///' + str(_basedir.joinpath(pathlib.PurePath('app.db')).resolve())
)
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECRET_KEY = 'INSECURE'
MAIL_SERVER = 'localhost'
MAIL_PORT = '25'
MAIL_DEFAULT_SENDER = 'no-reply@localhos... | Fix absolute reference to logfile location | Fix absolute reference to logfile location
| Python | agpl-3.0 | interactomix/iis,interactomix/iis | ---
+++
@@ -28,7 +28,7 @@
"level": "DEBUG",
"formatter": "verbose",
"class": "iis.log.LockingFileHandler",
- "filename": "/home/max/Projects/iis/iis.log"
+ "filename": "./iis.log"
},
},
"loggers": { |
b326d43a94058390a559c4c9f55e9cd88dcac747 | adhocracy4/emails/mixins.py | adhocracy4/emails/mixins.py | from email.mime.image import MIMEImage
from django.contrib.staticfiles import finders
from .base import EmailBase
class PlatformEmailMixin:
"""
Attaches the static file images/logo.png so it can be used in an html
email.
"""
def get_attachments(self):
attachments = super().get_attachments... | from email.mime.image import MIMEImage
from django.contrib.staticfiles import finders
from .base import EmailBase
class PlatformEmailMixin:
"""
Attaches the static file images/logo.png so it can be used in an html
email.
"""
def get_attachments(self):
attachments = super().get_attachments... | Set propper mimetype for image attachment | Set propper mimetype for image attachment
| Python | agpl-3.0 | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | ---
+++
@@ -16,8 +16,14 @@
or finders.find('images/email_logo.svg')
)
if filename:
+ if filename.endswith('.png'):
+ imagetype = 'png'
+ else:
+ imagetype = 'svg+xml'
+
with open(filename, 'rb') as f:
- logo... |
07a04f63da897ae687fd90039d379482a13372e2 | txircd/modules/rfc/response_error.py | txircd/modules/rfc/response_error.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ErrorResponse(ModuleData):
implements(IPlugin, IModuleData)
name = "errorResponse"
core = True
def actions(self):
return [ ("quit", 10, self.sendE... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ErrorResponse(ModuleData):
implements(IPlugin, IModuleData)
name = "ErrorResponse"
core = True
def actions(self):
return [ ("quit", 10, self.sendE... | Standardize module names on leading capital letters | Standardize module names on leading capital letters
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd | ---
+++
@@ -5,7 +5,7 @@
class ErrorResponse(ModuleData):
implements(IPlugin, IModuleData)
- name = "errorResponse"
+ name = "ErrorResponse"
core = True
def actions(self): |
cb7aeb60fcff7f8fa6ac9e12282bf7dcd71617d8 | heat/tests/clients/test_ceilometer_client.py | heat/tests/clients/test_ceilometer_client.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
# ... | Fix ceilometerclient mocks for 2.8.0 release | Fix ceilometerclient mocks for 2.8.0 release
The function name changed in Iae7d60e1cf139b79e74caf81ed7bdbd0bf2bc473.
Change-Id: I1bbe3f32090b9b1fd7508b1b26665bceeea21f49
| Python | apache-2.0 | openstack/heat,noironetworks/heat,noironetworks/heat,openstack/heat | ---
+++
@@ -20,7 +20,7 @@
class CeilometerClientPluginTest(common.HeatTestCase):
def test_create(self):
- self.patchobject(cc.Client, '_get_alarm_client')
+ self.patchobject(cc.Client, '_get_redirect_client')
context = utils.dummy_context()
plugin = context.clients.client_plugi... |
12cf7d220408971509b57cb3a60f2d87b4a37477 | facebook_auth/models.py | facebook_auth/models.py | from uuid import uuid1
from django.conf import settings
from django.contrib.auth import models as auth_models
from django.db import models
import facepy
import simplejson
from facebook_auth import utils
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
access_token = models.... | from django.contrib.auth import models as auth_models
from django.db import models
import facepy
import simplejson
from facebook_auth import utils
class FacebookUser(auth_models.User):
user_id = models.BigIntegerField(unique=True)
access_token = models.TextField(blank=True, null=True)
app_friends = models... | Revert "Add support for server side authentication." | Revert "Add support for server side authentication."
This reverts commit 10ae930f6f14c2840d0b87cbec17054b4cc318d2.
Change-Id: Ied52c31f6f28ad635a6e5dae2171df22dc91e42c
Reviewed-on: http://review.pozytywnie.pl:8080/5153
Reviewed-by: Tomasz Wysocki <f17c2dc043305c950a029074ababd304e0373387@gmail.com>
Tested-by: Tomasz ... | Python | mit | jgoclawski/django-facebook-auth,pozytywnie/django-facebook-auth,pozytywnie/django-facebook-auth,jgoclawski/django-facebook-auth | ---
+++
@@ -1,6 +1,3 @@
-from uuid import uuid1
-
-from django.conf import settings
from django.contrib.auth import models as auth_models
from django.db import models
import facepy
@@ -33,11 +30,3 @@
friends_ids = [f['id'] for f in friends]
self.app_friends.clear()
self.app_friends.add(*... |
4378aef47a7e2b80a4a22af2bbe69ce4b780ab6d | pokr/views/login.py | pokr/views/login.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from flask import g, render_template, redirect, request, url_for
from flask.ext.login import current_user, login_required, logout_user
from social.apps.flask_app.template_filters import backends
def register(app):
@login_required
@app.route('/done/')
def ... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from flask import g, render_template, redirect, request, url_for
from flask.ext.login import current_user, login_required, logout_user
from social.apps.flask_app.template_filters import backends
def register(app):
@login_required
@app.route('/done/')
def ... | Fix due to Flask-Login version up | Fix due to Flask-Login version up
| Python | apache-2.0 | teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr | ---
+++
@@ -28,7 +28,7 @@
user = getattr(g, 'user')
return {
'user': user,
- 'is_logged': user and not user.is_anonymous()
+ 'is_logged': user and user.is_authenticated
}
app.context_processor(backends) |
f935eb48517627df679605aaee834165380d74db | django_db_geventpool/backends/postgresql_psycopg2/creation.py | django_db_geventpool/backends/postgresql_psycopg2/creation.py | # coding=utf-8
import django
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreationMixin16(object):
def _create_test_db(self, verbosity, autoclobber):
self.connection.closeall()
return super(DatabaseCreationMixin16, self)._c... | # coding=utf-8
import django
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreationMixin16(object):
def _create_test_db(self, verbosity, autoclobber):
self.connection.closeall()
return super(DatabaseCreationMixin16, self)._c... | Fix DatabaseCreation from django 1.7 | Fix DatabaseCreation from django 1.7
| Python | apache-2.0 | jneight/django-db-geventpool,PreppyLLC-opensource/django-db-geventpool | ---
+++
@@ -16,13 +16,13 @@
class DatabaseCreationMixin17(object):
- def _create_test_db(self, verbosity, autoclobber, keepdb=False):
+ def _create_test_db(self, verbosity, autoclobber):
self.connection.closeall()
- return super(DatabaseCreationMixin17, self)._create_test_db(verbosity, auto... |
385655debed235fcb32e70a3f506a6885f3e4e67 | c2cgeoportal/views/echo.py | c2cgeoportal/views/echo.py | from base64 import b64encode
import os.path
import re
from pyramid.httpexceptions import HTTPBadRequest
from pyramid.response import Response
from pyramid.view import view_config
def json_base64_encode_chunks(file, chunk_size=65536):
"""
Generate a JSON-wrapped base64-encoded string.
See http://en.wikipe... | from base64 import b64encode
import os.path
import re
from pyramid.httpexceptions import HTTPBadRequest
from pyramid.response import Response
from pyramid.view import view_config
def json_base64_encode_chunks(file, chunk_size=65536):
"""
Generate a JSON-wrapped base64-encoded string.
See http://en.wikipe... | Add success=true to satisfy Ext | Add success=true to satisfy Ext
| Python | bsd-2-clause | tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal | ---
+++
@@ -18,7 +18,7 @@
if not line:
break
yield b64encode(line)
- yield '"}'
+ yield '","success":true}'
@view_config(route_name='echo') |
90f4c06cd4186b08758ff599691d1ae1af522590 | cloudkitty/cli/processor.py | cloudkitty/cli/processor.py | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | Fix two mistakes of method description | Fix two mistakes of method description
Fix two mistakes of method description in processor.py
Change-Id: I3434665b6d458937295b0563ea0cd0ee6aebaca1
| Python | apache-2.0 | openstack/cloudkitty,stackforge/cloudkitty,stackforge/cloudkitty,openstack/cloudkitty | ---
+++
@@ -22,8 +22,8 @@
service.prepare_service()
# NOTE(mc): This import is done here to ensure that the prepare_service()
- # fonction is called before any cfg option. By importing the orchestrator
- # file, the utils one is imported too, and then some cfg option are read
+ # function is call... |
b7e781eed46503edee25547e8de8831ee6b0cf96 | src/data/download/BN_disease.py | src/data/download/BN_disease.py | # This script downloads weekly dengue statistics from data.gov.bn
import os
import sys
import logging
DIRECTORY = '../../Data/raw/disease_BN'
OUTFILE = "Trend of Notifiable Diseases (2008 - 2012).xlsx"
URL = "https://www.data.gov.bn/Lists/dataset/Attachments/460/Trend%20of%20Notifiable%20Diseases%20(2008%20-%202012).... | # This script downloads weekly dengue statistics from data.gov.bn
import os
import sys
import logging
DIRECTORY = '../../data/raw/disease_BN'
OUTFILE = "Trend of Notifiable Diseases (2008 - 2012).xlsx"
URL = "https://www.data.gov.bn/Lists/dataset/Attachments/460/Trend%20of%20Notifiable%20Diseases%20(2008%20-%202012).... | Add doc str and change logger config | Add doc str and change logger config
| Python | mit | DataKind-SG/healthcare_ASEAN | ---
+++
@@ -4,7 +4,7 @@
import logging
-DIRECTORY = '../../Data/raw/disease_BN'
+DIRECTORY = '../../data/raw/disease_BN'
OUTFILE = "Trend of Notifiable Diseases (2008 - 2012).xlsx"
URL = "https://www.data.gov.bn/Lists/dataset/Attachments/460/Trend%20of%20Notifiable%20Diseases%20(2008%20-%202012).xlsx"
@@ -12... |
c1d889f637d6d2a931f81332a9eef3974dfa18e0 | code/marv/marv/__init__.py | code/marv/marv/__init__.py | # Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import sys
from pkg_resources import iter_entry_points
from marv_node.io import Abort
from marv_node.io import create_group
from marv_node.io import create_stream
from marv_node.io import fork
from marv_node.io import get_logger
from marv_no... | # Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
from marv_node.io import Abort
from marv_node.io import create_group
from marv_node.io import create_stream
from marv_node.io import fork
from marv_node.io import get_logger
from marv_node.io import get_requested
from marv_node.io import get_s... | Drop unused support to add decorators via entry points | Drop unused support to add decorators via entry points
| Python | agpl-3.0 | ternaris/marv-robotics,ternaris/marv-robotics | ---
+++
@@ -1,9 +1,5 @@
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
-
-import sys
-
-from pkg_resources import iter_entry_points
from marv_node.io import Abort
from marv_node.io import create_group
@@ -41,9 +37,3 @@
'select',
'set_header',
]
-
-MODULE = sys.modules[__n... |
0a6e82485d4c4657efae629501f14c28c9287f48 | collectd_haproxy/compat.py | collectd_haproxy/compat.py | import sys
PY3 = sys.version_info >= (3,)
def iteritems(dictionary):
if PY3:
return dictionary.items()
return dictionary.iteritems()
def coerce_long(string):
if not PY3:
return long(string)
return int(string)
| import sys
PY3 = sys.version_info >= (3,)
def iteritems(dictionary):
if PY3:
return dictionary.items()
return dictionary.iteritems()
def coerce_long(string):
if not PY3:
return long(string) # noqa
return int(string)
| Fix flake8 test for the coersion function | Fix flake8 test for the coersion function
| Python | mit | wglass/collectd-haproxy | ---
+++
@@ -13,6 +13,6 @@
def coerce_long(string):
if not PY3:
- return long(string)
+ return long(string) # noqa
return int(string) |
4c52b8f63fea11278536ec6800305b01d9bd02a8 | blazar/plugins/dummy_vm_plugin.py | blazar/plugins/dummy_vm_plugin.py | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Add update_reservation to dummy plugin | Add update_reservation to dummy plugin
update_reservation is now an abstract method. It needs to be added to
all plugins.
Change-Id: I921878bd5233613b804b17813af1aac5bdfed9e7
(cherry picked from commit 1dbc30202bddfd4f03bdc9a8005de3c363d2ac1d)
| Python | apache-2.0 | ChameleonCloud/blazar,ChameleonCloud/blazar | ---
+++
@@ -25,6 +25,9 @@
def reserve_resource(self, reservation_id, values):
return None
+ def update_reservation(self, reservation_id, values):
+ return None
+
def on_start(self, resource_id):
"""Dummy VM plugin does nothing."""
return 'VM %s should be waked up this ... |
15b4f0c587bdd5772718d9d75ff5654d9b835ae5 | righteous/config.py | righteous/config.py | # coding: utf-8
"""
righteous.config
Settings object, lifted from https://github.com/kennethreitz/requests
"""
from requests.config import Settings
class RighteousSettings(Settings):
pass
settings = RighteousSettings()
settings.debug = False
settings.cookies = None
settings.username = None
settings.password ... | # coding: utf-8
"""
righteous.config
Settings object, lifted from https://github.com/kennethreitz/requests
"""
class Settings(object):
_singleton = {}
# attributes with defaults
__attrs__ = []
def __init__(self, **kwargs):
super(Settings, self).__init__()
self.__dict__ = self._sin... | Copy the settings class from an old requests version | Copy the settings class from an old requests version
| Python | unlicense | michaeljoseph/righteous,michaeljoseph/righteous | ---
+++
@@ -7,13 +7,53 @@
Settings object, lifted from https://github.com/kennethreitz/requests
"""
-from requests.config import Settings
+class Settings(object):
+ _singleton = {}
-class RighteousSettings(Settings):
- pass
+ # attributes with defaults
+ __attrs__ = []
+
+ def __init__(self, **kw... |
157197b330360ccfeaa0bbf54453702ee17d0106 | Code/Python/Kamaelia/Kamaelia/Device/__init__.py | Code/Python/Kamaelia/Kamaelia/Device/__init__.py | # Needed to allow import
#
# Copyright (C) 2006 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser Gener... | # -*- coding: utf-8 -*-
# Needed to allow import
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache Lice... | Change license to Apache 2 | Change license to Apache 2 | Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -1,23 +1,23 @@
+# -*- coding: utf-8 -*-
# Needed to allow import
#
-# Copyright (C) 2006 British Broadcasting Corporation and Kamaelia Contributors(1)
-# All Rights Reserved.
-#
-# You may only modify and redistribute this under the terms of any of the
-# following licenses(2): Mozilla Public License... |
1d09e197c02899bf33f4e30aef04e91cfe0dcbca | dbmigrator/commands/rollback.py | dbmigrator/commands/rollback.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Rollback a migration."""
from .. import utils
__all__ = ('cli_loader',)
@utils.with_cursor
def cli_... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Rollback a migration."""
from .. import logger, utils
__all__ = ('cli_loader',)
@utils.with_cursor
... | Change print statement to logger.debug | Change print statement to logger.debug
| Python | agpl-3.0 | karenc/db-migrator | ---
+++
@@ -7,7 +7,7 @@
# ###
"""Rollback a migration."""
-from .. import utils
+from .. import logger, utils
__all__ = ('cli_loader',)
@@ -18,7 +18,7 @@
db_connection_string='', **kwargs):
migrated_versions = list(utils.get_schema_versions(
cursor, include_deferred=False))
- ... |
6f60f6257cbcd0328fcdb0873d88d55772731ba4 | api/app.py | api/app.py | from flask import Flask
from flask import request
from flask import jsonify
from y_text_recommender_system.recommender import recommend
app = Flask(__name__)
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, payload=None):
Exception.__init__(self)
self.message = m... | from flask import Flask
from flask import request
from flask import jsonify
from y_text_recommender_system.recommender import recommend
app = Flask(__name__)
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, payload=None):
Exception.__init__(self)
self.message = m... | Refactor to separate the function to clean the data | Refactor to separate the function to clean the data
| Python | mit | joaojunior/y_text_recommender_system | ---
+++
@@ -34,14 +34,18 @@
if content is not None:
doc = content.get('doc', {})
docs = content.get('docs', [])
- if doc == {}:
- msg = 'The parameter `doc` is missing or empty'
- raise InvalidUsage(msg)
- if len(docs) == 0:
- msg = 'The parameter ... |
2cc51dd426f53b699a544ef34984dc9efdfe03cc | debugger/urls.py | debugger/urls.py | from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('debugger.views',
url(r'^$', 'index', name='index'),
url(... | from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('debugger.views',
url(r'^$', 'index', name='index'),
url(... | Fix trailing slashes in URLconfs | Fix trailing slashes in URLconfs
| Python | apache-2.0 | lovehhf/xblock-sdk,lovehhf/XBlock,stvstnfrd/xblock-sdk,edx-solutions/XBlock,Lyla-Fischer/xblock-sdk,edx/xblock-sdk,lovehhf/xblock-sdk,Pilou81715/hackathon_edX,EDUlib/XBlock,cpennington/XBlock,nagyistoce/edx-XBlock,edx-solutions/XBlock,edx-solutions/xblock-sdk,edx/xblock-sdk,nagyistoce/edx-xblock-sdk,Pilou81715/hackatho... | ---
+++
@@ -7,11 +7,11 @@
urlpatterns = patterns('debugger.views',
url(r'^$', 'index', name='index'),
- url(r'^settings$', 'settings', name='settings'),
- url(r'^scenario/(?P<scenario_id>[^/]+)$', 'show_scenario', name='scenario'),
- url(r'^resource/(?P<package>[^/]+)/(?P<resource>.*)/?', 'package_re... |
7785d3129d089ce99aee340b3a72fd78d7e8f556 | send.py | send.py | import os
sender = str(raw_input("Your Username: "))
target = str(raw_input("Target's Username: "))
message = str(raw_input("Message: "))
#Messages are encoded like so "senderProgramVx.x##target##sender##message"
#Example: "linuxV1.8##person87##NickGeek##Hey mate! What do you think of this WiN thing?"
formattedMessag... | import os
if os.path.exists("account.conf") is False:
sender = str(raw_input("Your Username: "))
accountFile = open('account.conf', 'w+')
accountFile.write(sender)
accountFile.close()
else:
accountFile = open('account.conf', 'r')
sender = accountFile.read()
accountFile.close()
target = str(raw_input("Target's ... | Store your username in a file | Store your username in a file
| Python | mit | NickGeek/WiN,NickGeek/WiN,NickGeek/WiN | ---
+++
@@ -1,6 +1,15 @@
import os
-sender = str(raw_input("Your Username: "))
+if os.path.exists("account.conf") is False:
+ sender = str(raw_input("Your Username: "))
+ accountFile = open('account.conf', 'w+')
+ accountFile.write(sender)
+ accountFile.close()
+else:
+ accountFile = open('account.conf', 'r')
+ se... |
42e4f42901872433f90dd84d5acf04fec76ab7f3 | curious/commands/exc.py | curious/commands/exc.py | class CommandsError(Exception):
pass
class CheckFailureError(Exception):
def __init__(self, ctx, check):
self.ctx = ctx
self.check = check
def __repr__(self):
if isinstance(self.check, list):
return "The checks for {.name} failed.".format(self.ctx)
return "The ... | class CommandsError(Exception):
pass
class CheckFailureError(Exception):
def __init__(self, ctx, check):
self.ctx = ctx
self.check = check
def __repr__(self):
if isinstance(self.check, list):
return "The checks for `{.name}` failed.".format(self.ctx)
return "Th... | Add better __repr__s for commands errors. | Add better __repr__s for commands errors.
| Python | mit | SunDwarf/curious | ---
+++
@@ -9,8 +9,8 @@
def __repr__(self):
if isinstance(self.check, list):
- return "The checks for {.name} failed.".format(self.ctx)
- return "The check {.__name__} for {.name} failed.".format(self.check, self.ctx)
+ return "The checks for `{.name}` failed.".format(self... |
d8179c0006fb5b9983898e4cd93ffacfe3fdd54f | caminae/mapentity/templatetags/convert_tags.py | caminae/mapentity/templatetags/convert_tags.py | import urllib
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def convert_url(request, sourceurl, format='pdf'):
fullurl = request.build_absolute_uri(sourceurl)
conversion_url = "%s?url=%s&to=%s" % (settings.CONVERSION_SERVER,
... | import urllib
from mimetypes import types_map
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def convert_url(request, sourceurl, format='pdf'):
if '/' not in format:
extension = '.' + format if not format.startswith('.') else format
... | Support conversion format as extension, instead of mimetype | Support conversion format as extension, instead of mimetype
| Python | bsd-2-clause | makinacorpus/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,mabhub/Geotrek,GeotrekCE/Geotrek-admin,Anaethelion/Geotrek,johan--/Geotrek,camillemonchicourt/Geotrek,johan--/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,GeotrekCE/Geotrek-admin,camillemo... | ---
+++
@@ -1,12 +1,18 @@
import urllib
+from mimetypes import types_map
+
from django import template
from django.conf import settings
+
register = template.Library()
@register.simple_tag
def convert_url(request, sourceurl, format='pdf'):
+ if '/' not in format:
+ extension = '.' + format if no... |
e853e0137e59314f5101c178c74fd626984c34ac | pygraphc/similarity/LogTextSimilarity.py | pygraphc/similarity/LogTextSimilarity.py | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended for
non-graph based clust... | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended for
non-graph based clust... | Change input from previous processing not from a file | Change input from previous processing not from a file
| Python | mit | studiawan/pygraphc | ---
+++
@@ -7,18 +7,18 @@
"""A class for calculating cosine similarity between a log pair. This class is intended for
non-graph based clustering method.
"""
- def __init__(self, logtype, logfile):
+ def __init__(self, logtype, logs):
"""The constructor of class LogTextSimilarity.
... |
921ce44cd766540d74b8496029e871d5aceb5cbb | urls.py | urls.py | from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from filebrowser.sites import site
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url('', include('uqam.cat.urls')),
url(r'^admin... | from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url('', include('uqam.cat.urls')),
# Uncomment the admin/doc line below to enable ... | Remove last bits of file browser stuff | Remove last bits of file browser stuff | Python | bsd-3-clause | uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam | ---
+++
@@ -1,6 +1,5 @@
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
-from filebrowser.sites import site
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
@@ -9,7 +8,6 @@
urlpatterns = patterns('',
url('', include('uqam.ca... |
86a5fff9add5980892c90a3e34476802dec7a6dc | jsonschema/tests/_helpers.py | jsonschema/tests/_helpers.py | def bug(issue=None):
message = "A known bug."
if issue is not None:
message += " See issue #{issue}.".format(issue=issue)
return message
| from urllib.parse import urljoin
def issues_url(organization, repository):
return urljoin(
urljoin(
urljoin("https://github.com", organization),
repository,
),
"issues",
)
ISSUES_URL = issues_url("python-jsonschema", "jsonschema")
TEST_SUITE_ISSUES_URL = issue... | Improve the internal skipped-test helper messages. | Improve the internal skipped-test helper messages.
| Python | mit | python-jsonschema/jsonschema | ---
+++
@@ -1,5 +1,29 @@
+from urllib.parse import urljoin
+
+
+def issues_url(organization, repository):
+ return urljoin(
+ urljoin(
+ urljoin("https://github.com", organization),
+ repository,
+ ),
+ "issues",
+ )
+
+
+ISSUES_URL = issues_url("python-jsonschema", "j... |
bf96bf9d71f432f2db75b0c62b49098235d75661 | cryptography/bindings/openssl/pkcs12.py | cryptography/bindings/openssl/pkcs12.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Move these to macros, the exact type of these functions changes by deifne | Move these to macros, the exact type of these functions changes by deifne
| Python | bsd-3-clause | Lukasa/cryptography,kimvais/cryptography,skeuomorf/cryptography,sholsapp/cryptography,dstufft/cryptography,bwhmather/cryptography,glyph/cryptography,dstufft/cryptography,bwhmather/cryptography,kimvais/cryptography,dstufft/cryptography,Ayrx/cryptography,Lukasa/cryptography,skeuomorf/cryptography,sholsapp/cryptography,Ha... | ---
+++
@@ -20,10 +20,6 @@
"""
FUNCTIONS = """
-int PKCS12_parse(PKCS12 *, const char *, EVP_PKEY **, X509 **,
- struct stack_st_X509 **);
-PKCS12 *PKCS12_create(char *, char *, EVP_PKEY *, X509 *,
- struct stack_st_X509 *, int, int, int, int, int);
void PKCS12_free(PKCS12 *)... |
bcaf887ccad40adf2cb09627c12f2a3e1b4b006d | redis_cache/client/__init__.py | redis_cache/client/__init__.py | # -*- coding: utf-8 -*-
from .default import DefaultClient
from .sharded import ShardClient
from .herd import HerdClient
from .experimental import SimpleFailoverClient
from .sentinel import SentinelClient
__all__ = ['DefaultClient', 'ShardClient',
'HerdClient', 'SimpleFailoverClient',
'SentinelC... | # -*- coding: utf-8 -*-
import warnings
from .default import DefaultClient
from .sharded import ShardClient
from .herd import HerdClient
from .experimental import SimpleFailoverClient
__all__ = ['DefaultClient', 'ShardClient',
'HerdClient', 'SimpleFailoverClient',]
try:
from .sentinel import Sentine... | Disable Sentinel client with redis-py < 2.9 | Disable Sentinel client with redis-py < 2.9
| Python | bsd-3-clause | zl352773277/django-redis,smahs/django-redis,yanheng/django-redis,lucius-feng/django-redis,GetAmbassador/django-redis | ---
+++
@@ -1,11 +1,20 @@
# -*- coding: utf-8 -*-
+
+import warnings
from .default import DefaultClient
from .sharded import ShardClient
from .herd import HerdClient
from .experimental import SimpleFailoverClient
-from .sentinel import SentinelClient
+
__all__ = ['DefaultClient', 'ShardClient',
- ... |
a99dd63f357548cc4eef5121e3a2da9dfd6b7a01 | education/test/test_absenteeism_form.py | education/test/test_absenteeism_form.py | # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from unittest import TestCase
from education.views import AbsenteeismForm
from datetime import datetime
class TestAbsenteeismForm(TestCase):
def test_should_invalidate_empty_form(self):
absenteeism_form = AbsenteeismForm(data={})
self.assertFalse(absentee... | # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from unittest import TestCase
from education.views import AbsenteeismForm
from datetime import datetime
class TestAbsenteeismForm(TestCase):
def test_should_invalidate_empty_form(self):
absenteeism_form = AbsenteeismForm(data={})
self.assertFalse(absentee... | Put dates in the past so that we have no chance of having them spontaneously fail. | Put dates in the past so that we have no chance of having them spontaneously fail.
| Python | bsd-3-clause | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | ---
+++
@@ -9,12 +9,12 @@
self.assertFalse(absenteeism_form.is_valid())
def test_should_validate_if_to_date_is_greater_than_from_date(self):
- absenteeism_form = AbsenteeismForm(data={'to_date':'12/12/2013', 'from_date':'12/14/2013'})
+ absenteeism_form = AbsenteeismForm(data={'to_date':... |
684ac5e6e6011581d5abcb42a7c0e54742f20606 | Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py | Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py | # -------------------------------------------------------
import socket, traceback
import time
import json
host = ''
port = 2390
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind((host, port))
fi... | # -------------------------------------------------------
import socket, traceback
import time
import json
import numpy as np
from scipy.spatial.transform import Rotation as R
host = ''
port = 2390
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsocko... | Add computations of great roll, pitch and small yaw angle (kite angles) | Add computations of great roll, pitch and small yaw angle (kite angles)
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -2,6 +2,9 @@
import socket, traceback
import time
import json
+
+import numpy as np
+from scipy.spatial.transform import Rotation as R
host = ''
port = 2390
@@ -13,11 +16,35 @@
filein = open('saveUDP.txt', 'w')
t0 = time.time()
+
+# Place IMU x-axis into wind going direction when launching scrip... |
0254ad22680d32a451d1faf4b21809394a399311 | packages/pegasus-python/src/Pegasus/cli/startup-validation.py | packages/pegasus-python/src/Pegasus/cli/startup-validation.py | #!/usr/bin/python3
import sys
if not sys.version_info >= (3, 5):
sys.stderr.write("Pegasus requires Python 3.5 or above\n")
sys.exit(1)
try:
pass
except:
sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n")
sys.exit(1)
| #!/usr/bin/python3
import sys
if not sys.version_info >= (3, 5):
sys.stderr.write("Pegasus requires Python 3.5 or above\n")
sys.exit(1)
try:
import yaml # noqa
except:
sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n")
sys.exit(1)
| Add noqa comment so unused import does not get removed by code lint steps | Add noqa comment so unused import does not get removed by code lint steps
| Python | apache-2.0 | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | ---
+++
@@ -7,7 +7,7 @@
sys.exit(1)
try:
- pass
+ import yaml # noqa
except:
sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n")
sys.exit(1) |
6d18ff715a5fa3059ddb609c1abdbbb06b15ad63 | fuel/downloaders/celeba.py | fuel/downloaders/celeba.py | from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the CelebA dataset file.
Parameters
----------
subparser : :class:`argparse.ArgumentParser`
Subparser handling the `celeba` command.
"""
urls = ['https://www.dropbox... | from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the CelebA dataset file.
Parameters
----------
subparser : :class:`argparse.ArgumentParser`
Subparser handling the `celeba` command.
"""
urls = ['https://www.dropbox... | Update download links for CelebA files | Update download links for CelebA files
| Python | mit | mila-udem/fuel,dmitriy-serdyuk/fuel,dmitriy-serdyuk/fuel,mila-udem/fuel,vdumoulin/fuel,vdumoulin/fuel | ---
+++
@@ -11,9 +11,9 @@
"""
urls = ['https://www.dropbox.com/sh/8oqt9vytwxb3s4r/'
- 'AAB7G69NLjRNqv_tyiULHSVUa/list_attr_celeba.txt?dl=1',
+ 'AAC7-uCaJkmPmvLX2_P5qy0ga/Anno/list_attr_celeba.txt?dl=1',
'https://www.dropbox.com/sh/8oqt9vytwxb3s4r/'
- 'AADVdnYb... |
e66fe8e6c79f7b29e2f334b481904f7d838a2655 | gameon/users/middleware.py | gameon/users/middleware.py | from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect
from gameon.users.models import get_profile_safely
class ProfileMiddleware(object):
@classmethod
def safe_paths(cls):
return ('users_edit', 'django.views.static.serve', 'users_signout')
def is_saf... | from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect
from django.conf import settings
from gameon.users.models import get_profile_safely
class ProfileMiddleware(object):
"""
This middleware will redirect a user, once signed into the site via Persona
to comple... | Fix up nits on profileMiddleware as noticed in bugzilla-813182 | Fix up nits on profileMiddleware as noticed in bugzilla-813182
| Python | bsd-3-clause | mozilla/gameon,mozilla/gameon,mozilla/gameon,mozilla/gameon | ---
+++
@@ -1,16 +1,29 @@
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect
+from django.conf import settings
from gameon.users.models import get_profile_safely
class ProfileMiddleware(object):
-
+ """
+ This middleware will redirect a user, once signed... |
e818860af87cad796699e27f8dfb4ff6fc9354e8 | h2o-py/h2o/model/autoencoder.py | h2o-py/h2o/model/autoencoder.py | """
AutoEncoder Models
"""
from model_base import *
from metrics_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for AutoEncoder models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly(se... | """
AutoEncoder Models
"""
from model_base import *
from metrics_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for AutoEncoder models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly(se... | Add extra argument to get per-feature reconstruction error for anomaly detection from Python. | PUBDEV-2078: Add extra argument to get per-feature reconstruction error for
anomaly detection from Python.
| Python | apache-2.0 | kyoren/https-github.com-h2oai-h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,datachand/h2o-3,YzPaul3/h2o-3,h2oai/h2o-3,brightchen/h2o-3,mathemage/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,datachand/h2o-3,kyoren/https-github.com-h2oai-h2o-3,printedheart/h2o-3,pchmieli/h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,datacha... | ---
+++
@@ -13,13 +13,14 @@
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
- def anomaly(self,test_data):
+ def anomaly(self,test_data,per_feature=False):
"""
Obtain the reconstruction error for the input test_... |
ea1c095fb12c4062616ee0d38818ab1baaabd1eb | ipywidgets/widgets/tests/test_widget_upload.py | ipywidgets/widgets/tests/test_widget_upload.py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from unittest import TestCase
from traitlets import TraitError
from ipywidgets import FileUpload
class TestFileUpload(TestCase):
def test_construction(self):
uploader = FileUpload()
# Default
... | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from unittest import TestCase
from traitlets import TraitError
from ipywidgets import FileUpload
class TestFileUpload(TestCase):
def test_construction(self):
uploader = FileUpload()
# Default
... | Test deserialization of comm message following upload | Test deserialization of comm message following upload
| Python | bsd-3-clause | ipython/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets | ---
+++
@@ -27,3 +27,26 @@
def test_empty_initial_value(self):
uploader = FileUpload()
assert uploader.value == []
+
+ def test_receive_single_file(self):
+ uploader = FileUpload()
+ content = memoryview(b"file content")
+ message = {
+ "value": [
+ ... |
c5730d19d41f7221c4108f340d0ff8be26c24c74 | auxiliary/tag_suggestions/__init__.py | auxiliary/tag_suggestions/__init__.py | from tagging.models import Tag, TaggedItem
from django.contrib.contenttypes.models import ContentType
from auxiliary.models import TagSuggestion
from django.db import IntegrityError
def approve(admin, request, tag_suggestions):
for tag_suggestion in tag_suggestions:
object = tag_suggestion.object
t... | from tagging.models import Tag, TaggedItem
from django.contrib.contenttypes.models import ContentType
def approve(admin, request, tag_suggestions):
for tag_suggestion in tag_suggestions:
obj = tag_suggestion.object
ct = ContentType.objects.get_for_model(obj)
tag, t_created = Tag.objects.... | Make tag_suggestions test less flaky | Make tag_suggestions test less flaky
Failed on Python 2.7.6 as it was dependant on an error string returned
| Python | bsd-3-clause | noamelf/Open-Knesset,otadmor/Open-Knesset,habeanf/Open-Knesset,habeanf/Open-Knesset,daonb/Open-Knesset,navotsil/Open-Knesset,noamelf/Open-Knesset,navotsil/Open-Knesset,navotsil/Open-Knesset,otadmor/Open-Knesset,noamelf/Open-Knesset,otadmor/Open-Knesset,ofri/Open-Knesset,Shrulik/Open-Knesset,jspan/Open-Knesset,jspan/Ope... | ---
+++
@@ -1,15 +1,15 @@
from tagging.models import Tag, TaggedItem
from django.contrib.contenttypes.models import ContentType
-from auxiliary.models import TagSuggestion
-from django.db import IntegrityError
+
def approve(admin, request, tag_suggestions):
for tag_suggestion in tag_suggestions:
- ob... |
85b269bde76af2b8d15dc3b1e9f7cf882fc18dc2 | labcalc/tests/test_functions.py | labcalc/tests/test_functions.py | #!/usr/bin/env python3
from labcalc.run import *
from labcalc import gibson
# labcalc.gibson
def test_gibson_one_insert():
d = {'insert1': [300, 50], 'vector': [5000, 50]}
assert gibson.gibson_calc(d) == {'insert1': 0.24, 'vector': 2.0}
| #!/usr/bin/env python3
from labcalc.run import *
from labcalc import gibson
# labcalc.gibson
def test_gibson_one_insert():
d = {'vector': [5000, 50], 'insert1': [300, 50]}
assert gibson.gibson_calc(d) == {'vector': 2.0, 'insert1': 0.24}
def test_gibson_two_inserts():
d = {'vector': [5000, 50], 'insert1':... | Add tests for multiple gibson inserts | Add tests for multiple gibson inserts
| Python | bsd-3-clause | dtarnowski16/labcalc,mandel01/labcalc,mjmlab/labcalc | ---
+++
@@ -5,5 +5,14 @@
# labcalc.gibson
def test_gibson_one_insert():
- d = {'insert1': [300, 50], 'vector': [5000, 50]}
- assert gibson.gibson_calc(d) == {'insert1': 0.24, 'vector': 2.0}
+ d = {'vector': [5000, 50], 'insert1': [300, 50]}
+ assert gibson.gibson_calc(d) == {'vector': 2.0, 'insert1': ... |
caaa807a4226bfdeb18681f8ccb6119bd2caa609 | pombola/core/context_processors.py | pombola/core/context_processors.py | from django.conf import settings
import logging
def add_settings( request ):
"""Add some selected settings values to the context"""
return {
'settings': {
'STAGING': settings.STAGING,
'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER,
... | from django.conf import settings
import logging
def add_settings( request ):
"""Add some selected settings values to the context"""
return {
'settings': {
'STAGING': settings.STAGING,
'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER,
... | Add COUNTRY_APP to settings exposed to the templates | Add COUNTRY_APP to settings exposed to the templates
| Python | agpl-3.0 | hzj123/56th,mysociety/pombola,hzj123/56th,hzj123/56th,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,patricmutwiri/pombola,mysociety/pombola,mysociety/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola... | ---
+++
@@ -15,6 +15,7 @@
'TWITTER_WIDGET_ID': settings.TWITTER_WIDGET_ID,
'BLOG_RSS_FEED': settings.BLOG_RSS_FEED,
'ENABLED_FEATURES': settings.ENABLED_FEATURES,
+ 'COUNTRY_APP': settings.COUNTRY_APP,
... |
8de4cb6e314da95b243f140f53b3c77487695a55 | tests/cyclus_tools.py | tests/cyclus_tools.py | #! /usr/bin/env python
from tools import check_cmd
def run_cyclus(cyclus, cwd, sim_files):
"""Runs cyclus with various inputs and creates output databases
"""
for sim_input, sim_output in zip(sim_files):
holdsrtn = [1] # needed because nose does not send() to test generator
cmd = [cyc... | #! /usr/bin/env python
from tools import check_cmd
def run_cyclus(cyclus, cwd, sim_files):
"""Runs cyclus with various inputs and creates output databases
"""
for sim_input, sim_output in sim_files:
holdsrtn = [1] # needed because nose does not send() to test generator
cmd = [cyclus, ... | Correct zip() error in run_cyclus function | Correct zip() error in run_cyclus function
| Python | bsd-3-clause | Baaaaam/cyBaM,gonuke/cycamore,cyclus/cycaless,gonuke/cycamore,Baaaaam/cycamore,jlittell/cycamore,rwcarlsen/cycamore,Baaaaam/cyBaM,Baaaaam/cycamore,rwcarlsen/cycamore,jlittell/cycamore,gonuke/cycamore,jlittell/cycamore,rwcarlsen/cycamore,Baaaaam/cycamore,jlittell/cycamore,Baaaaam/cyBaM,Baaaaam/cyCLASS,cyclus/cycaless,Ba... | ---
+++
@@ -6,7 +6,7 @@
"""Runs cyclus with various inputs and creates output databases
"""
- for sim_input, sim_output in zip(sim_files):
+ for sim_input, sim_output in sim_files:
holdsrtn = [1] # needed because nose does not send() to test generator
cmd = [cyclus, "-o", sim_o... |
47d9a8df136e235f49921d4782c5e392b0101107 | migrations/versions/147_add_cleaned_subject.py | migrations/versions/147_add_cleaned_subject.py | """add cleaned subject
Revision ID: 486c7fa5b533
Revises: 1d7a72222b7c
Create Date: 2015-03-10 16:33:41.740387
"""
# revision identifiers, used by Alembic.
revision = '486c7fa5b533'
down_revision = 'c77a90d524'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
def upgrade():
conn ... | """add cleaned subject
Revision ID: 486c7fa5b533
Revises: 1d7a72222b7c
Create Date: 2015-03-10 16:33:41.740387
"""
# revision identifiers, used by Alembic.
revision = '486c7fa5b533'
down_revision = 'c77a90d524'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
def upgrade():
conn ... | Make _cleaned_subject migration match declared schema. | Make _cleaned_subject migration match declared schema.
Test Plan: Upgrade old database to head.
Reviewers: kav-ya
Reviewed By: kav-ya
Differential Revision: https://review.inboxapp.com/D1394
| Python | agpl-3.0 | Eagles2F/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,PriviPK/privipk-sync-engine,PriviPK/privipk-sync-engine,nylas/sync-engine,closeio/nylas,jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine,wakermahmud/sync-engine,PriviPK/privipk-sync-engine,wakermahmud/sync-engine,gale320/sync-engine,Eagl... | ---
+++
@@ -21,8 +21,8 @@
op.add_column('thread', sa.Column('_cleaned_subject',
sa.String(length=255), nullable=True))
- op.create_index('ix_cleaned_subject', 'thread',
- ['namespace_id', '_cleaned_subject'], unique=False)
+ op.create_index('ix_cl... |
8910a61025062a40a3129f7a4330964b20337ec2 | insanity/core.py | insanity/core.py | import numpy as np
import theano
import theano.tensor as T | import numpy as np
import theano
import theano.tensor as T
class NeuralNetwork(object):
def __init__(self, layers, miniBatchSize):
self.miniBatchSize = miniBatchSize
#Initialize layers.
self.layers = layers
self.numLayers = len(self.layers)
self.firstLayer = self.layers[0]
self.lastLayer = self.layer... | Add first code for NeuralNetwork class. | Add first code for NeuralNetwork class.
| Python | cc0-1.0 | cn04/insanity | ---
+++
@@ -1,3 +1,24 @@
import numpy as np
import theano
import theano.tensor as T
+
+
+class NeuralNetwork(object):
+
+ def __init__(self, layers, miniBatchSize):
+ self.miniBatchSize = miniBatchSize
+ #Initialize layers.
+ self.layers = layers
+ self.numLayers = len(self.layers)
+ self.firstLayer = self... |
cdaeb29474df423e66cbc79fffa74d937fe2193c | justitie/just/pipelines.py | justitie/just/pipelines.py | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import requests
import json
from just.items import JustPublication
import logging
API_KEY = 'justitie-very-secret-key'
API_PU... | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import requests
import json
import logging
from just.items import JustPublication
import logging
API_KEY = 'justitie-very-sec... | Add logging for api calls. | Add logging for api calls.
| Python | mpl-2.0 | mgax/czl-scrape,margelatu/czl-scrape,costibleotu/czl-scrape,mgax/czl-scrape,code4romania/czl-scrape,lbogdan/czl-scrape,mgax/czl-scrape,lbogdan/czl-scrape,lbogdan/czl-scrape,mgax/czl-scrape,code4romania/czl-scrape,code4romania/czl-scrape,code4romania/czl-scrape,lbogdan/czl-scrape,margelatu/czl-scrape,margelatu/czl-scrap... | ---
+++
@@ -7,6 +7,7 @@
import requests
import json
+import logging
from just.items import JustPublication
import logging
@@ -22,4 +23,11 @@
r = requests.post(API_PUBLICATIONS, json=dict(item), headers={'Authorization': 'Token %s' % (API_KEY,) } )
+ api_log = logging.getLogger('api-log.txt... |
837efcddd6c111dabf14a6017d0ae2f6aacbddac | konstrukteur/HtmlParser.py | konstrukteur/HtmlParser.py | #
# Konstrukteur - Static website generator
# Copyright 2013 Sebastian Fastner
#
__all__ = ["parse"]
from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup
def parse(filename):
""" HTML parser class for Konstrukteur """
page = {}
parsedContent = BeautifulSoup(open(filenam... | #
# Konstrukteur - Static website generator
# Copyright 2013 Sebastian Fastner
#
__all__ = ["parse"]
from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup
def parse(filename):
""" HTML parser class for Konstrukteur """
page = {}
parsedContent = BeautifulSoup(open(filenam... | Add detection of wrong meta data | Add detection of wrong meta data
| Python | mit | fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur | ---
+++
@@ -24,6 +24,9 @@
page["summary"] = body.p.get_text()
for meta in parsedContent.find_all("meta"):
- page[meta["name"].lower()] = meta["contents"]
+ if not hasattr(meta, "name") or not hasattr(meta, "content"):
+ raise RuntimeError("Meta elements must have attributes name and content : %s" % filename... |
a31db91800630520c5b516493bddef76ba8b7edd | flask_oauthlib/utils.py | flask_oauthlib/utils.py | # coding: utf-8
import logging
import base64
from flask import request, Response
from oauthlib.common import to_unicode, bytes_type
log = logging.getLogger('flask_oauthlib')
def extract_params():
"""Extract request params."""
uri = request.url
http_method = request.method
headers = dict(request.head... | # coding: utf-8
import logging
import base64
from flask import request, Response
from oauthlib.common import to_unicode, bytes_type
log = logging.getLogger('flask_oauthlib')
def extract_params():
"""Extract request params."""
uri = request.url
http_method = request.method
headers = dict(request.head... | Delete useless header transform in extract_params. | Delete useless header transform in extract_params.
| Python | bsd-3-clause | auerj/flask-oauthlib,auerj/flask-oauthlib,kevin1024/flask-oauthlib,stianpr/flask-oauthlib,CoreyHyllested/flask-oauthlib,lepture/flask-oauthlib,Ryan-K/flask-oauthlib,tonyseek/flask-oauthlib,RealGeeks/flask-oauthlib,adambard/flask-oauthlib,huxuan/flask-oauthlib,PyBossa/flask-oauthlib,Fleurer/flask-oauthlib,CoreyHyllested... | ---
+++
@@ -17,8 +17,6 @@
del headers['wsgi.input']
if 'wsgi.errors' in headers:
del headers['wsgi.errors']
- if 'Http-Authorization' in headers:
- headers['Authorization'] = headers['Http-Authorization']
body = request.form.to_dict()
return uri, http_method, body, headers |
a91a04af6b95fa600a0b3ce74b5fffc07ecf590e | polymorphic/__init__.py | polymorphic/__init__.py | # -*- coding: utf-8 -*-
"""
Seamless Polymorphic Inheritance for Django Models
Copyright:
This code and affiliated files are (C) by Bert Constantin and individual contributors.
Please see LICENSE and AUTHORS for more information.
"""
# See PEP 440 (https://www.python.org/dev/peps/pep-0440/)
__version__ = "1.3"
| # -*- coding: utf-8 -*-
"""
Seamless Polymorphic Inheritance for Django Models
Copyright:
This code and affiliated files are (C) by Bert Constantin and individual contributors.
Please see LICENSE and AUTHORS for more information.
"""
import pkg_resources
__version__ = pkg_resources.require("django-polymorphic")[0].... | Set polymorphic.__version__ from setuptools metadata | Set polymorphic.__version__ from setuptools metadata
| Python | bsd-3-clause | skirsdeda/django_polymorphic,skirsdeda/django_polymorphic,skirsdeda/django_polymorphic,chrisglass/django_polymorphic,chrisglass/django_polymorphic | ---
+++
@@ -7,5 +7,7 @@
Please see LICENSE and AUTHORS for more information.
"""
-# See PEP 440 (https://www.python.org/dev/peps/pep-0440/)
-__version__ = "1.3"
+import pkg_resources
+
+
+__version__ = pkg_resources.require("django-polymorphic")[0].version |
8cb680c7fbadfe6cfc245fe1eb1261a00c5ffd6d | djmoney/forms/fields.py | djmoney/forms/fields.py | from __future__ import unicode_literals
from warnings import warn
from django.forms import MultiValueField, DecimalField, ChoiceField
from moneyed.classes import Money
from .widgets import MoneyWidget, CURRENCY_CHOICES
__all__ = ('MoneyField',)
class MoneyField(MultiValueField):
def __init__(self, currency_wi... | from __future__ import unicode_literals
from warnings import warn
from django.forms import MultiValueField, DecimalField, ChoiceField
from moneyed.classes import Money
from .widgets import MoneyWidget, CURRENCY_CHOICES
__all__ = ('MoneyField',)
class MoneyField(MultiValueField):
def __init__(self, currency_wi... | Support for value of None in MoneyField.compress. Leaving a MoneyField blank in the Django admin site caused an issue when attempting to save an exception was raised since Money was getting an argument list of None. | Support for value of None in MoneyField.compress.
Leaving a MoneyField blank in the Django admin site caused an issue when
attempting to save an exception was raised since Money was getting an
argument list of None.
| Python | bsd-3-clause | recklessromeo/django-money,rescale/django-money,iXioN/django-money,AlexRiina/django-money,tsouvarev/django-money,iXioN/django-money,tsouvarev/django-money,recklessromeo/django-money | ---
+++
@@ -25,4 +25,9 @@
super(MoneyField, self).__init__(fields, *args, **kwargs)
def compress(self, data_list):
+ try:
+ if data_list[0] is None:
+ return None
+ except IndexError:
+ return None
return Money(*data_list[:2]) |
98ca37ed174e281542df2f1026a298387845b524 | rmgpy/tools/data/generate/input.py | rmgpy/tools/data/generate/input.py | # Data sources for kinetics
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = 'default',
#this section lists possible reaction families to find reactioons with
kineticsFamilies = ['!Intra_Disproportionation','!Substitutio... | # Data sources for kinetics
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = 'default',
#this section lists possible reaction families to find reactioons with
kineticsFamilies = ['R_Recombination'],
kineticsEstimator... | Cut down on the loading of families in the normal GenerateReactionsTest | Cut down on the loading of families in the normal GenerateReactionsTest
Change generateReactions input reactant to propyl
| Python | mit | nickvandewiele/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,chatelak/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py | ---
+++
@@ -5,15 +5,15 @@
seedMechanisms = [],
kineticsDepositories = 'default',
#this section lists possible reaction families to find reactioons with
- kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
+ kineticsFamilies = ['R_Recombination'],
kineticsEstimator = 'rate r... |
25695e927fbbf46df385b4c68fa4d80b81283ace | indico/migrations/versions/20200904_1543_f37d509e221c_add_user_profile_picture_source_column.py | indico/migrations/versions/20200904_1543_f37d509e221c_add_user_profile_picture_source_column.py | """Add column for profile picture type to User
Revision ID: f37d509e221c
Revises: c997dc927fbc
Create Date: 2020-09-04 15:43:18.413156
"""
from enum import Enum
import sqlalchemy as sa
from alembic import op
from indico.core.db.sqlalchemy import PyIntEnum
# revision identifiers, used by Alembic.
revision = 'f37d5... | """Add column for profile picture type to User
Revision ID: f37d509e221c
Revises: c997dc927fbc
Create Date: 2020-09-04 15:43:18.413156
"""
from enum import Enum
import sqlalchemy as sa
from alembic import op
from werkzeug.http import http_date
from indico.core.db.sqlalchemy import PyIntEnum
from indico.util.date_ti... | Add lastmod to existing profile picture metadata | Add lastmod to existing profile picture metadata
| Python | mit | pferreir/indico,indico/indico,pferreir/indico,indico/indico,indico/indico,DirkHoffmann/indico,ThiefMaster/indico,ThiefMaster/indico,ThiefMaster/indico,pferreir/indico,pferreir/indico,DirkHoffmann/indico,ThiefMaster/indico,indico/indico,DirkHoffmann/indico,DirkHoffmann/indico | ---
+++
@@ -9,8 +9,10 @@
import sqlalchemy as sa
from alembic import op
+from werkzeug.http import http_date
from indico.core.db.sqlalchemy import PyIntEnum
+from indico.util.date_time import now_utc
# revision identifiers, used by Alembic.
@@ -33,6 +35,11 @@
schema='users')
op.alt... |
6384fd52a4d271f0f3403ae613dd66cbeb217ddf | indra/tests/test_biogrid.py | indra/tests/test_biogrid.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.databases import biogrid_client
from indra.util import unicode_strs
from nose.plugins.attrib import attr
from indra.sources.biogrid import process_file
from indra.statements import Complex
import os
this_... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
from nose.plugins.attrib import attr
from indra.statements import Complex
from indra.databases import biogrid_client
from indra.util import unicode_strs
from indra.sources.biogrid import BiogridProcessor
t... | Update test to use new API | Update test to use new API
| Python | bsd-2-clause | johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy | ---
+++
@@ -1,11 +1,11 @@
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
+import os
+from nose.plugins.attrib import attr
+from indra.statements import Complex
from indra.databases import biogrid_client
from indra.util import unicode_strs
-from nose.plugins... |
79c8d40d8a47a4413540acac671345dd5faed46e | suorganizer/urls.py | suorganizer/urls.py | """suorganizer 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... | """suorganizer 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... | Add name parameter to Tag Detail URL. | Ch05: Add name parameter to Tag Detail URL.
| Python | bsd-2-clause | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | ---
+++
@@ -23,5 +23,5 @@
url(r'^$', homepage),
url(r'^tag/(?P<slug>[\w\-]+)/$',
tag_detail,
- ),
+ name='organizer_tag_detail'),
] |
3d71a09837d73e2a976f1911ed072225ffc2f841 | marconiclient/auth/base.py | marconiclient/auth/base.py | # Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Fix misspellings in python marconiclient | Fix misspellings in python marconiclient
Fix misspellings detected by:
* pip install misspellings
* git ls-files | grep -v locale | misspellings -f -
Change-Id: I4bbc0ba5be154950a160871ef5675039697f2314
Closes-Bug: #1257295
| Python | apache-2.0 | openstack/python-zaqarclient | ---
+++
@@ -32,7 +32,7 @@
request and prepare it to send the auth information
back to Marconi's instance.
- :params api_version: Marconi's API verison.
+ :params api_version: Marconi's API version.
:params request: Request Spec instance
that can be manipulated b... |
38ae4ddab1a5b94d03941c4080df72fea4e750bc | defprogramming/settings_production.py | defprogramming/settings_production.py | from defprogramming.settings import *
ALLOWED_HOSTS = ['*']
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Update database configuration with $DATABASE_URL.
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_P... | import os
from defprogramming.settings import *
ALLOWED_HOSTS = ['*']
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Update database configuration with $DATABASE_URL.
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_F... | Add secret key env var | Add secret key env var
| Python | mit | daviferreira/defprogramming,daviferreira/defprogramming,daviferreira/defprogramming | ---
+++
@@ -1,3 +1,4 @@
+import os
from defprogramming.settings import *
ALLOWED_HOSTS = ['*']
@@ -15,3 +16,5 @@
# MIDDLEWARE_CLASSES += ('sslify.middleware.SSLifyMiddleware',)
PREPEND_WWW = True
+
+SECRET_KEY = os.environ['SECRET_KEY'] |
75c48ecbac476fd751e55745cc2935c1dac1f138 | longest_duplicated_substring.py | longest_duplicated_substring.py | #!/usr/bin/env python
import sys
# O(n^4) approach: generate all possible substrings and
# compare each for equality.
def longest_duplicated_substring(string):
"""Return the longest duplicated substring.
Keyword Arguments:
string -- the string to examine for duplicated substrings
This approach exa... | #!/usr/bin/env python
import sys
def longest_duplicated_substring(string):
"""Return the longest duplicated substring.
Keyword Arguments:
string -- the string to examine for duplicated substrings
This approach examines each possible pair of starting points
for duplicated substrings. If the char... | Move todos into issues tracking on GitHub | Move todos into issues tracking on GitHub
| Python | mit | taylor-peterson/longest-duplicated-substring | ---
+++
@@ -2,9 +2,6 @@
import sys
-
-# O(n^4) approach: generate all possible substrings and
-# compare each for equality.
def longest_duplicated_substring(string):
"""Return the longest duplicated substring.
@@ -25,8 +22,6 @@
string_length = len(string)
for i in range(string_length):
... |
847a88c579118f8a0d528284ab3ea029ccca7215 | git_pre_commit_hook/builtin_plugins/rst_check.py | git_pre_commit_hook/builtin_plugins/rst_check.py | import os
import fnmatch
import restructuredtext_lint
DEFAULTS = {
'files': '*.rst',
}
def make_message(error):
return '%s %s:%s %s\n' % (
error.type, error.source, error.line, error.message,
)
def check(file_staged_for_commit, options):
basename = os.path.basename(file_staged_for_commit.p... | """Check that files contains valid ReStructuredText."""
import os
import fnmatch
import restructuredtext_lint
DEFAULTS = {
'files': '*.rst',
}
def make_message(error):
return '%s %s:%s %s\n' % (
error.type, error.source, error.line, error.message,
)
def check(file_staged_for_commit, options):
... | Add description to rst plugin | Add description to rst plugin
| Python | mit | evvers/git-pre-commit-hook | ---
+++
@@ -1,3 +1,4 @@
+"""Check that files contains valid ReStructuredText."""
import os
import fnmatch
import restructuredtext_lint |
bc7b1fc053150728095ec5d0a41611aa4d4ede45 | kerrokantasi/settings/__init__.py | kerrokantasi/settings/__init__.py | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi":
raise ValueError("Refusing to run o... | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
settings['CKEDITOR_CONFIGS'] = {
'default': {
'stylesSet': [
{
"name": 'Lead',
... | Remove JWT_AUTH check from settings | Remove JWT_AUTH check from settings
JWT settings has been removed in OpenID change and currently there isn't use for this.
| Python | mit | City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi | ---
+++
@@ -4,9 +4,6 @@
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
-
-if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi":
- raise ValueError("Refusing to run out of DEBUG mode with insecure JWT secret key.")
setti... |
c0fc60aa5fd51ac9a5795017fdc57d5b89b300e7 | tests/check_locale_format_consistency.py | tests/check_locale_format_consistency.py | import re
import json
import glob
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
locale_files.remove("en.json")
reference = json.loads(open(locale_folder + "en.json").read())
for locale_file in locale_files:
... | import re
import json
import glob
# List all locale files (except en.json being the ref)
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
locale_files.remove("en.json")
reference = json.loads(open(locale_folder + "en... | Add comments + return 1 if inconsistencies found | Add comments + return 1 if inconsistencies found
| Python | agpl-3.0 | YunoHost/yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost | ---
+++
@@ -2,6 +2,7 @@
import json
import glob
+# List all locale files (except en.json being the ref)
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
@@ -9,20 +10,31 @@
reference = json.loads(open(locale... |
875e9df7d59cbf8d504696b1eb906f4da0ffabc2 | test/cooper_test.py | test/cooper_test.py | import pagoda.cooper
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def test_c3d(self):
self.markers.load_c3d('examples/co... | import pagoda.cooper
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def test_c3d(self):
self.markers.load_c3d('examples/co... | Fix style in cooper test. | Fix style in cooper test.
| Python | mit | EmbodiedCognition/pagoda,EmbodiedCognition/pagoda | ---
+++
@@ -20,7 +20,7 @@
assert len(self.markers.channels) == 41
def test_csv(self):
- return # TODO
+ return # TODO
self.markers.load_csv('examples/cooper-motion.csv')
assert self.markers.num_frames == 343
assert len(self.markers.marker_bodies) == 41 |
423dcb102fc2b7a1108a0b0fe1e116e8a5d451c9 | netsecus/korrekturtools.py | netsecus/korrekturtools.py | from __future__ import unicode_literals
import os
def readStatus(student):
student = student.lower()
if not os.path.exists("attachments"):
return
if not os.path.exists(os.path.join("attachments", student)):
return "Student ohne Abgabe"
if not os.path.exists(os.path.join("attachment... | from __future__ import unicode_literals
import os
from . import helper
def readStatus(student):
student = student.lower()
if not os.path.exists("attachments"):
return
if not os.path.exists(os.path.join("attachments", student)):
return "Student ohne Abgabe"
if not os.path.exists(o... | Add error message for malformed request | Add error message for malformed request
| Python | mit | hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem | ---
+++
@@ -1,6 +1,9 @@
from __future__ import unicode_literals
import os
+
+from . import helper
+
def readStatus(student):
@@ -25,6 +28,7 @@
status = status.lower()
if not os.path.exists(os.path.join("attachments", student)):
+ logging.error("Requested student '%s' hasn't submitted anyth... |
c88789847a9bf604d897f4b469a3585347fef3f9 | portality/migrate/2819_clean_unused_license_data/operations.py | portality/migrate/2819_clean_unused_license_data/operations.py | def clean(record):
if record.bibjson().get_journal_license():
record.bibjson().remove_journal_license()
return record
| def clean(record):
if record.bibjson().get_journal_license():
record.bibjson().remove_journal_licences()
return record
| Fix another typo in migration | Fix another typo in migration
| Python | apache-2.0 | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | ---
+++
@@ -1,4 +1,4 @@
def clean(record):
if record.bibjson().get_journal_license():
- record.bibjson().remove_journal_license()
+ record.bibjson().remove_journal_licences()
return record |
3cbc3b96d3f91c940c5d762ce08da9814c29b04d | utils/gyb_syntax_support/protocolsMap.py | utils/gyb_syntax_support/protocolsMap.py | SYNTAX_BUILDABLE_EXPRESSIBLE_BY_CONFORMANCES = {
'ExpressibleByConditionElement': [
'ExpressibleByConditionElementList'
],
'ExpressibleByDeclBuildable': [
'ExpressibleByCodeBlockItem',
'ExpressibleByMemberDeclListItem',
'ExpressibleBySyntaxBuildable'
],
'ExpressibleBy... | SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = {
'ExpressibleAsConditionElement': [
'ExpressibleAsConditionElementList'
],
'ExpressibleAsDeclBuildable': [
'ExpressibleAsCodeBlockItem',
'ExpressibleAsMemberDeclListItem',
'ExpressibleAsSyntaxBuildable'
],
'ExpressibleAs... | Revert "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols" | Revert "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols"
| Python | apache-2.0 | roambotics/swift,glessard/swift,ahoppen/swift,roambotics/swift,apple/swift,roambotics/swift,gregomni/swift,ahoppen/swift,JGiola/swift,JGiola/swift,apple/swift,gregomni/swift,benlangmuir/swift,gregomni/swift,glessard/swift,atrick/swift,benlangmuir/swift,ahoppen/swift,atrick/swift,benlangmuir/swift,gregomni/swift,atrick/... | ---
+++
@@ -1,18 +1,18 @@
-SYNTAX_BUILDABLE_EXPRESSIBLE_BY_CONFORMANCES = {
- 'ExpressibleByConditionElement': [
- 'ExpressibleByConditionElementList'
+SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = {
+ 'ExpressibleAsConditionElement': [
+ 'ExpressibleAsConditionElementList'
],
- 'Expressi... |
1b3f97ff7bc219588b94a2346ac91f10203e44b9 | matador/commands/deployment/__init__.py | matador/commands/deployment/__init__.py | from .deploy_sql_script import DeploySqlScript, DeployOraclePackage
from .deploy_report import DeployExceleratorReport
| from .deploy_sql_script import DeploySqlScript, DeployOraclePackage
from .deploy_report import DeployExceleratorReport, DeployReportFile
| Add report file deployment to init | Add report file deployment to init
| Python | mit | Empiria/matador | ---
+++
@@ -1,2 +1,2 @@
from .deploy_sql_script import DeploySqlScript, DeployOraclePackage
-from .deploy_report import DeployExceleratorReport
+from .deploy_report import DeployExceleratorReport, DeployReportFile |
7ea03c6ded823458d7159c05f89d99ee3c4a2e42 | scripts/tools/botmap.py | scripts/tools/botmap.py | #!/usr/bin/env python
import os
import sys
path = os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')
sys.path.append(path)
import chromium_utils
slaves = []
for master in chromium_utils.ListMasters():
masterbase = os.path.basename(master)
master_slaves = {}
execfile(os.path.join(master, 'slaves.c... | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Dumps a list of known slaves, along with their OS and master."""
import os
import sys
path = os.path.join(os.path.dirname(__fil... | Tweak import statement to satisfy presubmit checks. | Tweak import statement to satisfy presubmit checks.
Review URL: http://codereview.chromium.org/8292004
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@105578 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -1,10 +1,15 @@
#!/usr/bin/env python
+# Copyright (c) 2011 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.
+
+"""Dumps a list of known slaves, along with their OS and master."""
import os
import sys
-pat... |
6fc5a47efbd4b760672b13292c5c4886842fbdbd | tests/local_test.py | tests/local_test.py | from nose.tools import istest, assert_equal
from spur import LocalShell
shell = LocalShell()
@istest
def output_of_run_is_stored():
result = shell.run(["echo", "hello"])
assert_equal("hello\n", result.output)
@istest
def cwd_of_run_can_be_set():
result = shell.run(["pwd"], cwd="/")
assert_equal("/\n... | from nose.tools import istest, assert_equal
from spur import LocalShell
shell = LocalShell()
@istest
def output_of_run_is_stored():
result = shell.run(["echo", "hello"])
assert_equal("hello\n", result.output)
@istest
def cwd_of_run_can_be_set():
result = shell.run(["pwd"], cwd="/")
assert_equal("/\n... | Add test for LocalShell.run with update_env | Add test for LocalShell.run with update_env
| Python | bsd-2-clause | mwilliamson/spur.py | ---
+++
@@ -13,3 +13,8 @@
def cwd_of_run_can_be_set():
result = shell.run(["pwd"], cwd="/")
assert_equal("/\n", result.output)
+
+@istest
+def environment_variables_can_be_added_for_run():
+ result = shell.run(["sh", "-c", "echo $NAME"], update_env={"NAME": "Bob"})
+ assert_equal("Bob\n", result.outp... |
16eb7232c3bf8470ca37c5e67d1af7d86b5c7b14 | test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py | test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py | from test.integration.base import DBTIntegrationTest, use_profile
import textwrap
import yaml
class TestBigqueryCopyTableFails(DBTIntegrationTest):
@property
def schema(self):
return "bigquery_test_022"
@property
def models(self):
return "copy-failing-models"
@property
def p... | from test.integration.base import DBTIntegrationTest, use_profile
import textwrap
import yaml
class TestBigqueryCopyTableFails(DBTIntegrationTest):
@property
def schema(self):
return "bigquery_test_022"
@property
def models(self):
return "copy-failing-models"
@property
def p... | Check the copy model for failure | Check the copy model for failure
| Python | apache-2.0 | analyst-collective/dbt,analyst-collective/dbt | ---
+++
@@ -33,4 +33,4 @@
def test__bigquery_copy_table_fails(self):
results = self.run_dbt(expect_pass=False)
self.assertEqual(len(results), 2)
- self.assertTrue(results[0].error)
+ self.assertTrue(results[1].error) |
08d1db2f6031d3496309ae290e4d760269706d26 | meinberlin/config/settings/dev.py | meinberlin/config/settings/dev.py | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
for template_engine in TEMPLATES:
template_engine['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qid$h1o8&wh#p(j)lifis*5-rf@lbiy8%^3l4x%@b$z(tli@ab'
try... | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
for template_engine in TEMPLATES:
template_engine['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qid$h1o8&wh#p(j)lifis*5-rf@lbiy8%^3l4x%@b$z(tli@ab'
try... | Print tracebacks that happened in tasks | Print tracebacks that happened in tasks
| Python | agpl-3.0 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | ---
+++
@@ -31,6 +31,14 @@
except ImportError:
pass
+LOGGING = {
+ 'version': 1,
+ 'handlers': {
+ 'console': {
+ 'class': 'logging.StreamHandler'},
+ },
+ 'loggers': {'background_task': {'handlers': ['console'], 'level': 'INFO'}}}
+
try:
... |
f55d590004874f9ec64c041b5630321e686bf6f9 | mindbender/plugins/validate_id.py | mindbender/plugins/validate_id.py | import pyblish.api
class ValidateMindbenderID(pyblish.api.InstancePlugin):
"""All models must have an ID attribute"""
label = "Mindbender ID"
order = pyblish.api.ValidatorOrder
hosts = ["maya"]
families = ["mindbender.model"]
def process(self, instance):
from maya import cmds
... | import pyblish.api
class ValidateMindbenderID(pyblish.api.InstancePlugin):
"""All models must have an ID attribute"""
label = "Mindbender ID"
order = pyblish.api.ValidatorOrder
hosts = ["maya"]
families = ["mindbender.model", "mindbender.lookdev"]
def process(self, instance):
from ma... | Extend ID validator to lookdev | Extend ID validator to lookdev
| Python | mit | mindbender-studio/core,MoonShineVFX/core,mindbender-studio/core,getavalon/core,MoonShineVFX/core,getavalon/core,pyblish/pyblish-mindbender | ---
+++
@@ -7,7 +7,7 @@
label = "Mindbender ID"
order = pyblish.api.ValidatorOrder
hosts = ["maya"]
- families = ["mindbender.model"]
+ families = ["mindbender.model", "mindbender.lookdev"]
def process(self, instance):
from maya import cmds |
09be419960d208967771d93025c4f86b80ebe4e9 | python/qibuild/__init__.py | python/qibuild/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" This module contains a few functions for running CMake and building projects. """
from __future__ import absolute_impor... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" This module contains a few functions for running CMake and building projects. """
from __future__ import absolute_impor... | Revert "use utf-8 by default" | Revert "use utf-8 by default"
This reverts commit a986aac5e3b4f065d6c2ab70129bde105651d2ca.
| Python | bsd-3-clause | aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild | ---
+++
@@ -8,10 +8,7 @@
from __future__ import print_function
import os
-import sys
-reload(sys)
-sys.setdefaultencoding('utf-8')
QIBUILD_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
c7cb6c1441bcfe359a9179858492044591e80007 | osgtest/tests/test_10_condor.py | osgtest/tests/test_10_condor.py | from os.path import join
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.condor as condor
import osgtest.library.osgunittest as osgunittest
import osgtest.library.service as service
personal_condor_config = '''
DAEMON_LIST = COLLECTOR, MASTER, NEGOTIATOR, SCHEDD, START... | from os.path import join
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.condor as condor
import osgtest.library.osgunittest as osgunittest
import osgtest.library.service as service
personal_condor_config = '''
DAEMON_LIST = COLLECTOR, MASTER, NEGOTIATOR, SCHEDD, START... | Make the personal condor config world readable | Make the personal condor config world readable
| Python | apache-2.0 | efajardo/osg-test,efajardo/osg-test | ---
+++
@@ -24,7 +24,7 @@
return
core.config['condor.personal_condor'] = join(condor.config_val('LOCAL_CONFIG_DIR'), '99-personal-condor.conf')
- files.write(core.config['condor.personal_condor'], personal_condor_config, owner='condor')
+ files.write(core.config['condor.personal_... |
d8b477083866a105947281ca34cb6e215417f44d | packs/salt/actions/lib/utils.py | packs/salt/actions/lib/utils.py | import yaml
action_meta = {
"name": "",
"parameters": {
"action": {
"type": "string",
"immutable": True,
"default": ""
},
"kwargs": {
"type": "object",
"required": False
}
},
"runner_type": "run-python",
"de... | # pylint: disable=line-too-long
import yaml
from .meta import actions
runner_action_meta = {
"name": "",
"parameters": {
"action": {
"type": "string",
"immutable": True,
"default": ""
},
"kwargs": {
"type": "object",
"required... | Make distinction between local and runner action payload templates. Added small description for sanitizing the NetAPI payload for logging. | Make distinction between local and runner action payload templates.
Added small description for sanitizing the NetAPI payload for logging.
| Python | apache-2.0 | pidah/st2contrib,StackStorm/st2contrib,psychopenguin/st2contrib,lmEshoo/st2contrib,armab/st2contrib,StackStorm/st2contrib,pearsontechnology/st2contrib,digideskio/st2contrib,digideskio/st2contrib,armab/st2contrib,tonybaloney/st2contrib,pearsontechnology/st2contrib,lmEshoo/st2contrib,tonybaloney/st2contrib,psychopenguin/... | ---
+++
@@ -1,6 +1,9 @@
+# pylint: disable=line-too-long
+
import yaml
+from .meta import actions
-action_meta = {
+runner_action_meta = {
"name": "",
"parameters": {
"action": {
@@ -18,19 +21,48 @@
"enabled": True,
"entry_point": "runner.py"}
+local_action_meta = {
+ "name": "",
... |
60625877a23e26e66c2c97cbeb4f139ede717eda | B.py | B.py | #! /usr/bin/env python3
# coding: utf-8
from collections import namedtuple
import matplotlib.pyplot as plt
BCand = namedtuple('BCand', ['m', 'merr', 'pt', 'p'])
bs = []
with open('B.txt') as f:
for line in f.readlines()[1:]:
bs.append(BCand(*[float(v) for v in line.strip().split(',')]))
masses = [b.m f... | #! /usr/bin/env python3
# coding: utf-8
from collections import namedtuple
import matplotlib.pyplot as plt
import numpy as np
BCand = namedtuple('BCand', ['m', 'merr', 'pt', 'p'])
bs = [BCand(*b) for b in np.genfromtxt('B.txt', skip_header=1, delimiter=',')]
masses = [b.m for b in bs]
ns, bins, _ = plt.hist(masses... | Use numpy for readin and add errorbars. | Use numpy for readin and add errorbars.
| Python | mit | bixel/python-introduction | ---
+++
@@ -3,17 +3,18 @@
from collections import namedtuple
import matplotlib.pyplot as plt
+import numpy as np
BCand = namedtuple('BCand', ['m', 'merr', 'pt', 'p'])
-bs = []
-
-with open('B.txt') as f:
- for line in f.readlines()[1:]:
- bs.append(BCand(*[float(v) for v in line.strip().split(',')]... |
2dcb159bdd826ceeb68658cc3760c97dae04289e | partner_firstname/exceptions.py | partner_firstname/exceptions.py | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program 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 versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program 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 versio... | Add args to exception to display the correct message in the UI. | Add args to exception to display the correct message in the UI.
| Python | agpl-3.0 | BT-ojossen/partner-contact,Ehtaga/partner-contact,BT-fgarbely/partner-contact,acsone/partner-contact,BT-jmichaud/partner-contact,charbeljc/partner-contact,sergiocorato/partner-contact,Antiun/partner-contact,raycarnes/partner-contact,idncom/partner-contact,Endika/partner-contact,gurneyalex/partner-contact,QANSEE/partner... | ---
+++
@@ -24,3 +24,4 @@
self.record = record
self._value = value
self.name = _("Error(s) with partner %d's name.") % record.id
+ self.args = (self.name, value) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.