commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
01d4279b40eb9e3029f857bf9d81d66d0314532d | Bump version to 1.5.1 | Rockhopper-Technologies/enlighten | enlighten/__init__.py | enlighten/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2017 - 2020 Avram Lubkin, All Rights Reserved
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
**Enlighten Progress Bar**
Provi... | # -*- coding: utf-8 -*-
# Copyright 2017 - 2020 Avram Lubkin, All Rights Reserved
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
**Enlighten Progress Bar**
Provi... | mpl-2.0 | Python |
b54d7b8079bf414b1fe79061b33e41c6350707d6 | use integer instead of string | KreMat/mopidy-rotaryencoder | mopidy_rotaryencoder/__init__.py | mopidy_rotaryencoder/__init__.py | from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
__version__ = '0.1.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-RotaryEncoder'
ext_name = 'rotaryencoder'
version = __version__
def get_default_config(sel... | from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
__version__ = '0.1.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-RotaryEncoder'
ext_name = 'rotaryencoder'
version = __version__
def get_default_config(sel... | apache-2.0 | Python |
c2a79d8cbbb174530991d8b59578169ee9b2be44 | use absolute paths for external scripts in Spidermonkey wrapper | FND/jslint-cli,FND/jslint-cli | wrapper_spidermonkey.py | wrapper_spidermonkey.py | #!/usr/bin/env python
"""
wrapper for JSLint
requires Spidermonkey
Usage:
$ wrapper_spidermonkey.py <filepath>
TODO:
* support for JSLint options
"""
import sys
import os
import spidermonkey
from simplejson import loads as json
cwd = sys.path[0]
lint_path = os.path.join(cwd, "fulljslint.js")
json_path = os.pa... | #!/usr/bin/env python
"""
wrapper for JSLint
requires Spidermonkey
Usage:
$ wrapper_spidermonkey.py <filepath>
TODO:
* support for JSLint options
"""
import sys
import spidermonkey
from simplejson import loads as json
lint_path = "fulljslint.js"
json_path = "json2.js"
def main(args=None):
filepath = args[1... | bsd-3-clause | Python |
2271131d5c2794eeba256a9d9547fa925f7bdf73 | bump __version__ | dougnd/matplotlib2tikz,danielhkl/matplotlib2tikz,m-rossi/matplotlib2tikz,nschloe/matplotlib2tikz | matplotlib2tikz/__init__.py | matplotlib2tikz/__init__.py | # -*- coding: utf-8 -*-
#
'''Script to convert Matplotlib generated figures into TikZ/PGFPlots figures.
'''
__author__ = 'Nico Schlömer'
__email__ = 'nico.schloemer@gmail.com'
__copyright__ = 'Copyright (c) 2010-2016, %s <%s>' % (__author__, __email__)
__credits__ = []
__license__ = 'MIT License'
__version__ = '0.5.7'... | # -*- coding: utf-8 -*-
#
'''Script to convert Matplotlib generated figures into TikZ/PGFPlots figures.
'''
__author__ = 'Nico Schlömer'
__email__ = 'nico.schloemer@gmail.com'
__copyright__ = 'Copyright (c) 2010-2016, %s <%s>' % (__author__, __email__)
__credits__ = []
__license__ = 'MIT License'
__version__ = '0.5.6'... | mit | Python |
cd25fd1bd40a98886b92f5e3b357ee0ab2796c7b | add /query route, with plain text for mongo | pdpino/FlaskApp,pdpino/FlaskApp,pdpino/FlaskApp | flaskr/__init__.py | flaskr/__init__.py | #!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
# import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
a... | #!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
# import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
a... | mit | Python |
af4b53a85aec95c9ec7bf20b1c019ec0f397eacb | Bump version to 0.2.2 | flav-io/flavio,flav-io/flavio | flavio/_version.py | flavio/_version.py | __version__='0.2.2'
| __version__='0.2.1'
| mit | Python |
90571c86f39fee14fafcc9c030de66d4255c5d82 | Change naming style | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | lexos/interfaces/statistics_interface.py | lexos/interfaces/statistics_interface.py | from flask import request, session, render_template, Blueprint
from lexos.helpers import constants as constants
from lexos.interfaces.base_interface import detect_active_docs
from lexos.managers import utility, session_manager as session_manager
# this is a flask blue print
# it helps us to manage groups of views
# s... | from flask import request, session, render_template, Blueprint
from lexos.helpers import constants as constants
from lexos.managers import utility, session_manager as session_manager
from lexos.interfaces.base_interface import detect_active_docs
# this is a flask blue print
# it helps us to manage groups of views
# s... | mit | Python |
009cdf804f0f730ed081c6003eedb1015283948f | update to test for non categorized event publishing | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | lg_replay/test/offline/test_lg_replay.py | lg_replay/test/offline/test_lg_replay.py | #!/usr/bin/env python
PKG = 'lg_replay'
NAME = 'test_lg_replay'
import rospy
import unittest
import json
from evdev import InputEvent
from lg_replay import DeviceReplay
from interactivespaces_msgs.msg import GenericMessage
class MockDevice:
def __init__(self):
self.events = [
InputEvent(144... | #!/usr/bin/env python
PKG = 'lg_replay'
NAME = 'test_lg_replay'
import rospy
import unittest
import json
from evdev import InputEvent
from lg_replay import DeviceReplay
from interactivespaces_msgs.msg import GenericMessage
class MockDevice:
def __init__(self):
self.events = [
InputEvent(144... | apache-2.0 | Python |
25f57a023f978fca94bbeb9655a4d90f0b2d95f0 | Fix typo | martinjrobins/hobo,martinjrobins/hobo,martinjrobins/hobo,martinjrobins/hobo | pints/toy/__init__.py | pints/toy/__init__.py | #
# Root of the toy module.
# Provides a number of toy models and logpdfs for tests of Pints' functions.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
from __future_... | #
# Root of the toy module.
# Provides a number of toy models and logpdfs for tests of Pints' functions.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
from __future_... | bsd-3-clause | Python |
5b120e5b89c06a0a5c01f8c710f85a4a179f56f7 | Change HTML theme to match BIND ARM, add copyright, EPUB info | isc-projects/isc-dnssec-guide | doc/conf.py | doc/conf.py | ############################################################################
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozil... | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | isc | Python |
6366fe6da78cd0e910b52352b918ff18d89f25c4 | update tests_forms | dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall | myideas/core/tests/test_forms.py | myideas/core/tests/test_forms.py | from django.test import TestCase
from django.shortcuts import resolve_url as r
from registration.forms import RegistrationForm
from myideas.core.forms import IdeasForm, IdeasFormUpdate
class IdeasFormTest(TestCase):
def setUp(self):
self.form = IdeasForm()
def test_form_has_fields(self):
"""... | from django.test import TestCase
from django.shortcuts import resolve_url as r
from registration.forms import RegistrationForm
from myideas.core.forms import IdeasForm, IdeasFormUpdate
class IdeasFormTest(TestCase):
def setUp(self):
self.form = IdeasForm()
def test_form_has_fields(self):
""... | agpl-3.0 | Python |
b3dfb211d0d81210dcaa317a0d6f79b6ad249816 | Update netlogo_example.py | quaquel/EMAworkbench,quaquel/EMAworkbench | ema_workbench/examples/netlogo_example.py | ema_workbench/examples/netlogo_example.py | """
This example is a proof of principle for how NetLogo models can be
controlled using pyNetLogo and the ema_workbench. Note that this
example uses the NetLogo 6 version of the predator prey model that
comes with NetLogo. If you are using NetLogo 5, replace the model file
with the one that comes with NetLogo.
"""
im... | '''
This example is a proof of principle for how NetLogo models can be
controlled using pyNetLogo and the ema_workbench. Note that this
example uses the NetLogo 6 version of the predator prey model that
comes with NetLogo. If you are using NetLogo 5, replace the model file
with the one that comes with NetLogo.
'''
fr... | bsd-3-clause | Python |
8c6f178782b6470b98536a2384391970e0cbafb9 | Update config file | edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io,edwinksl/edwinksl.github.io | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Edwin Khoo'
SITENAME = 'Edwin Khoo'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = No... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Edwin Khoo'
SITENAME = 'Edwin Khoo'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = No... | mit | Python |
5cf5c6028bd7007a867691af966f89574f02de1f | clean up setup | sxend/FrameworkBenchmarks,victorbriz/FrameworkBenchmarks,Dith3r/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,nbrady-techempower/FrameworkBenchmarks,grob/FrameworkBenchmarks,yunspace/FrameworkBenchmarks,zapov/FrameworkBenchmarks,yunspace/FrameworkBenchmarks,F3Community/FrameworkBenchmarks,zapov/FrameworkBenchmark... | mojolicious/setup.py | mojolicious/setup.py | import subprocess
import sys
import json
from os.path import expanduser
import os
import getpass
home = expanduser("~")
def start(args, logfile, errfile):
conf = {
'database_host' : args.database_host,
'workers' : args.max_threads,
}
with open('mojolicious/app.conf', 'w') as f:
f.write(json.d... | import subprocess
import sys
#import setup_util
import json
from os.path import expanduser
import os
import getpass
home = expanduser("~")
def start(args, logfile, errfile):
# setup_util.replace_text("mojolicious/app.pl", "localhost", ""+ args.database_host +"")
# str(args.max_threads)
conf = {
'database_h... | bsd-3-clause | Python |
8d935a2141b8f5c080d922189df7d79bb838b3a0 | Use default router implementation | dz0ny/mopidy-lux,dz0ny/mopidy-lux | mopidy_lux/router.py | mopidy_lux/router.py | import os
from tinydb import TinyDB
from tinydb.storages import JSONStorage
from tinydb.middlewares import CachingMiddleware
import tornado.web
from mopidy import http
class LuxRouter(http.Router):
name = 'lux'
def setup_routes(self):
db = TinyDB(
self.config['lux']['db_file'],
... | import os
from tinydb import TinyDB
from tinydb.storages import JSONStorage
from tinydb.middlewares import CachingMiddleware
import tornado.web
class LuxRouter(object):
def __init__(self, _config):
self.config = _config
self._db = TinyDB(
self.config['lux']['db_file'],
sto... | mit | Python |
32481a906e00a1c5d301e6227ab43cf8feba31e0 | fix double-import trap | dpranke/pyjson5 | json5/__init__.py | json5/__init__.py | # Copyright 2014 Google Inc. 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 ag... | # Copyright 2014 Google Inc. 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 ag... | apache-2.0 | Python |
95bde4f783a4d11627d8bc64e24b383e945bdf01 | Revert local CDN location set by Jodok | crate/crate-web,jomolinare/crate-web,crate/crate-web,crate/crate-web,jomolinare/crate-web,jomolinare/crate-web | src/web/tags.py | src/web/tags.py | # -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
__docformat__ = "reStructuredText"
import json
import datetime
from django.template.base import Library
from django.utils.safestring import mark_safe
register = Library()
CDN_URL = 'https://cdn.crate.io'
def media(context, media_url):
"""
Get the path... | # -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
__docformat__ = "reStructuredText"
import json
import datetime
from django.template.base import Library
from django.utils.safestring import mark_safe
register = Library()
#CDN_URL = 'https://cdn.crate.io'
CDN_URL = 'http://localhost:8001'
def media(context, m... | apache-2.0 | Python |
06f328b5843d83946b353697745ec82c7741ee3e | Allow colons in record label URLs (for timestamps such as '2013-02-13_08:42:00'). | babsey/sumatra,apdavison/sumatra,maxalbert/sumatra,babsey/sumatra,open-research/sumatra,dpad/sumatra,maxalbert/sumatra,open-research/sumatra,dpad/sumatra,babsey/sumatra,babsey/sumatra,maxalbert/sumatra,open-research/sumatra,dpad/sumatra,dpad/sumatra,apdavison/sumatra,maxalbert/sumatra,open-research/sumatra,apdavison/su... | src/web/urls.py | src/web/urls.py | """
Define URL dispatching for the Sumatra web interface.
"""
from django.conf.urls.defaults import *
from django.views.generic import list_detail
from django.conf import settings
from sumatra.web.views import Timeline
P = {
'project': r'(?P<project>\w+[\w ]*)',
'label': r'(?P<label>\w+[\w|\-\.:]*)',
}
urlpa... | """
Define URL dispatching for the Sumatra web interface.
"""
from django.conf.urls.defaults import *
from django.views.generic import list_detail
from django.conf import settings
from sumatra.web.views import Timeline
P = {
'project': r'(?P<project>\w+[\w ]*)',
'label': r'(?P<label>\w+[\w|\-\.]*)',
}
urlpat... | bsd-2-clause | Python |
a1cbeb7f7a03d0618ec9f60f65308168e521af18 | Add encodings for imul instructions to RISC-V. | stoklund/cretonne,sunfishcode/cretonne,stoklund/cretonne,sunfishcode/cretonne,stoklund/cretonne,sunfishcode/cretonne | meta/isa/riscv/encodings.py | meta/isa/riscv/encodings.py | """
RISC-V Encodings.
"""
from __future__ import absolute_import
from cretonne import base
from .defs import RV32, RV64
from .recipes import OPIMM, OPIMM32, OP, OP32, R, Rshamt, I
from .settings import use_m
# Basic arithmetic binary instructions are encoded in an R-type instruction.
for inst, inst_imm, ... | """
RISC-V Encodings.
"""
from __future__ import absolute_import
from cretonne import base
from .defs import RV32, RV64
from .recipes import OPIMM, OPIMM32, OP, OP32, R, Rshamt, I
# Basic arithmetic binary instructions are encoded in an R-type instruction.
for inst, inst_imm, f3, f7 in [
(bas... | apache-2.0 | Python |
d017c2a2e09d043caecd555217a399453c7e60b8 | fix migration imports | praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub | eventstore/migrations/0050_askfeedback.py | eventstore/migrations/0050_askfeedback.py | # Generated by Django 2.2.24 on 2021-12-07 06:26
import uuid
import django.contrib.postgres.fields.jsonb
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("eventstore", "0049_auto_20211202_1220")]
operations = [
migrations... | # Generated by Django 2.2.24 on 2021-12-07 06:26
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
dependencies = [("eventstore", "0049_auto_20211202_1220")]
operations = [
migrations.... | bsd-3-clause | Python |
5763c341a1660e13b70780a37d822eed65b00255 | refactor example fit_text_path_into_box.py | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/addons/fit_text_path_into_box.py | examples/addons/fit_text_path_into_box.py | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf import path, zoom
from ezdxf.math import Matrix44
from ezdxf.tools import fonts
from ezdxf.addons import text2path
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".... | # Copyright (c) 2021, Manfred Moitzi
# License: MIT License
from pathlib import Path
import ezdxf
from ezdxf import path, zoom
from ezdxf.math import Matrix44
from ezdxf.tools import fonts
from ezdxf.addons import text2path
DIR = Path("~/Desktop/Outbox").expanduser()
fonts.load()
doc = ezdxf.new()
doc.layers.new("... | mit | Python |
daed646ff987bc86b333a995bac1283360a583ef | bump up version to 0.1.2 | mogproject/javactl,mogproject/javactl | src/javactl/__init__.py | src/javactl/__init__.py | __version__ = '0.1.2'
| __version__ = '0.1.1'
| apache-2.0 | Python |
c6453752f9630a760cd2b2508d9ba39413871d86 | Update SensorMotorTest.py | WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS | 04Dan/SensorMotorTest.py | 04Dan/SensorMotorTest.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
##GPIO.setup(18, GPIO.OUT) servo
##GPIO.setup(22, GPIO.OUT) motor
GPIO.setup(16, GPIO.IN) ##button
try:
while True:
i = GPIO.input(16)
print(i)
delay(1000)
except Keyboardinterrupt:
GPIO.cleanup()
| import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
##GPIO.setup(18, GPIO.OUT) servo
##GPIO.setup(22, GPIO.OUT) motor
GPIO.setup(16, GPIO.IN) ##button
try:
while True:
i = GPIO.input(16)
print(i)
delay(1000)
except Keyboardinterupt:
GPIO.cleanup()
| mit | Python |
c3ecc4a06a212da11f52c9c0cd5c7b5c8d500516 | Support -h/--help on createdb.py | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | createdb.py | createdb.py | #!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
if '-h' in sys.argv or '--help'in sys.argv:
print "createdb.py [--with-dev-data]"
sys.... | #!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
session = fmn.lib.models.init(uri, debug=True, create=True)
if '--with-dev-data' in sys.argv:... | lgpl-2.1 | Python |
29205582e07eaa8b28eea4b0691a9556d0999015 | Remove unused LoginForm | keybar/keybar | src/keybar/web/forms.py | src/keybar/web/forms.py | from django.utils.translation import ugettext_lazy as _
from django.contrib import auth
import floppyforms.__future__ as forms
from keybar.models.user import User
class RegisterForm(forms.ModelForm):
name = forms.CharField(label=_('Your name'),
widget=forms.TextInput(
attrs={'placeholder': _(... | from django.utils.translation import ugettext_lazy as _
from django.contrib import auth
import floppyforms.__future__ as forms
from keybar.models.user import User
class RegisterForm(forms.ModelForm):
name = forms.CharField(label=_('Your name'),
widget=forms.TextInput(
attrs={'placeholder': _(... | bsd-3-clause | Python |
8d8002062a0ecbf3720870d7561670a8c7e98da2 | Fix test for auth tokens store | cgwire/zou | test/stores/test_auth_tokens_store.py | test/stores/test_auth_tokens_store.py | from test.base import ApiTestCase
from zou.app.stores import auth_tokens_store
class CommandsTestCase(ApiTestCase):
def setUp(self):
super(CommandsTestCase, self).setUp()
self.store = auth_tokens_store
self.store.clear()
def tearDown(self):
self.store.clear()
def test_g... | from test.base import ApiTestCase
from zou.app.stores import auth_tokens_store
class CommandsTestCase(ApiTestCase):
def setUp(self):
super(CommandsTestCase, self).setUp()
self.store = auth_tokens_store
self.store.clear()
def tearDown(self):
self.store.clear()
def test_g... | agpl-3.0 | Python |
b1244fe396e2ed6acb72b3ccd151fbde24f78198 | Adjust yaml_reader for Waypoint type | CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg | src/waypoints_reader/scripts/yaml_reader.py | src/waypoints_reader/scripts/yaml_reader.py | #!/usr/bin/env python
# coding UTF-8
import yaml
import rospy
from goal_sender_msgs.srv import ApplyGoals
from goal_sender_msgs.msg import GoalSequence, Waypoint
from geometry_msgs.msg import Point, Quaternion
def read_yaml(path):
f = open(path, 'r')
waypoints = yaml.load(f)
f.close()
return waypoint... | #!/usr/bin/env python
# coding UTF-8
import yaml
import rospy
from goal_sender_msgs.srv import ApplyGoals
from goal_sender_msgs.msg import GoalSequence
from goal_sender_msgs.msg import Waypoint
def read_yaml(path):
f = open(path, 'r')
waypoints = yaml.load(f)
f.close()
return waypoints
def get_waypo... | bsd-3-clause | Python |
0f1551db96cd27ed20e62545cac1540a405e8f1a | fix bug | andrewsy97/Treehacks,andrewsy97/Treehacks | FlaskWebProject/views.py | FlaskWebProject/views.py | """
Routes and views for the flask application.
"""
import os
from datetime import datetime
from flask import render_template, request
from FlaskWebProject import app
from generate_summary_json import generate_summary_json
@app.route('/')
@app.route('/home')
def home():
"""Renders the home page."""
return re... | """
Routes and views for the flask application.
"""
import os
from datetime import datetime
from flask import render_template, request
from FlaskWebProject import app
from generate_summary_json import generate_summary_json
@app.route('/')
@app.route('/home')
def home():
"""Renders the home page."""
return re... | mit | Python |
529987bb17a05c041cdbf3bbe2a98edda72872fc | remove unneeded Todo | SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree | InvenTree/plugin/urls.py | InvenTree/plugin/urls.py | """
URL lookup for plugin app
"""
from django.conf.urls import url, include
from plugin import plugin_reg
PLUGIN_BASE = 'plugin' # Constant for links
def get_plugin_urls():
"""returns a urlpattern that can be integrated into the global urls"""
urls = []
for plugin in plugin_reg.plugins.values():
... | """
URL lookup for plugin app
"""
from django.conf.urls import url, include
from plugin import plugin_reg
PLUGIN_BASE = 'plugin' # Constant for links
def get_plugin_urls():
"""returns a urlpattern that can be integrated into the global urls"""
urls = []
for plugin in plugin_reg.plugins.values():
... | mit | Python |
6137a6f00abbeb81b080f534481bb255f950dd83 | access oauth token securely through azure | andrewsy97/Treehacks,andrewsy97/Treehacks | FlaskWebProject/views.py | FlaskWebProject/views.py | """
Routes and views for the Flask application.
"""
import os
from flask import render_template, request
from FlaskWebProject import app
from generate_summary_json import generate_summary_json
ACCESS_TOKEN = os.getenv('TREEHACKS_SLACK_ACCESS_TOKEN')
@app.route('/')
@app.route('/home')
def home():
"""Renders t... | """
Routes and views for the Flask application.
"""
from flask import render_template, request
from FlaskWebProject import app
from oauth_constants import TEST_TEAM_SLACK_ACCESS_TOKEN
from generate_summary_json import generate_summary_json
global TEST_TEAM_SLACK_ACCESS_TOKEN
@app.route('/')
@app.route('/home')
de... | mit | Python |
6565e5bd88ebe5fde8d65664041a9e8f571ca7d7 | switch to requests | samcheck/Scripts,samcheck/Scripts | IMGURdl/downloadIMGUR.py | IMGURdl/downloadIMGUR.py | # example from:
# https://www.toptal.com/python/beginners-guide-to-concurrency-and-parallelism-in-python
import json
import logging
import os
from pathlib import Path
from urllib.request import urlopen, Request
import requests
logger = logging.getLogger(__name__)
def get_links(client_id):
headers = {'Authorizati... | # example from:
# https://www.toptal.com/python/beginners-guide-to-concurrency-and-parallelism-in-python
import json
import logging
import os
from pathlib import Path
from urllib.request import urlopen, Request
# import requests
logger = logging.getLogger(__name__)
def get_links(client_id):
headers = {'Authoriza... | mit | Python |
1323154dfbc453959f3d64fef439288004f6461e | add test for SyntaxError on def f(a): global a | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_compile.py | Lib/test/test_compile.py | from test_support import verbose, TestFailed
if verbose:
print 'Running tests on argument handling'
try:
exec('def f(a, a): pass')
raise TestFailed, "duplicate arguments"
except SyntaxError:
pass
try:
exec('def f(a = 0, a = 1): pass')
raise TestFailed, "duplicate keyword arguments"
except Syn... | from test_support import verbose, TestFailed
if verbose:
print 'Running test on duplicate arguments'
try:
exec('def f(a, a): pass')
raise TestFailed, "duplicate arguments"
except SyntaxError:
pass
try:
exec('def f(a = 0, a = 1): pass')
raise TestFailed, "duplicate keyword arguments"
except Sy... | mit | Python |
69a735cd134723e4d47c02d21f4ff85a65d28148 | enable test_main.py | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_lib2to3.py | Lib/test/test_lib2to3.py | # Skipping test_parser and test_all_fixers
# because of running
from lib2to3.tests import (test_fixers, test_pytree, test_util, test_refactor,
test_parser, test_main as test_main_)
import unittest
from test.test_support import run_unittest
def suite():
tests = unittest.TestSuite()
lo... | # Skipping test_parser and test_all_fixers
# because of running
from lib2to3.tests import (test_fixers, test_pytree, test_util, test_refactor,
test_parser)
import unittest
from test.test_support import run_unittest
def suite():
tests = unittest.TestSuite()
loader = unittest.TestLoade... | mit | Python |
ae23c81ee18726755ed770d1d3654e50d28fb028 | Update views.py | bardia73/Graph,bardia-heydarinejad/Graph,bardia-heydarinejad/Graph,bardia73/Graph | chat/views.py | chat/views.py | from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.contrib import auth
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.views.decorators.csrf import csrf_exempt
import json
from chat.mo... | from django.shortcuts import render
# Create your views here.
| mit | Python |
a6acf8a68ee5b2ef185f279b6169a34c2b70896d | Increase feature version | darashenka/aem-cmd,darashenka/aem-cmd,darashenka/aem-cmd | acmd/__init__.py | acmd/__init__.py | # coding: utf-8
""" aem-cmd main module. """
__version__ = '0.12.0b'
# Standard error codes that can be returned from any tool.
OK = 0
UNCHANGED = 1
USER_ERROR = 4711
CONFIG_ERROR = 4712
SERVER_ERROR = 4713
INTERNAL_ERROR = 4714
import acmd.logger
init_log = acmd.logger.init_log
log = acmd.logger.log
warning = acmd... | # coding: utf-8
""" aem-cmd main module. """
__version__ = '0.11.1b'
# Standard error codes that can be returned from any tool.
OK = 0
UNCHANGED = 1
USER_ERROR = 4711
CONFIG_ERROR = 4712
SERVER_ERROR = 4713
INTERNAL_ERROR = 4714
import acmd.logger
init_log = acmd.logger.init_log
log = acmd.logger.log
warning = acmd... | mit | Python |
69c590d7cf2d328b9e6ef63ddf49933e67df9614 | fix typo | wolph/python-statsd | statsd/gauge.py | statsd/gauge.py | import statsd
class Gauge(statsd.Client):
'''Class to implement a statsd gauge
'''
def send(self, subname, value):
'''Send the data to statsd via self.connection
:keyword subname: The subname to report the data to (appended to the
client name)
:keyword value: The gau... | import statsd
class Gauge(statsd.Client):
'''Class to implement a statd gauge
'''
def send(self, subname, value):
'''Send the data to statsd via self.connection
:keyword subname: The subname to report the data to (appended to the
client name)
:keyword value: The gaug... | bsd-3-clause | Python |
b97edcc911419197099338085f0f2937286dead0 | Bump version | chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy | galaxy/__init__.py | galaxy/__init__.py | # (c) 2012-2014, Ansible, Inc. <support@ansible.com>
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | # (c) 2012-2014, Ansible, Inc. <support@ansible.com>
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | apache-2.0 | Python |
747fa98c7a9ec7906dfba44e4860d300825eee39 | Drop Py2 and six on tests/integration/modules/test_key.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/test_key.py | tests/integration/modules/test_key.py | import re
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
@pytest.mark.windows_whitelisted
class KeyModuleTest(ModuleCase):
@slowTest
def test_key_finger(self):
"""
test key.finger to ensure we receive a valid fingerprint
"""
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import re
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
@pytest.mark.windows_whitelisted
class KeyModuleTest(ModuleCase):
@slowTest
def test_key_finger(self)... | apache-2.0 | Python |
6140507068c7a42a988bad951c1a6f120de741fb | Update cam_timeLapse_Threaded_upload.py | philprobinson84/RPi,philprobinson84/RPi | camera/timelapse/cam_timeLapse_Threaded_upload.py | camera/timelapse/cam_timeLapse_Threaded_upload.py | #!/usr/bin/env python2.7
import time
import os
from subprocess import call
import sys
class Logger(object):
def __init__(self):
self.terminal = sys.stdout
self.log = open("logfile.log", "a")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
sys.... | #!/usr/bin/env python2.7
import time
import os
from subprocess import call
UPLOAD_INTERVAL = 60
def upload_file(inpath, outpath):
uploadCmd = "/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload %s %s" % (inpath, outpath)
call ([uploadCmd], shell=True)
while True:
# record start_time
start_time = time.tim... | artistic-2.0 | Python |
16fca36c2032929589a718507a74c87bee52c161 | move planarAxiPotential to top-level | followthesheep/galpy,jobovy/galpy,followthesheep/galpy,followthesheep/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy,followthesheep/galpy | galpy/potential.py | galpy/potential.py | from galpy.potential_src import Potential
from galpy.potential_src import planarPotential
from galpy.potential_src import linearPotential
from galpy.potential_src import verticalPotential
from galpy.potential_src import MiyamotoNagaiPotential
from galpy.potential_src import LogarithmicHaloPotential
from galpy.potential... | from galpy.potential_src import Potential
from galpy.potential_src import planarPotential
from galpy.potential_src import linearPotential
from galpy.potential_src import verticalPotential
from galpy.potential_src import MiyamotoNagaiPotential
from galpy.potential_src import LogarithmicHaloPotential
from galpy.potential... | bsd-3-clause | Python |
4c084313d2e27a620f194e6282a51aa1e94f7a35 | Change chunk so it only takes an int | muddyfish/PYKE,muddyfish/PYKE | node/floor_divide.py | node/floor_divide.py | #!/usr/bin/env python
from nodes import Node
class FloorDiv(Node):
char = "f"
args = 2
results = 1
@Node.test_func([3,2], [1])
@Node.test_func([6,-3], [-2])
def func(self, a:Node.number,b:Node.number):
"""a/b. Rounds down, returns an int."""
return a//b
@Node.test... | #!/usr/bin/env python
from nodes import Node
class FloorDiv(Node):
char = "f"
args = 2
results = 1
@Node.test_func([3,2], [1])
@Node.test_func([6,-3], [-2])
def func(self, a:Node.number,b:Node.number):
"""a/b. Rounds down, returns an int."""
return a//b
@Node.test... | mit | Python |
942e3b183859623d2f2a6bf874f8d763e960ea5b | Print AST during integration test | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/integration/test_integration.py | tests/integration/test_integration.py | import collections
import io
import json
import os
import pytest
import glob
import subprocess
import thinglang
from thinglang import run, utils
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
SEARCH_PATTERN = os.path.join(BASE_PATH, '**/*.thing')
TestCase = collections.namedtuple('TestCase', ['code', 'meta... | import collections
import io
import json
import os
import pytest
import glob
import subprocess
import thinglang
from thinglang import run, utils
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
SEARCH_PATTERN = os.path.join(BASE_PATH, '**/*.thing')
TestCase = collections.namedtuple('TestCase', ['code', 'meta... | mit | Python |
0dd41b65aaa0798a7a72a0d61d746bfa29bc3aad | Allow POST of fly and worm donors | 4dn-dcic/fourfront,hms-dbmi/fourfront,ENCODE-DCC/snovault,ClinGen/clincoded,ENCODE-DCC/encoded,ClinGen/clincoded,philiptzou/clincoded,kidaa/encoded,ENCODE-DCC/snovault,ENCODE-DCC/encoded,philiptzou/clincoded,ClinGen/clincoded,4dn-dcic/fourfront,hms-dbmi/fourfront,ClinGen/clincoded,philiptzou/clincoded,kidaa/encoded,ENC... | src/encoded/types/donor.py | src/encoded/types/donor.py | from ..schema_utils import (
load_schema,
)
from ..contentbase import (
location,
)
from .base import (
ACCESSION_KEYS,
ALIAS_KEYS,
Collection,
paths_filtered_by_status,
)
class DonorItem(Collection.Item):
base_types = ['donor'] + Collection.Item.base_types
embedded = set(['organism'])... | from ..schema_utils import (
load_schema,
)
from ..contentbase import (
location,
)
from .base import (
ACCESSION_KEYS,
ALIAS_KEYS,
Collection,
paths_filtered_by_status,
)
class DonorItem(Collection.Item):
base_types = ['donor'] + Collection.Item.base_types
embedded = set(['organism'])... | mit | Python |
b9133e2fe7444b4449ab67f4d726c20ce5e21cd8 | clean ups in presentation of names | rob-metalinkage/django-gazetteer,rob-metalinkage/django-gazetteer,rob-metalinkage/django-gazetteer | gazetteer/admin.py | gazetteer/admin.py | from django.contrib import admin
from django import forms
from gazetteer.models import *
from skosxl.models import Notation
from .settings import TARGET_NAMESPACE_FT
# Register your models here.
# works for Dango > 1.6
class NameInline(admin.TabularInline):
model = LocationName
readonly_fields = ['nameUsed',... | from django.contrib import admin
from django import forms
from gazetteer.models import *
from skosxl.models import Notation
from .settings import TARGET_NAMESPACE_FT
# Register your models here.
# works for Dango > 1.6
class NameInline(admin.TabularInline):
model = LocationName
class LocationTypeInlineForm... | cc0-1.0 | Python |
4ac7e5d15d3fba11ae37e5826ca6c7181539804b | Disable nested types tests affected by IMPALA-2295 | michaelhkw/incubator-impala,cloudera/Impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,michaelhkw/incubator-impala,cloudera/Impala,michaelhkw/incubator-impala,cloudera/Impala,cloudera/Impala | tests/query_test/test_nested_types.py | tests/query_test/test_nested_types.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
import pytest
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestNestedTypes(ImpalaTestSuite):
@classmethod
def get_workload(self):
return 'functional-query'
@classmethod
def add_test... | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
import pytest
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestNestedTypes(ImpalaTestSuite):
@classmethod
def get_workload(self):
return 'functional-query'
@classmethod
def add_test... | apache-2.0 | Python |
f5f0cc6998f28bee7ccdaf304d3bc5e7e45ab9a6 | save memory allocation using kwarg `out`. | chainer/chainer,niboshi/chainer,okuta/chainer,wkentaro/chainer,okuta/chainer,hvy/chainer,chainer/chainer,niboshi/chainer,hvy/chainer,wkentaro/chainer,hvy/chainer,hvy/chainer,okuta/chainer,chainer/chainer,niboshi/chainer,niboshi/chainer,chainer/chainer,okuta/chainer,pfnet/chainer,wkentaro/chainer,wkentaro/chainer | chainer/optimizer_hooks/gradient_hard_clipping.py | chainer/optimizer_hooks/gradient_hard_clipping.py | import chainer
from chainer import backend
class GradientHardClipping(object):
"""Optimizer/UpdateRule hook function for gradient clipping.
This hook function clips all gradient arrays to be within a lower and upper
bound.
Args:
lower_bound (float): The lower bound of the gradient value.
... | import chainer
class GradientHardClipping(object):
"""Optimizer/UpdateRule hook function for gradient clipping.
This hook function clips all gradient arrays to be within a lower and upper
bound.
Args:
lower_bound (float): The lower bound of the gradient value.
upper_bound (float): T... | mit | Python |
8c17d2076d54864094c3cd8ee51d514bc806c913 | bump version | jrversteegh/flexx,zoofIO/flexx,zoofIO/flexx,jrversteegh/flexx | flexx/__init__.py | flexx/__init__.py | """
`Flexx <https://flexx.readthedocs.io>`_ is a pure Python toolkit for
creating graphical user interfaces (GUI's), that uses web technology
for its rendering. Apps are written purely in Python; The
`PScript <https://pscript.readthedocs.io>`_ transpiler generates the
necessary JavaScript on the fly.
You can use Flexx... | """
`Flexx <https://flexx.readthedocs.io>`_ is a pure Python toolkit for
creating graphical user interfaces (GUI's), that uses web technology
for its rendering. Apps are written purely in Python; The
`PScript <https://pscript.readthedocs.io>`_ transpiler generates the
necessary JavaScript on the fly.
You can use Flexx... | bsd-2-clause | Python |
7ba77209687ae1bb1344cc09e3539f7e21bfe599 | Improve test of csvstack --filenames. | unpingco/csvkit,snuggles08/csvkit,doganmeh/csvkit,aequitas/csvkit,themiurgo/csvkit,bradparks/csvkit__query_join_filter_CSV_cli,matterker/csvkit,archaeogeek/csvkit,metasoarous/csvkit,jpalvarezf/csvkit,kyeoh/csvkit,nriyer/csvkit,gepuro/csvkit,bmispelon/csvkit,KarrieK/csvkit,Tabea-K/csvkit,moradology/csvkit,tlevine/csvkit... | tests/test_utilities/test_csvstack.py | tests/test_utilities/test_csvstack.py | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... | #!/usr/bin/env python
import sys
import StringIO
import unittest
from csvkit import CSVKitReader
from csvkit.utilities.stack import CSVStack
class TestCSVStack(unittest.TestCase):
def test_explicit_grouping(self):
# stack two CSV files
args = ["--groups", "asd,sdf", "-n", "foo", "examples/dummy.c... | mit | Python |
2f2114b47618ef6435543c05d941d3191ef44d5c | refactor Valuation functions | MBALearnsToCode/FinSymPy,MBALearnsToCode/CorpFin,MBALearnsToCode/CorpFin,MBALearnsToCode/FinSymPy | FinSymPy/Valuation.py | FinSymPy/Valuation.py |
def terminal_value(
terminal_cash_flow=0.,
long_term_discount_rate=.01,
long_term_growth_rate=0.):
return (1 + long_term_growth_rate) * terminal_cash_flow / (long_term_discount_rate - long_term_growth_rate)
def present_value(amount=0., discount_rate=0., nb_periods=0.):
return amount ... | from sympy.matrices import Determinant, Matrix
def terminal_value(
cash_flows=Matrix([0.]),
long_term_discount_rate=0.,
long_term_growth_rate=0.):
m, n = cash_flows.shape
if m == 1:
filter_vector = Matrix((n - 1) * [0] + [1])
tv = Determinant(cash_flows * filter_vector)... | mit | Python |
6ff7389f85485b8aa2848aa0e7420569c0c06f37 | Update pluginLoader. | splice/gofer,jortel/gofer,jortel/gofer,kgiusti/gofer,credativ/gofer,credativ/gofer,kgiusti/gofer,splice/gofer,splice/gofer | src/gopher/agent/plugin.py | src/gopher/agent/plugin.py | #
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | #
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | lgpl-2.1 | Python |
60f3c4e1bbd25d781cfba5993aac647d937c64c9 | add BillSource to public interface | opencivicdata/python-opencivicdata,opencivicdata/python-opencivicdata-django,opencivicdata/python-opencivicdata-django,influence-usa/python-opencivicdata-django,opencivicdata/python-opencivicdata-divisions,opencivicdata/python-opencivicdata,rshorey/python-opencivicdata-django,opencivicdata/python-opencivicdata-django,r... | opencivicdata/models/__init__.py | opencivicdata/models/__init__.py | # flake8: NOQA
from .jurisdiction import Jurisdiction, JurisdictionSession
from .division import Division
from .people_orgs import (
Organization, OrganizationIdentifier, OrganizationName, OrganizationContactDetail,
OrganizationLink, OrganizationSource,
Person, PersonIdentifier, PersonName, PersonContactDet... | # flake8: NOQA
from .jurisdiction import Jurisdiction, JurisdictionSession
from .division import Division
from .people_orgs import (
Organization, OrganizationIdentifier, OrganizationName, OrganizationContactDetail,
OrganizationLink, OrganizationSource,
Person, PersonIdentifier, PersonName, PersonContactDet... | bsd-3-clause | Python |
5232597d574f7089f592aac0a5f25efd1ff7763a | Update test_blt.py. | cjerdonek/open-rcv,cjerdonek/open-rcv | openrcv/test/formats/test_blt.py | openrcv/test/formats/test_blt.py |
from textwrap import dedent
from openrcv.formats.blt import BLTFileWriter
from openrcv.models import BallotsResource, ContestInput
from openrcv.streams import StringResource
from openrcv.utiltest.helpers import UnitCase
class BLTFileWriterTest(UnitCase):
def test(self):
contest = ContestInput()
... |
from textwrap import dedent
from openrcv.formats.blt import BLTFileWriter
from openrcv.models import BallotsResource, ContestInput
from openrcv.utils import StringInfo
from openrcv.utiltest.helpers import UnitCase
class BLTFileWriterTest(UnitCase):
def test(self):
contest = ContestInput()
conte... | mit | Python |
ff63f077fe68ae18b409598a3860d0abbc7442e3 | fix num_topics property | cheral/orange3-text,cheral/orange3-text,cheral/orange3-text | orangecontrib/text/topics/hdp.py | orangecontrib/text/topics/hdp.py | from gensim import models
from .topics import GensimWrapper
class HdpModel(models.HdpModel):
def __init__(self, corpus, id2word, **kwargs):
# disable fitting during initialization
_update = self.update
self.update = lambda x: x
super().__init__(corpus, id2word, **kwargs)
s... | from gensim import models
from .topics import GensimWrapper
class HdpModel(models.HdpModel):
def __init__(self, corpus, id2word, **kwargs):
# disable fitting during initialization
_update = self.update
self.update = lambda x: x
super().__init__(corpus, id2word, **kwargs)
s... | bsd-2-clause | Python |
3a247b72ba39bb2f49099905c435127aea424fe0 | Remove unused variable | La0/mozilla-relengapi,mozilla-releng/services,garbas/mozilla-releng-services,garbas/mozilla-releng-services,srfraser/services,mozilla-releng/services,srfraser/services,lundjordan/services,mozilla-releng/services,garbas/mozilla-releng-services,srfraser/services,lundjordan/services,mozilla-releng/services,La0/mozilla-rel... | lib/backend_common/tests/conftest.py | lib/backend_common/tests/conftest.py | """Configure a mock application to run queries against"""
import pytest
from flask_login import current_user
from flask import jsonify
from backend_common import create_app, auth, auth0, mocks
from os.path import join, dirname
@pytest.fixture(scope='module')
def app():
"""
Build an app with an authenticated ... | """Configure a mock application to run queries against"""
import pytest
from flask_login import current_user
from flask import jsonify
from backend_common import create_app, auth, auth0, mocks
from os.path import join, dirname
FAKE_CLIENT_SECRETS = """
{
"web": {
"auth_uri": "https://auth.mozilla.auth0.co... | mpl-2.0 | Python |
6cd9af9d1c2f6b7e366c4bcc0b7c7422d4f776be | Add device events hook to app engine app. | tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation | src/appengine/main.py | src/appengine/main.py | import json
import logging
import os
import random
import string
import sys
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import login_required
from google.appengine.ext import db
from google.appengine.e... | import json
import logging
import os
import random
import string
import sys
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import login_required
from google.appengine.ext import db
from google.appengine.e... | mit | Python |
2c6a495351de52fe1de0b36d73f22e777ef3d08c | fix sqlalchemy url with sqlite prefix | saschagottfried/OpenShift-ToDoPyramid,saschagottfried/OpenShift-ToDoPyramid,saschagottfried/OpenShift-ToDoPyramid | wsgi/todopyramid/todopyramid/__init__.py | wsgi/todopyramid/todopyramid/__init__.py | import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import (
DBSession,
Base,
)
from .views import get_user
def get_db_session(request):
"""return thread-local DB session"""
return DBSession
def main(global_config, **settings):
""" This f... | import os
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from .models import (
DBSession,
Base,
)
from .views import get_user
def get_db_session(request):
"""return thread-local DB session"""
return DBSession
def main(global_config, **settings):
""" This f... | mit | Python |
926df1bc4dee9fc613f0fb31bb8c579943008645 | Update plot_label_propagation_digits.py (#22725) | TomDLT/scikit-learn,espg/scikit-learn,anntzer/scikit-learn,scikit-learn/scikit-learn,jakirkham/scikit-learn,betatim/scikit-learn,lesteve/scikit-learn,manhhomienbienthuy/scikit-learn,lesteve/scikit-learn,jakirkham/scikit-learn,vinayak-mehta/scikit-learn,ivannz/scikit-learn,scikit-learn/scikit-learn,TomDLT/scikit-learn,s... | examples/semi_supervised/plot_label_propagation_digits.py | examples/semi_supervised/plot_label_propagation_digits.py | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause | Python |
4b7e6d7df8a447873bc57adfedfb6013b915190c | Fix Node.namespace_uri for py3 | 5monkeys/content-io | cio/node.py | cio/node.py | # coding=utf-8
from __future__ import unicode_literals
from .environment import env
from .utils.formatters import ContentFormatter
from .utils.uri import URI
import six
empty = object()
class Node(object):
_formatter = ContentFormatter()
def __init__(self, uri, content=None, **meta):
self.env = en... | # coding=utf-8
from __future__ import unicode_literals
from .environment import env
from .utils.formatters import ContentFormatter
from .utils.uri import URI
import six
empty = object()
class Node(object):
_formatter = ContentFormatter()
def __init__(self, uri, content=None, **meta):
self.env = en... | bsd-3-clause | Python |
3a42b4458f85d8f2640c34fce79c9a99a79f5323 | Revert "add second db connection to coastdat" | openego/data_processing | calc_renpass_gis/scenario_reader/db.py | calc_renpass_gis/scenario_reader/db.py | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Float, ForeignKey, Integer, MetaData, String,
Table, join, create_engine, ForeignKeyConstraint,
Boolean, DateTime, Sequence)
from sqlalchemy.orm import sessionmaker, relationship, configure_mappers
# from sqlalchemy.... | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Float, ForeignKey, Integer, MetaData, String,
Table, join, create_engine, ForeignKeyConstraint,
Boolean, DateTime, Sequence)
from sqlalchemy.orm import sessionmaker, relationship, configure_mappers
# from sqlalchemy.... | agpl-3.0 | Python |
49152781ecbfb4f51707e6e54641301038eba80f | set varchar length | nebgnahz/CS268NetworkMeasurement,nebgnahz/CS268NetworkMeasurement,nebgnahz/CS268NetworkMeasurement | king/DataPoint.py | king/DataPoint.py | from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, PickleType, Boolean, String, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
engine = create_engine('mysql+pymysql://ucb_268_measure:ucb_268_measure@data.c... | from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, PickleType, Boolean, String, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
engine = create_engine('mysql+pymysql://ucb_268_measure:ucb_268_measure@data.c... | bsd-2-clause | Python |
93db3543a576ccde905fc77d7c3ad825f6a100a1 | change threshold | derwind/fontUtils,derwind/fontUtils,derwind/fontUtils,derwind/fontUtils,derwind/otfparser,derwind/otfparser | misc_scripts/compare_bounds.py | misc_scripts/compare_bounds.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re
from fontTools.ttLib import TTFont
from fontTools.pens.boundsPen import BoundsPen, ControlBoundsPen
class ConcordanceInfo(object):
def __init__(self):
self.glyphs = 0
self.concordant_glyphs = 0
self.maxdiff = 0
self.... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re
from fontTools.ttLib import TTFont
from fontTools.pens.boundsPen import BoundsPen, ControlBoundsPen
class ConcordanceInfo(object):
def __init__(self):
self.glyphs = 0
self.concordant_glyphs = 0
self.maxdiff = 0
self.... | apache-2.0 | Python |
be0b85f50b8cd4f7323d5c6def5c388c7a8fad36 | fix webhook | Windfarer/episode,Windfarer/episode | webhooks.py | webhooks.py | from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import shutil
from episode import GitRepo, Episode
WORK_DIR = "repo"
class WebHookHandler(BaseHTTPRequestHandler):
def do_POST(self):
event_type = self.headers.get('X-Github-Event')
if event_type != 'push':
... | from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import shutil
from episode import GitRepo, Episode
WORK_DIR = "repo"
class WebHookHandler(BaseHTTPRequestHandler):
def do_POST(self):
event_type = self.headers.get('X-Github-Event')
if event_type != 'push':
... | mit | Python |
4787c9e1b895b5ce0bdd0fedeb537a971fab5933 | add management command to benchmark get_direct_ccz | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.management.commands.benchmark_build_times import Timer
f... | bsd-3-clause | Python | |
585317f3a03f55f6487a98446d4a9279f91714d2 | Add a test of the linearity of scalar multiplication | ppb/ppb-vector,ppb/ppb-vector | tests/test_vector2_scalar_multiplication.py | tests/test_vector2_scalar_multiplication.py | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | artistic-2.0 | Python |
cecbb5951ef806c5b4b7b6894c05e4d086730fb0 | order fy descending (newest on top) | camptocamp/c2c-rd-addons,Endika/c2c-rd-addons,Antiun/c2c-rd-addons,Endika/c2c-rd-addons,Antiun/c2c-rd-addons,Antiun/c2c-rd-addons,camptocamp/c2c-rd-addons,camptocamp/c2c-rd-addons,VitalPet/c2c-rd-addons,Endika/c2c-rd-addons,VitalPet/c2c-rd-addons,VitalPet/c2c-rd-addons | base_ordered/ordered.py | base_ordered/ordered.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
#
# This program is free softw... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
#
# This program is free softw... | agpl-3.0 | Python |
2fedc43c50bd933924046b6f79633687a452116a | bump version | jklynch/mr-fitty,jklynch/mr-fitty | src/mrfitty/__init__.py | src/mrfitty/__init__.py | __version__ = '0.12.0'
| __version__ = '0.11.0'
| mit | Python |
f5e2e7cbb494fc111efcf4abd5c744091e9ee8aa | Fix function name error | shinken-monitoring/mod-webui,mohierf/mod-webui,rednach/mod-webui,rednach/mod-webui,vizvayu/mod-webui,vizvayu/mod-webui,shinken-monitoring/mod-webui,rednach/mod-webui,mohierf/mod-webui,mohierf/mod-webui,shinken-monitoring/mod-webui | module/submodules/graphs.py | module/submodules/graphs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import time
from shinken.log import logger
from .metamodule import MetaModule
class GraphsMetaModule(MetaModule):
_functions = ['get_graph_uris']
_custom_log = "You should configure the module 'graphite' in your broker and the mo... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import time
from shinken.log import logger
from .metamodule import MetaModule
class GraphsMetaModule(MetaModule):
_functions = ['get_graph_uris']
_custom_log = "You should configure the module 'graphite' in your broker and the mo... | agpl-3.0 | Python |
e69542c01959e7cf874c6ca1ae5c94d0c9a0ba1f | Fix tarball URL's for htslib (#5993) | iulian787/spack,EmreAtes/spack,tmerrick1/spack,EmreAtes/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,iulian787/spack,LLNL/spack,lgarren/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,mfherbst/spack,matthiasdiener/spack,tmerrick1/spack,krafczyk/spack,skosukhin/spack,tmerrick1/spack,matthiasdiener/spac... | var/spack/repos/builtin/packages/htslib/package.py | var/spack/repos/builtin/packages/htslib/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
7f29770766a30bf821689960189e95526eee6bdc | print python version if using file directly, not as import | hchiam/cognateLanguage | getDataRemotely.py | getDataRemotely.py | import sys
from dictAsFile_wrapper import *
def run():
hashtableName = 'hashtable.pkl'
data = {}
# use different import based on python version number:
if (sys.version_info > (3, 0)):
# python 3:
if __name__ == '__main__':
print('python 3')
import urllib.reques... | import sys
from dictAsFile_wrapper import *
def run():
hashtableName = 'hashtable.pkl'
data = {}
# use different import based on python version number:
if (sys.version_info > (3, 0)):
# python 3:
print('python 3')
import urllib.request
url = 'https://raw.githubuser... | mit | Python |
9c218079f00e9b3c7285cd94dcc7836531f722a5 | Install RMPISNOW wrapper in prefix.bin for r-snow (#16479) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/r-snow/package.py | var/spack/repos/builtin/packages/r-snow/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RSnow(RPackage):
"""Support for simple parallel computing in R."""
homepage = "https:... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RSnow(RPackage):
"""Support for simple parallel computing in R."""
homepage = "https:... | lgpl-2.1 | Python |
f42744558b989f8122f67d24bf65c8514eb516cb | Use better names for generated IR files. | djc/runa,djc/runa,djc/runa,djc/runa | runac/__init__.py | runac/__init__.py | from . import tokenizer, ast, blocks, ti, specialize, codegen
from util import Error
import sys, os, subprocess, tempfile
BASE = os.path.dirname(__path__[0])
CORE_DIR = os.path.join(BASE, 'core')
TRIPLES = {
'darwin': 'x86_64-apple-darwin11.0.0',
'linux2': 'x86_64-pc-linux-gnu',
}
def tokenize(f):
return tokenize... | from . import tokenizer, ast, blocks, ti, specialize, codegen
from util import Error
import sys, os, subprocess, tempfile
BASE = os.path.dirname(__path__[0])
CORE_DIR = os.path.join(BASE, 'core')
TRIPLES = {
'darwin': 'x86_64-apple-darwin11.0.0',
'linux2': 'x86_64-pc-linux-gnu',
}
def tokenize(f):
return tokenize... | mit | Python |
a328a1974b985eda47191748e28a69d1e521f070 | 实现FREEBUF的AJAX页面爬取的几种小爬虫-json库解析-科学方法 | NORTHERNhacker/many-spiders | freebufspider2.py | freebufspider2.py | import requests
from bs4 import BeautifulSoup
import json
for i in range(1, 20):
url = 'http://www.freebuf.com/www.freebuf.com?action=ajax_wenku&year=all&score=all&type=all&tech=0&keyword=&page=' + str(
i)
r = requests.get(url)
data = json.loads(r.text)#使用json库解析,科学的做法
soup = BeautifulSoup(data... | import requests
from bs4 import BeautifulSoup
import json
for i in range(1, 20):
url = 'http://www.freebuf.com/www.freebuf.com?action=ajax_wenku&year=all&score=all&type=all&tech=0&keyword=&page=' + str(
i)
r = requests.get(url)
data = json.loads(r.text)
soup = BeautifulSoup(data['cont'])
fo... | apache-2.0 | Python |
cd9e8c1595e0e987e2ec0067c9532a9778e64ea3 | Update test_plugin.py | kemiz/cloudify-logstash-plugin,cloudify-cosmo/cloudify-logstash-plugin,EarthmanT/cloudify-logstash-plugin | logstash_plugin/tests/test_plugin.py | logstash_plugin/tests/test_plugin.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | apache-2.0 | Python |
74a182a13bae5dde3e2b4fe604a839e5ec05e771 | load palette hoohah | cooperhewitt/py-cooperhewitt-swatchbook | cooperhewitt/swatchbook/palettes/__init__.py | cooperhewitt/swatchbook/palettes/__init__.py | def palettes():
return [
'css3',
'css4'
]
def load_palette(reference):
if not reference in palettes():
raise Exception, "Invalid palette"
# Please figure out the hoo-hah to make dynamic
# loading work (20140623/straup)
if reference == 'css3':
import css3
... | # I blame, Guido
| bsd-3-clause | Python |
220983a4cf75f4e27f5491812de9ff04f4104510 | fix butter_bandpass | vincentadam87/gatsby-hackathon-seizure,vincentadam87/gatsby-hackathon-seizure | code/python/seizures/preprocessing/preprocessing.py | code/python/seizures/preprocessing/preprocessing.py | import scipy.signal as signal
def preprocess_multichannel_data(matrix,fs):
"""
:param matrix: multichannel EEG data
:param fs: sampling frequency
:return: data without mains, electrical artefacts etc
authors: Lea and Vincent
"""
n_channel,m= matrix.shape
for i in range(n_channel):
... | import scipy.signal as signal
def preprocess_multichannel_data(matrix,fs):
"""
:param matrix: multichannel EEG data
:param fs: sampling frequency
:return: data without mains, electrical artefacts etc
authors: Lea and Vincent
"""
n_channel,m= matrix.shape
for i in range(n_channel):
... | bsd-2-clause | Python |
4a4e56a0909d8e89d82462c846f365b0849b3cb4 | add missing import | simpleton/eclipse2buck | generator/aidl.py | generator/aidl.py | #!/usr/bin/python
from eclipse2buck.generator.base_target import BaseTarget
from eclipse2buck.decorator import target
from eclipse2buck.util import util
from eclipse2buck import config
import os
class AIDL(BaseTarget):
"""
generated all aidl targets
"""
aidl_path_list = []
def __init__(self, root,... | #!/usr/bin/python
from eclipse2buck.generator.base_target import BaseTarget
from eclipse2buck.decorator import target
from eclipse2buck.util import util
from eclipse2buck import config
class AIDL(BaseTarget):
"""
generated all aidl targets
"""
aidl_path_list = []
def __init__(self, root, name):
... | mit | Python |
fe007b772f5f2ef50d99ce7967df33752f37a17c | adjust tests for is_advanced | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/export/tests/test_export_item.py | corehq/apps/export/tests/test_export_item.py | from django.test import SimpleTestCase
from corehq.apps.export.models import (
ExportItem,
ExportColumn,
)
class TestExportItemGeneration(SimpleTestCase):
app_id = '1234'
def setUp(self):
self.item = ExportItem(
path=['data', 'question1'],
label='Question One',
... | from django.test import SimpleTestCase
from corehq.apps.export.models import (
ExportItem,
ExportColumn,
)
class TestExportItemGeneration(SimpleTestCase):
app_id = '1234'
def setUp(self):
self.item = ExportItem(
path=['data', 'question1'],
label='Question One',
... | bsd-3-clause | Python |
6e7a20675cd66d9ca7d4a286958404198369dece | Validate ReplicationTopology data | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/physical/forms/replication_topology.py | dbaas/physical/forms/replication_topology.py | # -*- coding: utf-8 -*-
from django import forms
from django.forms.widgets import SelectMultiple
#from django.forms.widgets import CheckboxSelectMultiple
from ..models import ReplicationTopology, Parameter, DatabaseInfraParameter
class ReplicationTopologyForm(forms.ModelForm):
class Meta:
model = Replica... | from django import forms
from django.forms.widgets import SelectMultiple
#from django.forms.widgets import CheckboxSelectMultiple
from ..models import ReplicationTopology, Parameter
class ReplicationTopologyForm(forms.ModelForm):
class Meta:
model = ReplicationTopology
def __init__(self, *args, **kw... | bsd-3-clause | Python |
1820001e6ec6960014b5e9cf23eb7a2f8b90c213 | Remove a broken test case from decorators_test | deepmind/dm_control | dm_control/mujoco/testing/decorators_test.py | dm_control/mujoco/testing/decorators_test.py | # Copyright 2017 The dm_control 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | # Copyright 2017 The dm_control 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | apache-2.0 | Python |
b58d296373ed4ba75d0e6409e332e70abea76086 | add more axes labels | boada/vpCluster,boada/vpCluster | data/boada/analysis_all/redshifts/redshift_stats.py | data/boada/analysis_all/redshifts/redshift_stats.py | import pandas as pd
import pylab as pyl
from glob import glob
files = glob('*.csv')
for f in files:
results = pd.read_csv(f)
# good redshifts
try:
q0 = pyl.append(q0, results[results.Q == 0].r.values)
q1 = pyl.append(q1, results[results.Q == 1].r.values)
x = ~pyl.isnan(results.fibe... | import pandas as pd
import pylab as pyl
from glob import glob
files = glob('*.csv')
for f in files:
results = pd.read_csv(f)
# good redshifts
try:
q0 = pyl.append(q0, results[results.Q == 0].r.values)
q1 = pyl.append(q1, results[results.Q == 1].r.values)
x = ~pyl.isnan(results.fibe... | mit | Python |
b8399e48872271ccac6431d9f875238ff509a03a | Increment number of JS files in test_js_load | SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree | InvenTree/InvenTree/test_views.py | InvenTree/InvenTree/test_views.py | """
Unit tests for the main web views
"""
import re
import os
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
class ViewTests(TestCase):
""" Tests for various top-level views """
username = 'test_user'
password = 'test_pass'
def setUp... | """
Unit tests for the main web views
"""
import re
import os
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
class ViewTests(TestCase):
""" Tests for various top-level views """
username = 'test_user'
password = 'test_pass'
def setUp... | mit | Python |
83b6e177fccaef7d62682c25a0e82f29bcba01e6 | Remove autofilling "GSSAPI" mechanism in hue.ini | mapr/hue,mapr/hue,mapr/hue,mapr/hue,mapr/hue,mapr/hue,mapr/hue | desktop/core/src/desktop/lib/mapr_config_changer.py | desktop/core/src/desktop/lib/mapr_config_changer.py | import re
import os
MAPR_SECURITY = "MAPR-SECURITY"
SECURE = "secure"
SECURITY_ENABLED = 'security_enabled'
MECHANISM = 'mechanism'
MAPR_CLUSTERS_CONF_PATH = "/opt/mapr/conf/mapr-clusters.conf"
templates = {
MECHANISM: 'none',
SECURITY_ENABLED: 'false'
}
def read_values_from_mapr_clusters_conf():
if not os.pa... | import re
import os
GSSAPI = "GSSAPI"
MAPR_SECURITY = "MAPR-SECURITY"
KERBEROS_ENABLE = "kerberosEnable"
SECURE = "secure"
SECURITY_ENABLED = 'security_enabled'
MECHANISM = 'mechanism'
MAPR_CLUSTERS_CONF_PATH = "/opt/mapr/conf/mapr-clusters.conf"
templates = {
MECHANISM: 'none',
SECURITY_ENABLED: 'false'
}
def ... | apache-2.0 | Python |
06277ea30094ff6669537f2365b6ad9f5a19642b | Update laundry.py | JamesKBowler/fxcmminer | fxcmminer_v1.1/fxcmminer/cleaning/laundry.py | fxcmminer_v1.1/fxcmminer/cleaning/laundry.py | from event import CleanedDataEvent
class DataCleaner(object):
"""
The DataCleaner class is the process of correcting
(or removing) corrupt or inaccurate records from a record set
and refers to identifying incomplete, incorrect, inaccurate
or irrelevant parts of the data and then replacing,
modi... | from event import CleanedDataEvent
class DataCleaner(object):
"""
Basic data cleaning
"""
def __init__(self, events_queue):
"""
"""
self.events_queue = events_queue
def _remove_duplicates(self, data):
"""
Drop any duplicates in the Datetime Index
"""... | mit | Python |
4844ba065d86fdce3f01b7b191ecc6a4ef43661e | Add autoclass directives to Visualization/__init__.py. This will enable Visualization module methods to appear in function reference. | amdouglas/OpenPNM,PMEAL/OpenPNM,TomTranter/OpenPNM,stadelmanma/OpenPNM,amdouglas/OpenPNM | OpenPNM/Visualization/__init__.py | OpenPNM/Visualization/__init__.py | r"""
*******************************************************************************
:mod:`OpenPNM.Visualization`: Network Visualization
*******************************************************************************
.. module:: OpenPNM.Visualization
Contents
--------
tbd
.. note::
n/a
Classes
-------
.. auto... | r"""
*******************************************************************************
:mod:`OpenPNM.Visualization`: Network Visualization
*******************************************************************************
.. module:: OpenPNM.Visualization
Contents
--------
tbd
.. note::
n/a
Import
------
>>> import ... | mit | Python |
6e6ccc8566fe90323d900fd0ebd38f45ad4d0b63 | Update TipCalculator.py | ZEUSOFCS/Python | PracticePrograms/TipCalculator.py | PracticePrograms/TipCalculator.py | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | mit | Python |
953ce15f2a3b2ffdc0e27d95afbe4f8cda2cdbfd | set default behavior to add datacenters | softlayer/softlayer-python,allmightyspiff/softlayer-python | SoftLayer/CLI/image/datacenter.py | SoftLayer/CLI/image/datacenter.py | """Edit details of an image."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click.option('--add/--remove', default=True,
help="To add or remove Datac... | """Edit details of an image."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click.option('--add/--remove',
default=False,
help="To add ... | mit | Python |
cdd28cba2c6299e18b5d5221f8d10b8649c1faed | Use numpy | chainer/chainer,kikusu/chainer,jnishi/chainer,jnishi/chainer,ktnyt/chainer,cupy/cupy,pfnet/chainer,okuta/chainer,wkentaro/chainer,kiyukuta/chainer,jnishi/chainer,keisuke-umezawa/chainer,aonotas/chainer,keisuke-umezawa/chainer,AlpacaDB/chainer,niboshi/chainer,cupy/cupy,kashif/chainer,tkerola/chainer,cupy/cupy,hvy/chaine... | tests/chainer_tests/functions_tests/array_tests/test_expand_dims.py | tests/chainer_tests/functions_tests/array_tests/test_expand_dims.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_shape': (3, 2), 'out_shape': (1, 3, 2), 'axis': 0},
{'in_shape': (3, 2), 'out_shape':... | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_shape': (3, 2), 'out_shape': (1, 3, 2), 'axis': 0},
{'in_shape': (3, 2), 'out_shape':... | mit | Python |
d1fa13bdf3ca7d1c4eabdaace5758d6b031ef909 | Set up the download url, which I forgot about. | Rhombik/rhombik-object-repository,Rhombik/rhombik-object-repository,Rhombik/rhombik-object-repository,Rhombik/rhombik-object-repository,Rhombik/rhombik-object-repository | exampleSettings/urls.py | exampleSettings/urls.py | from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'post.views.list', name='home'),
(r'... | from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'post.views.list', name='home'),
(r'... | agpl-3.0 | Python |
5b1eefb315cd9094de8c8827e0f3a8c0eeefe95a | delete view: make sure item is closed before it is removed from storage | bepasty/bepasty-server,makefu/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,makefu/bepasty-server,bepasty/bepasty-server,makefu/bepasty-server | bepasty/views/delete.py | bepasty/views/delete.py | # Copyright: 2014 Dennis Schmalacker <github@progde.de>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, redirect, url_for, render_template, abort
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from . import blueprint
from ..utils.permissions ... | # Copyright: 2014 Dennis Schmalacker <github@progde.de>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, redirect, url_for, render_template, abort
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from . import blueprint
from ..utils.permissions ... | bsd-2-clause | Python |
aa5259efac8f7fbe8e2afd263198feaaa45fc4c3 | Change test for running on Tingbot | furbrain/tingbot-python | tingbot/platform_specific/__init__.py | tingbot/platform_specific/__init__.py | import platform, os
def is_tingbot():
"""
Return True if running as a tingbot.
"""
# TB_RUN_ON_LCD is an environment variable set by tbprocessd when running tingbot apps.
return 'TB_RUN_ON_LCD' in os.environ
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, regi... | import platform
def is_tingbot():
"""return True if running as a tingbot. We can update this function to be more smart in future"""
return platform.machine().startswith('armv71')
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, register_button_callback
elif is_tingbot():
... | bsd-2-clause | Python |
6f0676877f5c23c0e6d04422cb8365e16958eb82 | document potential for streaming | benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer | camerav4.py | camerav4.py | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v3 | Ben Broce & William Hampton\n\n"
print "Streams video to vids/vidstream.h264 | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n\n"
stream =... | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v3 | Ben Broce & William Hampton\n\n"
print "Streams video to vids/vidstream.h264 | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n\n"
stream =... | mit | Python |
48a30aade7e606e671db44e8ee69092c0e67b363 | Complete lc051_n_queens.py | bowen0701/algorithms_data_structures | lc051_n_queens.py | lc051_n_queens.py | """Leetcode 51. N-Queens.
Hard.
URL: https://leetcode.com/problems/n-queens/
The n-queens puzzle is the problem of placing n queens on an nxn chessboard
such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board confi... | """Leetcode 51. N-Queens.
Hard.
URL: https://leetcode.com/problems/n-queens/
The n-queens puzzle is the problem of placing n queens on an nxn chessboard
such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board confi... | bsd-2-clause | Python |
16c1ae09e0288036aae87eb4337c24b23b1e6638 | Clean up some unused imports and comments | timvandermeij/sentiment-analysis,timvandermeij/sentiment-analysis | classify.py | classify.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
import numpy as np
import json
import sys
from analyze import Analyzer # for some train data labelling
def main(argv):
group = argv[0] if len(argv) > 0 else "id"
... | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
import numpy as np
import json
import sys
import time
from analyze import Analyzer # for some train data labelling
def m... | mit | Python |
4f3d1e90ec4af618ada415f53ddd9eec42bafb38 | Indent with 4 spaces, not 3 | CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer | wafer/talks/tests/test_wafer_basic_talks.py | wafer/talks/tests/test_wafer_basic_talks.py | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talks
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
talk = ... | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talks
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
talk = Talks... | isc | Python |
7b0a6d27389f8e4abde77b2ed76dac795c33cfab | Use url_for | uranusjr/diffhtml | demo/app.py | demo/app.py | import flask
from flask import request
from markupsafe import Markup
import diffhtml
app = flask.Flask('Diff-HTML Demo')
DEFAULT_A = """
I am the very model of a modern Major-General,
I've information vegetable, animal, and mineral,
I know the kings of England, and I quote the fights historical,
From Marathon to ... | import flask
from flask import request
from markupsafe import Markup
import diffhtml
app = flask.Flask('Diff-HTML Demo')
DEFAULT_A = """
I am the very model of a modern Major-General,
I've information vegetable, animal, and mineral,
I know the kings of England, and I quote the fights historical,
From Marathon to ... | isc | Python |
68b2e1cb5a914d408761229bd27677e80967f5ff | Remove unused import. | potatolondon/django-hashbrown | hashbrown/management/commands/switches.py | hashbrown/management/commands/switches.py | from django.core.management.base import BaseCommand
from django.utils.six.moves import input
from hashbrown.models import Switch
from hashbrown.utils import SETTINGS_KEY, is_active, get_defaults
class Command(BaseCommand):
help = 'Creates / deletes feature switches in the database'
def add_arguments(self, p... | from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils.six.moves import input
from hashbrown.models import Switch
from hashbrown.utils import SETTINGS_KEY, is_active, get_defaults
class Command(BaseCommand):
help = 'Creates / deletes feature switches in the databa... | bsd-2-clause | Python |
114d7bc6b45d18f528a7ed5c12e1938e35efb93c | Update hash_db_password.py | dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,zhounanshu... | bin/hash_db_password.py | bin/hash_db_password.py | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | import sys
from werkzeug.security import generate_password_hash
from flask_appbuilder.security.models import User
try:
from app import app, db
except:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
if len(sys.argv) < 2:
print "Without typical app structure use parameter t... | bsd-3-clause | Python |
3224a95d79f6e3166e235f4cfc857a48d1b17c52 | Revise docstring: memoization | bowen0701/algorithms_data_structures | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get the nth number of Fibonacci series, Fn, by recursion.
-... | bsd-2-clause | Python |
858e84f336f76a1e65b730834ad8ffb346ee6b0f | fix logger singleton to work with pyjd | gpitel/pyjs,spaceone/pyjs,pombredanne/pyjs,minghuascode/pyj,spaceone/pyjs,pombredanne/pyjs,Hasimir/pyjs,Hasimir/pyjs,Hasimir/pyjs,minghuascode/pyj,anandology/pyjamas,pyjs/pyjs,pombredanne/pyjs,spaceone/pyjs,anandology/pyjamas,gpitel/pyjs,anandology/pyjamas,minghuascode/pyj,pyjs/pyjs,lancezlin/pyjs,minghuascode/pyj,pyjs... | examples/mail/Logger.py | examples/mail/Logger.py | from pyjamas.ui.Grid import Grid
_logger = None
class LoggerCls(Grid):
def __init__(self):
Grid.__init__(self)
self.targets=[]
self.targets.append("app")
#self.targets.append("ui")
self.resize(len(self.targets)+1, 2)
self.setBorderWidth("1px")
self.counte... | from pyjamas.ui.Grid import Grid
_logger = None
class Logger(Grid):
def __new__(cls):
global _logger
# make sure there is only one instance of this class
if _logger:
return _logger
_logger = Grid.__new__(cls)
return _logger
def __init__(self, target="", mes... | apache-2.0 | Python |
f10dcd822f72e86d0eb0071acf7d38e81cfe32da | Add a blank line | raviqqe/tensorflow-qnd,raviqqe/tensorflow-qnd | examples/mnist/mnist.py | examples/mnist/mnist.py | import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
qnd.add_flag("use_eval_input_fn", action="store_true")
qnd.add_flag("use_model_fn_ops", action="store_true")
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature ... | import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
qnd.add_flag("use_eval_input_fn", action="store_true")
qnd.add_flag("use_model_fn_ops", action="store_true")
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature ... | unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.