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 |
|---|---|---|---|---|---|---|---|---|
ae2a3716556b6c689d46e52544f7c98f2dfa0a69 | Remove language property from Context resource template | chop-dbhi/serrano,rv816/serrano_night,chop-dbhi/serrano,rv816/serrano_night | serrano/resources/templates.py | serrano/resources/templates.py | Category = {
'fields': [':pk', 'name', 'order', 'parent_id'],
'allow_missing': True,
}
BriefField = {
'fields': [':pk', 'name', 'description'],
'allow_missing': True,
}
Field = {
'fields': [
':pk', 'name', 'plural_name', 'description', 'keywords',
'app_name', 'model_name', 'field_n... | Category = {
'fields': [':pk', 'name', 'order', 'parent_id'],
'allow_missing': True,
}
BriefField = {
'fields': [':pk', 'name', 'description'],
'allow_missing': True,
}
Field = {
'fields': [
':pk', 'name', 'plural_name', 'description', 'keywords',
'app_name', 'model_name', 'field_n... | bsd-2-clause | Python |
d13353eac11e03aa3d3d83d49058b05ceb64e626 | Update version.py | mir-dataset-loaders/mirdata | mirdata/version.py | mirdata/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Version info"""
# version = '0.1.0'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Version info"""
# version = '0.1.0'
` | bsd-3-clause | Python |
42b6e51df4377e933e6ee24b12a5d83d42a655da | Add missing packages to backend | picsadotcom/maguire | backend/setup.py | backend/setup.py | from setuptools import setup, find_packages
setup(
name="maguire",
version="0.1",
url='https://github.com/picsadotcom/maguire',
license='BSD',
author='Picsa',
author_email='admin@picsa.com',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Django',
... | from setuptools import setup, find_packages
setup(
name="maguire",
version="0.1",
url='https://github.com/picsadotcom/maguire',
license='BSD',
author='Picsa',
author_email='admin@picsa.com',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Django',
... | bsd-3-clause | Python |
43b0bd441f4b91357cb4895eb59a394eaf2feef0 | Add __version__ | JaviMerino/bart,ARM-software/bart | bart/__init__.py | bart/__init__.py | # Copyright 2015-2015 ARM Limited
#
# 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 w... | # Copyright 2015-2015 ARM Limited
#
# 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 w... | apache-2.0 | Python |
98f7b5df3286503ab082f85b242f8282f9783b66 | Add refresh token for Strava | python-social-auth/social-core,python-social-auth/social-core | social_core/backends/strava.py | social_core/backends/strava.py | """
Strava OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/strava.html
"""
from .oauth import BaseOAuth2
class StravaOAuth(BaseOAuth2):
name = 'strava'
AUTHORIZATION_URL = 'https://www.strava.com/oauth/authorize'
ACCESS_TOKEN_URL = 'https://www.strava.com/oauth/to... | """
Strava OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/strava.html
"""
from .oauth import BaseOAuth2
class StravaOAuth(BaseOAuth2):
name = 'strava'
AUTHORIZATION_URL = 'https://www.strava.com/oauth/authorize'
ACCESS_TOKEN_URL = 'https://www.strava.com/oauth/to... | bsd-3-clause | Python |
3d1552677cbe0b3c91f71240b9685c55e04e72fa | Remove commented debugger | engagespark/mulungwishi-webhook,engagespark/mulungwishi-webhook,admiral96/mulungwishi-webhook,admiral96/public-webhooks,engagespark/public-webhooks,admiral96/mulungwishi-webhook,admiral96/public-webhooks,engagespark/public-webhooks | app/weather_parser.py | app/weather_parser.py | import forecastio
from config import FORECAST_API_KEY
class WeatherForecast:
def generate_forecast(self, latitude, longitude, frequency):
forecast = self.get_forecast_request(latitude, longitude)
if frequency == 'hourly':
return forecast.hourly()
return forecast.currently()
... | import forecastio
from config import FORECAST_API_KEY
class WeatherForecast:
def generate_forecast(self, latitude, longitude, frequency):
forecast = self.get_forecast_request(latitude, longitude)
# import pdb; pdb.set_trace();
if frequency == 'hourly':
return forecast.hourly()... | mit | Python |
dbe7aea203d35fbc60b916ae5ec9e8394936dc17 | Simplify conditional statement | unixsurfer/haproxytool | haproxytool/utils.py | haproxytool/utils.py | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Created by: Pavlos Parissis <pavlos.parissis@gmail.com>
#
from six.moves import input
def get_arg_option(args):
for key, value in args.items():
if (key != '--force' and key.startswith('--') and
isinstance(value, bool) and value):
ret... | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Created by: Pavlos Parissis <pavlos.parissis@gmail.com>
#
from six.moves import input
def get_arg_option(args):
for key, value in args.items():
if (key != '--force' and key.startswith('--') and
isinstance(value, bool) and value):
ret... | apache-2.0 | Python |
3be0bc09f0ea1f5f86fadd17b8c3460849418c66 | Fix incorrect import in hardware | Gleamo/gleamo-device,Gleamo/gleamo-device | hardware/hardware.py | hardware/hardware.py | import RPi.GPIO as GPIO
from .ihardware import IHardware
from colors.color import Color
'''
The Hardware class is set up to be used in a with statement
'''
class Hardware(IHardware):
def __init__(
self,
red_pin: int = 14,
green_pin: int = 15,
blue_pin: int = 18,
motor_pin: i... | import RPi.GPIO as GPIO
from .ihardware import IHardware
from color import Color
'''
The Hardware class is set up to be used in a with statement
'''
class Hardware(IHardware):
def __init__(
self,
red_pin: int = 14,
green_pin: int = 15,
blue_pin: int = 18,
motor_pin: int = 2
... | bsd-2-clause | Python |
6bf7a242078e03486abde2e8b1acdd4e4596bcb6 | Fix in readarrcfg() for case when the cfg file only has one row and np.loadtxt returns a 0-d (scalar) array. This func should always return a 1-d array for each field. | 2baOrNot2ba/dreamBeam,2baOrNot2ba/dreamBeam | dreambeam/telescopes/geometry_ingest.py | dreambeam/telescopes/geometry_ingest.py | """This package retrieves the metadata for a telescope, such as position,
alignment and bands.
The metadata for a telescope should be in the folder '<telescope>/share/'.
Subfolders should be 'simmos' (for array configurations of stations) and
'alignment' for station rotation.
"""
import os
import numpy as np
CASA_CFG... | """This package retrieves the metadata for a telescope, such as position,
alignment and bands.
The metadata for a telescope should be in the folder '<telescope>/share/'.
Subfolders should be 'simmos' (for array configurations of stations) and
'alignment' for station rotation.
"""
import os
import numpy as np
CASA_CFG... | isc | Python |
04a6a59530034904baf33752e204912e59d64ed4 | Increase log level of workers | Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger | dallinger/heroku/worker.py | dallinger/heroku/worker.py | """Heroku web worker."""
import os
import redis
listen = ['high', 'default', 'low']
redis_url = os.getenv('REDIS_URL', 'redis://localhost:6379')
conn = redis.from_url(redis_url)
if __name__ == '__main__': # pragma: nocover
# Make sure gevent patches are applied early.
import gevent.monkey
gevent.monke... | """Heroku web worker."""
import os
import redis
listen = ['high', 'default', 'low']
redis_url = os.getenv('REDIS_URL', 'redis://localhost:6379')
conn = redis.from_url(redis_url)
if __name__ == '__main__': # pragma: nocover
# Make sure gevent patches are applied early.
import gevent.monkey
gevent.monke... | mit | Python |
4215a155a6f0be6273a47b1208960a34d801cec6 | fix quote_plus import | jqnatividad/ckanext-officedocs,jqnatividad/ckanext-officedocs,jqnatividad/ckanext-officedocs | ckanext/officedocs/plugin.py | ckanext/officedocs/plugin.py | from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import ckan.lib.helpers as h
import ckan.plugins as p
import ckan.plugins.toolkit as toolkit
from six.moves.urllib.parse import quote_plus
class OfficeDocsPlugin(p.SingletonPlugin):
p.implements(p.ICon... | from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import ckan.lib.helpers as h
import ckan.plugins as p
import ckan.plugins.toolkit as toolkit
from urllib import quote_plus
class OfficeDocsPlugin(p.SingletonPlugin):
p.implements(p.IConfigurer)
p.i... | agpl-3.0 | Python |
dde1a9f835e29b7bd1d551f113e376af1f69e496 | Fix prompt import handling in reindex library. | edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform | cms/djangoapps/contentstore/management/commands/reindex_library.py | cms/djangoapps/contentstore/management/commands/reindex_library.py | """ Management command to update libraries' search index """
from django.core.management import BaseCommand, CommandError
from optparse import make_option
from textwrap import dedent
from contentstore.courseware_index import LibrarySearchIndexer
from opaque_keys.edx.keys import CourseKey
from opaque_keys import Inval... | """ Management command to update libraries' search index """
from django.core.management import BaseCommand, CommandError
from optparse import make_option
from textwrap import dedent
from contentstore.courseware_index import LibrarySearchIndexer
from opaque_keys.edx.keys import CourseKey
from opaque_keys import Inval... | agpl-3.0 | Python |
ca8f5d2e7e0e08ab3788d84907ae9470b3ceb22a | Add a QUEST_REWARDS map | HearthSim/python-hearthstone | hearthstone/utils.py | hearthstone/utils.py | try:
from lxml import etree as ElementTree # noqa
except ImportError:
from xml.etree import ElementTree # noqa
from .enums import CardClass, Rarity
CARDCLASS_HERO_MAP = {
CardClass.DRUID: "HERO_06",
CardClass.HUNTER: "HERO_05",
CardClass.MAGE: "HERO_08",
CardClass.PALADIN: "HERO_04",
CardClass.PRIEST: "HERO_... | try:
from lxml import etree as ElementTree # noqa
except ImportError:
from xml.etree import ElementTree # noqa
from .enums import CardClass, Rarity
CARDCLASS_HERO_MAP = {
CardClass.DRUID: "HERO_06",
CardClass.HUNTER: "HERO_05",
CardClass.MAGE: "HERO_08",
CardClass.PALADIN: "HERO_04",
CardClass.PRIEST: "HERO_... | mit | Python |
2bf6d37599ce59e04916cc9c0d1fff348c33ac8e | Add time display to note mod | billyvg/piebot | modules/notemod.py | modules/notemod.py | """Handles user notes
@package ppbot
@syntax tell <user> <note>
@syntax showtells
"""
from datetime import datetime
from dateutil.relativedelta import relativedelta
from modules import *
class Notemod(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=k... | """Handles user notes
@package ppbot
@syntax tell <user> <note>
@syntax showtells
"""
from datetime import datetime
from modules import *
class Notemod(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=kwargs)
def _register_events(self):
s... | mit | Python |
7b2b1f6efa5775483bc32edd6bf0fd6281ef0974 | Update mecanumjoystick.py | ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things | mecanumbot/mecanumjoystick.py | mecanumbot/mecanumjoystick.py | import time
import math
from gpiozero import Motor
# Motors P+ N-
# FL 4 17
# FR 23 24
# BL 27 22
# BR 26 19
motorFL = Motor( 4, 17, pwm=True)
motorFR = Motor(23, 24, pwm=True)
motorBL = Motor(27, 22, pwm=True)
motorBR = Motor(26, 19, pwm=True)
from pygame import display, joystick, event
from pygame import QUIT... | from gpiozero import Motor
import time
import math
# Motors P+ N-
# FL 4 17
# FR 27 22
# BL 23 24
# BR 26 19
motorFL = Motor( 4, 17, pwm=True)
motorFR = Motor(27, 22, pwm=True)
motorBL = Motor(23, 24, pwm=True)
motorBR = Motor(26, 19, pwm=True)
while True:
spd = math.sin(time.time())
motorFL.value = spd
motor... | mit | Python |
e60930a57f3fdd9e960e5f4f4c96d320faf59aaf | Add verified field to user admin | pycontw/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016 | src/users/admin.py | src/users/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import User
from .forms import AdminUserChangeForm, UserCreationForm
@admin.register(User)
class UserAdmin(UserAdmin):
fieldsets = (
(
None,
... | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import User
from .forms import AdminUserChangeForm, UserCreationForm
@admin.register(User)
class UserAdmin(UserAdmin):
fieldsets = (
(
None,
... | mit | Python |
97f64d01199efc65d18a08c47812d2820e872eb0 | update dev version after 0.57.1 tag [ci skip] | desihub/desitarget,desihub/desitarget | py/desitarget/_version.py | py/desitarget/_version.py | __version__ = '0.57.1.dev4806'
| __version__ = '0.57.1'
| bsd-3-clause | Python |
51a505747d29198ea3df0a43c32b1018a40e6bc9 | Move ratelimit functionality into its own class | laneshetron/monopoly | monopoly/Bank/g.py | monopoly/Bank/g.py | import time
import json
import sqlite3
import socket
from collections import deque
class ratelimit:
def __init__(self, max, duration):
self.max = max
self.duration = duration # in milliseconds
self.rateQueue = deque([0] * max, maxlen=max)
def queue(self, job):
elapsed = int(tim... | import time
import json
import sqlite3
import socket
from collections import deque
class safesocket(socket.socket):
def __init__(self, *args):
self.floodQueue = deque([0] * 10, maxlen=10)
super().__init__(*args)
def send(self, message, *args):
try:
elapsed = int(time.time()... | mit | Python |
7444c4e3b3549a6caf09ca85566ba4834e63a256 | Add iso8601 translator. | django-pci/django-axes,jazzband/django-axes,svenhertle/django-axes | axes/utils.py | axes/utils.py | from axes.models import AccessAttempt
def reset(ip=None, username=None):
"""Reset records that match ip or username, and
return the count of removed attempts.
"""
count = 0
attempts = AccessAttempt.objects.all()
if ip:
attempts = attempts.filter(ip_address=ip)
if username:
... | from axes.models import AccessAttempt
def reset(ip=None, username=None):
"""Reset records that match ip or username, and
return the count of removed attempts.
"""
count = 0
attempts = AccessAttempt.objects.all()
if ip:
attempts = attempts.filter(ip_address=ip)
if username:
... | mit | Python |
455a948621983a23dd1d0d966152b8f14fcb6d42 | Update Ch. 16 PracticeQuestions: removed comment | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter16/PracticeQuestions.py | books/CrackingCodesWithPython/Chapter16/PracticeQuestions.py | # Chapter 16 Practice Questions
# 1. Why can't a brute-force attack be used against a simple substitution
# cipher, even with a powerful supercomputer?
# Hint: Check page 208
from math import factorial
numKeys = factorial(26)
print(numKeys)
# 2. What does the spam variable contain after running this code?
spam = [4, ... | # Chapter 16 Practice Questions
# 1. Why can't a brute-force attack be used against a simple substitution
# cipher, even with a powerful supercomputer?
# Hint: Check page 208
from math import factorial # Don't do this - imports should be at the top of the file
numKeys = factorial(26)
print(numKeys)
# 2. What does th... | mit | Python |
f52287bfc6a38b35daf9d880886cc159550a157c | Make sure to avoid loading hacks on mutant loading | charettes/django-mutant | mutant/__init__.py | mutant/__init__.py | import logging
__version__ = VERSION = (0, 0, 1)
logger = logging.getLogger('mutant')
| import logging
__version__ = VERSION = (0, 0, 1)
logger = logging.getLogger('mutant')
import hacks | mit | Python |
e33d44ca880f31c93dc5eef8d5162fec71f8d090 | Add PostgresqlDialect. | SunDwarf/asyncqlio | katagawa/backends/postgresql/__init__.py | katagawa/backends/postgresql/__init__.py | # used for namespace packages
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from katagawa.backends.base import BaseDialect
DEFAULT_CONNECTOR = "asyncpg"
class PostgresqlDialect(BaseDialect):
"""
The dialect for Postgres.
"""
def has_checkpoints(self):
return Tru... | # used for namespace packages
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
DEFAULT_CONNECTOR = "asyncpg"
| mit | Python |
4585ab22a4185122162b987cf8cc845a63ed5a05 | Make it possible for modules to send a response | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | pyheufybot/modules/say.py | pyheufybot/modules/say.py | from module_interface import Module, ModuleType
from message import IRCResponse, ResponseType
class Say(Module):
def __init__(self):
self.trigger = "say"
self.moduleType = ModuleType.ACTIVE
self.messagesTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message> | Makes the bot say th... | from module_interface import Module, ModuleType
class Say(Module):
def __init__(self):
self.trigger = "say"
self.moduleType = ModuleType.ACTIVE
self.messagesTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message> | Makes the bot say the given line"
def execute(self, message, ... | mit | Python |
85513edd0a2b0e3c0e64e8a00bef6381d5f370d1 | Bump version to 2.5.1.dev0 | pyQode/pyqode.python,mmolero/pyqode.python,pyQode/pyqode.python,zwadar/pyqode.python | pyqode/python/__init__.py | pyqode/python/__init__.py | # -*- coding: utf-8 -*-
"""
pyqode.python is an extension of pyqode.core that brings support
for the python programming language. It provides a set of additional modes and
panels for the frontend and a series of worker for the backend (code
completion, documentation lookups, code linters, and so on...).
"""
__version... | # -*- coding: utf-8 -*-
"""
pyqode.python is an extension of pyqode.core that brings support
for the python programming language. It provides a set of additional modes and
panels for the frontend and a series of worker for the backend (code
completion, documentation lookups, code linters, and so on...).
"""
__version... | mit | Python |
cc2e44d76c20b5eb03a645ce6ef3601be05e3f69 | Modify imports | thombashi/pytablewriter | pytablewriter/__init__.py | pytablewriter/__init__.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from dataproperty import LineBreakHandling
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._factory import TableWriterFactory
from ._function import dump_tabledata, dumps_tabledata
from ._logger impor... | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from dataproperty import LineBreakHandling
from typepy import (
Bool,
DateTime,
Dictionary,
Infinity,
Integer,
IpAddress,
List,
Nan,
NoneType,
NullString,
RealNumber,
String,
)
from .__version__ imp... | mit | Python |
244485f85024ef23e05aaedacbf94f5949b38733 | Clean imports, separate prints to functions | gjcooper/repovisor,gjcooper/repovisor | repovisor/repovisor.py | repovisor/repovisor.py | from .repostate import GitRepoState
from git.exc import InvalidGitRepositoryError
from colorama import Fore, Style, init
import os
init()
def reposearch(*folders):
for folder in folders:
for dir, subdirs, files in os.walk(folder):
try:
yield GitRepoState(dir)
s... | from .repostate import GitRepoState
from git import Repo
from git.exc import InvalidGitRepositoryError
from colorama import Fore, Style, init
import os
import warnings
init()
def reposearch(*folders):
for folder in folders:
for dir, subdirs, files in os.walk(folder):
try:
yiel... | bsd-3-clause | Python |
b723289c95333ddfcf07fb167d8af59d4fba31b2 | Update test_basics | openfisca/openfisca-tunisia,openfisca/openfisca-tunisia | openfisca_tunisia/tests/test_basics.py | openfisca_tunisia/tests/test_basics.py | # -*- coding: utf-8 -*-
from __future__ import division
import datetime
from openfisca_tunisia.model.data import CAT
from openfisca_tunisia.tests import base
scenarios_arguments = [
dict(
period = year,
parent1 = dict(
date_naissance = datetime.date(1972, 1, 1),
salaire_... | # -*- coding: utf-8 -*-
from __future__ import division
import datetime
from openfisca_tunisia.model.data import CAT
from openfisca_tunisia.tests import base
scenarios_arguments = [
dict(
period = year,
parent1 = dict(
date_naissance = datetime.date(1972, 1, 1),
salaire_... | agpl-3.0 | Python |
577c5b61f936f59d3ff08a0aacf1411014e600e0 | Remove unnecessary context | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | manage.py | manage.py | #!/usr/bin/env python
import os
from flask_admin import Admin
from flask_admin.menu import MenuLink
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, Shell
from labsys.app import create_app
from labsys.extensions import db
from labsys.auth.models import User, Role, PreAllowedUser
fro... | #!/usr/bin/env python
import os
from flask_admin import Admin
from flask_admin.menu import MenuLink
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, Shell
from labsys.app import create_app
from labsys.extensions import db
from labsys.auth.models import User, Role, PreAllowedUser
fro... | mit | Python |
d8a388d9c11efffb3266586acbf3e950a09f7dc3 | Comment and pep8 validation for TestEnv class | pombredanne/pythran,pombredanne/pythran,artas360/pythran,artas360/pythran,hainm/pythran,pbrunet/pythran,pbrunet/pythran,serge-sans-paille/pythran,pbrunet/pythran,artas360/pythran,pombredanne/pythran,hainm/pythran,hainm/pythran,serge-sans-paille/pythran | pythran/tests/test_env.py | pythran/tests/test_env.py | from pythran import cxx_generator
from pythran import compile as pythran_compile
from imp import load_dynamic
import unittest
import os
class TestEnv(unittest.TestCase):
"""
Test environment to validate a pythran execution against python
"""
# default options used for the c++ compiler
PYTHRAN_CXX... | from pythran import cxx_generator
from pythran import compile as pythran_compile
from imp import load_dynamic
import unittest
import os
class TestEnv(unittest.TestCase):
def assertAlmostEqual(self, ref, res):
if hasattr(ref,'__iter__'):
self.assertEqual(len(ref), len(res))
for ire... | bsd-3-clause | Python |
eff2461087bea6b0959dcdbd48d1873fd350e880 | Change config settings in manage.py | andela-hoyeboade/bucketlist-api | manage.py | manage.py | from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from app import app
app = Flask(__name__)
app.config.from_object('config.DevelopmentConfig')
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manag... | from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from app import app
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manager = Manager(app)
... | mit | Python |
b56a14d247395f65fe54c22227b599b66270ded9 | Update spinthewheel.py | sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis | jarviscli/plugins/spinthewheel.py | jarviscli/plugins/spinthewheel.py | from plugin import plugin
import random
'''This code picks one of the random inputs given by the user
like spin wheel'''
@plugin("spin wheel")
def spin(jarvis, s):
jarvis.say(' ')
jarvis.say('welcome to spin the wheel\n')
jarvis.say('enter the number of elements in the wheel')
num = jarvis.input()
... | from plugin import plugin
import random
'''This code picks one of the random inputs given by the user
like spin wheel'''
@plugin("spin wheel")
def spin(jarvis, s):
jarvis.say(' ')
jarvis.say('welcome to spin the wheel\n')
jarvis.say('enter the number of elements in the wheel')
num = jarvis.input()
... | mit | Python |
884cdda7304edfed8c026aac02217b4087f49d81 | fix recipe | samuel/kokki | kokki/cookbooks/mdadm/recipes/default.py | kokki/cookbooks/mdadm/recipes/default.py |
from kokki import *
if env.config.mdadm.arrays:
Package("mdadm")
Execute("mdadm-update-conf",
action = "nothing",
command = ("("
"echo DEVICE partitions > /etc/mdadm/mdadm.conf"
"; mdadm --detail --scan >> /etc/mdadm/mdadm.conf"
")"
))
for array in env.config.mdadm.arrays:
en... |
from kokki import *
if env.config.mdadm.arrays:
Package("mdadm")
Execute("mdadm-update-conf",
action = "nothing",
command = ("("
"echo DEVICE partitions > /etc/mdadm/mdadm.conf"
"; mdadm --detail --scan >> /etc/mdadm/mdadm.conf"
")"
))
for array in env.config.mdadm.arrays:
en... | bsd-3-clause | Python |
bafea222db835f4f2fee8ad603b2b997b33922d4 | Fix call to create_tunnel and some other small things. | peplin/astral | astral/node/tunnel.py | astral/node/tunnel.py | import threading
import asyncore
import time
from astral.net.tunnel import Tunnel
from astral.models import Ticket
from astral.models.ticket import TUNNEL_QUEUE
import logging
log = logging.getLogger(__name__)
class TunnelControlThread(threading.Thread):
def __init__(self):
super(TunnelControlThread, se... | import threading
import asyncore
import time
from astral.net.tunnel import Tunnel
from astral.models import Ticket
from astral.models.ticket import TUNNEL_QUEUE
import logging
log = logging.getLogger(__name__)
class TunnelControlThread(threading.Thread):
def __init__(self):
super(TunnelControlThread, se... | mit | Python |
abcb8e05914efd47d071039bb143e993542c09ee | use CherryPy as the HTTP server | schettino72/serveronduty | manage.py | manage.py | #!/usr/bin/env python
from werkzeug import script
from cherrypy import wsgiserver
def make_app():
from websod.application import WebSod
return WebSod('sqlite:///sod.db')
def make_shell():
from websod import models, utils
application = make_app()
return locals()
def make_server(hostname="localhos... | #!/usr/bin/env python
from werkzeug import script
def make_app():
from websod.application import WebSod
return WebSod('sqlite:///sod.db')
def make_shell():
from websod import models, utils
application = make_app()
return locals()
action_runserver = script.make_runserver(make_app, use_reloader=Tr... | mit | Python |
59fec8fdcf811aefec7a03e0fc107a24ecb1d5ed | Refactor manager | reubano/pkutils,reubano/pkutils | manage.py | manage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from manager import Manager
from subprocess import call
manager = Manager()
_basedir = p.d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from manager import Manager
from subprocess import call
manager = Manager()
_basedir = p.d... | mit | Python |
0f4fd0d49ba06963b0b97e032fd2e6eedf8e597a | Fix missing space between lede and rest of article | ahalterman/cloacina | cloacina/extract_from_b64.py | cloacina/extract_from_b64.py | from bs4 import BeautifulSoup
import json
import re
def extract_from_b64(encoded_doc):
#doc = base64.urlsafe_b64decode(encoded_doc)
doc = encoded_doc.decode("base64")
doc = re.sub("</p><p>", " ", doc)
doc = re.sub('<div class="BODY-2">', " ", doc)
soup = BeautifulSoup(doc)
news_source = soup.fi... | from bs4 import BeautifulSoup
import json
import re
def extract_from_b64(encoded_doc):
#doc = base64.urlsafe_b64decode(encoded_doc)
doc = encoded_doc.decode("base64")
doc = re.sub("</p><p>", " ", doc)
soup = BeautifulSoup(doc)
news_source = soup.find("meta", {"name":"sourceName"})['content']
ar... | mit | Python |
8b3d641c2cb1f43f5ddb122b68fd37df6d0ab1e3 | Update MIDDLEWARE to be compatible with Django 1.11+ | bugsnag/bugsnag-python,bugsnag/bugsnag-python | tests/fixtures/django1/bugsnag_demo/settings.py | tests/fixtures/django1/bugsnag_demo/settings.py | """
Django settings for bugsnag_demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | """
Django settings for bugsnag_demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | mit | Python |
a154ccdf9bb0d6ba06b4038789437bd98d656282 | fix incorrect url pattern for archived studentships | evildmp/Arkestra,bubenkoff/Arkestra,bubenkoff/Arkestra,evildmp/Arkestra,bubenkoff/Arkestra,evildmp/Arkestra | vacancies_and_studentships/urls.py | vacancies_and_studentships/urls.py | from django.conf.urls.defaults import patterns, url
import views
urlpatterns = patterns('',
# vacancies and studentships items
url(r"^vacancy/(?P<slug>[-\w]+)/$", views.vacancy, name="vacancy"),
url(r"^studentship/(?P<slug>[-\w]+)/$", views.studentship, name="studentship"),
# entities' vacanc... | from django.conf.urls.defaults import patterns, url
import views
urlpatterns = patterns('',
# vacancies and studentships items
url(r"^vacancy/(?P<slug>[-\w]+)/$", views.vacancy, name="vacancy"),
url(r"^studentship/(?P<slug>[-\w]+)/$", views.studentship, name="studentship"),
# entities' vacanc... | bsd-2-clause | Python |
29ca88405f37019932ea82042ebdadaafbda69af | Remove lang arg, dont need it ...yet | durden/dash,durden/dash | apps/codrspace/templatetags/short_codes.py | apps/codrspace/templatetags/short_codes.py | """Custom filters to grab code from the web via short codes"""
import requests
import re
from django.utils import simplejson
from django import template
from django.utils.safestring import mark_safe
from codrspace.templatetags.syntax_color import _colorize_table
import markdown
register = template.Library()
@regis... | """Custom filters to grab code from the web via short codes"""
import requests
import re
from django.utils import simplejson
from django import template
from django.utils.safestring import mark_safe
from codrspace.templatetags.syntax_color import _colorize_table
import markdown
register = template.Library()
@regis... | mit | Python |
51d37f7ac6bebf9b1d4c6efd16a968b7410a7791 | Save mul at the end to force execution. | marianotepper/csnmf | rcnmf/tests/test_tsqr2.py | rcnmf/tests/test_tsqr2.py | import dask.array as da
from into import into
from dask.array.into import discover
from dask.dot import dot_graph
import tempfile
import rcnmf.tsqr
x = da.random.standard_normal(size=(100, 100), blockshape=(100, 50))
temp_file = tempfile.NamedTemporaryFile(suffix='.hdf5')
uri = temp_file.name + '::/X'
into(uri, x)
... | import dask.array as da
from into import into
from dask.array.into import discover
from dask.dot import dot_graph
import tempfile
import rcnmf.tsqr
x = da.random.standard_normal(size=(100, 100), blockshape=(100, 50))
temp_file = tempfile.NamedTemporaryFile(suffix='.hdf5')
uri = temp_file.name + '::/X'
into(uri, x)
... | bsd-2-clause | Python |
d707426caae0038609fcc71531fd5d7aa61f4f47 | Bump jaxlib version to 0.1.5 in preparation for building new wheels. | google/jax,google/jax,tensorflow/probability,google/jax,tensorflow/probability,google/jax | build/setup.py | build/setup.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
6703427bb70ebec3df22844df7b22026266c0b04 | Set PYTHONPATH during runtime | rburchell/ck,rburchell/ck,rburchell/ck,rburchell/ck,rburchell/ck | tests/python-test-library/testcases/runtests.py | tests/python-test-library/testcases/runtests.py | #!/usr/bin/env python2.5
##
## @file runtests.py
##
## Copyright (C) 2008 Nokia. All rights reserved.
##
##
##
##
## Requires python2.5-gobject and python2.5-dbus
##
## Implements also some testing API:
##
##
import sys
sys.path.append("../testcases")
sys.path.append("../stubs")
import os
from time import sleep
impo... | #!/usr/bin/env python2.5
##
## @file runtests.py
##
## Copyright (C) 2008 Nokia. All rights reserved.
##
##
##
##
## Requires python2.5-gobject and python2.5-dbus
##
## Implements also some testing API:
##
##
import os
from time import sleep
import dbus
import commands
import dbus_emulator
import conf
import contex... | lgpl-2.1 | Python |
bc4b6e80688f9bebd3220fed12645aeb58d710c9 | Update : client db_name param renamed | oleiade/Elevator | client/base.py | client/base.py | from __future__ import absolute_import
import zmq
import msgpack
from .message import Message
from .error import ELEVATOR_ERROR
from elevator.constants import FAILURE_STATUS
from elevator.db import DatabaseOptions
class Client(object):
def __init__(self, db=None, *args, **kwargs):
self.protocol = kwar... | from __future__ import absolute_import
import zmq
import msgpack
from .message import Message
from .error import ELEVATOR_ERROR
from elevator.constants import FAILURE_STATUS
from elevator.db import DatabaseOptions
class Client(object):
def __init__(self, db_name=None, *args, **kwargs):
self.protocol =... | mit | Python |
54bcdb0ca215c1d76b096240778354c30d16f453 | fix a few bugs in shape features | Radiomics/pyradiomics,Radiomics/pyradiomics,Radiomics/pyradiomics,Radiomics/pyradiomics | bin/helloRadiomics.py | bin/helloRadiomics.py | from radiomics import firstorder, glcm, preprocessing, shape, rlgl
import SimpleITK as sitk
import sys, os
#imageName = sys.argv[1]
#maskName = sys.argv[2]
testBinWidth = 25
#testResampledPixelSpacing = (3,3,3) no resampling for now.
dataDir = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + ".." + os.path... | from radiomics import firstorder, glcm, preprocessing, shape, rlgl
import SimpleITK as sitk
import sys, os
#imageName = sys.argv[1]
#maskName = sys.argv[2]
testBinWidth = 25
#testResampledPixelSpacing = (3,3,3) no resampling for now.
dataDir = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + ".." + os.path... | bsd-3-clause | Python |
359040acc4b8c54db84e154b15cabfb23b4e18a6 | Use VISION_BONNET_MODELS_PATH env var for custom models path. | google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian | src/aiy/vision/models/utils.py | src/aiy/vision/models/utils.py | """Utility to load compute graphs from diffrent sources."""
import os
def load_compute_graph(name):
path = os.environ.get('VISION_BONNET_MODELS_PATH', '/opt/aiy/models')
with open(os.path.join(path, name), 'rb') as f:
return f.read()
| """Utility to load compute graphs from diffrent sources."""
import os
def load_compute_graph(name):
path = os.path.join('/opt/aiy/models', name)
with open(path, 'rb') as f:
return f.read()
| apache-2.0 | Python |
9cb4ba7bd05b8a7b6bd69bcc33cd791580f84be1 | write longest sequence to a file | linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab | bin/longest_contig.py | bin/longest_contig.py | """
Print the length of the longest contig for each file in a directory of fasta files.
"""
import os
import sys
import argparse
from roblib import read_fasta, bcolors
__author__ = 'Rob Edwards'
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Print the length of the longest contig for ea... | """
Print the length of the longest contig for each file in a directory of fasta files.
"""
import os
import sys
import argparse
from roblib import read_fasta
__author__ = 'Rob Edwards'
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Print the length of the longest contig for each file i... | mit | Python |
274e0eaa2c60ea116d798e1aaa7429ac59c60fbd | make manage.py is more simple | ownport/pywebase,ownport/pywebase | manage.py | manage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Manager for pywebase
#
from packages import pywebase
# -----------------------------------------------
# Application functions (they can be changed
# in your application)
# -----------------------------------------------
pywebase.add_routes(
('/', 'GET', p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Manager for pywebase
#
import os
import sys
import settings
from packages import bottle
from packages import pywebase
# -----------------------------------------------
# Application functions (they can be changed
# in your application)
# ----------------------... | bsd-2-clause | Python |
84c5ac764b6ca2f452db2f387d0f838d395e31fa | Remove duplicate import of "sys" module. | silentbob73/kitsune,chirilo/kitsune,feer56/Kitsune1,H1ghT0p/kitsune,feer56/Kitsune2,brittanystoroz/kitsune,asdofindia/kitsune,H1ghT0p/kitsune,MikkCZ/kitsune,MziRintu/kitsune,mythmon/kitsune,turtleloveshoes/kitsune,NewPresident1/kitsune,chirilo/kitsune,feer56/Kitsune2,philipp-sumo/kitsune,feer56/Kitsune2,chirilo/kitsune... | manage.py | manage.py | #!/usr/bin/env python
import os
import site
import sys
ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT, *a)
prev_sys_path = list(sys.path)
site.addsitedir(path('apps'))
site.addsitedir(path('lib'))
site.addsitedir(path('vendor'))
# Move the new items to the front of sys.path.
... | #!/usr/bin/env python
import os
import site
import sys
ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT, *a)
prev_sys_path = list(sys.path)
site.addsitedir(path('apps'))
site.addsitedir(path('lib'))
site.addsitedir(path('vendor'))
# Move the new items to the front of sys.path.
... | bsd-3-clause | Python |
7127132e0a0c7c478ed1aa29dc9c6ffe9ed670d2 | Add comments and NotImplementedErrors for _ParticleFilterSetOperations | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/filter/set_.py | hoomd/filter/set_.py | from hoomd.filter.filter_ import _ParticleFilter
from hoomd import _hoomd
class _ParticleFilterSetOperations(_ParticleFilter):
"""An abstract class for `ParticleFilters` with set operations.
Should not be instantiated directly."""
@property
def _cpp_cls_name(self):
"""The name of the C++ cla... | from hoomd.filter.filter_ import _ParticleFilter
from hoomd import _hoomd
class _ParticleFilterSetOperations(_ParticleFilter):
def __init__(self, f, g):
if f == g:
raise ValueError("Cannot use same filter for {}"
"".format(self.__class__.__name__))
else:
... | bsd-3-clause | Python |
b001530004d856462b1edd5c6053e3c4cb0ea466 | Use reloader for runserver | KanColleTool/kcsrv,KanColleTool/kcsrv,KanColleTool/kcsrv | manage.py | manage.py | #!/usr/bin/env python
from flask.ext.script import Manager, Server
from flask.ext.migrate import MigrateCommand
from kcsrv import app
manager = Manager(app)
manager.add_command('runserver', Server(host='0.0.0.0', use_reloader=True))
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
| #!/usr/bin/env python
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand
from kcsrv import app
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
| mit | Python |
85f8e7e79c56caa9c37fead6b650f6c0321207e9 | Rebase master | nnsnodnb/django-mbaas,nnsnodnb/django-mbaas,nnsnodnb/django-mbaas | manage.py | manage.py | # coding: utf-8
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mbaas.settings")
import pymysql
pymysql.install_as_MySQLdb()
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| # coding: utf-8
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mbaas.settings")
import pymysql
pymysql.install_as_MySQLdb()
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv... | apache-2.0 | Python |
63dd856fad5f6afd0927d9b051c4e59ed85dd092 | Remove unnecessary variable | datamicroscopes/lda,datamicroscopes/lda,datamicroscopes/lda | cmake/print_cmake_command.py | cmake/print_cmake_command.py | import sys
import os
from subprocess import check_output
if __name__ == '__main__':
build_type = "RelWithDebInfo"
if len(sys.argv) > 1:
build_type = sys.argv[1]
if build_type not in ('Debug', 'Release', 'RelWithDebInfo'):
raise ValueError("invalid build type: {}".format(build_type))
## ... | import sys
import os
from subprocess import check_output
if __name__ == '__main__':
build_type = "RelWithDebInfo"
if len(sys.argv) > 1:
build_type = sys.argv[1]
ValidBuildTypes = ('Debug', 'Release', 'RelWithDebInfo')
if not build_type in ValidBuildTypes:
raise ValueError("invalid build... | bsd-3-clause | Python |
7b82626201812710c4013d05279572a06e641bbd | remove unnecessary imports | dschmaryl/golf-flask,dschmaryl/golf-flask,dschmaryl/golf-flask | manage.py | manage.py | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from golf_stats import app, db
from golf_stats.utils import export_all, import_all
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
def create_db():
db.create_all()
... | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from golf_stats import app, db
from golf_stats.utils import export_all, import_all
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCom... | mit | Python |
7725f1af0134c6d9db5b9ed116118fd6a9dd1295 | make server candlestick demo sync with file demo | jakirkham/bokeh,msarahan/bokeh,percyfal/bokeh,jakirkham/bokeh,bokeh/bokeh,ericmjl/bokeh,daodaoliang/bokeh,saifrahmed/bokeh,DuCorey/bokeh,maxalbert/bokeh,Karel-van-de-Plassche/bokeh,satishgoda/bokeh,khkaminska/bokeh,ChinaQuants/bokeh,ericmjl/bokeh,canavandl/bokeh,caseyclements/bokeh,canavandl/bokeh,ahmadia/bokeh,ptitjan... | examples/plotting/server/candlestick.py | examples/plotting/server/candlestick.py |
import pandas as pd
from bokeh.sampledata.stocks import MSFT
from bokeh.plotting import *
output_server("candlestick.py example")
hold()
df = pd.DataFrame(MSFT)[:50]
df['date'] = pd.to_datetime(df['date'])
dates = df.date.astype(int)
mids = (df.open + df.close)/2
spans = abs(df.close-df.open)
inc = df.close > d... |
import pandas as pd
from bokeh.sampledata.stocks import MSFT
from bokeh.plotting import *
output_server("candlestick.py example")
hold()
df = pd.DataFrame(MSFT)
df['date'] = pd.to_datetime(df['date'])
dates = df.date.astype(int)
mids = (df.open + df.close)/2
spans = abs(df.close-df.open)
inc = df.close > df.ope... | bsd-3-clause | Python |
26811edc8023c24377a5cfae9d4699ae91df47f8 | Add required module | xeroc/python-bitshares | bitshares/proposal.py | bitshares/proposal.py | from .instance import BlockchainInstance
from .account import Account
from .exceptions import ProposalDoesNotExistException
from .blockchainobject import BlockchainObject, ObjectCache
from .utils import parse_time
import logging
log = logging.getLogger(__name__)
class Proposal(BlockchainObject):
""" Read data abo... | from .instance import BlockchainInstance
from .account import Account
from .exceptions import ProposalDoesNotExistException
from .blockchainobject import BlockchainObject
from .utils import parse_time
import logging
log = logging.getLogger(__name__)
class Proposal(BlockchainObject):
""" Read data about a Proposal... | mit | Python |
26b2eb5efd7d1be8c19cb7395cae7d5b2ac9f3df | Fix url prefix. | quantumlib/OpenFermion-FQE,quantumlib/OpenFermion-FQE,quantumlib/OpenFermion-FQE | dev/docs/build_api_docs.py | dev/docs/build_api_docs.py | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python |
917a38845f3fd03805b99c3a8df6f09b047ed0e0 | Fix tvseries preprocess script to accomodate literal NER refactor. | machinalis/iepy,mrshu/iepy,machinalis/iepy,mrshu/iepy,machinalis/iepy,mrshu/iepy | examples/tvseries/scripts/preprocess.py | examples/tvseries/scripts/preprocess.py | """
Wikia Series Pre Processing
Usage:
preprocess.py <dbname>
"""
import re
from docopt import docopt
from mwtextextractor import get_body_text
from iepy.db import connect, DocumentManager
from iepy.models import set_custom_entity_kinds
from iepy.preprocess import PreProcessPipeline
from iepy.tokenizer import T... | """
Wikia Series Pre Processing
Usage:
preprocess.py <dbname>
"""
import re
from docopt import docopt
from mwtextextractor import get_body_text
from iepy.db import connect, DocumentManager
from iepy.models import set_custom_entity_kinds
from iepy.preprocess import PreProcessPipeline
from iepy.tokenizer import T... | bsd-3-clause | Python |
379ca60d8b79a8b6ce5ae7256ccae8a90bb83be8 | Remove experimental. | LettError/glyphNameFormatter,LettError/glyphNameFormatter | Lib/glyphNameFormatter/rangeProcessors/mathematical_alphanumeric_symbols.py | Lib/glyphNameFormatter/rangeProcessors/mathematical_alphanumeric_symbols.py |
def process(self):
self.edit("MATHEMATICAL")
self.edit("EPSILON SYMBOL", "epsilonsymbol")
self.edit("CAPITAL THETA SYMBOL", "Thetasymbol")
self.edit("THETA SYMBOL", "thetasymbol")
self.edit("KAPPA SYMBOL", "kappasymbol")
self.edit("PHI SYMBOL", "phisymbol")
self.edit("PI SYMBOL", "pisymbol... |
def process(self):
self.setExperimental()
self.edit("MATHEMATICAL")
self.edit("EPSILON SYMBOL", "epsilonsymbol")
self.edit("CAPITAL THETA SYMBOL", "Thetasymbol")
self.edit("THETA SYMBOL", "thetasymbol")
self.edit("KAPPA SYMBOL", "kappasymbol")
self.edit("PHI SYMBOL", "phisymbol")
self.... | bsd-3-clause | Python |
389e0bd3ee306811cfd433fb19c1bf776c7ddff4 | Revise documentation | berkeley-stat159/project-delta | code/utils/utils.py | code/utils/utils.py | import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
def load_data(filename):
"""
Loads the data in a file, given its path.
Parameters
----------
filename : str
The path to the file containing fMRI data
Returns
-------
np.ndarray of data to be saved... | import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
def plot_nii(filename):
"""
Plots the middle slice of an anatomy image
Parameters
----------
filename: str
The path to the file comtaining the anatomy
Returns
-------
Plot of the middle
"""... | bsd-3-clause | Python |
45663d2eb5ad1309f309978aecce25dc74994d17 | fix packagist | nikitanovosibirsk/vedro | vedro/hooks/packagist/packagist.py | vedro/hooks/packagist/packagist.py | import os
from ..hook import Hook
class Packagist(Hook):
def __get_files(self, path):
files = []
for filename in os.listdir(path):
if (not filename.startswith('_')) and (not filename.startswith('.')):
files += [filename[:-3] if filename.endswith('.py') else filename]
return files
def _... | import os
from ..hook import Hook
class Packagist(Hook):
def __get_files(self, path):
files = []
for filename in os.listdir(path):
if not filename.startswith('_'):
files += [filename[:-3] if filename.endswith('.py') else filename]
return files
def __get_directories(self, path):
dir... | apache-2.0 | Python |
91a2cdeffbce65d4ca65e9429fee198ed76ef230 | Reduce num params | charanpald/APGL | exp/viroscopy/model/RunEpidemicModel.py | exp/viroscopy/model/RunEpidemicModel.py |
import logging
import sys
import numpy
from apgl.graph import *
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVEpidemicModel import HIVEpidemicModel
from exp.viroscopy.model.HIVRates import HIVRates
from exp.viroscopy.model.HIVModelUtils import HIVModelUtils
impor... |
import logging
import sys
import numpy
from apgl.graph import *
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVEpidemicModel import HIVEpidemicModel
from exp.viroscopy.model.HIVRates import HIVRates
from exp.viroscopy.model.HIVModelUtils import HIVModelUtils
impor... | bsd-3-clause | Python |
0ac3d7cf48bbeda33e319e149b1a2d36b04fbf94 | Add base pipeline data source class | povilasb/pycollection-pipelines | collection_pipelines/core.py | collection_pipelines/core.py | import functools
def coroutine(fn):
def wrapper(*args, **kwargs):
generator = fn(*args, **kwargs)
next(generator)
return generator
return wrapper
class CollectionPipelineProcessor:
sink = None
start_source = None
receiver = None
def process(self, item):
rais... | import functools
def coroutine(fn):
def wrapper(*args, **kwargs):
generator = fn(*args, **kwargs)
next(generator)
return generator
return wrapper
class CollectionPipelineProcessor:
sink = None
start_source = None
receiver = None
def process(self, item):
rais... | mit | Python |
550fd42b1e66436cdc814fa77d39b9ba414beb87 | Refactor with lambda | moritzdannhauer/SCIRunGUIPrototype,jcollfont/SCIRun,collint8/SCIRun,collint8/SCIRun,moritzdannhauer/SCIRunGUIPrototype,jessdtate/SCIRun,jessdtate/SCIRun,moritzdannhauer/SCIRunGUIPrototype,moritzdannhauer/SCIRunGUIPrototype,jessdtate/SCIRun,moritzdannhauer/SCIRunGUIPrototype,jessdtate/SCIRun,collint8/SCIRun,jessdtate/SC... | src/Testing/Python/Unit/add_module.py | src/Testing/Python/Unit/add_module.py | def scirun_assert(func):
if not func():
scirun_add_module("ReadMatrix") # guarantee errored network
scirun_quit_after_execute()
scirun_execute_all()
else:
scirun_force_quit() # SCIRun returns 0 to console
m1 = scirun_add_module("ReadMatrix")
m2 = scirun_add_module("ReportMatrixInfo")
scirun_assert(... | import sys
m1 = scirun_add_module("ReadMatrix")
m2 = scirun_add_module("ReportMatrixInfo")
if len(scirun_module_ids()) != 2:
scirun_quit_after_execute()
scirun_execute_all()
else:
scirun_force_quit()
| mit | Python |
b5936f07c88ae260babb1850949b26dc6a06ab65 | fix counter today | niemandkun/diaphragm,niemandkun/diaphragm,niemandkun/diaphragm | diaphragm/counter/views.py | diaphragm/counter/views.py | from datetime import datetime
from flask import Blueprint, request, abort
from diaphragm.counter.models import Visitor
from diaphragm.database import db
from diaphragm.utils import render_ajax, json_dict
counter = Blueprint('counter', __name__,
template_folder="templates")
@counter.route('/api/... | from datetime import datetime
from flask import Blueprint, request, abort
from diaphragm.counter.models import Visitor
from diaphragm.database import db
from diaphragm.utils import render_ajax, json_dict
counter = Blueprint('counter', __name__,
template_folder="templates")
@counter.route('/api/... | mit | Python |
955d55293e8a2a96b2427af8d2c5de4cba6b1e79 | Refactor to Linter v2 API | ankit01ojha/coala-bears,SanketDG/coala-bears,yash-nisar/coala-bears,ku3o/coala-bears,srisankethu/coala-bears,srisankethu/coala-bears,naveentata/coala-bears,SanketDG/coala-bears,aptrishu/coala-bears,ankit01ojha/coala-bears,shreyans800755/coala-bears,ankit01ojha/coala-bears,LWJensen/coala-bears,yash-nisar/coala-bears,ref... | bears/xml2/XMLBear.py | bears/xml2/XMLBear.py | import itertools
import re
from coalib.bearlib.abstractions.Linter import linter
from coalib.bears.requirements.DistributionRequirement import (
DistributionRequirement)
from coalib.settings.Setting import path, url
def path_or_url(xml_dtd):
'''
Coverts the setting value to url or path.
:param xml_d... | import itertools
from coalib.bearlib.abstractions.Lint import Lint, escape_path_argument
from coalib.bears.LocalBear import LocalBear
from coalib.bears.requirements.DistributionRequirement import (
DistributionRequirement)
from coalib.settings.Setting import path, url
def path_or_url(xml_dtd):
'''
Covert... | agpl-3.0 | Python |
2944b50b0ef6b341a8d60aed8c2371292e81a255 | update tests | mupi/tecsaladeaula,mupi/tecsaladeaula,mupi/escolamupi,hacklabr/timtec,GustavoVS/timtec,mupi/escolamupi,mupi/tecsaladeaula,GustavoVS/timtec,virgilio/timtec,mupi/tecsaladeaula,mupi/timtec,AllanNozomu/tecsaladeaula,mupi/timtec,virgilio/timtec,hacklabr/timtec,GustavoVS/timtec,GustavoVS/timtec,AllanNozomu/tecsaladeaula,mupi... | accounts/tests/test_acceptance.py | accounts/tests/test_acceptance.py | import pytest
@pytest.mark.django_db
def test_custom_login_view(client):
response = client.get('/login/')
assert response.status_code == 200
assert response.context['request'].user.is_authenticated() is False
response = client.post('/login/', {'username':'abcd',
... | import pytest
@pytest.mark.django_db
def test_custom_login_view(client):
response = client.get('/login/')
assert response.status_code == 200
assert response.context['request'].user.is_authenticated() is False
response = client.post('/login/', {'username':'abcd',
... | agpl-3.0 | Python |
e02570e3f22d24d12228c3ea51199d587735917c | Add newline add end of post. | allanino/rnn-music-of-the-day,allanino/rnn-music-of-the-day,allanino/rnn-music-of-the-day | create_post.py | create_post.py | #!/usr/bin/env python
import argparse
import dropbox
import os
from time import gmtime, strftime
def get_link(client, folder_path, opus_number):
folder_metadata = client.metadata(folder_path)
path = folder_metadata['contents'][opus_number-1]['path']
url = client.share(path, short_url=False)['url']
# Fo... | #!/usr/bin/env python
import argparse
import dropbox
import os
from time import gmtime, strftime
def get_link(client, folder_path, opus_number):
folder_metadata = client.metadata(folder_path)
path = folder_metadata['contents'][opus_number-1]['path']
url = client.share(path, short_url=False)['url']
# Fo... | mit | Python |
4ee6ce2b8d59266ed7b08422088d20edda1effe2 | Simplify a bit | rafaelmartins/rst2pdf,rafaelmartins/rst2pdf | rst2pdf/tests/input/test_issue_216.py | rst2pdf/tests/input/test_issue_216.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.platypus.doctemplate import Indenter
from reportlab.platypus.flowables import *
from reportlab.platypus.xpreformatted import *
from reportlab.lib.styles import getSampleStyleSheet
from copy import c... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.platypus.doctemplate import Indenter
from reportlab.platypus.flowables import *
from reportlab.platypus.xpreformatted import *
from reportlab.lib.styles import getSampleStyleSheet
from copy import c... | mit | Python |
b1ee34bcc827e6ac08d445f694f9cec035d4c85f | Update version | cloudboss/bossimage,cloudboss/bossimage | bossimage/__init__.py | bossimage/__init__.py | __version__ = '0.1.4'
| __version__ = '0.1.3'
| mit | Python |
f02ad2f5b4a8444d7aae5a53a5a5a842b5935fc7 | Update update-episodes/anime1_me | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | my-ACG/update-episodes/anime1_me.py | my-ACG/update-episodes/anime1_me.py | # -*- coding: utf-8 -*-
import argparse
import importlib
import os
import sys
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
sys.path.append('..')
animeSite = importlib.import_module('util.anime1_me', 'Anime1Me').Anime1Me()
site = pywikibot.Site()
site.login()
datasite = ... | # -*- coding: utf-8 -*-
import argparse
import importlib
import os
import sys
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
sys.path.append('..')
animeSite = importlib.import_module('util.anime1_me', 'Anime1Me').Anime1Me()
site = pywikibot.Site()
site.login()
datasite = ... | mit | Python |
39639d45fea8753869feeed4f879533811a9222d | Bump version to 4.1.0rc7 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
b42d0efa73c0c9e8daf8756753eb3303bdaf79e1 | Bump version to 3.6.2b5 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
a93028d6e4dc1439666f7bbed6c4643268542a49 | Bump version to 3.2.0b3 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | apache-2.0 | Python |
f39c9fb597facb92701afbfc687e37898e7bf43d | Bump version to 4.4.0b4 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
a3f3f37f7a978c1a5b39007c08f956addedc5bd1 | Update Battle_ship.py | kejrp23/Python | Battle_ship.py | Battle_ship.py | """
Created on Code Academy in python lauguage project.
Created by Jason R. Pittman
Created on 3/19/16
Code partially modified from orginial state.
"""
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
p... | """
Created on Code Academy in python lauguage project.
Created by Jason R. Pittman
Created on 3/19/16
Code partially modified from orginial state.
"""
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
p... | artistic-2.0 | Python |
16844f9063d84cac85e04cd48bbb4364f909038c | Bump version number | nabla-c0d3/sslyze | sslyze/__init__.py | sslyze/__init__.py |
__author__ = 'Alban Diquet'
__license__ = 'GPLv2'
__version__ = '0.13.3'
__email__ = 'nabla.c0d3@gmail.com'
PROJECT_URL = 'https://github.com/nabla-c0d3/sslyze'
PROJECT_DESC = 'Fast and full-featured SSL scanner.'
|
__author__ = 'Alban Diquet'
__license__ = 'GPLv2'
__version__ = '0.13.2'
__email__ = 'nabla.c0d3@gmail.com'
PROJECT_URL = 'https://github.com/nabla-c0d3/sslyze'
PROJECT_DESC = 'Fast and full-featured SSL scanner.'
| agpl-3.0 | Python |
429e419f3baa067002f0b6a832fa3fe8fff72288 | Remove senstive data from settings.py. | editorsnotes/editorsnotes,editorsnotes/editorsnotes | editorsnotes/settings.py | editorsnotes/settings.py | # Django settings for editorsnotes project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Ryan Shaw', 'ryanshaw@ischool.berkeley.edu'),
)
MANAGERS = ADMINS
TIME_ZONE = 'America/Los_Angeles'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
# Absolute path to the directory that holds media.
# Example: "... | # Django settings for editorsnotes project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Ryan Shaw', 'ryanshaw@ischool.berkeley.edu'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'editorsnotes'
DATABASE_USER = 'editorsnotes'
DATABASE_PASSWORD = 'Beev0dir'
DATABASE_HOST = '' #... | agpl-3.0 | Python |
4084b31a97fd85b81e80e0af5e6007c367c4582f | correct allowed_hosts | ewjoachim/bttn_finds_my_phone | bttn/settings.py | bttn/settings.py | """
Django settings for bttn project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... | """
Django settings for bttn project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... | mit | Python |
f0b7c9024fc8c8cdfe084bc52bd23560c60c7c96 | Make modules uninstallable | brain-tec/l10n-switzerland,brain-tec/l10n-switzerland,brain-tec/l10n-switzerland | l10n_ch_hr_payroll/__openerp__.py | l10n_ch_hr_payroll/__openerp__.py | # -*- coding: utf-8 -*-
#
# File: __openerp__.py
# Module: l10n_ch_hr_payroll
#
# Created by sge@open-net.ch
#
# Copyright (c) 2014-TODAY Open-Net Ltd. <http://www.open-net.ch>
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyrig... | # -*- coding: utf-8 -*-
#
# File: __openerp__.py
# Module: l10n_ch_hr_payroll
#
# Created by sge@open-net.ch
#
# Copyright (c) 2014-TODAY Open-Net Ltd. <http://www.open-net.ch>
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyrig... | agpl-3.0 | Python |
86d2fd8fef263e85d305fef5cc300cd9e3e04a4e | Add date_created to User model | tortxof/flask-password,tortxof/flask-password,tortxof/flask-password | models.py | models.py | import os
import secrets
from urllib.parse import urlparse
import datetime
from peewee import *
from playhouse.postgres_ext import PostgresqlExtDatabase, TSVectorField
def gen_id():
return secrets.token_urlsafe(24)
database = PostgresqlExtDatabase(
os.environ.get('PG_NAME', 'passwords'),
host = os.enviro... | import os
import secrets
from urllib.parse import urlparse
import datetime
from peewee import *
from playhouse.postgres_ext import PostgresqlExtDatabase, TSVectorField
def gen_id():
return secrets.token_urlsafe(24)
database = PostgresqlExtDatabase(
os.environ.get('PG_NAME', 'passwords'),
host = os.enviro... | mit | Python |
9bb97d0545f7283fea55b50263fd980fab5cb824 | Update ThreadPool.py | Salandora/OctoPrint-FileManager,Salandora/OctoPrint-FileManager,Salandora/OctoPrint-FileManager | octoprint_filemanager/ThreadPool.py | octoprint_filemanager/ThreadPool.py | # http://code.activestate.com/recipes/577187-python-thread-pool/
from Queue import Queue
from threading import Thread
class Worker(Thread):
"""Thread executing tasks from a given tasks queue"""
def __init__(self, tasks):
Thread.__init__(self)
self.tasks = tasks
self.daemon = True
... | # http://code.activestate.com/recipes/577187-python-thread-pool/
from Queue import Queue
from threading import Thread
class Worker(Thread):
"""Thread executing tasks from a given tasks queue"""
def __init__(self, tasks):
Thread.__init__(self)
self.tasks = tasks
self.daemon = True
... | agpl-3.0 | Python |
4309705d00d3f3f09ddb1d9c2acc76fd9477af4c | Add error code mapping that is consistent with Discord. | SunDwarf/curious | curious/exc.py | curious/exc.py | """
Exceptions raised from within the library.
"""
import enum
from curious.http.curio_http import Response
class CuriousError(Exception):
"""
The base class for all curious exceptions.
"""
# HTTP based exceptions.
class ErrorCode(enum.IntEnum):
UNKNOWN_ACCOUNT = 10001
UNKNOWN_APPLICATION = 100... | """
Exceptions raised from within the library.
"""
from curious.http.curio_http import Response
class CuriousError(Exception):
"""
The base class for all curious exceptions.
"""
class HTTPException(CuriousError):
"""
Raised when a HTTP request fails with a 400 <= e < 600 error code.
"""
... | mit | Python |
06d4b5dde3a566f50ec5c2d12358fce842a42ceb | Add files via upload | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/olivegarden.py | locations/spiders/olivegarden.py | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class OliveGardenSpider(scrapy.Spider):
name = "olivegarden"
allowed_domains = ['olivegarden.com']
start_urls = (
'http://www.olivegarden.com/en-locations-sitemap.xml',
)
def address(self, addres... | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class OliveGardenSpider(scrapy.Spider):
name = "olivegarden"
allowed_domains = ['olivegarden.com']
start_urls = (
'http://www.olivegarden.com/en-locations-sitemap.xml',
)
def address(self, addres... | mit | Python |
c434a5f4c4ca55ba8fbea81637dfe4db610bd5d1 | backup view actions | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/backup/views.py | nodeconductor/backup/views.py | from django.shortcuts import get_object_or_404
from rest_framework import permissions as rf_permissions
from rest_framework.response import Response
from rest_framework.decorators import action
from nodeconductor.core import viewsets
from nodeconductor.backup import models
from nodeconductor.backup import serializers... | from django.shortcuts import get_object_or_404
from rest_framework import permissions as rf_permissions
from rest_framework import views
from rest_framework.response import Response
from nodeconductor.core import viewsets
from nodeconductor.backup import models
from nodeconductor.backup import serializers
from nodeco... | mit | Python |
209c0d0201b76a0f2db7d8b507b2eaa2df03fcae | Replace custom GRW dist with scipy gengamma. Implement file fitting function. | jbernhard/ebe-analysis | lib/stats.py | lib/stats.py | """
Statistics.
"""
import numpy as np
from scipy.stats import gengamma, norm
"""
Set default starting parameters for fitting a generalized gamma distribution.
These parameters are sensible for ATLAS v_n distributions.
Order: (a, c, loc, scale) where a,c are shape params.
"""
gengamma._fitstart = lambda data: (... | """
Statistics.
"""
from numpy import exp
from scipy.stats import rv_continuous
from scipy.special import gamma
class grw_gen(rv_continuous):
"""
Generalized Reverse Weibull distribution.
PDF:
a/gamma(g) * x^(a*g-1) * exp(-x^a)
for x,a,g >= 0
"""
def _pdf(self,x,a,g):
... | mit | Python |
e0367ccff78768d8e0cb0f2274bafe6871d6d392 | Fix filters | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/filters.py | resolwe_bio/filters.py | """.. Ignore pydocstyle D400.
===================
Resolwe Bio Filters
===================
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import rest_framework_filters as filters
from resolwe.flow.filters import CollectionFilter, DataFilter
from resolwe_bio.models import Sampl... | """.. Ignore pydocstyle D400.
===================
Resolwe Bio Filters
===================
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import rest_framework_filters as filters
from resolwe.flow.filters import CollectionFilter, DataFilter
from resolwe_bio.models import Sampl... | apache-2.0 | Python |
313aafc11f76888614e2a0523e9e858e71765eaa | Add some more tests for wc module. | jelmer/subvertpy,jelmer/subvertpy | tests/test_wc.py | tests/test_wc.py | # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# This program 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 option) any later version.
# This p... | # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# This program 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 option) any later version.
# This p... | lgpl-2.1 | Python |
c99bfaf3d09b1926603a7fef52187e89572a606c | fix cibuild for brave_electron_version auditors: @bbondy | pmkary/braver,pmkary/braver,willy-b/browser-laptop,luixxiul/browser-laptop,luixxiul/browser-laptop,darkdh/browser-laptop,luixxiul/browser-laptop,diasdavid/browser-laptop,darkdh/browser-laptop,timborden/browser-laptop,jonathansampson/browser-laptop,diasdavid/browser-laptop,dcposch/browser-laptop,Sh1d0w/browser-laptop,jo... | tools/cibuild.py | tools/cibuild.py | #!/usr/bin/env python
import os
import subprocess
import sys
import os.path
BRAVE_ELECTRON = process.env.npm_config_brave_electron_version
UPSTREAM_ELECTRON = '1.4.0'
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
TARGET_ARCH= os.environ['TARGET_ARCH'] if os.environ.has_key('TARGET_ARCH') e... | #!/usr/bin/env python
import os
import subprocess
import sys
import os.path
UPSTREAM_ELECTRON = '1.4.0'
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
TARGET_ARCH= os.environ['TARGET_ARCH'] if os.environ.has_key('TARGET_ARCH') else 'x64'
os.environ['npm_config_arch'] = TARGET_ARCH
def exec... | mpl-2.0 | Python |
5b557fe66fab24b6daf2300d7681a7d274301bbb | add models.py | yosukesuzuki/deep-link-app,yosukesuzuki/deep-link-app,yosukesuzuki/deep-link-app | project/core/models.py | project/core/models.py | # -*- coding: utf-8 -*-
# core.models
from google.appengine.ext import db
# Create your models here.
class Article(db.Model):
title = db.StringProperty()
updated_at = db.DateTimeProperty(auto_now=True)
created_at = db.DateTimeProperty(auto_now_add=True)
def __unicode__(self):
return self.ti... | # -*- coding: utf-8 -*-
# core.models
from google.appengine.ext import db
# Create your models here.
class Article(db.Model):
title = db.StringProperty()
updated_at = db.DateTimeProperty(auto_now=True)
created_at = db.DateTimeProperty(auto_now_add=True)
def __unicode__(self):
return self.ti... | mit | Python |
35fe01413e1e8868776704c8b3492877f3df63e6 | add head sord | turbidsoul/tsutil | tsutil/sorted.py | tsutil/sorted.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Turbidsoul Chen
# @Date: 2014-07-30 10:07:05
# @Last Modified by: Turbidsoul Chen
# @Last Modified time: 2014-08-07 17:51:57
def quick_sorted(lst, func=lambda a, b: cmp(a, b), reversed=False):
if len(lst) <= 1:
return lst
pivot = lst[0]
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Turbidsoul Chen
# @Date: 2014-07-30 10:07:05
# @Last Modified by: Turbidsoul Chen
# @Last Modified time: 2014-07-30 10:14:44
def quick_sorted(lst, func=lambda a, b: cmp(a, b), reversed=False):
if len(lst) <= 1:
return lst
pivot = lst[0]
... | mit | Python |
53e46daf96d903b94d43d0911c637a3bc388d630 | Change minimum length of query on dm+d simple search to 3 | ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc | openprescribing/dmd2/forms.py | openprescribing/dmd2/forms.py | from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, ButtonHolder, Submit
from crispy_forms.bootstrap import InlineCheckboxes
obj_types_choices = [
("vtm", "VTMs"),
("vmp", "VMPs"),
("amp", "AMPs"),
("vmpp", "VMPPs"),
("ampp", "AMPPs")... | from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, ButtonHolder, Submit
from crispy_forms.bootstrap import InlineCheckboxes
obj_types_choices = [
("vtm", "VTMs"),
("vmp", "VMPs"),
("amp", "AMPs"),
("vmpp", "VMPPs"),
("ampp", "AMPPs")... | mit | Python |
d49262b0329df8c4ebb53f3c4c4161d2269348a6 | remove unused imports | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/contrib/views.py | meinberlin/apps/contrib/views.py | from django.shortcuts import redirect
from django.views import generic
class ComponentLibraryView(generic.base.TemplateView):
template_name = 'meinberlin_contrib/component_library.html'
class CanonicalURLDetailView(generic.DetailView):
"""DetailView redirecting to the canonical absolute url of an object."""... | from django.http import Http404
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.views import generic
class ComponentLibraryView(generic.base.TemplateView):
template_name = 'meinberlin_contrib/component_library.html'
class CanonicalURLDetailView(generic.DetailView... | agpl-3.0 | Python |
6074202fdc8fa0e707c21edf78dd6c78cfce668a | Fix static file locations in setup.py | schandrika/volttron,schandrika/volttron,schandrika/volttron,schandrika/volttron | Agents/PlatformManagerAgent/setup.py | Agents/PlatformManagerAgent/setup.py | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2013, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2013, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | bsd-2-clause | Python |
30726ed0ed50af7deb50ddce569968d937f96fa3 | Implement TagForm clean_slug method. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | organizer/forms.py | organizer/forms.py | from django import forms
from django.core.exceptions import ValidationError
from .models import Tag
class TagForm(forms.Form):
name = forms.CharField(max_length=31)
slug = forms.SlugField(
max_length=31,
help_text='A label for URL config')
def clean_name(self):
return self.cleane... | from django import forms
from .models import Tag
class TagForm(forms.Form):
name = forms.CharField(max_length=31)
slug = forms.SlugField(
max_length=31,
help_text='A label for URL config')
def clean_name(self):
return self.cleaned_data['name'].lower()
def save(self):
... | bsd-2-clause | Python |
eadc0eb76fc027e5eaee5b9c3c734eaa42a73bf1 | set up... | IQSS/miniverse,IQSS/miniverse,IQSS/miniverse | miniverse/settings/heroku_dev.py | miniverse/settings/heroku_dev.py | from __future__ import absolute_import
import os
from os.path import join#, normpath, isdir, isfile
import dj_database_url
from .base import *
# Set the secret key
SECRET_KEY = os.environ['SECRET_KEY']
# Cookie name
SESSION_COOKIE_NAME = 'dv_metrics_dev'
#INTERNAL_IPS = () # Heroku IP
ALLOWED_HOSTS = ['54.235.7... | from __future__ import absolute_import
import os
from os.path import join#, normpath, isdir, isfile
import dj_database_url
from .base import *
# Set the secret key
SECRET_KEY = os.environ['SECRET_KEY']
# Cookie name
SESSION_COOKIE_NAME = 'dv_metrics_dev'
#INTERNAL_IPS = () # Heroku IP
ALLOWED_HOSTS = ['54.235.7... | mit | Python |
e5f662d9cebe4133705eca74a300c325d432ad04 | Remove destruction of pips/test requires entries that don't exist. | stackforge/anvil,stackforge/anvil,mc2014/anvil,mc2014/anvil | anvil/components/cinder_client.py | anvil/components/cinder_client.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | apache-2.0 | Python |
e1e7589b805072ff741eeb7b31ba326f45ea0504 | Implement an authorization system | vtemian/buffpy,bufferapp/buffer-python | buffpy/api.py | buffpy/api.py | import json
import urllib
from rauth import OAuth2Session, OAuth2Service
from buffpy.response import ResponseObject
BASE_URL = 'https://api.bufferapp.com/1/%s'
PATHS = {
'INFO': 'info/configuration.json'
}
AUTHORIZE_URL = 'https://bufferapp.com/oauth2/authorize'
ACCESS_TOKEN = 'https://api.bufferapp.com/1/oaut... | import json
from rauth import OAuth2Session
from buffpy.response import ResponseObject
BASE_URL = 'https://api.bufferapp.com/1/%s'
PATHS = {
'INFO': 'info/configuration.json'
}
class API(object):
'''
Small and clean class that embrace all basic
operations with the buffer app
'''
def __init__(self, ... | mit | Python |
7bb5f463dfeb39b8ba84a63147756d27901a2f56 | fix cymysql's _extact_error_code() for py3 | graingert/sqlalchemy,Cito/sqlalchemy,robin900/sqlalchemy,olemis/sqlalchemy,276361270/sqlalchemy,epa/sqlalchemy,halfcrazy/sqlalchemy,sandan/sqlalchemy,itkovian/sqlalchemy,epa/sqlalchemy,robin900/sqlalchemy,sqlalchemy/sqlalchemy,Akrog/sqlalchemy,bootandy/sqlalchemy,bdupharm/sqlalchemy,hsum/sqlalchemy,ThiefMaster/sqlalche... | lib/sqlalchemy/dialects/mysql/cymysql.py | lib/sqlalchemy/dialects/mysql/cymysql.py | # mysql/cymysql.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+cymysql
:name: CyMySQL
:dbapi: cymysql
:connectst... | # mysql/cymysql.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+cymysql
:name: CyMySQL
:dbapi: cymysql
:connectst... | mit | Python |
8e86727c52b4a6e2277be6ab270aa1ec67441526 | use all_to_dicts | uranusjr/mosql,moskytw/mosql | examples/40_join.py | examples/40_join.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from pprint import pprint
from mosql.query import select, left_join
from mosql.db import Database, all_to_dicts
db = Database(psycopg2, host='127.0.0.1')
with db as cur:
cur.execute(select(
'person',
{'person_id': 'mosky'},
#... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from pprint import pprint
from mosql.query import select, left_join
from mosql.db import Database
db = Database(psycopg2, host='127.0.0.1')
with db as cur:
cur.execute(select(
'person',
{'person_id': 'mosky'},
# It is same as... | mit | Python |
f9837d8c661a4f8354574a82b1aea0ac4658a8be | add v6.1.6 (#22713) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/qwt/package.py | var/spack/repos/builtin/packages/qwt/package.py | # Copyright 2013-2021 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 Qwt(QMakePackage):
"""The Qwt library contains GUI Components and utility classes which ar... | # Copyright 2013-2021 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 Qwt(QMakePackage):
"""The Qwt library contains GUI Components and utility classes which ar... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.