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 |
|---|---|---|---|---|---|---|---|---|
3c4cb8daac7872a2969c8b5437fb66459cce5ce9 | expand allowed http methods for thread detail view | annaelde/forum-app,annaelde/forum-app,annaelde/forum-app | site/threads/views.py | site/threads/views.py | from rest_framework.generics import CreateAPIView, ListAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAuthenticated
from utils.mixins import MultipleFieldLookupMixin
from .models import Post
from .serializers import PostSerializer
class ThreadList(ListAPIVi... | from rest_framework.generics import CreateAPIView, ListAPIView, RetrieveAPIView
from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAuthenticated
from utils.mixins import MultipleFieldLookupMixin
from .models import Post
from .serializers import PostSerializer
class ThreadList(ListAPIView):
seri... | mit | Python |
420a626297c33b9c4800cd11aff00b27ba8d20c9 | improve example.py (#1843) | exercism/python,exercism/xpython,jmluy/xpython,behrtam/xpython,smalley/python,jmluy/xpython,smalley/python,behrtam/xpython,exercism/xpython,exercism/python | exercises/kindergarten-garden/example.py | exercises/kindergarten-garden/example.py | class Garden(object):
STUDENTS = [
"Alice",
"Bob",
"Charlie",
"David",
"Eve",
"Fred",
"Ginny",
"Harriet",
"Ileana",
"Joseph",
"Kincaid",
"Larry",
]
PLANTS = {"C": "Clover", "G": "Grass", "R": "Radishes", "V": "V... | class Garden(object):
__plant_names = {"C": "Clover", "G": "Grass",
"R": "Radishes", "V": "Violets"}
def __init__(self, diagram,
students=("Alice Bob Charlie David "
"Eve Fred Ginny Harriet "
"Ileana Joseph Kincaid Lar... | mit | Python |
432433296921d52b6a5bbb7ef590a188b042ebc7 | fix docstring | mapbox/geocoding-example,mapbox/geocoding-example,mapbox/geocoding-example,mapbox/geocoding-example | python/mapbox_geocode.py | python/mapbox_geocode.py | import __future__
import os, sys, json
try:
# python 3
from urllib.request import urlopen as urlopen
from urllib.parse import quote_plus as quote_plus
except:
# python 2
from urllib import quote_plus as quote_plus
from urllib2 import urlopen as urlopen
def geocode(mapbox_access_token, query):
... | import __future__
import os, sys, json
try:
# python 3
from urllib.request import urlopen as urlopen
from urllib.parse import quote_plus as quote_plus
except:
# python 2
from urllib import quote_plus as quote_plus
from urllib2 import urlopen as urlopen
def geocode(mapbox_access_token, query):
... | isc | Python |
6efd0829024050422bab78639cf6b642fee39df8 | Add a convenient method to directly get the manager of an employee. | xcgd/hr_streamline | models.py | models.py | # -*- coding: utf-8 -*-
from base64 import b64decode
from cStringIO import StringIO
from PIL import Image
import openerp
from openerp.tools.translate import _
from osv import fields
from osv import osv
class hr_employee_streamline(osv.osv):
_inherit = 'hr.employee'
def _get_managers(self, cr, uid, ids, fi... | # -*- coding: utf-8 -*-
from base64 import b64decode
from cStringIO import StringIO
from PIL import Image
import openerp
from openerp.tools.translate import _
from osv import fields
from osv import osv
class hr_employee_streamline(osv.osv):
_inherit = 'hr.employee'
_columns ={
'signature' : fields... | agpl-3.0 | Python |
3c046cd134885bb62abe7e906e4d5db7a57f0352 | add SpecialUnit model | jantoniomartin/condottieri_scenarios,jantoniomartin/condottieri_scenarios | models.py | models.py | ## Copyright (c) 2012 by Jose Antonio Martin <jantonio.martin AT gmail DOT com>
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU Affero General Public License as published by the
## Free Software Foundation, either version 3 of the License, or (at your option
## a... | ## Copyright (c) 2012 by Jose Antonio Martin <jantonio.martin AT gmail DOT com>
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU Affero General Public License as published by the
## Free Software Foundation, either version 3 of the License, or (at your option
## a... | agpl-3.0 | Python |
39dbbac659e9ae9c1bbad8a979cc99ef6eafaeff | Include class name in model representations | alykhank/FoodMenu,alykhank/FoodMenu,alykhank/FoodMenu | models.py | models.py | #!/usr/bin/env python
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
db = SQLAlchemy(app)
class FoodMenu(db.Model):
id = db.Column(db.Integer, primary_key=True)
result = db.Column(db.Text)
d... | #!/usr/bin/env python
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
db = SQLAlchemy(app)
class FoodMenu(db.Model):
id = db.Column(db.Integer, primary_key=True)
result = db.Column(db.Text)
d... | mit | Python |
5c489f9dac99e33cc2a73fc713e116a5a8cf5368 | Remove emails from AgencyChain | gadventures/gapipy | gapipy/resources/booking/agency_chain.py | gapipy/resources/booking/agency_chain.py | from ..base import Resource
class AgencyChain(Resource):
_resource_name = 'agency_chains'
_as_is_fields = ['id', 'href', 'name', 'flags', 'communication_preferences', 'payment_options', 'agencies']
_date_time_fields_local = ['date_created']
| from ..base import Resource
class AgencyChain(Resource):
_resource_name = 'agency_chains'
_as_is_fields = ['id', 'href', 'name', 'flags', 'communication_preferences', 'payment_options', 'emails', 'agencies']
_date_time_fields_local = ['date_created']
| mit | Python |
cf412b97bc4c1d794c16a7fa6a8f7acefb54b620 | Use setuptools-scm instead of hard-coding __version__ in __init__.py | dr-leo/pandaSDMX | pandasdmx/__init__.py | pandasdmx/__init__.py | from setuptools_scm import get_version
from pandasdmx.api import Request, read_sdmx, read_url
from pandasdmx.source import add_source, list_sources
from pandasdmx.util import Resource
from pandasdmx.writer import write as to_pandas
import logging
__all__ = [
'Request',
'Resource',
'add_source',
'list_... | from pandasdmx.api import Request, read_sdmx, read_url
from pandasdmx.source import add_source, list_sources
from pandasdmx.util import Resource
from pandasdmx.writer import write as to_pandas
import logging
__all__ = [
'Request',
'Resource',
'add_source',
'list_sources',
'logger',
'read_sdmx',... | apache-2.0 | Python |
6e96ce864b76a56b4e4d7494126577ecd1de1f72 | fix bug | alingse/panshell | panshell/baidu/pan.py | panshell/baidu/pan.py | # coding=utf-8
# author@alingse
# 2016.12.14
import requests
from account import BaiduAccount
class Pan(object):
def __init__(self, name='default'):
self._name = name
self.session = requests.Session()
self.account = None
self.context = None
def new_account(self, username, p... | # coding=utf-8
# author@alingse
# 2016.12.14
import requests
from account import BaiduAccount
class Pan(object):
def __init__(self, name='default'):
self._name = name
self.session = requests.Session()
self.account = None
self.context = None
def new_account(self, username, p... | apache-2.0 | Python |
98f796877955c2ff94dade4df33604cd0e0db825 | Remove extraneous line | astropy/photutils,larrybradley/photutils | photutils/conftest.py | photutils/conftest.py | # This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure. It needs to live inside the package in order for it to
# get picked up when running the tests inside an interpreter using
# packagename.test
import os
try:
from pytest_astropy_header.display import PYTEST_HEADER_... | # This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure. It needs to live inside the package in order for it to
# get picked up when running the tests inside an interpreter using
# packagename.test
import os
try:
from pytest_astropy_header.display import PYTEST_HEADER_... | bsd-3-clause | Python |
8d45fba1a412914ddfddaa91074a11e349f71a09 | Compress AAR packages generated with Python's zipfile. | chinakids/crosswalk,ZhengXinCN/crosswalk,pk-sam/crosswalk,XiaosongWei/crosswalk,rakuco/crosswalk,crosswalk-project/crosswalk,lincsoon/crosswalk,mrunalk/crosswalk,zliang7/crosswalk,darktears/crosswalk,rakuco/crosswalk,baleboy/crosswalk,heke123/crosswalk,tomatell/crosswalk,tomatell/crosswalk,rakuco/crosswalk,stonegithubs... | build/android/generate_xwalk_core_library_aar.py | build/android/generate_xwalk_core_library_aar.py | #!/usr/bin/env python
#
# Copyright (c) 2014 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import sys
import zipfile
def main():
option_parser = optparse.OptionParser()
option_parser.add_opti... | #!/usr/bin/env python
#
# Copyright (c) 2014 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import sys
import zipfile
def main():
option_parser = optparse.OptionParser()
option_parser.add_opti... | bsd-3-clause | Python |
0db823d552375d09c03f1a529fe91d25ce236ca3 | fix to use self.view | richardjellis/SublimeEmailInliner,richardjellis/SublimeEmailInliner | EmailInliner.py | EmailInliner.py | import sublime, sublime_plugin, urllib, json
class EmailInlineCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
content = self.view.substr(region)
api_url = 'http://premailer.dialect.ca/api/0.1/documents'
values = { 'html' : content,
'adapter' : self... | import sublime, sublime_plugin, urllib, json
class EmailInlineCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
content = self.view.substr(region)
api_url = 'http://premailer.dialect.ca/api/0.1/documents'
values = { 'html' : content,
'adapter' : vie... | mit | Python |
30566970fe2507048133a9683a1c4381808d2c94 | fix ascii error | wanghaihan/FormatByFecs,wanghaihan/FormatByFecs | FormatByFecs.py | FormatByFecs.py | import sublime, sublime_plugin, os,shlex, subprocess, tempfile
import merge_utils
def formatWholeFile(view, edit):
region = sublime.Region(0, view.size())
code = view.substr(region)
newCode = format(code)
view.replace(edit, sublime.Region(0, view.size()), newCode)
def format(code):
#temp = tempfil... | import sublime, sublime_plugin, os,shlex, subprocess, tempfile
import merge_utils
def formatWholeFile(view, edit):
region = sublime.Region(0, view.size())
code = view.substr(region)
newCode = format(code)
view.replace(edit, sublime.Region(0, view.size()), newCode)
def format(code):
#temp = tempfil... | mit | Python |
31dff61063dac172466e6557c73e6b6e0ea4796a | Test non-numeric input to normalization_length | jrsmith3/tec,jrsmith3/tec | test/test_Langmuir.py | test/test_Langmuir.py | # -*- coding: utf-8 -*-
import numpy as np
from astropy import units
import unittest
from tec.electrode import Metal
from tec.models import Langmuir
em = Metal(temp=1000., barrier=2., richardson=10.)
co = Metal(temp=300., barrier=1., richardson=10., position=10.)
class Base(unittest.TestCase):
"""
Base class... | # -*- coding: utf-8 -*-
import numpy as np
from astropy import units
import unittest
from tec.electrode import Metal
from tec.models import Langmuir
em = Metal(temp=1000., barrier=2., richardson=10.)
co = Metal(temp=300., barrier=1., richardson=10., position=10.)
class Base(unittest.TestCase):
"""
Base class... | mit | Python |
b9507e4fc2dc0fab59663a4ff92204f27f779469 | Replace test of <foo> with one for <html> | gpodder/podcastparser | test_podcastparser.py | test_podcastparser.py | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | isc | Python |
1bf2c6d5201a91646a223e66f7b64fcaffe6ce22 | Add tests for feeds with invalid root elements | gpodder/podcastparser | test_podcastparser.py | test_podcastparser.py | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | isc | Python |
1fe037c5f94c15233b2d75fc549a527b854af80a | Update __init__.py | ysekky/GPy,avehtari/GPy,esiivola/GPYgradients,ysekky/GPy,befelix/GPy,dhhjx880713/GPy,ysekky/GPy,SheffieldML/GPy,avehtari/GPy,SheffieldML/GPy,esiivola/GPYgradients,dhhjx880713/GPy,mikecroucher/GPy,befelix/GPy,SheffieldML/GPy,mikecroucher/GPy,esiivola/GPYgradients,avehtari/GPy,mikecroucher/GPy,SheffieldML/GPy,befelix/GPy... | GPy/__init__.py | GPy/__init__.py | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
from . import core
from .core.parameterization import transformations, priors
constraints = transformations
from . import model... | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
from . import core
from .core.parameterization import transformations, priors
constraints = transformations
from . import model... | bsd-3-clause | Python |
01509b989a76694315a11c927367020f179e1121 | Update HoneypotBase.py | laurenmalone/honeypot,coyle5280/honeypot,laurenmalone/honeypot,ckaz18/honeypot,ckaz18/honeypot,coyle5280/honeypot,ckaz18/honeypot,laurenmalone/honeypot,theplue/honeypot,coyle5280/honeypot,coyle5280/honeypot,theplue/honeypot,theplue/honeypot,ckaz18/honeypot,laurenmalone/honeypot,theplue/honeypot | HoneypotBase.py | HoneypotBase.py | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import OperationalError
from PluginManager import PluginManager
import os
import sys
import time
import logging
import datetime
def _load_plugins():
try:
... | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from PluginManager import PluginManager
import os
import sys
def _load_plugins():
sys.path.insert(0, plugin_directory)
for i in os.listdir(plugin_directory):
filename, e... | mit | Python |
c3a08a122a2b3736d6551b6a7575194e56f3b3be | Revert main.py to full functionality | XENON1T/cax,XENON1T/cax | cax/main.py | cax/main.py | import logging
import time
from cax.config import mongo_password
from cax.tasks import checksum, clear, data_mover, process
def single():
main(run_once = True)
def main(run_once = False):
# Check passwords and API keysspecified
mongo_password()
# Setup logging
logging.basicConfig(filename='cax.l... | import logging
import time
from cax.config import mongo_password
from cax.tasks import checksum, clear, data_mover#, process
def single():
main(run_once = True)
def main(run_once = False):
# Check passwords and API keysspecified
mongo_password()
# Setup logging
logging.basicConfig(filename='cax.... | isc | Python |
8e41c05501aeb54062e1a06e105c7e615fb0ac47 | Add oamdata addr | pusscat/refNes | nesPPU.py | nesPPU.py |
class PPU():
def __init__(self, cpu):
self.cpu = cpu
self.ctrl = 0x2000
self.mask = 0x2001
self.status = 0x2002
self.oamaddr = 0x2003
self.oamdata = 0x2004
self.scroll = 0x2005
self.addr = 0x2006
self.data ... |
class PPU():
def __init__(self, cpu):
self.cpu = cpu
self.ctrl = 0x2000
self.mask = 0x2001
self.status = 0x2002
self.oamaddr = 0x2003
self.scroll = 0x2005
self.addr = 0x2006
self.data = 0x2007
def stepPPU(self)... | bsd-2-clause | Python |
a41258152b8fa0c746e2346ee34f22eb9b23d705 | fix lazyloading | EnTeQuAk/pytest-django-casperjs | src/pytest_django_casperjs/fixtures.py | src/pytest_django_casperjs/fixtures.py | import os
import pytest
from pytest_django.lazy_django import skip_if_no_django
@pytest.fixture(scope='session')
def casper_js(request):
skip_if_no_django()
from pytest_django_casperjs.helper import CasperJSLiveServer
addr = request.config.getvalue('liveserver')
if not addr:
addr = os.gete... | import os
import pytest
from pytest_django.lazy_django import skip_if_no_django
from pytest_django_casperjs.helper import CasperJSLiveServer
@pytest.fixture(scope='session')
def casper_js(request):
skip_if_no_django()
addr = request.config.getvalue('liveserver')
if not addr:
addr = os.getenv('D... | bsd-3-clause | Python |
b70002ee6ffd10f8d6244be92cc53bd067b07000 | Use mercury endpoint for const config var | jr0d/mercury,jr0d/mercury | tests/common/const.py | tests/common/const.py | class ConfigVars(object):
"""Configuration environment variables"""
# behavior
VERBOSE = 'VERBOSE'
# Mercury API URL
MERCURY_API_ENDPOINT = 'MERCURY_API_ENDPOINT'
# TODO some of these probably just belong in this file in another Class
# instead of being defined in a config file (like 'merc... | class ConfigVars(object):
"""Configuration environment variables"""
# behavior
VERBOSE = 'VERBOSE'
# Mercury API URL
MIGRATOR_API_ENDPOINT = 'MIGRATOR_API_ENDPOINT'
# TODO some of these probably just belong in this file in another Class
# instead of being defined in a config file (like 'me... | apache-2.0 | Python |
ca292082d086a501f4b7357cb0935e17924733ca | Revert "Use glibtool." because the proper fix landed in xamarin-gtk-theme. | BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/xamarin-gtk-theme.py | packages/xamarin-gtk-theme.py | Package ('xamarin-gtk-engine', 'master',
sources = [ 'git@github.com:lanedo/xamarin-gtk-theme.git' ],
override_properties = { 'configure':
'./autogen.sh --prefix=%{prefix}'
}
)
| Package ('xamarin-gtk-engine', 'master',
sources = [ 'git@github.com:lanedo/xamarin-gtk-theme.git' ],
override_properties = { 'configure':
'LIBTOOL=glibtool ./autogen.sh --prefix=%{prefix}'
}
)
| mit | Python |
1bd70dcea9c272fe0c553db8b301659071a3e6d9 | Remove backref use in migrate project contributed | HalcyonChimera/osf.io,Nesiehr/osf.io,CenterForOpenScience/osf.io,rdhyee/osf.io,leb2dg/osf.io,saradbowman/osf.io,kch8qx/osf.io,felliott/osf.io,jnayak1/osf.io,hmoco/osf.io,billyhunt/osf.io,TomHeatwole/osf.io,KAsante95/osf.io,alexschiller/osf.io,erinspace/osf.io,leb2dg/osf.io,asanfilippo7/osf.io,mluke93/osf.io,zamattiac/o... | scripts/migrate_presentation_service.py | scripts/migrate_presentation_service.py | import sys
import logging
from framework.auth.core import get_user
from framework.transactions.context import TokuTransaction
from website.project.model import Node
from website.app import init_app
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def do_migration(records, dry=False):
... | import sys
import logging
from framework.auth.core import get_user
from framework.transactions.context import TokuTransaction
from website.project.model import Node
from website.app import init_app
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def do_migration(records, dry=False):
... | apache-2.0 | Python |
a5870479ebd2ecdfda529753f42d3d64a9291ed5 | Fix the test_wsgi. | lucasmiqueias/speakerfight-1,Thalesgm/speakerfight,luanfonceca/speakerfight,fariias/speakerfight,estheraragaos/speakerfight,gtsalles/speakerfight,wagnerluis1982/speakerfight,estheraragaos/speakerfight,wagnerluis1982/speakerfight,fariias/speakerfight,deboraazevedo/speakerfight,gustavopxavier/speakerfight,felipevolpone/s... | deck/tests/test_wsgi.py | deck/tests/test_wsgi.py | from django.test import TestCase
from django.core.handlers.wsgi import WSGIHandler
from os import environ
from speakerfight.wsgi import application
class WSGITest(TestCase):
def test_assert_django_settings_module(self):
self.assertEquals('speakerfight.settings',
environ.get('DJ... | from django.test import TestCase
from django.core.handlers.wsgi import WSGIHandler
from os import environ
from speakerfight.wsgi import application
class WSGITest(TestCase):
def test_assert_django_settings_module(self):
self.assertEquals('settings', environ.get('DJANGO_SETTINGS_MODULE'))
def test_a... | mit | Python |
6b7abe38e57562bae2be02c77cf338b0d55458a9 | debug prints | sepulchered/plan | bot/plan.py | bot/plan.py | import os
import flask
import telepot
import telepot.loop as pot_loop
import telepot.delegate as pot_delegate
BOT_API_TOKEN = os.environ.get('PLAN_BOT_TOKEN', '')
BOT_HOOK_URL = os.environ.get('PLAN_BOT_URL', '/bot/hook')
# bot related
class Planner(telepot.helper.ChatHandler):
def __init__(self, *args, **kwarg... | import os
import logging
import flask
import telepot
import telepot.loop as pot_loop
import telepot.delegate as pot_delegate
logging.basicConfig(filename='plan_bot.log')
BOT_API_TOKEN = os.environ.get('PLAN_BOT_TOKEN', '')
BOT_HOOK_URL = os.environ.get('PLAN_BOT_URL', '/bot/hook')
# bot related
class Planner(tele... | mit | Python |
5f38fb2d0359101b2c786af90b8685e87236d1af | remove extra arg from get dtype | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/ensemble/mmap_util.py | streammorphology/ensemble/mmap_util.py | # coding: utf-8
""" Utilities for keeping track of big memmap'd files """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import numpy as np
__all__ = ['read_allkld', 'get_dtype']
def get_dtype(nkld): #, ndensity_threshold)... | # coding: utf-8
""" Utilities for keeping track of big memmap'd files """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import numpy as np
__all__ = ['read_allkld', 'get_dtype']
def get_dtype(nkld): #, ndensity_threshold)... | mit | Python |
6cf2a9c1d97dffd197f73194a08aef153ae431b7 | Use reverse in symposion.schedule.tests. | pydata/conf_site,pydata/conf_site,pydata/conf_site | symposion/schedule/tests/test_views.py | symposion/schedule/tests/test_views.py | import json
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from . import factories
class ScheduleViewTests(TestCase):
def test_empty_json(self):
c = Client()
r = c.get(reverse("schedule_json"))
assert r.status_code == ... | import json
from django.test.client import Client
from django.test import TestCase
from . import factories
class ScheduleViewTests(TestCase):
def test_empty_json(self):
c = Client()
r = c.get('/conference.json')
assert r.status_code == 200
conference = json.loads(r.content)
... | mit | Python |
2979e8b0941b98cd5eeec8e75b6ccb197f8f97dd | fix imports on mapreduce tests | meyersj/geotweet,meyersj/geotweet,meyersj/geotweet | tests/mapreduce/geo-wordcount_tests.py | tests/mapreduce/geo-wordcount_tests.py | import unittest
import os
from os.path import dirname
import sys
import json
from mrjob.job import MRJob
import Geohash
root = dirname(dirname(dirname(os.path.abspath(__file__))))
sys.path.append(root)
GEOTWEET_DIR = root
COUNTIES_GEOJSON_LOCAL = os.path.join(GEOTWEET_DIR, 'data/geo/us_counties.json')
os.environ['CO... | import unittest
import os
from os.path import dirname
import sys
import json
from mrjob.job import MRJob
import Geohash
root = dirname(dirname(dirname(os.path.abspath(__file__))))
sys.path.append(root)
GEOTWEET_DIR = root
COUNTIES_GEOJSON_LOCAL = os.path.join(GEOTWEET_DIR, 'data/geo/us_counties.json')
os.environ['CO... | mit | Python |
3354b340a6de2d508ec2f2ed8313e05d3eb21420 | Fix duplicate test name in `test_tensor_reflection.py` (#850) | yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi | tests/python/test_tensor_reflection.py | tests/python/test_tensor_reflection.py | import taichi as ti
@ti.all_archs
def test_POT1():
val = ti.var(ti.i32)
n = 4
m = 8
p = 16
@ti.layout
def values():
ti.root.dense(ti.i, n).dense(ti.j, m).dense(ti.k, p).place(val)
assert val.dim() == 3
assert val.shape() == (n, m, p)
@ti.all_archs
def test_POT2():
val ... | import taichi as ti
@ti.all_archs
def test_POT():
val = ti.var(ti.i32)
n = 4
m = 8
p = 16
@ti.layout
def values():
ti.root.dense(ti.i, n).dense(ti.j, m).dense(ti.k, p).place(val)
assert val.dim() == 3
assert val.shape() == (n, m, p)
@ti.all_archs
def test_POT():
val = ... | apache-2.0 | Python |
abff0177579e8a3092dab57a199929930d6eb75f | Fix a set vs list bug | c00w/bitHopper,c00w/bitHopper | ResourcePool.py | ResourcePool.py | #Copyright (C) 2011,2012 Colin Rice
#This software is licensed under an included MIT license.
#See the file entitled LICENSE
#If you were not provided with a copy of the license please contact:
# Colin Rice colin@daedrum.net
import threading
class ResourceGenerator:
def __init__(self, generate = lambda:None,... | #Copyright (C) 2011,2012 Colin Rice
#This software is licensed under an included MIT license.
#See the file entitled LICENSE
#If you were not provided with a copy of the license please contact:
# Colin Rice colin@daedrum.net
import threading
class ResourceGenerator:
def __init__(self, generate = lambda:None,... | mit | Python |
2acf231893ee31692391c98ce85b5a0890294989 | Use re.group instead of groups | zapstar/n-gram-python,zapstar/n-gram-python | ngrams.py | ngrams.py | #!/usr/bin/env python3
"""
Module that can generate N-Grams from a Shakespear's play
"""
import itertools
import re
import string
from collections import Counter, deque
def dialogs(lines):
"""
Extract the dialogues from lines
:param lines: Generator object containing lines of HTML page
:return: Yield... | #!/usr/bin/env python3
"""
Module that can generate N-Grams from a Shakespear's play
"""
import itertools
import re
import string
from collections import Counter, deque
def dialogs(lines):
"""
Extract the dialogues from lines
:param lines: Generator object containing lines of HTML page
:return: Yield... | mit | Python |
bc0ba1fbb6cbf761be150057aca0fbee3ce1a4ee | remove paras when log | geekan/task-manager,geekan/task-manager,geekan/task-manager,geekan/task-manager | task_manager/task_processor/views.py | task_manager/task_processor/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.db.models import Q
from .models import ImageNeuralTask
from time import strftime, localtime
import logging
import json
l = logging.getLogger(__nam... | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.db.models import Q
from .models import ImageNeuralTask
from time import strftime, localtime
import logging
import json
l = logging.getLogger(__nam... | mit | Python |
be24e7bbb506d3c6c80e2edddb5346eb9c1fad5e | fix os.startfile patch under linux | xflr6/graphviz | tests/test_backend.py | tests/test_backend.py | # test_backend.py
import subprocess
import mock
import pytest
from graphviz.backend import render, pipe, view
def test_render_engine_unknown():
with pytest.raises(ValueError) as e:
pipe('spam', 'pdf', b'')
e.match(r'engine')
def test_render_format_unknown():
with pytest.raises(ValueError) as ... | # test_backend.py
import subprocess
import mock
import pytest
from graphviz.backend import render, pipe, view
def test_render_engine_unknown():
with pytest.raises(ValueError) as e:
pipe('spam', 'pdf', b'')
e.match(r'engine')
def test_render_format_unknown():
with pytest.raises(ValueError) as ... | mit | Python |
b5d66e570ba7b0570f10f19e57e56c318a68db9a | Change quality threshold | kyamagu/psd2svg | tests/test_quality.py | tests/test_quality.py | from __future__ import absolute_import, unicode_literals
from glob import glob
import os
import pytest
import imagehash
import numpy as np
import psd2svg
import psd2svg.rasterizer
from psd_tools import PSDImage
FIXTURES = [
p for p in glob(
os.path.join(os.path.dirname(__file__), 'fixtures', '*.psd'))
]
... | from __future__ import absolute_import, unicode_literals
from glob import glob
import os
import pytest
import imagehash
import numpy as np
import psd2svg
import psd2svg.rasterizer
from psd_tools import PSDImage
FIXTURES = [
p for p in glob(
os.path.join(os.path.dirname(__file__), 'fixtures', '*.psd'))
]
... | mit | Python |
f429df3147dfdbdf0504616500a637dd91076417 | add the procedure parameter to the function | kaguna/Yummy-Recipes,kaguna/Yummy-Recipes,kaguna/Yummy-Recipes | tests/test_recipes.py | tests/test_recipes.py | from unittest import TestCase
from classes.categories import Categories
class TestRecipes(TestCase):
"""This class will handle all the functions to test for the recipe name"""
def setUp(self):
"""This method defines the test fixture for all test to be undertaken"""
self.new_category = Categor... | from unittest import TestCase
from classes.categories import Categories
class TestRecipes(TestCase):
"""This class will handle all the functions to test for the recipe name"""
def setUp(self):
"""This method defines the test fixture for all test to be undertaken"""
self.new_category = Categor... | mit | Python |
d4a7215bfcbccfb91aa98f8a760974c81909905b | replace with new test | uranusjr/mosql,moskytw/mosql | tests/test_result2.py | tests/test_result2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from mosql.result2 import Model
class PostgreSQL(Model):
getconn = classmethod(lambda cls: psycopg2.connect(database='mosky'))
putconn = classmethod(lambda cls, conn: None)
class Person(PostgreSQL):
clauses = dict(table='person')
arrange_b... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from mosql.result2 import Model
class PostgreSQL(Model):
getconn = classmethod(lambda cls: psycopg2.connect(database='mosky'))
putconn = classmethod(lambda cls, conn: None)
class Person(PostgreSQL):
clauses = dict(table='person')
arrange_b... | mit | Python |
7bc8935127b7e4c35b4538ba6512ecb48613367a | Test submitting raw and idna-encoded unicode domains | thisismyrobot/dnstwister,thisismyrobot/dnstwister,thisismyrobot/dnstwister | tests/test_unicode.py | tests/test_unicode.py | """Testing Unicode."""
# -*- coding: UTF-8 -*-
from dnstwister import dnstwist, tools
def test_encode_ascii_domain():
assert tools.encode_domain('www.example.com') == '7777772e6578616d706c652e636f6d'
def test_encode_unicode_domain():
unicode_domain = u'www.\u0454xampl\u0454.com'
# www.xn--xampl-91ef.co... | """Testing Unicode."""
import binascii
from dnstwister import dnstwist, tools
def test_encode_ascii_domain():
assert tools.encode_domain('www.example.com') == '7777772e6578616d706c652e636f6d'
def test_encode_unicode_domain():
unicode_domain = u'www.\u0454xampl\u0454.com'
# www.xn--xampl-91ef.com in he... | unlicense | Python |
b35ce6fd9b06cc6f81c009338e1d9b3bc024a4a8 | Fix a typo caused by vim | mineo/lala,mineo/lala | lala/plugins/decide.py | lala/plugins/decide.py | import logging
from random import choice
from lala.util import command, msg
@command
def decide(user, channel, text):
"""Pick one choice in an arbitrary list of choices separated by a slash"""
s_text = text.split("/")
s_text[0] = " ".join(s_text[0].split()[1:])
msg(channel, "%s: %s" %(user, choice(s_t... | import logging
from random import choice
from lala.util import command, msg
@command
def decide(user, channel, text):
"""Pick one choice in an arbitrary list of choicesi separated by a slash"""
s_text = text.split("/")
s_text[0] = " ".join(s_text[0].split()[1:])
msg(channel, "%s: %s" %(user, choice(s_... | mit | Python |
5f12082575dab5964a736a182f6b3fb1f99a861e | Work on thumb, an url param is still missing | tuxity/MYTF1.bundle | Contents/Code/__init__.py | Contents/Code/__init__.py | TITLE = 'MYTF1'
ART = 'art-default.jpg'
ICON = 'icon-default.png'
DB = 'database'
DB_PROGRAMS = '%s/programs.json' % DB
DB_LINKS = '%s/links.json' % DB
API_INIT = 'http://api.mytf1.tf1.fr/mobile/init?device=%s'
API_SYNC = 'http://api.mytf1.tf1.fr/mobile/sync/%s?device=%s&key=%s'
#####################################... | TITLE = 'MYTF1'
ART = 'art-default.jpg'
ICON = 'icon-default.png'
DB = 'database'
DB_PROGRAMS = '%s/programs.json' % DB
DB_LINKS = '%s/links.json' % DB
API_INIT = 'http://api.mytf1.tf1.fr/mobile/init?device=%s'
API_SYNC = 'http://api.mytf1.tf1.fr/mobile/sync/%s?device=%s&key=%s'
#####################################... | mit | Python |
e0f4714162117aff45da886272e0d03068466196 | replace __metaclass__ by with_metaclass | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/data_source_providers.py | corehq/apps/userreports/data_source_providers.py | from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
from corehq.apps.userreports.models import DataSourceConfiguration, StaticDataSourceConfiguration
import six
class DataSourceProvider(six.with_metaclass(ABCMeta, object)):
@abstractmethod
def get_data_sources(self):
pass
... | from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
from corehq.apps.userreports.models import DataSourceConfiguration, StaticDataSourceConfiguration
class DataSourceProvider(object):
__metaclass__ = ABCMeta
@abstractmethod
def get_data_sources(self):
pass
class Dynam... | bsd-3-clause | Python |
c0c58c447fec61efdbdbc5b58705800c2df8f7cf | Set roleid_field for pages. | appressoas/django_cradmin,appressoas/django_cradmin,appressoas/django_cradmin | cradmin_demo/cradmin_demo/webdemo/views/pages.py | cradmin_demo/cradmin_demo/webdemo/views/pages.py | from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import truncatechars
from django import forms
from django_cradmin.viewhelpers import objecttable
from django_cradmin.viewhelpers import create
from django_cradmin.viewhelpers import update
from django_cradmin.viewhelpers import ... | from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import truncatechars
from django import forms
from django_cradmin.viewhelpers import objecttable
from django_cradmin.viewhelpers import create
from django_cradmin.viewhelpers import update
from django_cradmin.viewhelpers import ... | bsd-3-clause | Python |
7b039587a47e99a8c2a63bc19df7501303a90d55 | Bump version | rtfd/recommonmark,tqchen/recommonmark,sid-kap/recommonmark | recommonmark/__init__.py | recommonmark/__init__.py | __version__ = '0.0.2'
| __version__ = '0.0.1'
| mit | Python |
d9509b9b898fa297aa3b9c640efd11b15fff0084 | update the default pg user/pass | cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo | distributed/settings.py | distributed/settings.py | import os
# Database connection URI. PostgreSQL or MySQL suggested.
# Examples, see documentation for more:
# postgresql://foo:bar@localhost:5432/mydatabase
# mysql://foo:bar@localhost/mydatabase
SQLALCHEMY_DATABASE_URI = "postgresql://cuckoo:cuckoo@localhost/distributed"
# Secret key used by Flask to generate sessio... | import os
# Database connection URI. PostgreSQL or MySQL suggested.
# Examples, see documentation for more:
# postgresql://foo:bar@localhost:5432/mydatabase
# mysql://foo:bar@localhost/mydatabase
SQLALCHEMY_DATABASE_URI = "postgresql://jbr:jbr@localhost/distributed"
# Secret key used by Flask to generate sessions etc... | mit | Python |
5219864f447e0b7bf7450ebdd6d4613c2337c9e4 | update version | chiu/django-nvd3,areski/django-nvd3,areski/django-nvd3,areski/django-nvd3,lgp171188/django-nvd3,lgp171188/django-nvd3,lgp171188/django-nvd3,chiu/django-nvd3,marcogiusti/django-nvd3,chiu/django-nvd3 | django_nvd3/__init__.py | django_nvd3/__init__.py | # -*- coding: utf-8 -*-
VERSION = (0, 0, 3, "")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Arezqui Belaid"
__contact__ = "areski@gmail.com"
__homepage__ = "http://www.areski.net"
__docformat__ = "restructuredtext"
| # -*- coding: utf-8 -*-
VERSION = (0, 0, 2, "")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Arezqui Belaid"
__contact__ = "areski@gmail.com"
__homepage__ = "http://www.areski.net"
__docformat__ = "restructuredtext"
| mit | Python |
9cdd4901f1a9502935fceb13832f1725025985db | Add comments and prepare to change to module | ajorg/DMR_contacts | dmr-marc-users-cs750.py | dmr-marc-users-cs750.py | #!/usr/bin/env python2
import csv
import re
from urllib2 import urlopen
# The JSON is invalid, because of mixed encodings. The CSV also has
# data quality issues, but most can be ignored.
DB_URL = ('http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi'
'?table=users&format=csv&header=1')
# The CS750 u... | #!/usr/bin/env python2
import csv
import re
from urllib2 import urlopen
DB_URL = ('http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi'
'?table=users&format=csv&header=1')
ILLEGAL = re.compile('[^a-zA-Z0-9\. ]')
FIELDNAMES = ('No', 'Call Alias', 'Call Type', 'Call ID', 'Receive Tone')
def alias(user... | apache-2.0 | Python |
e19d5eecec1473f38d2802d545fb0f1cfab234f5 | Update threadpool.py | galkan/flashlight | lib/core/threadpool.py | lib/core/threadpool.py | try:
import sys
import inspect
from Queue import Queue
from threading import Thread
except ImportError, err:
import sys
sys.stderr.write("%s : %s-%s\n"% (err, __file__, inspect.currentframe().f_lineno))
sys.exit(1)
class Worker(Thread):
def __init__(self, ... | try:
import sys
import inspect
from Queue import Queue
from threading import Thread
except ImportError, err:
import sys
sys.stderr.write("%s : %s-%s\n"% (err, __file__, inspect.currentframe().f_lineno))
sys.exit(1)
class Worker(Thread):
def __init__(self, ... | mit | Python |
2fda2e05cf22763a62d7e48597499167884d36a8 | Fix the command related to logos extraction, refs #326 | davidbgk/udata,etalab/udata,opendatateam/udata,opendatateam/udata,etalab/udata,davidbgk/udata,opendatateam/udata,etalab/udata,jphnoel/udata,davidbgk/udata,jphnoel/udata,jphnoel/udata | udata/features/territories/commands.py | udata/features/territories/commands.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import contextlib
import logging
import lzma
import os
import shutil
import tarfile
from urllib import urlretrieve
import requests
from udata.models import (
Dataset, TERRITORY_DATASETS, ResourceBasedTerritoryDataset
)
from udata.comma... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import contextlib
import logging
import lzma
import os
import shutil
import tarfile
from urllib import urlretrieve
import requests
from udata.models import (
Dataset, TERRITORY_DATASETS, ResourceBasedTerritoryDataset
)
from udata.comma... | agpl-3.0 | Python |
fdc2b0f04babc9cede8be82ea39493d1b8db30d0 | Add link to issue | blag/django-watchman,mwarkentin/django-watchman,blag/django-watchman,ulope/django-watchman,JBKahn/django-watchman,ulope/django-watchman,mwarkentin/django-watchman,JBKahn/django-watchman | watchman/settings.py | watchman/settings.py | from django.conf import settings
# TODO: these should not be module level (https://github.com/mwarkentin/django-watchman/issues/13)
WATCHMAN_ENABLE_PAID_CHECKS = getattr(settings, 'WATCHMAN_ENABLE_PAID_CHECKS', False)
WATCHMAN_AUTH_DECORATOR = getattr(settings, 'WATCHMAN_AUTH_DECORATOR', 'watchman.decorators.token_req... | from django.conf import settings
# TODO: these should not be module level.
WATCHMAN_ENABLE_PAID_CHECKS = getattr(settings, 'WATCHMAN_ENABLE_PAID_CHECKS', False)
WATCHMAN_AUTH_DECORATOR = getattr(settings, 'WATCHMAN_AUTH_DECORATOR', 'watchman.decorators.token_required')
WATCHMAN_TOKEN = getattr(settings, 'WATCHMAN_TOKE... | bsd-3-clause | Python |
811afc8704d705054da3fea2db524beaf8391433 | Update HoneypotBase.py | laurenmalone/honeypot,ckaz18/honeypot,coyle5280/honeypot,ckaz18/honeypot,coyle5280/honeypot,coyle5280/honeypot,theplue/honeypot,theplue/honeypot,laurenmalone/honeypot,ckaz18/honeypot,ckaz18/honeypot,coyle5280/honeypot,theplue/honeypot,theplue/honeypot,laurenmalone/honeypot,laurenmalone/honeypot | Tests/HoneypotBaseTest.py | Tests/HoneypotBaseTest.py | import unittest
import HoneypotBase
class MyTestCase(unittest.TestCase):
# plugins tests
# make sure threads are being created for each plugin
def test_plugins_loaded(self):
HoneypotBase._load_plugins()
self.assertIsNotNone(HoneypotBase.threads)
self.assertNotEqual(len(HoneypotBas... | import unittest
from HoneypotBase import HoneypotBase
class MyTestCase(unittest.TestCase):
# plugins tests
# make sure threads are being created for each plugin
def test_plugins_loaded(self):
hp = HoneypotBase()
hp._load_plugins()
self.assertIsNotNone(hp._threads)
self.ass... | mit | Python |
8b341836dacc0806a0ae42acc844aca134fd675c | update course CSV generation script | LoyolaChicagoCS/coursedescriptions,LoyolaChicagoCS/coursedescriptions,LoyolaChicagoCS/coursedescriptions | scripts/syllabi/generate-course-csv.py | scripts/syllabi/generate-course-csv.py | #!/usr/bin/env python
# coding: utf-8
import sqlite3
import csv
import sys
import argparse
QUERY_TEMPLATE = """
select "COMP Course Number",
"COMP Section Number",
"Faculty Last Name",
Semester,
Syllabus
from courses
where Semester="%(qual_semester)s" and "Final Version" == 'Yes'
order b... | #!/usr/bin/env python
# coding: utf-8
import sqlite3
import csv
import sys
import argparse
QUERY_TEMPLATE = """
select "COMP Course Number",
"COMP Section Number",
"Faculty Last Name",
Semester,
Syllabus
from courses
where Semester="%(qual_semester)s" and "Final Version" == 'Yes'
order b... | apache-2.0 | Python |
7c5fc3803972c029dfc99d38c84f6267c68b257f | Fix in message class | ProtoxiDe22/Octeon | octeon.py | octeon.py | """
Octeon stuff
"""
class message:
"""
Base message class
Raises:
TypeError on incompatible conditions, like photo and parse_mode
"""
def __init__(self,
text="",
photo=None,
inline_keyboard=None,
parse_mode=None,
... | """
Octeon stuff
"""
class message:
"""
Base message class
Raises:
TypeError on incompatible conditions, like photo and parse_mode
"""
def __init__(self,
text="",
photo=None,
inline_keyboard=None,
parse_mode=None,
... | mit | Python |
e4c7fe41f45636af80b6047a784777ad6416ce11 | Prepare 1.10.53 | wagnerand/amo-validator,wagnerand/amo-validator,wagnerand/amo-validator,mozilla/amo-validator,mozilla/amo-validator,mozilla/amo-validator,wagnerand/amo-validator,mozilla/amo-validator | validator/__init__.py | validator/__init__.py | __version__ = '1.10.53'
class ValidationTimeout(Exception):
"""Validation has timed out.
May be replaced by the exception type raised by an external timeout
handler when run in a server environment."""
def __init__(self, timeout):
self.timeout = timeout
def __str__(self):
return... | __version__ = '1.10.52'
class ValidationTimeout(Exception):
"""Validation has timed out.
May be replaced by the exception type raised by an external timeout
handler when run in a server environment."""
def __init__(self, timeout):
self.timeout = timeout
def __str__(self):
return... | bsd-3-clause | Python |
66d34ea1b214e5c663f8db00cdaa0fbef9933116 | Switch osmapi to use requests and caching | emacsen/changemonger | osmapi.py | osmapi.py | ## Changemonger: An OpenStreetMap change analyzer
## Copyright (C) 2012 Serge Wroclawki
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as
## published by the Free Software Foundation, either version 3 of the
## License, or ... | import urllib2
server = 'api.openstreetmap.org'
def getNode(id):
url = 'http://' + server + '/api/0.6/node/' + str(id)
return urllib2.urlopen(url).read()
def getWay(id):
url = 'http://' + server + '/api/0.6/way/' + str(id)
return urllib2.urlopen(url).read()
def getRelation(id):
url = 'http://' +... | agpl-3.0 | Python |
97a60c3c7819beba1efe2f7ae68bbbc038449c9b | Fix broken speech link. | tswast/google-cloud-python,calpeyser/google-cloud-python,GoogleCloudPlatform/gcloud-python,tseaver/google-cloud-python,GoogleCloudPlatform/gcloud-python,tartavull/google-cloud-python,calpeyser/google-cloud-python,tseaver/gcloud-python,tseaver/gcloud-python,dhermes/gcloud-python,dhermes/google-cloud-python,googleapis/go... | speech/google/cloud/speech/encoding.py | speech/google/cloud/speech/encoding.py | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
67d6b023d213f78190dab2782c992397a2cbceb6 | Add missing space to help text for registration confirm text | fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver | src/ctf_gameserver/web/scoring/forms.py | src/ctf_gameserver/web/scoring/forms.py | from django import forms
from django.utils.translation import ugettext_lazy as _
from . import models
class GameControlAdminForm(forms.ModelForm):
"""
Form for the GameControl object, designed to be used in GameControlAdmin.
"""
# Ticks longer than 1 hours are possible but don't seem reasonable and ... | from django import forms
from django.utils.translation import ugettext_lazy as _
from . import models
class GameControlAdminForm(forms.ModelForm):
"""
Form for the GameControl object, designed to be used in GameControlAdmin.
"""
# Ticks longer than 1 hours are possible but don't seem reasonable and ... | isc | Python |
e16c65ec8c774cc27f9f7aa43e88521c3854b6b7 | Return exit code (count of errors) | MichalMaM/ella,MichalMaM/ella,WhiskeyMedia/ella,whalerock/ella,ella/ella,whalerock/ella,WhiskeyMedia/ella,petrlosa/ella,petrlosa/ella,whalerock/ella | ella/imports/management/commands/fetchimports.py | ella/imports/management/commands/fetchimports.py | from django.core.management.base import NoArgsCommand
from optparse import make_option
import sys
class Command(NoArgsCommand):
help = 'Fetch all registered imports'
def handle(self, *test_labels, **options):
from ella.imports.models import fetch_all
errors = fetch_all()
if errors:
... | from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
help = 'Fetch all registered imports'
def handle(self, *test_labels, **options):
from ella.imports.models import fetch_all
fetch_all()
| bsd-3-clause | Python |
ccfc36a9933cffd35558173d95b913f0f00ea2ca | Fix python 2.6 error | ImmobilienScout24/aws-monocyte,ImmobilienScout24/aws-monocyte | src/main/python/monocyte/handler/iam.py | src/main/python/monocyte/handler/iam.py | from __future__ import print_function, absolute_import, division
from monocyte.handler import Resource, Handler
import boto3
class User(Handler):
def fetch_regions(self):
return []
def get_users(self):
iam = boto3.resource('iam')
user_response = iam.list_users()
return user_r... | from __future__ import print_function, absolute_import, division
from monocyte.handler import Resource, Handler
import boto3
class User(Handler):
def fetch_regions(self):
return []
def get_users(self):
iam = boto3.resource('iam')
user_response = iam.list_users()
return user_r... | apache-2.0 | Python |
ffba5c688ff74a0630f9f70be1d7760a43a7deba | remove duplicate key in manifest | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/hr_expense_check/__manifest__.py | addons/hr_expense_check/__manifest__.py | # -*- coding: utf-8 -*-
{
'name': "Check Printing in Expenses",
'summary': """Print amount in words on checks issued for expenses""",
'category': 'Accounting',
'description': """
Print amount in words on checks issued for expenses
""",
'version': '1.0',
'depends': ['account_check_pri... | # -*- coding: utf-8 -*-
{
'name': "Check Printing in Expenses",
'summary': """Print amount in words on checks issued for expenses""",
'category': 'Accounting',
'description': """
Print amount in words on checks issued for expenses
""",
'category': 'Accounting & Finance',
'version... | agpl-3.0 | Python |
32a53186822106a59745541b951d5470beacd4a2 | Make 0 seconds never expire | zifnab06/zifb.in,zifnab06/zifb.in | api/v1.py | api/v1.py | from app import app, database
from util import random_string
from flask import request
import arrow
import json
@app.route('/api/v1/paste', methods=('POST',))
def paste():
paste = None
language = None
user = None
expiration = None
domain = 'https://zifb.in/'
try:
data = json.loads(reque... | from app import app, database
from util import random_string
from flask import request
import arrow
import json
@app.route('/api/v1/paste', methods=('POST',))
def paste():
paste = None
language = None
user = None
expiration = None
domain = 'https://zifb.in/'
try:
data = json.loads(reque... | mit | Python |
92d3c070744a48584a0f52c69a6ba6ac7e0ee86b | Make EntwinedCollection constructor take an entwiner class instead of template_pages as argument. | kirkeby/sheared | src/sheared/web/collections/entwined.py | src/sheared/web/collections/entwined.py | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# 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 2... | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# 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 2... | mit | Python |
a02e02a54a7c5640e1345766a883e46153e70138 | Allow multiple template_pages in EntwinedCollection. | kirkeby/sheared | src/sheared/web/collections/entwined.py | src/sheared/web/collections/entwined.py | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# 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 2... | #
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# 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 2... | mit | Python |
53a5259b639357acad383940f483804fe7928e90 | Fix logging for deprecated_traverse_pagination | edx/ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce,edx/ecommerce,edx/ecommerce | ecommerce/core/utils.py | ecommerce/core/utils.py | from __future__ import unicode_literals
import hashlib
import logging
from urlparse import parse_qs, urlparse
import six
import waffle
from django.core.exceptions import ValidationError
logger = logging.getLogger(__name__)
def log_message_and_raise_validation_error(message):
"""
Logs provided message and r... | from __future__ import unicode_literals
import hashlib
import logging
from urlparse import parse_qs, urlparse
import six
import waffle
from django.core.exceptions import ValidationError
logger = logging.getLogger(__name__)
def log_message_and_raise_validation_error(message):
"""
Logs provided message and r... | agpl-3.0 | Python |
89fc8580233548dd231ac3a1fdeaff3a7458a313 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/6721100c58e1ec6469e8a7813a3afcea9609aeae. | tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,tensorflow/... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "6721100c58e1ec6469e8a7813a3afcea9609aeae"
TFRT_SHA256 = "532282400d18eacde5babe9a19c1... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "7e6faaf516997b4745c4bb1966169426e26922a9"
TFRT_SHA256 = "f42af3632a39b24c5c3c28a482ac... | apache-2.0 | Python |
4fd355003712ff9626c01d24e29cdfc017ecb4a1 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/9f09fe00370c4305c17d6f36afeb821e0eebaece. | karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,karllessard/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,te... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "9f09fe00370c4305c17d6f36afeb821e0eebaece"
TFRT_SHA256 = "5d00fbb8367ae31d21bb908609f87a3fae1d47009d9ea4... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "300129639ddf8c93482a76e237ac8f258b4eb2b3"
TFRT_SHA256 = "f47c3ac2c3392e2ae5554d7f45df3cc2b28ef20615d6c2... | apache-2.0 | Python |
4718d34d9ce9502526309cec3c6d43d7cb6961f3 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/c97328dc7d527e39b868127bff31732ee2a7a9e5. | Intel-tensorflow/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,te... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "c97328dc7d527e39b868127bff31732ee2a7a9e5"
TFRT_SHA256 = "2605eb1bb250d02acc0efdea109417dfce60b92a1da284... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "fb895960cc796437c6d516cc19027c94f2319b4d"
TFRT_SHA256 = "9c5c10fa7b516554c8a6725e13c3d959609ad5d8fab2c6... | apache-2.0 | Python |
d513d801461dbb263254bb73b796e61c4ae57ff3 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/2d6cec61e55ca806a06ee5dc68d9ddf159bd4f9f. | tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,Intel-tensorflow/tensorflow,Intel-Corporation/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "2d6cec61e55ca806a06ee5dc68d9ddf159bd4f9f"
TFRT_SHA256 = "3e4a83e69e2501275a9cada5c6bf... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "374ed4ada52a9e067544f75390bed5227de3eb1d"
TFRT_SHA256 = "77df5f22d16f71a6fd5c94decceb... | apache-2.0 | Python |
0383c49001f1b51b0fa72e6776a36c696798fb38 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/7a6dcd91d1439a974eb3abacdaf4b0714cb60829. | gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,karllessard/tensorflow,Intel-Corporation/tensorflow,tensor... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "7a6dcd91d1439a974eb3abacdaf4b0714cb60829"
TFRT_SHA256 = "0015b3cc84b7a67ec21753bc3c00... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "89c7de85671c760981867f469db39d290c07c6b1"
TFRT_SHA256 = "d5ad765beaf3af77719455a6a050... | apache-2.0 | Python |
32df670b0a3c19ad86944ffae92926c76f3da2ad | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/f66f87bad3576356f286662b0f4a742ffed33c0d. | google/tsl,google/tsl,google/tsl | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "f66f87bad3576356f286662b0f4a742ffed33c0d"
TFRT_SHA256 = "b35a52bcd37a7aca08b0446b96eb... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "e628c9752dd4bcf12f7a38b945d5629cd03e6ee3"
TFRT_SHA256 = "d2259080a246eeaacb24dfdbd4b3... | apache-2.0 | Python |
82fe18a9a919abc1da407c86135bcce648354b19 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/059736af65f63a5ea7c968a275b6b873162dc2ba. | tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,yongtang/tensor... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "059736af65f63a5ea7c968a275b6b873162dc2ba"
TFRT_SHA256 = "c867a57f533786574d1bcc39ead0... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "fc70a32ecd248dd7612d75d2177125ed14541367"
TFRT_SHA256 = "29492ef37df4528b4b9c4741e773... | apache-2.0 | Python |
bebbaecd0b5c29b25448364610fc1a82373a2f65 | update User-Agent's | streamlink/streamlink,gravyboat/streamlink,bastimeyer/streamlink,melmorabity/streamlink,bastimeyer/streamlink,melmorabity/streamlink,chhe/streamlink,chhe/streamlink,streamlink/streamlink,gravyboat/streamlink | src/streamlink/plugin/api/useragents.py | src/streamlink/plugin/api/useragents.py | ANDROID = "Mozilla/5.0 (Linux; Android 10; SM-G960U) AppleWebKit/537.36 (KHTML, like Gecko) 87.0.4280.66 Mobile Safari/537.36"
CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 87.0.4280.66 Safari/537.36"
CHROME_OS = "Mozilla/5.0 (X11; CrOS armv7l 13421.99.0) AppleWebKit/537.36 ... | ANDROID = ("Mozilla/5.0 (Linux; Android 7.1.1; SM-J510FN Build/NMF26X) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36")
CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
CHROME_OS = ("Mozilla/5.0 ... | bsd-2-clause | Python |
94806044679ab28320cc32556ff6a6fa079e6248 | Fix pep8 on Articles models: E303 too many blank lines | MichalMaM/ella,whalerock/ella,ella/ella,petrlosa/ella,petrlosa/ella,whalerock/ella,WhiskeyMedia/ella,MichalMaM/ella,WhiskeyMedia/ella,whalerock/ella | ella/articles/models.py | ella/articles/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from ella.core.models import Publishable
class Article(Publishable):
"""
``Article`` is the most common publishable object. It can be used for
news on internet news pages, blog posts on smaller blogs or even for
news... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from ella.core.models import Publishable
class Article(Publishable):
"""
``Article`` is the most common publishable object. It can be used for
news on internet news pages, blog posts on smaller blogs or even for
new... | bsd-3-clause | Python |
575be49ef8d9f3d007b4c24995c9e37e604bcf69 | Improve description to avoid colisions with feedparser module | ZDroid/feedstyl | parser.py | parser.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Python feedparsing script
#
import sys
import feedparser
# List of uples (label, property tag, truncation)
# -----------------------------------------------
feed_properties = [
("\n\033[1mFeed title:\033[0m", "title", None),
("\033[1mFeed description:\033[0m", "d... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Python feed parser
#
import sys
import feedparser
# List of uples (label, property tag, truncation)
# -----------------------------------------------
feed_properties = [
("\n\033[1mFeed title:\033[0m", "title", None),
("\033[1mFeed description:\033[0m", "descript... | mit | Python |
9b61a5d5e0abf0888a34b32a8a1a4aeeb3487fcf | add another test case to the mod pyunit | madmax983/h2o-3,pchmieli/h2o-3,datachand/h2o-3,madmax983/h2o-3,mrgloom/h2o-3,mathemage/h2o-3,h2oai/h2o-3,printedheart/h2o-3,tarasane/h2o-3,weaver-viii/h2o-3,PawarPawan/h2o-v3,mathemage/h2o-3,weaver-viii/h2o-3,michalkurka/h2o-3,brightchen/h2o-3,tarasane/h2o-3,bospetersen/h2o-3,printedheart/h2o-3,mathemage/h2o-3,kyoren/h... | h2o-py/tests/testdir_munging/binop/pyunit_mod.py | h2o-py/tests/testdir_munging/binop/pyunit_mod.py | import sys
sys.path.insert(1, "../../../")
import h2o
def frame_as_list(ip,port):
# Connect to h2o
h2o.init(ip,port)
prostate = h2o.import_frame(path=h2o.locate("smalldata/prostate/prostate.csv.zip"))
print (prostate % 10).show()
print (prostate[4] % 10).show()
airlines = h2o.import_frame(path=h2o.loca... | import sys
sys.path.insert(1, "../../../")
import h2o
def frame_as_list(ip,port):
# Connect to h2o
h2o.init(ip,port)
prostate = h2o.import_frame(path=h2o.locate("smalldata/prostate/prostate.csv.zip"))
print (prostate % 10).show()
print (prostate[4] % 10).show()
if __name__ == "__main__":
h2o.run_test(sy... | apache-2.0 | Python |
45c400e02fbeb5b455e27fef81e47e45f274eaec | Add a default bet amount. | stephenmcd/gamblor,stephenmcd/gamblor | core/forms.py | core/forms.py |
from django import forms
class GameForm(forms.Form):
amount = forms.IntegerField(initial=100)
def __init__(self, *args, **kwargs):
super(GameForm, self).__init__(*args, **kwargs)
for name, field in self.fields.items():
if isinstance(field, forms.IntegerField):
se... |
from django import forms
class GameForm(forms.Form):
amount = forms.IntegerField()
def __init__(self, *args, **kwargs):
super(GameForm, self).__init__(*args, **kwargs)
for name, field in self.fields.items():
if isinstance(field, forms.IntegerField):
self.fields[n... | bsd-2-clause | Python |
cdef3dd62f04807f85315ac44a9f3867f969c582 | implement Locale class that responsible for translating item recording to locale config | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/tools/localization.py | app/tools/localization.py | #-*- coding:utf-8 -*-
import os
import json
from tools.config import Config
class LocaleProxyer(dict):
_locale_file_dir=None
_locale_files_content={}
def __init__(self,locale_file_dir):
assert isinstance(locale_file_dir,str)
if type(self)._locale_file_dir !=os.path.abspath(locale_file_dir):
type(self)._loca... | #-*- coding:utf-8 -*-
import os
import json
class LocaleProxyer(dict):
_locale_file_dir=None
_locale_files_content={}
def __init__(self,locale_file_dir):
assert isinstance(locale_file_dir,str)
if type(self)._locale_file_dir !=os.path.abspath(locale_file_dir):
type(self)._locale_file_dir=os.path.abspath(loca... | mit | Python |
961477dc3af03b0bb23f10c1db348dca0a4f42e0 | Add assets rest endpoint | kriberg/stationspinner,kriberg/stationspinner | stationspinner/character/serializers.py | stationspinner/character/serializers.py | from rest_framework import serializers
from stationspinner.character.models import CharacterSheet, Skill, \
SkillInTraining, SkillQueue, AssetList, Asset
class SkillSerializer(serializers.ModelSerializer):
class Meta:
model = Skill
exclude = ('owner',)
class SkillQueueSerializer(serializers.... | from rest_framework import serializers
from stationspinner.character.models import CharacterSheet, Skill, \
SkillInTraining, SkillQueue, AssetList
class SkillSerializer(serializers.ModelSerializer):
class Meta:
model = Skill
exclude = ('owner',)
class SkillQueueSerializer(serializers.ModelSe... | agpl-3.0 | Python |
7bca12a949097348606bfe0476f720ed1a229e86 | Change environment variable. | Agreste/MobUrbRoteiro,san-bil/astan,scwu/stress-relief,fert89/prueba-3-heroku-flask,san-bil/astan,Agreste/MobUrbRoteiro,albertogg/flask-bootstrap-skel,san-bil/astan,san-bil/astan,fert89/prueba-3-heroku-flask,Agreste/MobUrbRoteiro,scwu/stress-relief,akhilaryan/clickcounter | application/production.py | application/production.py | import os
DEBUG = False
RELOAD = False
CSRF_ENABLED = True
SECRET_KEY = 'notmysecretkey'
SQLALCHEMY_DATABASE_URI = str(os.environ.get('DATABASE_URL', 'postgresql://localhost/myproddatabase'))
| import os
DEBUG = False
RELOAD = False
CSRF_ENABLED = True
SECRET_KEY = 'notmysecretkey'
SQLALCHEMY_DATABASE_URI = str(os.environ.get('HEROKU_POSTGRESQL', 'postgresql://localhost/myproddatabase'))
| bsd-3-clause | Python |
436c465ba548fcc511fe9226fbffede8af4e0bad | Test genfromdta return DataFrame | waynenilsen/statsmodels,nvoron23/statsmodels,alekz112/statsmodels,rgommers/statsmodels,cbmoore/statsmodels,ChadFulton/statsmodels,bashtage/statsmodels,nguyentu1602/statsmodels,YihaoLu/statsmodels,wdurhamh/statsmodels,bzero/statsmodels,edhuckle/statsmodels,YihaoLu/statsmodels,josef-pkt/statsmodels,kiyoto/statsmodels,wzb... | statsmodels/iolib/tests/test_foreign.py | statsmodels/iolib/tests/test_foreign.py | """
Tests for iolib/foreign.py
"""
from numpy.testing import *
import numpy as np
import statsmodels.api as sm
import os
# Test precisions
DECIMAL_4 = 4
DECIMAL_3 = 3
def test_genfromdta():
"""
Test genfromdta vs. results/macrodta.npy created with genfromtxt.
"""
#NOTE: Stata handles data very oddly. R... | """
Tests for iolib/foreign.py
"""
from numpy.testing import *
import numpy as np
import statsmodels.api as sm
import os
# Test precisions
DECIMAL_4 = 4
DECIMAL_3 = 3
def test_genfromdta():
"""
Test genfromdta vs. results/macrodta.npy created with genfromtxt.
"""
#NOTE: Stata handles data very oddly. R... | bsd-3-clause | Python |
216c7af13b3976701e712d02fca10b5bcb2e0b7e | Fix test. Previous city wall example was edited upstream in OSM and does not match any more. | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/857-move_barriers_to_landuse.py | integration-test/857-move_barriers_to_landuse.py | # update landuse to include barriers features and delete from boundaries
# city_wall in landuse
# http://www.openstreetmap.org/way/81522922
assert_has_feature(
12, 2030, 1300, 'landuse',
{ 'kind': 'city_wall'})
# city_wall not in boundaries
assert_no_matching_feature(
12, 2030, 1300, 'boundaries',
{ '... | # update landuse to include barriers features and delete from boundaries
# city_wall in landuse
# http://www.openstreetmap.org/way/258909996
assert_has_feature(
12, 3302, 1750, 'landuse',
{ 'kind': 'city_wall'})
# city_wall not in boundaries
assert_no_matching_feature(
12, 3302, 1750, 'boundaries',
{ ... | mit | Python |
9254de827a88d1f84721a0108273d819359eac35 | Update booted.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/led_berepi/booted.py | apps/led_berepi/booted.py | ## This code for HW init
## It will show LED Blue ON, 30secs after booting
## We can easily check the booting has problem
thispath='...BerePi/trunk/apps/led_berepi'
import sys
from ledinit import *
debug_print = 1
def BootLed():
ledr_on()
time.sleep(1)
ledr_off()
time.sleep(1)
if __name__== "__main__" :
if... | ## This code for HW init
## It will show LED Blue ON, 30secs after booting
## We can easily check the booting has problem
thispath='...BerePi/trunk/apps/led_berepi'
import sys
from ledinit import *
debug_print = 1
def BootLed():
ledb_on()
time.sleep(1)
ledb_off()
time.sleep(1)
if __name__== "__main__" :
if... | bsd-2-clause | Python |
1b6bc19a0477327fd16b3b558915d7329fd4d2df | Update ipc_lista1.1.py | any1m1c/ipc20161 | lista1/ipc_lista1.1.py | lista1/ipc_lista1.1.py | #ipc_lista1.1
#Professor: Jucimar Junior
#Any Mendes Carvalho - 161531
#
#
#
#
#Faça um Programa que mostre a mensagem "Alo mundo" na tela.
print("Hello World")
| #ipc_lista1.1
#Professor: Jucimar Junior
#Any Mendes Carvalho - 16153
#
#
#
#
#Faça um Programa que mostre a mensagem "Alo mundo" na tela.
print("Hello World")
| apache-2.0 | Python |
3c6078483799bcd72ec33c840ec335b73e9637a4 | Update ipc_lista1.7.py | any1m1c/ipc20161 | lista1/ipc_lista1.7.py | lista1/ipc_lista1.7.py | #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça
| #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
| apache-2.0 | Python |
c1a64c36551426408e67846a94e442a52e22a3d5 | Update _version.py | colettace/wnd-charm,colettace/wnd-charm,cnerger/wnd-charm,cnerger/wnd-charm,cnerger/wnd-charm,colettace/wnd-charm,colettace/wnd-charm,cnerger/wnd-charm,colettace/wnd-charm,cnerger/wnd-charm,colettace/wnd-charm,cnerger/wnd-charm | wndcharm/_version.py | wndcharm/_version.py | __version__ = '0.9.2'
| __version__ = '0.9.1'
| lgpl-2.1 | Python |
b31227da61ec15c3c6e474098ef34a5d43caee01 | reset timer on death | pedro-b/layer-switcher | player.py | player.py | import pygame, character, enemy, item
from vector import Vec2d as Vector
class Player(character.Character):
def __init__(self, game):
super(Player, self).__init__(game, game.map, "player", Vector(0, 0), 0)
def spawn(self):
super(Player, self).spawn()
self.keyRect = self.position.inflate(15, 5)
self.keyLi... | import pygame, character, enemy, item
from vector import Vec2d as Vector
class Player(character.Character):
def __init__(self, game):
super(Player, self).__init__(game, game.map, "player", Vector(0, 0), 0)
def spawn(self):
super(Player, self).spawn()
self.keyRect = self.position.inflate(15, 5)
self.keyLi... | mit | Python |
69dcce25a4accf1c910a7d273c6b8510603bda2a | Add test | comandrei/django-template-shortcuts | template_shortcuts/tests/test_jquery.py | template_shortcuts/tests/test_jquery.py | import unittest
from django import template
from template_shortcuts.tests.helpers import render_to_string
class JQueryTest(unittest.TestCase):
def test_jquery_version_required(self):
with self.assertRaises(template.TemplateSyntaxError):
render_to_string("{% jquery %}")
def test_jquery_... | import unittest
from django import template
from template_shortcuts.tests.helpers import render_to_string
class JQueryTest(unittest.TestCase):
def test_jquery_version_required(self):
with self.assertRaises(template.TemplateSyntaxError):
render_to_string("{% jquery %}")
def test_jquery_... | bsd-3-clause | Python |
6bbad0a93cd323e63e41261c1dfbc6a3bc23d54e | Handle response errors | vmalloc/mailboxer-python | mailboxer/mailboxer.py | mailboxer/mailboxer.py | import json
import requests
from urlobject import URLObject as URL
from .query import Query
class Mailboxer(object):
def __init__(self, url):
super(Mailboxer, self).__init__()
self.url = URL(url).add_path("v2")
def create_mailbox(self, address):
self._post(self.url.add_path("mailbox... | import json
import requests
from urlobject import URLObject as URL
from .query import Query
class Mailboxer(object):
def __init__(self, url):
super(Mailboxer, self).__init__()
self.url = URL(url).add_path("v2")
def create_mailbox(self, address):
self._post(self.url.add_path("mailbox... | bsd-3-clause | Python |
f781053538046d27dab6c12ea6a25c8b557229c9 | bump to version 1.5.0 | industrydive/premailer,kengruven/premailer,BlokeOne/premailer-1,graingert/premailer,peterbe/premailer,BlokeOne/premailer-1,peterbe/premailer,peterbe/premailer,ionelmc/premailer,ionelmc/premailer,graingert/premailer,kengruven/premailer,lavr/premailer,industrydive/premailer,lavr/premailer | premailer/__init__.py | premailer/__init__.py | from premailer import Premailer, transform
__version__ = '1.5.0'
| from premailer import Premailer, transform
__version__ = '1.4.1'
| bsd-3-clause | Python |
601ba486caa09e2c820df3e648c9cd50c4cbf3bc | Load reader before writer | Autostew/autostew,Autostew/autostew,Autostew/autostew | autostew_back/settings.py | autostew_back/settings.py | import logging
from autostew_back.plugins import db, laptimes, crash_monitor, motd, db_reader, db_writer, db_enum_writer, clock
from autostew_back.setups import prl_s1_r2_dubai
logging.getLogger().setLevel(logging.INFO)
logging.getLogger('django.db.backends').setLevel(logging.INFO)
logging.getLogger('requests.package... | import logging
from autostew_back.plugins import db, laptimes, crash_monitor, motd, db_reader, db_writer, db_enum_writer, clock
from autostew_back.setups import prl_s1_r2_dubai
logging.getLogger().setLevel(logging.INFO)
logging.getLogger('django.db.backends').setLevel(logging.INFO)
logging.getLogger('requests.package... | agpl-3.0 | Python |
09040a8cbdd003ade53872a81b5fec8b3243a2ca | Bump version number | nabla-c0d3/nassl,nabla-c0d3/nassl,nabla-c0d3/nassl | nassl/__init__.py | nassl/__init__.py |
__author__ = 'Alban Diquet'
__version__ = '2.1.0'
|
__author__ = 'Alban Diquet'
__version__ = '2.0.0'
| agpl-3.0 | Python |
692dc5191c31016f2f1e47e63b5fd0709ce55e03 | Clarify names | funkybob/django-marionette | marionette/__init__.py | marionette/__init__.py |
from cgi import parse_header
import json
from django.http import HttpResponse
from django.core.serializers.json import DjangoJSONEncoder
RPC_MARKER = '_rpc'
class RPCMixin(object):
'''Mix in to a standard View to provide RPC actions'''
def dispatch(self, request, *args, **kwargs):
method = reques... |
from cgi import parse_header
import json
from django.http import HttpResponse
from django.core.serializers.json import DjangoJSONEncoder
RPC_MARKER = '_rpc'
class RPCMixin(object):
'''Mix in to a standard View to provide RPC actions'''
def dispatch(self, request, *args, **kwargs):
method = reques... | mit | Python |
62ff01b5e85c3a6c106c30235b89262984ee4b5c | Remove redundant previous_upper = True line. | DanLindeman/memegen,DanLindeman/memegen,joshfriend/memegen,DanLindeman/memegen,DanLindeman/memegen,joshfriend/memegen,CptSpaceToaster/memegen,joshfriend/memegen,joshfriend/memegen,CptSpaceToaster/memegen,CptSpaceToaster/memegen | memegen/domain/text.py | memegen/domain/text.py | class Text:
def __init__(self, path=None):
self._parts = [] if path is None else path.split('/')
def __getitem__(self, key):
try:
part = self._parts[key]
except (IndexError, ValueError):
return ""
else:
return part.strip()
def get_line(s... | class Text:
def __init__(self, path=None):
self._parts = [] if path is None else path.split('/')
def __getitem__(self, key):
try:
part = self._parts[key]
except (IndexError, ValueError):
return ""
else:
return part.strip()
def get_line(s... | mit | Python |
3d64e81e8fb75acfba79e976d552ef2823c7c540 | Add see and say sequence info | HKuz/PythonChallenge | Challenges/chall_10.py | Challenges/chall_10.py | #!/usr/local/bin/python3
# Python Challenge - 10
# http://www.pythonchallenge.com/pc/return/bull.html
# http://www.pythonchallenge.com/pc/return/sequence.txt
# Username: huge; Password: file
# Keyword: 5808
import re
def main():
'''
What are you looking at?
Hint: len(a[30]) = ?
a = [1, 11, 21, 1211, ... | #!/usr/local/bin/python3
# Python Challenge - 10
# http://www.pythonchallenge.com/pc/return/bull.html
# http://www.pythonchallenge.com/pc/return/sequence.txt
# Username: huge; Password: file
# Keyword: 5808
import re
def main():
'''
Hint: len(a[30]) = ?
a = [1, 11, 21, 1211, 111221,
<area shape="poly... | mit | Python |
44461ea914b130ee5bbe9f917282ef953575dacb | Bump version | Calysto/metakernel | metakernel/__init__.py | metakernel/__init__.py | from ._metakernel import MetaKernel, IPythonKernel, register_ipython_magics, get_metakernel
from . import pexpect
from .replwrap import REPLWrapper, u
from .process_metakernel import ProcessMetaKernel
from .magic import Magic, option
from .parser import Parser
__all__ = ['Magic', 'MetaKernel', 'option']
__version__ =... | from ._metakernel import MetaKernel, IPythonKernel, register_ipython_magics, get_metakernel
from . import pexpect
from .replwrap import REPLWrapper, u
from .process_metakernel import ProcessMetaKernel
from .magic import Magic, option
from .parser import Parser
__all__ = ['Magic', 'MetaKernel', 'option']
__version__ =... | bsd-3-clause | Python |
31f2cf19953ce2e6b74f73b557d4d12de8383a0e | Fix lint issue. | Kami/python-yubico-client | yubico_client/py3.py | yubico_client/py3.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | bsd-3-clause | Python |
18a7ebedd25afc83f45dbd32603c14254d01d669 | clear any existing figures before running plot tests | bayespy/bayespy,SalemAmeen/bayespy,jluttine/bayespy,fivejjs/bayespy | bayespy/tests/__init__.py | bayespy/tests/__init__.py | import bayespy.plot as bpplt
def setup():
for i in bpplt.pyplot.get_fignums():
fig = bpplt.pyplot.figure(i)
fig.clear()
| mit | Python | |
fcc571d2f4c35ac8f0e94e51e6ac94a0c051062d | Update the top-level rinoh package | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | src/rinoh/__init__.py | src/rinoh/__init__.py | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
"""rinohtype
"""
import os
import sys
from importlib ... | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
"""rinohtype
"""
import os
import sys
from importlib ... | agpl-3.0 | Python |
24805585ed0303a9ef84106e1919b1c396370119 | fix vaughnlive plugin #897 | chrippa/livestreamer,Masaz-/livestreamer,flijloku/livestreamer,derrod/livestreamer,Klaudit/livestreamer,Feverqwe/livestreamer,chrippa/livestreamer,okaywit/livestreamer,jtsymon/livestreamer,flijloku/livestreamer,charmander/livestreamer,Klaudit/livestreamer,Saturn/livestreamer,intact/livestreamer,Feverqwe/livestreamer,Do... | src/livestreamer/plugins/vaughnlive.py | src/livestreamer/plugins/vaughnlive.py | import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
INFO_URL = "http://mvn.vaughnsoft.net/video/edge/{domain}_{channel}"
DOMAIN_MAP = {
"breakers": "btv",
"vapers": "vtv",
"vaughnlive": "live",
}
_url_re = re.comp... | import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
INFO_URL = "http://mvn.vaughnsoft.net/video/edge/{domain}_{channel}"
DOMAIN_MAP = {
"breakers": "btv",
"vapers": "vtv",
"vaughnlive": "live",
}
_url_re = re.comp... | bsd-2-clause | Python |
76305d96ab137326d3ea8ef5d4aec4b95592463a | Send a mail to all new bands | dennisausbremen/tunefish,dennisausbremen/tunefish,dennisausbremen/tunefish | server/vote/band_mgmt.py | server/vote/band_mgmt.py | # coding=utf-8
from flask import flash, url_for, redirect, jsonify
from flask.templating import render_template
from server.bands.mails import send_reminder_mail
from server.models import Band, State, db, Comment
from server.vote.session_mgmt import RestrictedModAdminPage
class AdminBandView(RestrictedModAdminPage):... | # coding=utf-8
from flask import flash, url_for, redirect, jsonify
from flask.templating import render_template
from server.bands.mails import send_reminder_mail
from server.models import Band, State, db, Comment
from server.vote.session_mgmt import RestrictedModAdminPage
class AdminBandView(RestrictedModAdminPage):... | apache-2.0 | Python |
0b92f1aff660ffc8fcca9fafb9e48c2361f5c162 | Change import function | lreis2415/PyGeoC,lreis2415/PyGeoC,crazyzlj/PyGeoC | pygeoc/hydro/hydro.py | pygeoc/hydro/hydro.py | #! /usr/bin/env python
# coding=utf-8
from pygeoc.utils import FloatEqual
from pygeoc.utils.const import *
# find downslope coordinate for D8 and D-inf flow models
def downstream_index(DIR_VALUE, i, j):
drow, dcol = D8DIR_TD_DELTA[DIR_VALUE]
return i + drow, j + dcol
def CheckOrtho(a):
if FloatEqual(a,... | #! /usr/bin/env python
# coding=utf-8
from pygeoc.utils import *
from pygeoc.utils.const import *
# find downslope coordinate for D8 and D-inf flow models
def downstream_index(DIR_VALUE, i, j):
drow, dcol = D8DIR_TD_DELTA[DIR_VALUE]
return i + drow, j + dcol
def CheckOrtho(a):
if FloatEqual(a, e):
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.