commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
30fb89681658e0861ba2ff5bb76db81732024979
nb_classifier.py
nb_classifier.py
from feature_format import featureFormat, targetFeatureSplit import pickle from sklearn.naive_bayes import GaussianNB # loading the enron data dictionary with open("final_project_dataset.pkl", "r") as data_file: data_dict = pickle.load(data_file) # removing 'TOTAL' outlier del data_dict['TOTAL'] # selecting only...
from feature_format import featureFormat, targetFeatureSplit import pickle from sklearn.naive_bayes import GaussianNB from sklearn.cross_validation import KFold from sklearn.metrics import precision_score, recall_score, f1_score import numpy as np # loading the enron data dictionary with open("final_project_dataset.pk...
Add KFold cross validation and evaluation metrics to GaussianNB
feat: Add KFold cross validation and evaluation metrics to GaussianNB
Python
mit
rjegankumar/enron_email_fraud_identification
bfc50caf2ad967fa930faf34c6cac6b20b7fd4a7
nn/embedding/id_sequence_to_embedding.py
nn/embedding/id_sequence_to_embedding.py
from .ids_to_embeddings import ids_to_embeddings from .embeddings_to_embedding import embeddings_to_embedding from ..util import static_rank def id_sequecne_to_embedding(child_id_sequence, *, output_embedding_size, context_vector_s...
from .ids_to_embeddings import ids_to_embeddings from .embeddings_to_embedding import embeddings_to_embedding from ..util import static_rank def id_sequecne_to_embedding(child_id_sequence, child_embeddings, *, output_embedding_size...
Fix missing argument of child embeddings
Fix missing argument of child embeddings
Python
unlicense
raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten
083a9b4959feab6afe78509ed78cb60c44564cc2
python/convert_line_endings.py
python/convert_line_endings.py
#!/usr/bin/python import os import sys def convert_line_endings(file): if '\r\n' in open(file, 'rb').read(): print '%s contains DOS line endings. Converting' % file with open(file, 'rb') as infile: text = infile.read() text = text.replace('\r\n', '\n') with open(fil...
#!/usr/bin/python import os import sys def convert_line_endings(file): if '\r\n' in open(file, 'rb').read(): print '%s contains DOS line endings. Converting' % file with open(file, 'rb') as infile: text = infile.read() text = text.replace('\r\n', '\n') with open(fil...
Convert line endings on Objective C/C++ test source too
[trunk] Convert line endings on Objective C/C++ test source too
Python
bsd-3-clause
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
b21503105b9f8bc1eb21b62778963f23dd794de0
openacademy/model/openacademy_session.py
openacademy/model/openacademy_session.py
# -*- coding: utf-8 -*- from openerp import fields, models, api class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") in...
# -*- coding: utf-8 -*- from openerp import fields, models, api class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") in...
Add domain or and ilike
[REF] openacademy: Add domain or and ilike
Python
apache-2.0
colorisa/openacademy-proyect
7b7ffd10d17f1f6ea0c81c87e6ab19caa68cf68c
pavement.py
pavement.py
import subprocess from paver.easy import * def call(*args, **kwargs): return subprocess.call(args, **kwargs) @task def push(): """Install the app and start it.""" call('palm-package', '.') call('palm-install', '--device=emulator', '-r', 'org.markpasc.paperplain') call('palm-install', '--device=...
import subprocess from paver.easy import * def call(*args, **kwargs): return subprocess.call(args, **kwargs) @task def build(): """Package up the app.""" call('palm-package', '.') @task def halt(): call('palm-launch', '--device=emulator', '-c', 'org.markpasc.paperplain') @task @needs('halt') def ...
Split up some of the paver tasks so we can build and uninstall a la carte
Split up some of the paver tasks so we can build and uninstall a la carte
Python
mit
markpasc/paperplain,markpasc/paperplain
ebbea9212fc9cc3debb5300c2d008c653cc75af7
dartcms/apps/dicts/views.py
dartcms/apps/dicts/views.py
# coding: utf-8 from django.forms.models import modelform_factory from django.http import Http404 from dartcms import get_model from dartcms.views import GridView, InsertObjectView, UpdateObjectView, DeleteObjectView class DictsFormMixin(object): def get_form_class(self): return modelform_factory(self.mo...
# coding: utf-8 from django.forms.models import modelform_factory from django.http import Http404 from dartcms import get_model from dartcms.views import GridView, InsertObjectView, UpdateObjectView, DeleteObjectView class DictsFormMixin(object): def get_form_class(self): return modelform_factory(self.mo...
Add search by name to dicts
Add search by name to dicts
Python
mit
astrikov-d/dartcms,astrikov-d/dartcms,astrikov-d/dartcms
abdfd4441cc40f5c698e12f8f6aaf1c405b171e2
appengine_config.py
appengine_config.py
from google.appengine.ext import vendor # Add any libraries installed in the "lib" folder. vendor.add('lib')
import os import sys from google.appengine.ext import vendor # Add any libraries installed in the "lib" folder. vendor.add('lib') BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + os.sep SHARED_SOURCE_DIRECTORIES = [ os.path.abspath(os.environ.get('ISB_CGC_COMMON_MODU...
Add shared code module path to Python module path
Add shared code module path to Python module path
Python
apache-2.0
isb-cgc/ISB-CGC-API,isb-cgc/ISB-CGC-API,isb-cgc/ISB-CGC-API
b24094f979b90f087698d9696d661df7db857376
moonlighty.py
moonlighty.py
#!flask/bin/python from flask import Flask, render_template from subprocess import Popen, PIPE from flask.ext.script import Manager, Server app = Flask(__name__) manager = Manager(app) manager.add_command("runserver", Server(host='0.0.0.0')) @app.route('/') def index(): return render_template('index.html') @app...
#!venv/bin/python from flask import Flask, render_template from subprocess import Popen, PIPE from flask.ext.script import Manager, Server app = Flask(__name__) manager = Manager(app) manager.add_command("runserver", Server(host='0.0.0.0')) @app.route('/') def index(): return render_template('index.html') @app....
Add return value stating Steam was started
Add return value stating Steam was started
Python
artistic-2.0
VladimirDaniyan/moonlighty,VladimirDaniyan/moonlighty
12b1e22a16551b3f7fb0e663e42f7d84f9882e2c
pkglib/tests/unit/test_pyinstall_unit.py
pkglib/tests/unit/test_pyinstall_unit.py
import os import sys import pytest from mock import patch import pytest from pkglib.scripts import pyinstall @pytest.mark.skipif('TRAVIS' in os.environ, reason="Our monkey patch doesn't work with the version of setuptools on Travis. FIXME.") def test_pyinstall_respects_i_flag(): """Ensure th...
from __future__ import absolute_import import os import sys import pytest from mock import patch from pkglib.scripts import pyinstall from zc.buildout.easy_install import _get_index def test_pyinstall_respects_i_flag(): """Ensure that pyinstall allows us to override the PyPI URL with -i, even if it's alrea...
Fix for the pyinstall unit test
Fix for the pyinstall unit test
Python
mit
julietalucia/page-objects,manahl/pytest-plugins,manahl/pytest-plugins
c0ecc75d2c02a1c6b514b09e5f9ad907fb04ce82
new/meshes.py
new/meshes.py
class RectangularMesh(object): def __init__(self, d, atlas='atlas', meshname='mesh'): if not isinstance(d, (tuple, list)) or len(d) != 3: raise ValueError('Cellsize d must be a tuple of length 3.') elif d[0] <= 0 or d[1] <= 0 or d[2] <= 0: raise ValueError('Cellsize dimension...
from atlases import BoxAtlas class RectangularMesh(object): def __init__(self, atlas, d, meshname='mesh'): if not isinstance(d, (tuple, list)) or len(d) != 3: raise ValueError('Cellsize d must be a tuple of length 3.') elif d[0] <= 0 or d[1] <= 0 or d[2] <= 0: raise ValueEr...
Add atlas as an argument for mesh initialisation.
Add atlas as an argument for mesh initialisation.
Python
bsd-2-clause
fangohr/oommf-python,fangohr/oommf-python,fangohr/oommf-python
94e070ec33dbc86e38de4839be9461db3a301685
inonemonth/challenges/serializers.py
inonemonth/challenges/serializers.py
from rest_framework import serializers from .models import Challenge, Role from core.serializers import UserSerializer class RoleSerializer(serializers.ModelSerializer): #user = serializers.RelatedField(many=True) #user = serializers.PrimaryKeyRelatedField() #user = serializers.HyperlinkedRelatedField() ...
from rest_framework import serializers from .models import Challenge, Role from core.serializers import UserSerializer from comments.serializers import CommentSerializer class RoleSerializer(serializers.ModelSerializer): #user = UserSerializer() #challenge = serializers.RelatedField() comment_set = Comme...
Include comments in Role serializer
Include comments in Role serializer
Python
mit
robrechtdr/inonemonth,robrechtdr/inonemonth,robrechtdr/inonemonth,robrechtdr/inonemonth
32be37d7b43d9cc8a85b292ab324ebab95bc1aca
tests/test_rule.py
tests/test_rule.py
from datetime import datetime from unittest import TestCase from rule import PriceRule from stock import Stock class TestPriceRule(TestCase): @classmethod def setUpClass(cls): goog = Stock("GOOG") goog.update(datetime(2014, 2, 10), 11) cls.exchange = {"GOOG": goog} def test_a_Pri...
from datetime import datetime from unittest import TestCase from rule import PriceRule from stock import Stock class TestPriceRule(TestCase): @classmethod def setUpClass(cls): goog = Stock("GOOG") goog.update(datetime(2014, 2, 10), 11) cls.exchange = {"GOOG": goog} def test_a_Pri...
Add a PriceRule test if match is attempted when stock is not in the exchange.
Add a PriceRule test if match is attempted when stock is not in the exchange.
Python
mit
bsmukasa/stock_alerter
6263c544a5f8e09f1e3c2ee761af70f71acd0c79
webapp/tests/__init__.py
webapp/tests/__init__.py
# -*- coding: utf-8 -*- from unittest import TestCase from byceps.application import create_app from byceps.blueprints.brand.models import Brand from byceps.blueprints.party.models import Party from byceps.database import db class AbstractAppTestCase(TestCase): def setUp(self): self.app = create_app('t...
# -*- coding: utf-8 -*- from unittest import TestCase from byceps.application import create_app from byceps.blueprints.brand.models import Brand from byceps.blueprints.party.models import Party from byceps.database import db class AbstractAppTestCase(TestCase): def setUp(self): self.app = create_app('t...
Make brand and party available to tests.
Make brand and party available to tests.
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps
f1bc5d1b491926ccbe098a28a5b08a60741e5bc5
this_app/models.py
this_app/models.py
from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash class User(UserMixin): """Represents a user who can Create, Read, Update & Delete his own bucketlists""" counter = 0 users = {} def __init__(self, email, username, password): """Constru...
from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash class User(UserMixin): """Represents a user who can Create, Read, Update & Delete his own bucketlists""" counter = 0 users = {} def __init__(self, email, username, password): """Constru...
Use autoincrementing ID as primary key
Use autoincrementing ID as primary key
Python
mit
borenho/flask-bucketlist,borenho/flask-bucketlist
7e27c47496a55f7a4c58c2c8c79ce854d80f0893
skyfield/tests/test_trigonometry.py
skyfield/tests/test_trigonometry.py
from skyfield.api import Angle, Topos, load, load_file from skyfield.trigonometry import position_angle_of def test_position_angle(): a = Angle(degrees=0), Angle(degrees=0) b = Angle(degrees=1), Angle(degrees=1) assert str(position_angle_of(a, b)) == '315deg 00\' 15.7"' def test_position_angle_against_nas...
from skyfield.api import Angle, Topos, load, load_file from skyfield.trigonometry import position_angle_of def test_position_angle(): a = Angle(degrees=0), Angle(degrees=0) b = Angle(degrees=1), Angle(degrees=1) assert str(position_angle_of(a, b)) == '315deg 00\' 15.7"' def test_position_angle_against_nas...
Remove hack from position angle test
Remove hack from position angle test
Python
mit
skyfielders/python-skyfield,skyfielders/python-skyfield
0bd4d05dd9c4840cef93ef280d241e1e6a863a5d
server-example/app.py
server-example/app.py
# Example CI server that serves badges from flask import Flask import pybadges app = Flask(__name__) @app.route('/') def serveBadges(): # First example badge_arg = dict( left_text='build', right_text='passing', right_color='#008000' ) badge = pybadges.badge(**badge_arg) ...
# Copyright 2018 The pybadge Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Add license, right comment and format code
Add license, right comment and format code
Python
apache-2.0
google/pybadges,google/pybadges,google/pybadges
6487ca4227f75d11d9f3ee985056c3292d4df5e4
dmoj/tests/test_control.py
dmoj/tests/test_control.py
import threading import unittest import requests from dmoj.control import JudgeControlRequestHandler try: from unittest import mock except ImportError: import mock try: from http.server import HTTPServer except ImportError: from BaseHTTPServer import HTTPServer class ControlServerTest(unittest.Tes...
import mock import threading import unittest import requests from dmoj.control import JudgeControlRequestHandler try: from http.server import HTTPServer except ImportError: from BaseHTTPServer import HTTPServer class ControlServerTest(unittest.TestCase): @classmethod def setUpClass(cls): cla...
Make it work in PY3.5 *properly*
Make it work in PY3.5 *properly*
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
90d7d5deabf9e55ce75da06a61088630c2a2d103
gallery/urls.py
gallery/urls.py
# coding: utf-8 # Copyright (c) 2011-2012 Aymeric Augustin. All rights reserved. from django.conf.urls import patterns, url from django.contrib.auth.decorators import permission_required from . import views protect = permission_required('gallery.view') urlpatterns = patterns('', url(r'^$', protect(views.Gallery...
# coding: utf-8 # Copyright (c) 2011-2012 Aymeric Augustin. All rights reserved. from django.conf.urls import patterns, url from . import views urlpatterns = patterns('', url(r'^$', views.GalleryIndexView.as_view(), name='gallery-index'), url(r'^year/(?P<year>\d{4})/$', views.GalleryYearView.as_view(), name...
Remove blanket protection in preparation for granular access control.
Remove blanket protection in preparation for granular access control.
Python
bsd-3-clause
aaugustin/myks-gallery,aaugustin/myks-gallery
09089e4112c47c0b1b7549f0cc5651fa299cd961
tests/test_workers.py
tests/test_workers.py
import pytest import workers.repo_info_worker.repo_info_worker.runtime as ri def test_workers(): # print(dir(runtime)) ri.run() assert 0
import pytest import workers.repo_info_worker.runtime def test_workers(): assert True
Fix broken worker stub test
Fix broken worker stub test Signed-off-by: Carter Landis <84a516841ba77a5b4648de2cd0dfcb30ea46dbb4@carterlandis.com>
Python
mit
OSSHealth/ghdata,OSSHealth/ghdata,OSSHealth/ghdata
fcb041d46c40dd497524a70657cfc71220a2da76
{{cookiecutter.repo_name}}/tests/test_{{cookiecutter.repo_name}}.py
{{cookiecutter.repo_name}}/tests/test_{{cookiecutter.repo_name}}.py
# -*- coding: utf-8 -*- import pytest @pytest.fixture def basic_app(): """Fixture for a default app. Returns: :class:`{{cookiecutter.app_class_name}}`: App instance """ from {{cookiecutter.repo_name}} import {{cookiecutter.app_class_name}} return {{cookiecutter.app_class_name}}() def tes...
# -*- coding: utf-8 -*- import pytest @pytest.fixture def basic_app(): """Fixture for a default app. Returns: :class:`{{cookiecutter.app_class_name}}`: App instance """ from {{cookiecutter.repo_name}}.{{cookiecutter.repo_name}} import {{cookiecutter.app_class_name}} return {{cookiecutter.a...
Fix local import of the app
Fix local import of the app
Python
mit
hackebrot/cookiedozer,hackebrot/cookiedozer
3d23722089036042295365760a8fbdf5c69d09d2
tests/docformat_test.py
tests/docformat_test.py
# -*- coding: utf-8 -*- """Test document formats for correctness """ from __future__ import absolute_import import os import os.path as op import yaml import pytest import restructuredtext_lint as rstlint from .conftest import PROJ_DIR DIRS = [PROJ_DIR] def proj_files(suffix): for dir in DIRS: for f in...
# -*- coding: utf-8 -*- """Test document formats for correctness """ from __future__ import absolute_import import os import os.path as op import json import yaml import pytest import restructuredtext_lint as rstlint from .conftest import PROJ_DIR DIRS = [PROJ_DIR] def proj_files(suffix): for dir in DIRS: ...
Check JSON syntax as part of tests
Check JSON syntax as part of tests
Python
mit
bbiskup/purkinje,bbiskup/purkinje,bbiskup/purkinje,bbiskup/purkinje
171d14e2a0b433a0e6fc8837889c26f2d106f7a8
fancypages/models/base.py
fancypages/models/base.py
from django.db import models from .. import abstract_models from ..manager import PageManager class PageType(abstract_models.AbstractPageType): class Meta: app_label = 'fancypages' class VisibilityType(abstract_models.AbstractVisibilityType): class Meta: app_label = 'fancypages' class Fan...
from django.db import models from .. import abstract_models from ..manager import PageManager class PageType(abstract_models.AbstractPageType): class Meta: app_label = 'fancypages' class VisibilityType(abstract_models.AbstractVisibilityType): class Meta: app_label = 'fancypages' class Fan...
Change string formatting to use format
Change string formatting to use format
Python
bsd-3-clause
tangentlabs/django-fancypages,socradev/django-fancypages,tangentlabs/django-fancypages,socradev/django-fancypages,socradev/django-fancypages,tangentlabs/django-fancypages
7cb7474e4ed51e0080c42e97acd823d1417bdbe9
UM/Qt/GL/QtTexture.py
UM/Qt/GL/QtTexture.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from PyQt5.QtGui import QOpenGLTexture, QImage from UM.View.GL.Texture import Texture from UM.View.GL.OpenGL import OpenGL ## Texture subclass using PyQt for the OpenGL implementation. class QtTexture(Texture): de...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from PyQt5.QtGui import QOpenGLTexture, QImage from UM.View.GL.Texture import Texture from UM.View.GL.OpenGL import OpenGL ## Texture subclass using PyQt for the OpenGL implementation. class QtTexture(Texture): de...
Set Texture minification/magnification filters to Linear
Set Texture minification/magnification filters to Linear This improves the quality of textures that need to be rendered at a smaller size.
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
7654a81760d228227c3e3ef9ff9cac9927b4674a
scheduler/tests.py
scheduler/tests.py
from django.test import TestCase # Create your tests here.
from django.test import TestCase from .models import Event, Volunteer class VolunteerTestCase(TestCase): def test_gets_public_name(self): event = Event.objects.create(name='event', slug='event', description='event', slots_per_day=1, ...
Add a test for public names
Add a test for public names
Python
mit
thomasleese/rooster,thomasleese/rooster,thomasleese/rooster
2eaf5b4d236e7d90ca88bab1e41fb280d5b21fc3
spicedham/gottaimportthemall.py
spicedham/gottaimportthemall.py
import spicedham.bayes import spicedham.digitdestroyer import spicedham.nonsensefilter from spicedham.sqlalchemywrapper import SqlAlchemyWrapper
import spicedham.bayes import spicedham.digitdestroyer import spicedham.nonsensefilter try: from spicedham.sqlalchemywrapper import SqlAlchemyWrapper except ImportError: pass
Fix ImportError if sqlalchemy not installed
Fix ImportError if sqlalchemy not installed If sqlalchemy isn't installed, this would try to import the sqlalchemy wrapper and then kick up an ImportError. This changes it so that if there's an ImportError, it gets ignored.
Python
mpl-2.0
mozilla/spicedham,mozilla/spicedham
9e5bb5dd850332cdb410fbc2c9fdf78d08b3e9fb
every_election/apps/organisations/constants.py
every_election/apps/organisations/constants.py
PARENT_TO_CHILD_AREAS = { 'DIS': ['DIW',], 'MTD': ['MTW',], 'CTY': ['CED',], 'LBO': ['LBW',], 'CED': ['CPC',], 'UTA': ['UTW', 'UTE'], 'NIA': ['NIE',], } CHILD_TO_PARENT_AREAS = { 'DIW': 'DIS', 'MTW': 'MTD', 'UTW': 'UTA', 'UTE': 'UTA', 'CED': 'CTY', 'LBW': 'LBO', '...
PARENT_TO_CHILD_AREAS = { 'DIS': ['DIW',], 'MTD': ['MTW',], 'CTY': ['CED',], 'LBO': ['LBW',], 'CED': ['CPC',], 'UTA': ['UTW', 'UTE'], 'NIA': ['NIE',], 'COI': ['COP',], } CHILD_TO_PARENT_AREAS = { 'DIW': 'DIS', 'MTW': 'MTD', 'UTW': 'UTA', 'UTE': 'UTA', 'CED': 'CTY', ...
Support the Isles of Scilly
Support the Isles of Scilly
Python
bsd-3-clause
DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection
1aab2f41191d3de0b7bade31cdf83ae14be9dc2a
Lib/test/test_copy_reg.py
Lib/test/test_copy_reg.py
import copy_reg class C: pass try: copy_reg.pickle(C, None, None) except TypeError, e: print "Caught expected TypeError:" print e else: print "Failed to catch expected TypeError when registering a class type." print try: copy_reg.pickle(type(1), "not a callable") except TypeError, e: pr...
import copy_reg import test_support import unittest class C: pass class CopyRegTestCase(unittest.TestCase): def test_class(self): self.assertRaises(TypeError, copy_reg.pickle, C, None, None) def test_noncallable_reduce(self): self.assertRaises(TypeError, copy_...
Convert copy_reg test to PyUnit.
Convert copy_reg test to PyUnit.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
8281a2f614d686ba7c8c14e108d8415a43c80602
tests/blueprints/test_bp_features.py
tests/blueprints/test_bp_features.py
from flask import url_for from tests.base import SampleFrontendTestBase class BpFeaturesTestCase(SampleFrontendTestBase): def test_bustimes_reachable(self): self.assert200(self.client.get(url_for('features.bustimes'))) self.assertTemplateUsed("bustimes.html")
from unittest.mock import patch, MagicMock from flask import url_for from tests.base import SampleFrontendTestBase class BpFeaturesTestCase(SampleFrontendTestBase): def test_bustimes_reachable(self): mock = MagicMock() with patch('sipa.blueprints.features.get_bustimes', mock): resp =...
Improve test_bustimes speed by using mock
Improve test_bustimes speed by using mock
Python
mit
MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,agdsn/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,MarauderXtreme/sipa,agdsn/sipa,lukasjuhrich/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa
89f7678aa065d70d12d880ddaa7c22bbab2e84a8
scripts/install.py
scripts/install.py
import subprocess def run(command, *args, **kwargs): print("+ {}".format(command)) subprocess.run(command, *args, **kwargs) run("git submodule update --init", shell=True) run("pip install -e magma", shell=True) run("pip install -e mantle", shell=True) run("pip install -e loam", shell=True) run("pip install fa...
import subprocess def run(command, *args, **kwargs): print("+ {}".format(command)) subprocess.run(command, *args, **kwargs) run("git submodule update --init", shell=True) run("pip install -e magma", shell=True) run("pip install -e mantle", shell=True) run("pip install -e loam", shell=True) run("pip install fa...
Install jupyter so people can follow along with notebooks
Install jupyter so people can follow along with notebooks
Python
mit
phanrahan/magmathon,phanrahan/magmathon
8f1cbac14b2a24a3a124107c8252b7be6282f5a4
ODBPy/Components.py
ODBPy/Components.py
#!/usr/bin/env python3 import os.path from collections import namedtuple from .LineRecordParser import * from .SurfaceParser import * from .PolygonParser import * from .ComponentParser import * from .Decoder import * from .Treeifier import * from .Units import * Components = namedtuple("Components", ["top", "bot"]) d...
#!/usr/bin/env python3 import os.path from collections import namedtuple from .LineRecordParser import * from .SurfaceParser import * from .PolygonParser import * from .ComponentParser import * from .Decoder import * from .Treeifier import * from .Units import * Components = namedtuple("Components", ["top", "bot"]) d...
Allow ODB without components on bottom
Allow ODB without components on bottom
Python
apache-2.0
ulikoehler/ODBPy
0b6d5b0d10974842a0e52904d9793bfa4313ffb0
src/api/v1/watchers/__init__.py
src/api/v1/watchers/__init__.py
""" Copyright 2016 ElasticBox All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
""" Copyright 2016 ElasticBox All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
Fix user role filtered namespace
Fix user role filtered namespace
Python
apache-2.0
ElasticBox/elastickube,ElasticBox/elastickube,ElasticBox/elastickube,ElasticBox/elastickube,ElasticBox/elastickube
78c176c19a5fa03d03c9f2ff9b083a134888f964
test_arrange_schedule.py
test_arrange_schedule.py
import unittest from arrange_schedule import * class Arrange_Schedule(unittest.TestCase): def setUp(self): # test_read_system_setting keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in s...
import unittest from arrange_schedule import * class Arrange_Schedule(unittest.TestCase): def setUp(self): # test_read_system_setting keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in s...
Add test case for set_schedule_log
Add test case for set_schedule_log
Python
apache-2.0
Billy4195/electronic-blackboard,chenyang14/electronic-blackboard,stvreumi/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,Billy4195/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/electronic-blackboard,chenyang14/electronic-blackboard,chenyang14/electronic-blackboard,SW...
ebc4acb745287762cc8cb0a18fb97ed3e01c9ab0
mkerefuse/util.py
mkerefuse/util.py
from lxml import html class XPathObject(object): input_properties = {} """Dict of keys (property names) and XPaths (to read vals from)""" @classmethod def FromHTML(cls, html_contents): inst = cls() print("Reading through {b} bytes for {c} properties...".format( b=len(html_...
import json from lxml import html class XPathObject(object): input_properties = {} """Dict of keys (property names) and XPaths (to read vals from)""" @classmethod def FromHTML(cls, html_contents): inst = cls() print("Reading through {b} bytes for {c} properties...".format( ...
Add json library for repr() calls
Add json library for repr() calls
Python
unlicense
tomislacker/python-mke-trash-pickup,tomislacker/python-mke-trash-pickup
0183a92ad8488f80e884df7da231e4202b4e3bdb
shipyard2/rules/pods/operations/build.py
shipyard2/rules/pods/operations/build.py
from pathlib import Path import shipyard2.rules.pods OPS_DB_PATH = Path('/srv/operations/database/v1') shipyard2.rules.pods.define_pod( name='database', apps=[ shipyard2.rules.pods.App( name='database', exec=[ 'python3', *('-m', 'g1.operations.d...
from pathlib import Path import shipyard2.rules.pods OPS_DB_PATH = Path('/srv/operations/database/v1') shipyard2.rules.pods.define_pod( name='database', apps=[ shipyard2.rules.pods.App( name='database', exec=[ 'python3', *('-m', 'g1.operations.d...
Add journal watcher unit to pod rules
Add journal watcher unit to pod rules
Python
mit
clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage
d0d79ae8073b3d363b3b99e0e42659662b2bf4eb
go/conversation/models.py
go/conversation/models.py
from django.db import models from go.contacts.models import Contact class Conversation(models.Model): """A conversation with an audience""" user = models.ForeignKey('auth.User') subject = models.CharField('Conversation Name', max_length=255) message = models.TextField('Message') start_date = model...
from django.db import models from go.contacts.models import Contact class Conversation(models.Model): """A conversation with an audience""" user = models.ForeignKey('auth.User') subject = models.CharField('Conversation Name', max_length=255) message = models.TextField('Message') start_date = model...
Add link from conversations to message batches.
Add link from conversations to message batches.
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
8ff998d6f56077d4a6d2c174b3871100e43bae86
buildscripts/create_conda_pyenv_retry.py
buildscripts/create_conda_pyenv_retry.py
import subprocess from os import unlink from os.path import realpath, islink, isfile, isdir import sys import shutil import time def rm_rf(path): if islink(path) or isfile(path): # Note that we have to check if the destination is a link because # exists('/path/to/dead-link') will return False, alth...
import subprocess from os import unlink from os.path import realpath, islink, isfile, isdir import sys import shutil import time def rm_rf(path): if islink(path) or isfile(path): # Note that we have to check if the destination is a link because # exists('/path/to/dead-link') will return False, alth...
Make shell=True for the conda subprocess
Make shell=True for the conda subprocess
Python
bsd-2-clause
mwiebe/dynd-python,aterrel/dynd-python,izaid/dynd-python,mwiebe/dynd-python,pombredanne/dynd-python,pombredanne/dynd-python,insertinterestingnamehere/dynd-python,aterrel/dynd-python,pombredanne/dynd-python,mwiebe/dynd-python,izaid/dynd-python,cpcloud/dynd-python,michaelpacer/dynd-python,michaelpacer/dynd-python,izaid/d...
36a76ba62533fe04f71da4e8d4ac7e5a22d0835d
tests/test_20_message.py
tests/test_20_message.py
from __future__ import absolute_import, division, print_function, unicode_literals from builtins import open import os.path from eccodes_grib import eccodes from eccodes_grib import message TEST_DATA = os.path.join(os.path.dirname(__file__), 'sample-data', 'ERA5_levels.grib') def test_GribMessage(): codes_id...
from __future__ import absolute_import, division, print_function, unicode_literals import os.path from eccodes_grib import eccodes from eccodes_grib import message TEST_DATA = os.path.join(os.path.dirname(__file__), 'sample-data', 'ERA5_levels.grib') def test_GribMessage(): codes_id = eccodes.grib_new_from_f...
Fix python 2.7 (CFFI requires the use of the native open).
Fix python 2.7 (CFFI requires the use of the native open).
Python
apache-2.0
ecmwf/cfgrib
60ae97e2060cb01ac159acc6c0c7abdf866019b0
clean_lxd.py
clean_lxd.py
#!/usr/bin/env python from __future__ import print_function from argparse import ArgumentParser from datetime import ( datetime, timedelta, ) import json import os import subprocess import sys def list_old_juju_containers(hours): env = dict(os.environ) containers = json.loads(subprocess.check_out...
#!/usr/bin/env python from __future__ import print_function from argparse import ArgumentParser from datetime import ( datetime, timedelta, ) import json import os import subprocess import sys from dateutil import ( parser as date_parser, tz, ) def list_old_juju_containers(hours): env = ...
Use dateutil to calculate age of container.
Use dateutil to calculate age of container.
Python
agpl-3.0
mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju
d5ddfb8af861f02074fe113f87a6ea6b4f1bc5db
tests/child-process-sigterm-trap.py
tests/child-process-sigterm-trap.py
#!/usr/bin/env python3 from common import * import sys, signal # Be naughty and ignore SIGTERM to simulate hanging child signal.signal(signal.SIGTERM, signal.SIG_IGN) # Start a server that listens for incoming connections try: print_ok("child starting up on port %s" % sys.argv[1]) s = TcpServer(int(sys.argv[...
#!/usr/bin/env python3 from common import * import sys, signal # Be naughty and ignore SIGTERM to simulate hanging child signal.signal(signal.SIGTERM, signal.SIG_IGN) # Start a server that listens for incoming connections try: print_ok("child starting up on port %s" % sys.argv[1]) s = TcpServer(int(sys.argv[1]))...
Fix formatting in child sample to match other files
Fix formatting in child sample to match other files
Python
apache-2.0
square/ghostunnel,square/ghostunnel
9d1d99f8178252e91ae2ea62a20f6f4a104946fd
entities/base.py
entities/base.py
from kivy.uix.widget import Widget from kivy.core.window import Window from kivy.graphics import Ellipse from engine.entity import Entity class BaseEntity(Widget, Entity): def __init__(self, imageStr, **kwargs): Widget.__init__(self, **kwargs) Entity.__init__(self) with self.canvas: ...
from kivy.uix.widget import Widget from kivy.core.window import Window from kivy.graphics import Ellipse from engine.entity import Entity class BaseEntity(Widget, Entity): def __init__(self, imageStr, **kwargs): self.active = False Widget.__init__(self, **kwargs) Entity.__init__(self) ...
Add active flag to entities
Add active flag to entities
Python
mit
nephilahacks/spider-eats-the-kiwi
851579b14a34b8acc1977b2f4d2c991d8e5f5f2c
ledlight.py
ledlight.py
#!/usr/bin/env python import RPi.GPIO as GPIO from time import sleep pin_switch = 12 GPIO.setmode(GPIO.BCM) GPIO.setup(pin_switch, GPIO.IN) period = 0.1 duration = 4 samples = int(duration / float(period)) freq = 1.0 / period series = [] print "inputting", samples, "samples,", "at", freq, "Hz" for i in range(samp...
#!/usr/bin/env python import RPi.GPIO as GPIO from time import sleep pin_switch = 12 GPIO.setmode(GPIO.BCM) GPIO.setup(pin_switch, GPIO.IN) period = 0.25 duration = 30 samples = int(duration / float(period)) freq = 1.0 / period series = [] print "inputting", samples, "samples,", "at", freq, "Hz" for i in range(sa...
Print out 0/1 values as we sense them real-time.
Print out 0/1 values as we sense them real-time.
Python
mit
zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie
d2e52377f90c81365bd0ff62c8bea95207b44328
indra/sources/sofia/api.py
indra/sources/sofia/api.py
import openpyxl from .processor import SofiaProcessor def process_table(fname): """Return processor by processing a given sheet of a spreadsheet file. Parameters ---------- fname : str The name of the Excel file (typically .xlsx extension) to process Returns ------- sp : indra.sou...
import openpyxl from .processor import SofiaProcessor def process_table(fname): """Return processor by processing a given sheet of a spreadsheet file. Parameters ---------- fname : str The name of the Excel file (typically .xlsx extension) to process Returns ------- sp : indra.so...
Handle Causal and Relations worksheets
Handle Causal and Relations worksheets
Python
bsd-2-clause
pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,johnbachman/indra,johnbachman/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra
a555737e2d594a67078a15be9d5eb3c8524d0698
app/models.py
app/models.py
from . import db class Monkey(db.Model): __tablename__ = 'monkeys' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) email = db.Column(db.String(64), unique=True) age = db.Column(db.Date()) def __repr__(self): return '<User {} {}>'.format(self.id,...
from . import db from werkzeug.security import generate_password_hash, check_password_hash class Monkey(db.Model): __tablename__ = 'monkeys' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) email = db.Column(db.String(64), unique=True) password_hash = db.Column...
Add password hash to Monkey model
Add password hash to Monkey model
Python
mit
timzdevz/fm-flask-app
f333f29d4170527c985bc695cd7b8331041769d5
eva/layers/out_channels.py
eva/layers/out_channels.py
from keras.layers import Convolution2D, Reshape, Lambda, Activation from eva.layers.masked_convolution2d import MaskedConvolution2D class OutChannels(object): def __init__(self, height, width, channels, masked=False, palette=256): self.height = height self.width = width self.channels = cha...
from keras.layers import Convolution2D, Reshape, Lambda, Activation from eva.layers.masked_convolution2d import MaskedConvolution2D class OutChannels(object): def __init__(self, height, width, channels, masked=False, palette=256): self.height = height self.width = width self.channels = cha...
Make mono channel output activation more readable
Make mono channel output activation more readable
Python
apache-2.0
israelg99/eva
a21d484cc1131b56d793e75fbb6ab1531205dae6
joueur/base_game_object.py
joueur/base_game_object.py
from joueur.delta_mergeable import DeltaMergeable # the base class that every game object within a game inherit from for Python # manipulation that would be redundant via Creer class BaseGameObject(DeltaMergeable): def __init__(self): DeltaMergeable.__init__(self) def __str__(self): return "{...
from joueur.delta_mergeable import DeltaMergeable # the base class that every game object within a game inherit from for Python # manipulation that would be redundant via Creer class BaseGameObject(DeltaMergeable): def __init__(self): DeltaMergeable.__init__(self) def __str__(self): return "{...
Update BaseGameObject to be hashable
Update BaseGameObject to be hashable
Python
mit
JacobFischer/Joueur.py,siggame/Joueur.py,siggame/Joueur.py,JacobFischer/Joueur.py
aa9cb1bc1a04de4e4a4a787881123e2a60aaeb4e
docs/apps.py
docs/apps.py
import certifi from django.apps import AppConfig from django.conf import settings from django.utils.translation import ugettext_lazy as _ from elasticsearch_dsl.connections import connections class DocsConfig(AppConfig): name = 'docs' verbose_name = _('Documentation') def ready(self): super(DocsC...
import certifi from django.apps import AppConfig from django.conf import settings from django.utils.translation import ugettext_lazy as _ from elasticsearch_dsl.connections import connections class DocsConfig(AppConfig): name = 'docs' verbose_name = _('Documentation') def ready(self): super(DocsC...
Increase the ES timeout to 1 minute.
Increase the ES timeout to 1 minute.
Python
bsd-3-clause
rmoorman/djangoproject.com,hassanabidpk/djangoproject.com,relekang/djangoproject.com,django/djangoproject.com,khkaminska/djangoproject.com,django/djangoproject.com,hassanabidpk/djangoproject.com,gnarf/djangoproject.com,vxvinh1511/djangoproject.com,xavierdutreilh/djangoproject.com,hassanabidpk/djangoproject.com,django/d...
763d9f8ef45aff357e318d73cfd10512228d85f3
src/zeit/content/article/edit/browser/tests/test_preview.py
src/zeit/content/article/edit/browser/tests/test_preview.py
# Copyright (c) 2012 gocept gmbh & co. kg # See also LICENSE.txt import zeit.content.article.testing class Preview(zeit.content.article.testing.SeleniumTestCase): def test_selected_tab_is_stored_across_reload(self): self.open('/repository/online/2007/01/Somalia') s = self.selenium select...
# Copyright (c) 2012 gocept gmbh & co. kg # See also LICENSE.txt import zeit.content.article.testing class Preview(zeit.content.article.testing.SeleniumTestCase): def test_selected_tab_is_stored_across_reload(self): self.open('/repository/online/2007/01/Somalia') s = self.selenium select...
Update test to work with current jquery-ui
Update test to work with current jquery-ui
Python
bsd-3-clause
ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article
23ceddaff1752797fe775df950f6e62769b285a6
foyer/tests/test_plugin.py
foyer/tests/test_plugin.py
import pytest import foyer def test_basic_import(): assert 'forcefields' in dir(foyer) @pytest.mark.parametrize('ff_name', ['OPLSAA', 'TRAPPE_UA']) def test_forcefields_exist(ff_name): ff_name in dir(foyer.forcefields) def test_load_forcefield(): OPLSAA = foyer.forcefields.get_forcefield(name='oplsaa'...
import pytest import foyer def test_basic_import(): assert 'forcefields' in dir(foyer) @pytest.mark.parametrize('ff_loader', ['load_OPLSAA', 'load_TRAPPE_UA']) def test_forcefields_exist(ff_loader): assert ff_loader in dir(foyer.forcefields) def test_load_forcefield(): OPLSAA = foyer.forcefields.get_f...
Update test to properly assert loaders
Update test to properly assert loaders
Python
mit
iModels/foyer,mosdef-hub/foyer,mosdef-hub/foyer,iModels/foyer
183aacf12405eec38ba8b2193f8f89904d415c4a
yagocd/resources/base.py
yagocd/resources/base.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # The MIT License # # Copyright (c) 2016 Grigory Chernyshev # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation file...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # The MIT License # # Copyright (c) 2016 Grigory Chernyshev # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation file...
Return internal data for string representation.
Return internal data for string representation.
Python
isc
grundic/yagocd,grundic/yagocd
77fd12a850fbca0b3308e964e457f234d12d7c11
src/wad.blog/wad/blog/utils.py
src/wad.blog/wad/blog/utils.py
from zope.component import getUtility, getMultiAdapter, ComponentLookupError from plone.portlets.interfaces import IPortletAssignmentMapping from plone.portlets.interfaces import IPortletManager def find_assignment_context(assignment, context): # Finds the creation context of the assignment context = context....
from Acquisition import aq_inner from Acquisition import aq_parent from Acquisition import aq_base from plone.portlets.interfaces import IPortletAssignmentMapping from plone.portlets.interfaces import IPortletManager from zope.component import getUtility, getMultiAdapter, ComponentLookupError def find_assignment_con...
Fix portlet assignment context utility
Fix portlet assignment context utility
Python
mit
potzenheimer/buildout.wad,potzenheimer/buildout.wad
eea0a6bc56d69377519e5441074f32f5eb9fb01e
examples/storage/ext_flash_fatfs/example_test.py
examples/storage/ext_flash_fatfs/example_test.py
from __future__ import print_function import os import sys try: import IDF except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF @IDF.idf_example_test(env_tag='Example_ExtFlash') def test_exam...
from __future__ import print_function import os import sys try: import IDF except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF from IDF.IDFDUT import ESP32DUT @IDF.idf_example_test(env_tag=...
Add ESP32 DUT class to ext_flash_fatfs example test
examples: Add ESP32 DUT class to ext_flash_fatfs example test
Python
apache-2.0
espressif/esp-idf,espressif/esp-idf,espressif/esp-idf,espressif/esp-idf
5a310285c6e528555136a95221b628827d04cb81
l10n_br_base/__init__.py
l10n_br_base/__init__.py
# Copyright (C) 2009 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models from . import tests
# Copyright (C) 2009 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models from . import tests from odoo.addons import account from odoo import api, SUPERUSER_ID # Install Simple Chart of Account Template for Brazilian Companies _auto_install_l10n_original = ac...
Define l10n_br_simple as default COA for brazilian companies
Define l10n_br_simple as default COA for brazilian companies
Python
agpl-3.0
akretion/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil
08797de13a88bc742d905f2067df533a1a319c83
yawf/revision/models.py
yawf/revision/models.py
from django.db import models from django.contrib.contenttypes import generic class RevisionModelMixin(models.Model): class Meta: abstract = True _has_revision_support = True revision = models.PositiveIntegerField(default=0, db_index=True, editable=False) versions = generic.GenericR...
from django.db import models class RevisionModelMixin(models.Model): class Meta: abstract = True _has_revision_support = True revision = models.PositiveIntegerField(default=0, db_index=True, editable=False) def save(self, *args, **kwargs): self.revision += 1 super(R...
Remove generic relation to reversion.Version from RevisionModelMixin
Remove generic relation to reversion.Version from RevisionModelMixin
Python
mit
freevoid/yawf
cd09a040270eb3cf1b1966e76382e9e92f4323a8
soco/__init__.py
soco/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ SoCo (Sonos Controller) is a simple library to control Sonos speakers """ # Will be parsed by setup.py to determine package metadata __author__ = 'Rahim Sonawalla <rsonawalla@gmail.com>' __version__ = '0.6' __website__ = 'https://github.com/SoCo/SoCo...
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ SoCo (Sonos Controller) is a simple library to control Sonos speakers """ # Will be parsed by setup.py to determine package metadata __author__ = 'Rahim Sonawalla <rsonawalla@gmail.com>' __version__ = '0.6' __website__ = 'https://github.com/SoCo/SoCo...
Fix for logger configuration errors
Fix for logger configuration errors
Python
mit
dajobe/SoCo,flavio/SoCo,KennethNielsen/SoCo,lawrenceakka/SoCo,lawrenceakka/SoCo,bwhaley/SoCo,dundeemt/SoCo,dsully/SoCo,dsully/SoCo,TrondKjeldas/SoCo,bwhaley/SoCo,simonalpha/SoCo,petteraas/SoCo,flavio/SoCo,xxdede/SoCo,SoCo/SoCo,fgend31/SoCo,TrondKjeldas/SoCo,SoCo/SoCo,xxdede/SoCo,dundeemt/SoCo,petteraas/SoCo,intfrr/SoCo...
46c1378f345c8290fa34fc7f756ef6fafa8e2aa8
lucid/modelzoo/aligned_activations.py
lucid/modelzoo/aligned_activations.py
# Copyright 2018 The Lucid Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# Copyright 2018 The Lucid Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Remove stray print statement O_o
Remove stray print statement O_o
Python
apache-2.0
tensorflow/lucid,tensorflow/lucid,tensorflow/lucid,tensorflow/lucid
1e5a956eb289b8333ecf3c3cc00f51295f37870a
api_tests/institutions/views/test_institution_users_list.py
api_tests/institutions/views/test_institution_users_list.py
from nose.tools import * # flake8: noqa from tests.base import ApiTestCase from osf_tests.factories import InstitutionFactory, UserFactory from api.base.settings.defaults import API_BASE class TestInstitutionUsersList(ApiTestCase): def setUp(self): super(TestInstitutionUsersList, self).setUp() s...
import pytest from api.base.settings.defaults import API_BASE from osf_tests.factories import ( InstitutionFactory, UserFactory, ) @pytest.mark.django_db class TestInstitutionUsersList: @pytest.fixture() def institution(self): return InstitutionFactory() @pytest.fixture() def user_on...
Convert institutions users to pytest
Convert institutions users to pytest
Python
apache-2.0
cslzchen/osf.io,chennan47/osf.io,crcresearch/osf.io,caneruguz/osf.io,HalcyonChimera/osf.io,leb2dg/osf.io,icereval/osf.io,crcresearch/osf.io,cslzchen/osf.io,sloria/osf.io,felliott/osf.io,binoculars/osf.io,laurenrevere/osf.io,mfraezz/osf.io,felliott/osf.io,Johnetordoff/osf.io,aaxelb/osf.io,crcresearch/osf.io,adlius/osf.i...
97fa1de8a22ff8fd9fd80a39328ec57be672575d
mlabdata.py
mlabdata.py
import collections """All of the datatypes that get passed around inside Signal Searcher.""" InternetData = collections.namedtuple( 'InternetData', ['key', 'table', 'time', 'upload', 'download', 'rtt', 'samples']) # Everything below this line is temporary and should be deleted when the # migration away from...
"""All of the datatypes that get passed around inside Signal Searcher.""" import collections InternetData = collections.namedtuple( 'InternetData', ['key', 'table', 'time', 'upload', 'download', 'rtt', 'samples']) # Everything below this line is temporary and should be deleted when the # migration away from...
Make the string be an actual docstring
Make the string be an actual docstring
Python
apache-2.0
m-lab/signal-searcher
ca31ecaf79e42cacc023277aa163af8887a360ad
mlog/log.py
mlog/log.py
import gzip import json from datetime import datetime def log_database(conn, param, email): param = json.dumps(param) email_gz = gzip.compress(email.encode('ascii')) values = (param, email_gz) c = conn.cursor() c.execute(''' INSERT INTO email_log (`param`, `email_gz`) VALUES (?, ?) ''', values) ...
import gzip import json from datetime import datetime def log_database(conn, param, email): param = json.dumps(param) email_gz = gzip.compress(email.encode('ascii')) values = (param, email_gz) c = conn.cursor() c.execute(''' INSERT INTO email_log (`param`, `email_gz`) VALUES (?, ?) ''', values) ...
Use with statement when writing to a file
Use with statement when writing to a file
Python
agpl-3.0
fajran/mlog
d1e5cce57da49bd93950004b1a4e8766b525106a
backend/unpp_api/apps/common/tests/test_views.py
backend/unpp_api/apps/common/tests/test_views.py
from django.urls import reverse from agency.roles import AgencyRole from common.tests.base import BaseAPITestCase from rest_framework import status class TestGeneralConfigAPIView(BaseAPITestCase): user_type = BaseAPITestCase.USER_AGENCY agency_role = AgencyRole.ADMINISTRATOR def test_view(self): ...
from django.core.management import call_command from django.test import TestCase from django.urls import reverse from agency.roles import AgencyRole from common.tests.base import BaseAPITestCase from rest_framework import status class TestGeneralConfigAPIView(BaseAPITestCase): user_type = BaseAPITestCase.USER_A...
Add testin for unmigrated changes in models
Add testin for unmigrated changes in models
Python
apache-2.0
unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal
df385ac3c06018a2d151ead1e07293166ff92614
erpnext/patches/v11_0/move_leave_approvers_from_employee.py
erpnext/patches/v11_0/move_leave_approvers_from_employee.py
import frappe from frappe import _ from frappe.model.utils.rename_field import rename_field def execute(): frappe.reload_doc("hr", "doctype", "department_approver") frappe.reload_doc("hr", "doctype", "employee") frappe.reload_doc("hr", "doctype", "department") if frappe.db.has_column('Department', 'leave_approver...
import frappe from frappe import _ from frappe.model.utils.rename_field import rename_field def execute(): frappe.reload_doc("hr", "doctype", "department_approver") frappe.reload_doc("hr", "doctype", "employee") frappe.reload_doc("hr", "doctype", "department") if frappe.db.has_column('Department', 'leave_approver...
Check if table exists else return
Check if table exists else return
Python
agpl-3.0
gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext
8f484f4e79d50f71c0a593429f3e2dad0db56fff
microcosm_flask/matchers.py
microcosm_flask/matchers.py
""" Hamcrest matching support for JSON responses. """ from json import dumps, loads from hamcrest.core.base_matcher import BaseMatcher def prettify(value): return dumps( value, sort_keys=True, indent=4, separators=(',', ': '), ) class JSON(object): """ Dictionary wra...
""" Hamcrest matching support for JSON responses. """ from json import dumps, loads from hamcrest.core.base_matcher import BaseMatcher def prettify(value): return dumps( value, sort_keys=True, indent=4, separators=(',', ': '), ) class JSON(object): """ Dictionary wra...
Add get operation to JSON wrapper
Add get operation to JSON wrapper
Python
apache-2.0
globality-corp/microcosm-flask,globality-corp/microcosm-flask
a326f2daad6817f426099518da77bc241fd9b51e
bibpy/doi/__init__.py
bibpy/doi/__init__.py
# -*- coding: utf-8 -*- """Tools for downloading bibtex files from digital object identifiers.""" import bibpy try: from urllib.request import Request, urlopen except ImportError: from urllib2 import Request, urlopen def download(doi, source='http://dx.doi.org/{0}', raw=False): """Download a bibtex fil...
# -*- coding: utf-8 -*- """Tools for downloading bibtex files from digital object identifiers.""" import bibpy try: from urllib.request import Request, urlopen except ImportError: from urllib2 import Request, urlopen def retrieve(doi, source='http://dx.doi.org/{0}', raw=False, **options): """Download a...
Rename doi function, add keyword options
Rename doi function, add keyword options
Python
mit
MisanthropicBit/bibpy,MisanthropicBit/bibpy
8cceb96ae2d8352107dc2e03b336e84e9f2bdfb3
partner_feeds/templatetags/partner_feed_tags.py
partner_feeds/templatetags/partner_feed_tags.py
from django import template from partner_feeds.models import Partner register = template.Library() @register.assignment_tag def get_partners(*args): partners = [] for name in args: partner = Partner.objects.get(name=name) partner.posts = partner.post_set.all().order_by('-date') partners...
from django import template from partner_feeds.models import Partner register = template.Library() @register.assignment_tag def get_partners(*args): partners = [] for name in args: try: partner = Partner.objects.get(name=name) except Partner.DoesNotExist: continue ...
Make Django template tag forgiving of nonexistent partners.
Make Django template tag forgiving of nonexistent partners.
Python
bsd-2-clause
theatlantic/django-partner-feeds
27ee2752a71ee415154c40e1978edb9d5221a331
IPython/lib/tests/test_deepreload.py
IPython/lib/tests/test_deepreload.py
"""Test suite for the deepreload module.""" from IPython.testing import decorators as dec from IPython.lib.deepreload import reload as dreload @dec.skipif_not_numpy def test_deepreload_numpy(): import numpy exclude = [ # Standard exclusions: 'sys', 'os.path', '__builtin__', '__main__', ...
# -*- coding: utf-8 -*- """Test suite for the deepreload module.""" #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- from IPython.testing import decorators as dec from IPython.lib.deepreload import r...
Reformat test to a standard style.
Reformat test to a standard style.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
c2f2acc518f017a0d7b8ccfa6640595f2769aa98
nib/plugins/prettyurls.py
nib/plugins/prettyurls.py
from __future__ import absolute_import, division, print_function, unicode_literals from os import path from nib import Resource, Processor, after apache_redirects = b""" RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f RewriteRule ^(.*)$ /$1/index.html [L] RewriteCond %{DOCUMENT_ROOT}/$1.html -f RewriteRule ^(.*)$ /$1...
from __future__ import absolute_import, division, print_function, unicode_literals from os import path from nib import Resource, Processor, after apache_redirects = b""" RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f RewriteRule ^(.*)$ /$1/index.html [L] RewriteCond %{DOCUMENT_ROOT}/$1.html -f RewriteRule ^(.*)$ /$1...
Add nginx rules for pretty URLs
Add nginx rules for pretty URLs
Python
mit
jreese/nib
13208d4656adcf52a5842200ee1d9e079fdffc2b
bin/rate_limit_watcher.py
bin/rate_limit_watcher.py
#!/usr/bin/env python import requests URL = 'http://tutorials.pluralsight.com/gh_rate_limit' def main(): resp = requests.get(URL) if resp.status_code == 200: print resp.content else: print 'Failed checking rate limit, status_code: %d' % (resp.status_code) if __name__ == '__main__': ...
#!/usr/bin/env python """ Script to print out Github API rate limit for REPO_OWNER user i.e. the main github user account used for the guides-cms application. """ import argparse from datetime import datetime import requests DOMAIN = 'http://tutorials.pluralsight.com/' URL = '/gh_rate_limit' def main(domain): ...
Print rate limits from new JSON response url in a pretty, parsable format
Print rate limits from new JSON response url in a pretty, parsable format
Python
agpl-3.0
paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms
63af2d4267f7107232777fa0d8b222dc00f07a90
test_setup.py
test_setup.py
"""Test setup.py.""" import os import subprocess import sys import setup def test_setup(): """Run setup.py check.""" command = [ sys.executable, setup.__file__, 'check', '--metadata', '--strict', ] assert subprocess.run(command, check=False).returncode == 0 ...
"""Test setup.py.""" import os import subprocess import sys import sysconfig import setup def test_setup(): """Run setup.py check.""" command = [ sys.executable, setup.__file__, 'check', '--metadata', '--strict', ] assert subprocess.run(command, check=False)....
Check sysconfig 'scripts' instead of scanning PATH
Check sysconfig 'scripts' instead of scanning PATH
Python
lgpl-2.1
dmtucker/backlog
36ceeed4ff6b578e8b63b222cd9beea4e788a819
mongo_thingy/__init__.py
mongo_thingy/__init__.py
from pymongo import MongoClient from thingy import classproperty, DatabaseThingy class Thingy(DatabaseThingy): client = None _collection = None @classproperty def collection(cls): return cls._collection or cls.table @classproperty def collection_name(cls): return cls.collecti...
from pymongo import MongoClient from thingy import classproperty, DatabaseThingy class Thingy(DatabaseThingy): client = None _collection = None @classproperty def collection(cls): return cls._collection or cls.table @classproperty def collection_name(cls): return cls.collecti...
Define __all__ to restrict global imports
Define __all__ to restrict global imports
Python
mit
numberly/mongo-thingy
fb49d44cd1cb8ea8a3d291d79546914f15a58491
greenwich/__init__.py
greenwich/__init__.py
from greenwich.raster import (driver_for_path, frombytes, geom_to_array, open, AffineTransform, ImageDriver, Raster) from greenwich.geometry import Envelope, Geometry from greenwich.srs import SpatialReference
from greenwich.raster import (driver_for_path, fromarray, frombytes, geom_to_array, open, AffineTransform, ImageDriver, Raster) from greenwich.geometry import Envelope, Geometry from greenwich.srs import SpatialReference
Add fromarray to package root
Add fromarray to package root
Python
bsd-3-clause
bkg/greenwich
71088ebbed3f6060def0455814036185c70ba194
shopify_auth/context_processors.py
shopify_auth/context_processors.py
import shopify def current_shop(request): if not shopify.ShopifyResource.site: return {'current_shop': None} return {'current_shop': shopify.Shop.current()}
from django.conf import settings import shopify def shopify_context(request): return { 'shopify_current_shop': shopify.Shop.current() if shopify.ShopifyResource.site else None, 'shopify_app_api_key': settings.SHOPIFY_APP_API_KEY, }
Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information.
Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information.
Python
mit
funkybob/django-shopify-auth,RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,funkybob/django-shopify-auth
85dcb6ff036d03fd1fadc62a519147cf6b9ca8de
floq/blockmatrix.py
floq/blockmatrix.py
import numpy as np # Provide functions to get/set blocks in numpy arrays def get_block_from_matrix(matrix,dim_block,n_block,row,column): start_row = row*dim_block start_column = column*dim_block stop_row = start_row+dim_block stop_column = start_column+dim_block return matrix[start_row:stop_row,...
import numpy as np # Provide functions to get/set blocks in numpy arrays def get_block_from_matrix(matrix,dim_block,n_block,row,col): start_row = row*dim_block start_col = col*dim_block stop_row = start_row+dim_block stop_col = start_col+dim_block return matrix[start_row:stop_row,start_col:stop_...
Rename column -> col for consistency with row
Rename column -> col for consistency with row
Python
mit
sirmarcel/floq
980cbb13e874f7d3769dff12992779f676a5b2f3
plotly/plotly/__init__.py
plotly/plotly/__init__.py
""" plotly ====== This module defines functionality that requires interaction between your local machine and Plotly. Almost all functionality used here will require a verifiable account (username/api-key pair) and a network connection. """ from . plotly import ( sign_in, update_plot_options, get_plot_options, get...
""" plotly ====== This module defines functionality that requires interaction between your local machine and Plotly. Almost all functionality used here will require a verifiable account (username/api-key pair) and a network connection. """ from . plotly import ( sign_in, update_plot_options, get_plot_options, get...
Add get_config to the list of public functions for plotly.py
Add get_config to the list of public functions for plotly.py
Python
mit
plotly/python-api,plotly/plotly.py,ee-in/python-api,plotly/python-api,plotly/plotly.py,ee-in/python-api,plotly/python-api,plotly/plotly.py,ee-in/python-api
388826605b556a9632c3dea22ca3ba1219dfc5ea
wallp/main.py
wallp/main.py
import sys from redcmd.api import execute_commandline def main(): from .db.manage.db import DB db = DB() response = db.check() from util.printer import printer response and printer.printf('program maintenance', response) from .util import log from .db.app.config import Config, ConfigError from . import c...
import sys from redcmd.api import execute_commandline def main(): from .db.manage.db import DB db = DB() response = db.check() from util.printer import printer response and printer.printf('program maintenance', response) from .util import log from .db.app.config import Config, ConfigError from . import c...
Change default subcommand to "source random"
Change default subcommand to "source random"
Python
mit
amol9/wallp
e7691a775dc745984155a5f2e07140c207c3ab20
api/base/parsers.py
api/base/parsers.py
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer from api.base.exceptions import JSONAPIException class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPI...
from rest_framework.parsers import JSONParser from rest_framework.exceptions import ValidationError from api.base.renderers import JSONAPIRenderer from api.base.exceptions import JSONAPIException class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = '...
Enforce that request data is a dictionary.
Enforce that request data is a dictionary.
Python
apache-2.0
DanielSBrown/osf.io,asanfilippo7/osf.io,cwisecarver/osf.io,sloria/osf.io,Ghalko/osf.io,felliott/osf.io,caseyrygt/osf.io,jnayak1/osf.io,caneruguz/osf.io,mfraezz/osf.io,kch8qx/osf.io,KAsante95/osf.io,emetsger/osf.io,caseyrygt/osf.io,mluo613/osf.io,samchrisinger/osf.io,wearpants/osf.io,billyhunt/osf.io,chennan47/osf.io,Ne...
bc9488b6954c172d903521df9f00c7ff71243fff
tests.py
tests.py
#! /usr/bin/python # -*- coding: utf-8 -*- """ linescan.py - Effortlessly read lines from a text file using any encoding Created 2013-2014 Triangle717 <http://Triangle717.WordPress.com/> Licensed under The MIT License <http://opensource.org/licenses/MIT/> """ from __future__ import print_function ...
#! /usr/bin/python # -*- coding: utf-8 -*- """ linescan.py - Effortlessly read lines from a text file using any encoding Created 2013-2014 Triangle717 <http://Triangle717.WordPress.com/> Licensed under The MIT License <http://opensource.org/licenses/MIT/> """ from __future__ import print_function ...
Fix F401 error (module imported but unused)
Fix F401 error (module imported but unused) [ci skip]
Python
mit
le717/linescan.py
d2106c0a6cb4bbf523914786ded873261cb174c2
nipype/pipeline/__init__.py
nipype/pipeline/__init__.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Package contains modules for generating pipelines using interfaces """ __docformat__ = 'restructuredtext' from .engine import Node, MapNode, Workflow from .utils import write_prov
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Package contains modules for generating pipelines using interfaces """ __docformat__ = 'restructuredtext' from engine import Node, MapNode, JoinNode, Workflow from .utils import write_prov
Add JoinNode to pipeline init
Add JoinNode to pipeline init
Python
bsd-3-clause
arokem/nipype,gerddie/nipype,Leoniela/nipype,fprados/nipype,pearsonlab/nipype,blakedewey/nipype,carolFrohlich/nipype,blakedewey/nipype,gerddie/nipype,dgellis90/nipype,glatard/nipype,arokem/nipype,carlohamalainen/nipype,carolFrohlich/nipype,Leoniela/nipype,glatard/nipype,dmordom/nipype,grlee77/nipype,carolFrohlich/nipyp...
780d1fa408677994c739ce489bd0fde2ed6242f0
ideascaly/__init__.py
ideascaly/__init__.py
__author__ = 'jorgesaldivar'
# IdeaScaly # Copyright 2015 Jorge Saldivar # See LICENSE for details. """ IdeaScaly: IdeaScale API client """ __version__ = '0.1' __author__ = 'Jorge Saldivar' __license__ = 'MIT' from ideascaly.api import API from ideascaly.auth import AuthNonSSO, AuthNonSSOMem, AuthSSO, AuthResearch from ideascaly.error import Id...
Add details of the project
Add details of the project
Python
mit
joausaga/ideascaly
30b56f27cff21b93d68524fc992d6e731fb80e57
tests.py
tests.py
from models import AuthenticationError,AuthenticationRequired from trello import Trello import unittest import os class BoardTestCase(unittest.TestCase): def setUp(self): self._trello = Trello(os.environ['TRELLO_TEST_USER'], os.environ['TRELLO_TEST_PASS']) def test01_list_boards(self): print "list boards" se...
from models import AuthenticationError,AuthenticationRequired from trello import Trello import unittest import os class TrelloTestCase(unittest.TestCase): def setUp(self): self._trello = Trello(os.environ['TRELLO_TEST_USER'], os.environ['TRELLO_TEST_PASS']) def test01_list_boards(self): self.assertEquals( ...
Make it a single test case
Make it a single test case
Python
bsd-3-clause
Wooble/py-trello,mehdy/py-trello,ntrepid8/py-trello,portante/py-trello,nMustaki/py-trello,WoLpH/py-trello,sarumont/py-trello,merlinpatt/py-trello,gchp/py-trello
7e2565007c926765750641b048607ed29b8aada0
cmsplugin_zinnia/admin.py
cmsplugin_zinnia/admin.py
"""Admin of Zinnia CMS Plugins""" from django.contrib import admin from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from cms.plugin_rendering import render_placeholder from cms.admin.placeholderadmin import PlaceholderAdminMixin from zinnia.models import Entry from zi...
"""Admin of Zinnia CMS Plugins""" from django.contrib import admin from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from cms.plugin_rendering import render_placeholder from cms.admin.placeholderadmin import PlaceholderAdminMixin from zinnia.models import Entry from zi...
Add comment about why excepting KeyError
Add comment about why excepting KeyError
Python
bsd-3-clause
bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,bittner/cmsplugin-zinnia
ca62db36a14c9bcc447cb612a8fba4dd2c678629
functional_tests.py
functional_tests.py
#!/usr/bin/env python from unittest import TestCase import mechanize class ResponseTests(TestCase): def test_close_pickle_load(self): import pickle b = mechanize.Browser() r = b.open("http://wwwsearch.sf.net/bits/cctest2.txt") r.read() r.close() r.seek(0) ...
#!/usr/bin/env python from unittest import TestCase import mechanize class ResponseTests(TestCase): def test_close_pickle_load(self): print ("This test is expected to fail unless Python standard library" "patch http://python.org/sf/1144636 has been applied") import pickle ...
Add warning about failing functional test
Add warning about failing functional test
Python
bsd-3-clause
python-mechanize/mechanize,python-mechanize/mechanize
baaeb4fe0998bac8e0cb853d8124aa6134f55996
poradnia/letters/admin.py
poradnia/letters/admin.py
from django.contrib import admin from .models import Attachment, Letter class AttachmentInline(admin.StackedInline): ''' Stacked Inline View for Attachment ''' model = Attachment class LetterAdmin(admin.ModelAdmin): ''' Admin View for Letter ''' inlines = [ Attachmen...
from django.contrib import admin from .models import Attachment, Letter class AttachmentInline(admin.StackedInline): ''' Stacked Inline View for Attachment ''' model = Attachment @admin.register(Letter) class LetterAdmin(admin.ModelAdmin): ''' Admin View for Letter ''' inlin...
Rewrite DjangoAdmin in letters for decorators
Rewrite DjangoAdmin in letters for decorators
Python
mit
rwakulszowa/poradnia,rwakulszowa/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,watchdogpolska/poradnia.siecobywatelska.pl,watchdogpolska/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,rwakulszowa/poradnia,rwakulszowa/poradnia
e36e6c4db61381ca9f29ce1dc5f645cb65d3ba21
capstone/util/play.py
capstone/util/play.py
from __future__ import print_function import random from capstone.util import print_header def play_match(game, players, verbose=True): """Plays a match between the given players""" if verbose: print(game) while not game.is_over(): cur_player = players[game.cur_player()] move = cur...
from __future__ import print_function import random from . import print_header def play_match(game, players, verbose=True): """Plays a match between the given players""" if verbose: print(game) while not game.is_over(): cur_player = players[game.cur_player()] move = cur_player.choo...
Change absolute import to relative
Change absolute import to relative
Python
mit
davidrobles/mlnd-capstone-code
5486503c3e9664c1683e5de9381b4d0d413182c3
ipywidgets/widgets/widget_description.py
ipywidgets/widgets/widget_description.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Contains the DOMWidget class""" from traitlets import Unicode from .widget import Widget, widget_serialization, register from .trait_types import InstanceDict from .widget_style import Style from .widget_core impor...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Contains the DOMWidget class""" from traitlets import Unicode from .widget import Widget, widget_serialization, register from .trait_types import InstanceDict from .widget_style import Style from .widget_core impor...
Tweak the help text for the new tooltip attribute.
Tweak the help text for the new tooltip attribute.
Python
bsd-3-clause
ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets
3fcb69fbb623184a30d1d5ecb41e4c3c33128f1a
src/lyra/tests/dictionary/dict_descr_example.py
src/lyra/tests/dictionary/dict_descr_example.py
important: Set[str] = {"Albert Einstein" , "Alan Turing"} texts: Dict[str, str] = input() # {"<author >" : "<t e x t >"} freqdict: Dict[str, int] = {} # defaultdict(int) err: int recognized as varId #initialized to 0 a: str = "" #necessary? b: str = "" for a, b in texts.items(): if a in important: #...
important: Set[str] = {"Albert Einstein" , "Alan Turing"} texts: Dict[str, str] = input() # {"<author >" : "<t e x t >"} freqdict: Dict[str, int] = {} # defaultdict(int) err: int recognized as varId #initialized to 0 a: str = "" #necessary? b: str = "" for a, b in texts.items(): if a in important: #t...
Fix to typing of loop variables
Fix to typing of loop variables
Python
mpl-2.0
caterinaurban/Lyra
e99a0bdde697a0508bc17a8dd66943cdf97bdc3d
Main_program/src/main_program.py
Main_program/src/main_program.py
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. if __name__ == "__main__": print "Hello World"
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. print("Hello World") print("Hessel is een home")
Test commit push and pull
Test commit push and pull
Python
apache-2.0
HesselTjeerdsma/Cyber-Physical-Pacman-Game,HesselTjeerdsma/Cyber-Physical-Pacman-Game,HesselTjeerdsma/Cyber-Physical-Pacman-Game,HesselTjeerdsma/Cyber-Physical-Pacman-Game,HesselTjeerdsma/Cyber-Physical-Pacman-Game,HesselTjeerdsma/Cyber-Physical-Pacman-Game
43a672574d13ce3ce267f5e4773c5d26827a4b9a
app/sso/backends.py
app/sso/backends.py
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User from hashlib import sha1 class SimpleHashModelBackend(ModelBackend): supports_anonymous_user = False supports_object_permissions = False supports_inactive_user = False def authenticate(self, username=No...
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User from hashlib import sha1 class SimpleHashModelBackend(ModelBackend): supports_anonymous_user = False supports_object_permissions = False supports_inactive_user = False def authenticate(self, username=No...
Switch authenticator to migrate back to Django style passwords
Switch authenticator to migrate back to Django style passwords
Python
bsd-3-clause
nikdoof/test-auth
74cd91babf7466c35fbb680c10d5f2451b1409b0
appengine_config.py
appengine_config.py
import os import sys from google.appengine.ext import vendor # Add any libraries installed in the "lib" folder. vendor.add('lib') BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + os.sep SHARED_SOURCE_DIRECTORIES = [ os.path.abspath(os.environ.get('ISB_CGC_COMMON_MODU...
import os import sys from google.appengine.ext import vendor # Add any libraries installed in the "lib" folder. vendor.add('lib') BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + os.sep SHARED_SOURCE_DIRECTORIES = [ os.path.abspath('./ISB-CGC-Common') ] # Add the sh...
Use hardcoded path for ISB-CGC-Common
Use hardcoded path for ISB-CGC-Common
Python
apache-2.0
isb-cgc/ISB-CGC-API,isb-cgc/ISB-CGC-API,isb-cgc/ISB-CGC-API
edfc43f4c6041166845e5e4ffd2db58802d3e8c6
ml/pytorch/image_classification/architectures.py
ml/pytorch/image_classification/architectures.py
import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F ################################################################################ # SUPPORT ################################################################################ class Flat...
import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F ################################################################################ # SUPPORT ################################################################################ class Flat...
Add custom FC layer module
FEAT: Add custom FC layer module
Python
apache-2.0
ronrest/convenience_py,ronrest/convenience_py
23606cec326b75cb73ba31b93410770659481d41
test_echo.py
test_echo.py
# -*- coding: utf-8 -*- import subprocess import pytest def test_basic(string="This is a test."): """Test function to test echo server and client with inputted string.""" process = subprocess.Popen(['./echo_client.py', string], stdout=subprocess.PIPE) assert string == proces...
# -*- coding: utf-8 -*- import subprocess def test_basic(string=u"This is a test."): """Test function to test echo server and client with inputted string.""" process = subprocess.Popen(['./echo_client.py', string], stdout=subprocess.PIPE) assert string == process.stdout.read...
Change unicode test, to test decoding and encoding is done correctly.
Change unicode test, to test decoding and encoding is done correctly.
Python
mit
bm5w/network_tools
54461c89b61ba118ef98389c09b45138b32224ab
stagecraft/apps/datasets/admin/backdrop_user.py
stagecraft/apps/datasets/admin/backdrop_user.py
from __future__ import unicode_literals from django.contrib import admin from django.db import models import reversion from stagecraft.apps.datasets.models.backdrop_user import BackdropUser from stagecraft.apps.datasets.models.data_set import DataSet class DataSetInline(admin.StackedInline): model = DataSet f...
from __future__ import unicode_literals from django.contrib import admin from django.db import models import reversion from stagecraft.apps.datasets.models.backdrop_user import BackdropUser from stagecraft.apps.datasets.models.data_set import DataSet class DataSetInline(admin.StackedInline): model = DataSet f...
Add filter_horizontal to backdrop user admin
Add filter_horizontal to backdrop user admin - Provides a much more usable interface to filter and add data_sets for backdrop admin users
Python
mit
alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft
3af95029c3f784e17247abcd0123156ff9384513
pronto/serializers/base.py
pronto/serializers/base.py
import abc import io import typing from typing import BinaryIO, ClassVar from ..ontology import Ontology class BaseSerializer(abc.ABC): format: ClassVar[str] = NotImplemented def __init__(self, ont: Ontology): self.ont = ont @abc.abstractmethod def dump(self, file: BinaryIO, encoding: str ...
import abc import io import typing from typing import BinaryIO, ClassVar from ..ontology import Ontology class BaseSerializer(abc.ABC): format: ClassVar[str] = NotImplemented def __init__(self, ont: Ontology): self.ont = ont @abc.abstractmethod def dump(self, file: BinaryIO) -> None: ...
Fix signature of `BaseSerializer.dump` to remove `encoding` argument
Fix signature of `BaseSerializer.dump` to remove `encoding` argument
Python
mit
althonos/pronto
dbc234df7541f6aab32bce0c8f8ba149f9e4ad22
speeches/management/commands/populatespeakers.py
speeches/management/commands/populatespeakers.py
from django.core.management.base import NoArgsCommand import pprint from popit import PopIt from speeches.models import Speaker class Command(NoArgsCommand): help = 'Populates the database with people from Popit' def handle_noargs(self, **options): pp = pprint.PrettyPrinter(indent=4) # Do popu...
from django.core.management.base import NoArgsCommand import pprint from popit import PopIt from speeches.models import Speaker class Command(NoArgsCommand): help = 'Populates the database with people from Popit' def handle_noargs(self, **options): pp = pprint.PrettyPrinter(indent=4) # Do popu...
Make speaker population code use get_or_create instead of exception
Make speaker population code use get_or_create instead of exception
Python
agpl-3.0
opencorato/sayit,opencorato/sayit,opencorato/sayit,opencorato/sayit
93e7703e6b7c9115e441c1a285e508a7d0738639
mica/starcheck/__init__.py
mica/starcheck/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .starcheck import get_starcheck_catalog, get_starcheck_catalog_at_date, get_mp_dir, get_monitor_windows
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .starcheck import (get_starcheck_catalog, get_starcheck_catalog_at_date, get_mp_dir, get_monitor_windows, get_dither, get_att, get_starcat)
Add new get_ starcheck methods to exported/init methods
Add new get_ starcheck methods to exported/init methods
Python
bsd-3-clause
sot/mica,sot/mica
ab16cd72a2f2ed093f206b48379fb9f03f8d2f36
tests/example.py
tests/example.py
import unittest from src.dojo import Dojo """ Call "python -m tests.example" while being in parent directory to run tests in this file. """ class ExampleTest(unittest.TestCase): def test_example(self): dojo = Dojo() self.assertEqual(dojo.get_random_number(), 4) if __name__ == '__main__': uni...
import unittest from src.dojo import Dojo """ Call "python -m tests.example" while being in parent directory to run tests in this file. """ class ExampleTest(unittest.TestCase): def setUp(self): """ This method will be called *before* each test run. """ pass def tearDown(self): """ T...
Add setUp and tearDown to test file
Add setUp and tearDown to test file
Python
mit
pawel-lewtak/coding-dojo-template-python
0ff0a3137ea938b7db8167d132b08b9e8620e864
contrib/internal/run-pyflakes.py
contrib/internal/run-pyflakes.py
#!/usr/bin/env python # # Utility script to run pyflakes with the modules we care about and # exclude errors we know to be fine. import os import subprocess import sys module_exclusions = [ 'djblets', 'django_evolution', 'dist', 'ez_setup.py', 'settings_local.py', 'ReviewBoard.egg-info', ] ...
#!/usr/bin/env python # # Utility script to run pyflakes with the modules we care about and # exclude errors we know to be fine. import os import subprocess import sys module_exclusions = [ 'djblets', 'django_evolution', 'dist', 'ez_setup.py', 'htdocs', 'settings_local.py', 'ReviewBoard.e...
Exclude htdocs, because that just takes way too long to scan.
Exclude htdocs, because that just takes way too long to scan.
Python
mit
atagar/ReviewBoard,atagar/ReviewBoard,sgallagher/reviewboard,chazy/reviewboard,chipx86/reviewboard,Khan/reviewboard,custode/reviewboard,atagar/ReviewBoard,Khan/reviewboard,chazy/reviewboard,atagar/ReviewBoard,bkochendorfer/reviewboard,davidt/reviewboard,asutherland/opc-reviewboard,Khan/reviewboard,Khan/reviewboard,beol...
f996038681aed05645164642c8fed7d46735ca4b
deferrable/backend/sqs.py
deferrable/backend/sqs.py
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_or_thunk, visibility_timeout=30, wait_time=10, create_if_missing=False): if callable(sqs_connection_or_thunk): self.sqs_connection_thunk = sqs_co...
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10, create_if_missing=False): """To allow backends to be initialized lazily, this factory requires a thunk (p...
Remove option for non-thunk SQS initialization
Remove option for non-thunk SQS initialization
Python
mit
gamechanger/deferrable
48f6329a74bde4b045aff31e6b2def11c151d294
couchdb/tests/testutil.py
couchdb/tests/testutil.py
# -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import uuid from couchdb import client class TempDatabaseMixin(object): temp_dbs = None _d...
# -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import random import sys from couchdb import client class TempDatabaseMixin(object): temp_dbs ...
Use a random number instead of uuid for temp database name.
Use a random number instead of uuid for temp database name.
Python
bsd-3-clause
gcarranza/couchdb-python,jur9526/couchdb-python
f87585d51493157e89c0117a25bf7a6d4b2b135f
runtests.py
runtests.py
#!/usr/bin/env python import os import sys from django.conf import settings import django DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'spillway', 'tests', ), 'DATABASES': { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.spatialite', 'NAME': ':memory:' ...
#!/usr/bin/env python import os import sys from django.conf import settings import django DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'django.contrib.gis', 'spillway', 'tests', ), 'DATABASES': { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.spatialite', ...
Enable contrib.gis for test runs so templates are found
Enable contrib.gis for test runs so templates are found
Python
bsd-3-clause
kuzmich/django-spillway,barseghyanartur/django-spillway,bkg/django-spillway
e01140053a2a906084d0ba50801b17d4ae7ce850
samples/unmanage_node.py
samples/unmanage_node.py
import requests from orionsdk import SwisClient from datetime import datetime, timedelta def main(): hostname = 'localhost' username = 'admin' password = '' swis = SwisClient(hostname, username, password) results = swis.query('SELECT TOP 1 NodeID FROM Orion.Nodes') interfaceId = results['resu...
import requests from orionsdk import SwisClient from datetime import datetime, timedelta def main(): hostname = 'localhost' username = 'admin' password = '' swis = SwisClient(hostname, username, password) results = swis.query('SELECT NodeID, Caption FROM Orion.Nodes WHERE IPAddress = @ip_addr', i...
Correct node variable name and validate results
Correct node variable name and validate results
Python
apache-2.0
solarwinds/orionsdk-python
fd3c24537b9af6f7c79fc17b932c01372a569856
brake/backends/dummybe.py
brake/backends/dummybe.py
import random from cachebe import CacheBackend class DummyBackend(CacheBackend): """ A dummy rate-limiting backend that disables rate-limiting, for testing. """ def get_ip(self, request): return str(random.randrange(10e20))
import random from cachebe import CacheBackend class DummyBackend(CacheBackend): """ A dummy rate-limiting backend that disables rate-limiting, for testing. """ def get_ip(self, request): return str(random.randrange(10e20)) def limit(self, func_name, request, ip=True, ...
Make the dummy limit function always return nothing.
Make the dummy limit function always return nothing.
Python
bsd-3-clause
SilentCircle/django-brake,SilentCircle/django-brake,skorokithakis/django-brake,skorokithakis/django-brake