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 |
|---|---|---|---|---|---|---|---|---|
ce0d2c71263c3de98b8558c6b86060349d30a3ff | fix docstring | spyysalo/wvlib,spyysalo/wvlib | word-analogy.py | word-analogy.py | #!/usr/bin/env python
"""Given words w1, w2 and w3, find nearest neighbors to
vec(w2)-vec(w1)+vec(w3) in given word representation.
This is a python + wvlib version of word-analogy.c from word2vec
(https://code.google.com/p/word2vec/). The primary differences to
word-analogy.c are support for additional word vector f... | #!/usr/bin/env python
"""Given words w1, w2 and w3, find nearest neighbors to
vec(w2)-vec(w1)+vec(w2) in given word representation.
This is a python + wvlib version of word-analogy.c from word2vec
(https://code.google.com/p/word2vec/). The primary differences to
word-analogy.c are support for additional word vector f... | bsd-3-clause | Python |
840dce03718947498e72e561e7ddca22c4174915 | Fix a DoesNotExist bug in the olcc context processor. | twaddington/django-olcc,twaddington/django-olcc,twaddington/django-olcc | django_olcc/olcc/context_processors.py | django_olcc/olcc/context_processors.py | from olcc.models import ImportRecord
"""
Inject the last import date into the request context.
"""
def last_updated(request):
try:
return {
'last_updated': ImportRecord.objects.latest().created_at
}
except ImportRecord.DoesNotExist:
pass
| from olcc.models import ImportRecord
"""
Inject the last import date into the request context.
"""
def last_updated(request):
record = ImportRecord.objects.latest()
if record:
return {
'last_updated': record.created_at
}
| mit | Python |
b8912aa9d76a830402ff2a4c2198dd1d43731c44 | Fix travis | cchristelis/feti,cchristelis/feti,cchristelis/feti,cchristelis/feti | django_project/feti/urls.py | django_project/feti/urls.py | # coding=utf-8
"""URI Routing configuration for this apps."""
from django.conf.urls import patterns, url, include
# Needed by haystack views
from feti.forms.search import DefaultSearchForm
from haystack.query import SearchQuerySet
from haystack.views import search_view_factory, SearchView
from feti.views.campus import... | # coding=utf-8
"""URI Routing configuration for this apps."""
from django.conf.urls import patterns, url, include
# Needed by haystack views
from feti.forms.search import DefaultSearchForm
from haystack.query import SearchQuerySet
from haystack.views import search_view_factory, SearchView
from feti.views.campus import... | bsd-2-clause | Python |
ce2e19fd5c851471c79c6d1b1a7d292581a46564 | Create missing directory when writing new files. | Sable/mclab-ide,Sable/mclab-ide,Sable/mclab-ide,Sable/mclab-ide,Sable/mclab-ide,Sable/mclab-ide | ide/views.py | ide/views.py | import os
import json
from flask import render_template, request
import requests
from ide import app
MCLABAAS_URL = 'http://localhost:4242'
WORKSPACE_DIR = os.path.expanduser('~/mclab-ide-projects')
@app.route('/')
def index():
return render_template('index.html', projects=os.listdir(WORKSPACE_DIR))
@app.route... | import os
import json
from flask import render_template, request
import requests
from ide import app
MCLABAAS_URL = 'http://localhost:4242'
WORKSPACE_DIR = os.path.expanduser('~/mclab-ide-projects')
@app.route('/')
def index():
return render_template('index.html', projects=os.listdir(WORKSPACE_DIR))
@app.route... | apache-2.0 | Python |
9589deaacdfd1d3de39593568b134183815b7c6c | Fix NameErrors in auth.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | timpani/auth.py | timpani/auth.py | import bcrypt
import os
import binascii
import datetime
from . import database
from . import configmanager
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../configs/"))
configs = configmanager.ConfigManager(configPath = CONFIG_PATH)
authConfig = ... | import bcrypt
import os
import binascii
import datetime
from . import database
from . import configmanager
FILE_LOCATION = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.abspath(os.path.join(FILE_LOCATION, "../configs/"))
configs = configmanager.ConfigManager(configPath = CONFIG_PATH)
authConfig = ... | mit | Python |
46e86575f2bdde0ee2924f55c7588ab54b4b3024 | fix numerical stability issue present on certain platforms | pandas-dev/pandas,harisbal/pandas,datapythonista/pandas,Winand/pandas,toobaz/pandas,gfyoung/pandas,amolkahat/pandas,pratapvardhan/pandas,nmartensen/pandas,harisbal/pandas,jreback/pandas,amolkahat/pandas,nmartensen/pandas,cython-testbed/pandas,pandas-dev/pandas,Winand/pandas,winklerand/pandas,cython-testbed/pandas,jmmea... | pandas/stats/tests/test_fama_macbeth.py | pandas/stats/tests/test_fama_macbeth.py | from pandas import DataFrame, Panel
from pandas.stats.api import fama_macbeth
from common import assert_almost_equal, BaseTest
import numpy as np
class TestFamaMacBeth(BaseTest):
def testFamaMacBethRolling(self):
# self.checkFamaMacBethExtended('rolling', self.panel_x, self.panel_y,
# ... | from pandas import DataFrame, Panel
from pandas.stats.api import fama_macbeth
from common import assert_almost_equal, BaseTest
import numpy as np
class TestFamaMacBeth(BaseTest):
def testFamaMacBethRolling(self):
# self.checkFamaMacBethExtended('rolling', self.panel_x, self.panel_y,
# ... | bsd-3-clause | Python |
800dee41d0491be8db6f7d469934a3b3826d2278 | use dd_run_check in pdh checks (#10330) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | pdh_check/tests/test_pdh_check.py | pdh_check/tests/test_pdh_check.py | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
from datadog_test_libs.win.pdh_mocks import initialize_pdh_tests, pdh_mocks_fixture # noqa: F401
from datadog_checks.base import ConfigurationError
from datadog_checks.dev.testing import requires... | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
from datadog_test_libs.win.pdh_mocks import initialize_pdh_tests, pdh_mocks_fixture # noqa: F401
from datadog_checks.base import ConfigurationError
from datadog_checks.dev.testing import requires... | bsd-3-clause | Python |
8d7f910b88fb3bb3f5f86a5f2bdbd7eada176544 | Test based on / is not a good idea. I made the test look at /bin. | dongguangming/pexpect,dongguangming/pexpect,quatanium/pexpect,Depado/pexpect,nodish/pexpect,dongguangming/pexpect,Wakeupbuddy/pexpect,nodish/pexpect,bangi123/pexpect,bangi123/pexpect,crdoconnor/pexpect,quatanium/pexpect,Wakeupbuddy/pexpect,Depado/pexpect,crdoconnor/pexpect,dongguangming/pexpect,blink1073/pexpect,rockab... | pexpect/tests/test_constructor.py | pexpect/tests/test_constructor.py | #!/usr/bin/env python
import pexpect
import unittest
class TestCaseConstructor(unittest.TestCase):
#def runTest (self):
def test_constructor (self):
"""This tests that the constructor will work and give
the same results for different styles of invoking __init__().
This assumes that the root directo... | #!/usr/bin/env python
import pexpect
import unittest
class TestCaseConstructor(unittest.TestCase):
#def runTest (self):
def test_constructor (self):
"""This tests that the constructor will work and give
the same results for different styles of invoking __init__().
This assumes that the root directo... | isc | Python |
ee32d729ccff1b63c6f47e5949bd87d10cf90e38 | Add a work page | oktomus/website,oktomus/website,oktomus/website | website/urls.py | website/urls.py | """website URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """website URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | mit | Python |
c624488299fdbce5135c4f2e179b1952d1627785 | Add a util function load_driver by name or class | FrankDuan/df_code,openstack/dragonflow,openstack/dragonflow,FrankDuan/df_code,FrankDuan/df_code,openstack/dragonflow | dragonflow/common/utils.py | dragonflow/common/utils.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | apache-2.0 | Python |
7c4e372ec901e88ed0c6193a5c06f94a4bbc418b | Update the script to create EC2 instance. | flashxio/FlashX,icoming/FlashX,flashxio/FlashX,icoming/FlashX,flashxio/FlashX,flashxio/FlashX,icoming/FlashX,flashxio/FlashX,icoming/FlashX,icoming/FlashX,flashxio/FlashX | EC2/create_instance.py | EC2/create_instance.py | import boto3
import botocore
import time
ec2 = boto3.resource('ec2', region_name='us-east-1')
client = boto3.client('ec2')
# Create a security group
try:
sg = ec2.create_security_group(GroupName='jupyter', Description='EC2 for Jupyter Notebook')
response = client.authorize_security_group_ingress(GroupName='ju... | import boto3
import botocore
import time
ec2 = boto3.resource('ec2', region_name='us-east-1')
client = boto3.client('ec2')
# Create a security group
try:
sg = ec2.create_security_group(GroupName='jupyter', Description='EC2 for Jupyter Notebook')
response = client.authorize_security_group_ingress(GroupName='ju... | apache-2.0 | Python |
dba918008892214e56bebc8684839f16ae7d7325 | Debug flag to insert tank into game board | Tactique/game_engine,Tactique/game_engine | src/engine/request_handler.py | src/engine/request_handler.py | import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
from . import loc
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
reques... | import Queue
import json
import EBQP
from . import world
from . import types
from . import consts
from . import loc
class GameRequestHandler:
def __init__(self):
self.world = None
self.responses = {
EBQP.new: self.respond_new,
}
def process(self, request):
reques... | mit | Python |
483d7e89989ce16bfeac23cfb3669452aac7776f | Add usage pattern | keleshev/trash | trash.py | trash.py | #! /usr/bin/env python
import os, sys
from shutil import move
from datetime import datetime
def trash(*files, **options):
if not files:
exit('Usage: trash <files>...')
assert list(options) in (['trash_dir'], [])
trash_dir = os.path.expanduser(options.get('trash_dir') or '~/.Trash')
timestamp =... | #! /usr/bin/env python
import os, sys
from shutil import move
from datetime import datetime
def trash(*files, **options):
assert list(options) in (['trash_dir'], [])
trash_dir = os.path.expanduser(options.get('trash_dir') or '~/.Trash')
timestamp = '.' + datetime.now().isoformat()
for f in files:
... | mit | Python |
9daf5f372ac3dd218742201c63b3a67009689f28 | use again the webbrowser way to open links #6 | Azd325/sublime-text-caniuse,Azd325/sublime-text-caniuse | useIt.py | useIt.py | import sublime_plugin
import re
import webbrowser
# Outside pattern compilation to have better performance for multi
# selection
CLEAN_CSS_PATTERN = re.compile(r'([a-z-]+)', re.IGNORECASE)
BASE_URL = 'http://caniuse.com/#search='
class UseItCommand(sublime_plugin.TextCommand):
"""
This will search a word or ... | import sublime_plugin
import re
# Outside pattern compilation to have better performance for multi
# selection
CLEAN_CSS_PATTERN = re.compile(r'([a-z-]+)', re.IGNORECASE)
BASE_URL = 'http://caniuse.com/#search='
class UseItCommand(sublime_plugin.TextCommand):
"""
This will search a word or a selection.
D... | mit | Python |
6d16b386ac99f22cfffa510b2a3b114a6a5372d6 | refactor import statements | yuchenhou/elephant | elephant/test_estimator.py | elephant/test_estimator.py | import io
import json
import os
import unittest
import zipfile
import pandas
import requests
import estimator
class TestEstimator(unittest.TestCase):
def test_movie_lens_1m(self):
with open(os.path.join(os.path.dirname(__file__), 'movie_lens_1m.json')) as config_file:
config = json.load(conf... | import io
import json
import os
import unittest
import zipfile
import pandas
import requests
from estimator import Estimator
class TestEstimator(unittest.TestCase):
def test_movie_lens_1m(self):
with open(os.path.join(os.path.dirname(__file__), 'movie_lens_1m.json')) as config_file:
config =... | mit | Python |
255b8d62806e8ea3abe4e680f3820edaae364323 | Check math mode | mph-/lcapy | lcapy/latex.py | lcapy/latex.py | import re
sub_super_pattern = re.compile(r"([_\^]){([a-zA-Z]+)([0-9]*)}")
class Latex(object):
words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg',
'mean', 'peak', 'pp', 'min', 'max', 'src', 'bat',
'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol')
def __init__(self, string):... | import re
sub_super_pattern = re.compile(r"([_\^]){([a-zA-Z]+)([0-9]*)}")
class Latex(object):
words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg',
'mean', 'peak', 'pp', 'min', 'max', 'src', 'bat',
'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol')
def __init__(self, string):... | lgpl-2.1 | Python |
2aa256b55af3223b740443bb26aa9f169ccd9163 | Add more tests to cover the api more thoroughly. | sorgerlab/belpy,bgyori/indra,sorgerlab/indra,bgyori/indra,johnbachman/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,sorgerlab/indra,johnbachman/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra | indra/tests/test_rlimsp.py | indra/tests/test_rlimsp.py | from indra.sources import rlimsp
def test_simple_usage():
rp = rlimsp.process_from_webservice('PMC3717945')
stmts = rp.statements
assert len(stmts) == 6, len(stmts)
for s in stmts:
assert len(s.evidence) == 1, "Wrong amount of evidence."
ev = s.evidence[0]
assert ev.annotation... | from indra.sources import rlimsp
def test_simple_usage():
rp = rlimsp.process_from_webservice('PMC3717945')
stmts = rp.statements
assert len(stmts) == 6, len(stmts)
for s in stmts:
assert len(s.evidence) == 1, "Wrong amount of evidence."
ev = s.evidence[0]
assert ev.annotations... | bsd-2-clause | Python |
c958a314dc8ceb72e34ed969d3cff3751d513a49 | Fix bug in Progress object | codevlabs/grab,liorvh/grab,giserh/grab,alihalabyah/grab,SpaceAppsXploration/grab,istinspring/grab,DDShadoww/grab,subeax/grab,subeax/grab,istinspring/grab,pombredanne/grab-1,codevlabs/grab,giserh/grab,lorien/grab,huiyi1990/grab,maurobaraldi/grab,subeax/grab,lorien/grab,kevinlondon/grab,alihalabyah/grab,pombredanne/grab-... | grab/tools/progress.py | grab/tools/progress.py | import sys
import logging
logger = logging.getLogger('grab.tools.progress')
class Progress(object):
def __init__(self, step=None, total=None, stop=None, name='items', level=logging.DEBUG):
if total is None and step is None:
raise Exception('Both step and total arguments are None')
if ... | import sys
import logging
logger = logging.getLogger('grab.tools.progress')
class Progress(object):
def __init__(self, step=None, total=None, stop=None, name='items', level=logging.DEBUG):
if not total and not step:
raise Exception('Both step and total arguments are None')
if total an... | mit | Python |
900009adda5343cd9d64f1e2033993fb1e2eb7aa | add trailing slash to browse-letter url | emory-libraries/findingaids,mprefer/findingaids,emory-libraries/findingaids,mprefer/findingaids | findingaids/fa/urls.py | findingaids/fa/urls.py | from django.conf.urls.defaults import *
TITLE_LETTERS = '[a-zA-Z]'
title_urlpatterns = patterns('findingaids.fa.views',
url('^$', 'browse_titles', name='browse-titles'),
url(r'^(?P<letter>%s)/$' % TITLE_LETTERS, 'titles_by_letter', name='titles-by-letter')
)
# patterns for ead document id and series id
# def... | from django.conf.urls.defaults import *
TITLE_LETTERS = '[a-zA-Z]'
title_urlpatterns = patterns('findingaids.fa.views',
url('^$', 'browse_titles', name='browse-titles'),
url(r'^(?P<letter>%s)$' % TITLE_LETTERS, 'titles_by_letter', name='titles-by-letter')
)
# patterns for ead document id and series id
# defi... | apache-2.0 | Python |
53cf64b25b33d4be9ada366c8be02953ac2ca5c6 | Bump version | numirias/firefed | firefed/__version__.py | firefed/__version__.py | __title__ = 'firefed'
__version__ = '0.1.7'
__description__ = 'A tool for Firefox profile analysis, data extraction, \
forensics and hardening'
__url__ = 'https://github.com/numirias/firefed'
__author__ = 'numirias'
__author_email__ = 'numirias@users.noreply.github.com'
__license__ = 'MIT'
__keywords__ = 'firefox secur... | __title__ = 'firefed'
__version__ = '0.1.6'
__description__ = 'A tool for Firefox profile analysis, data extraction, \
forensics and hardening'
__url__ = 'https://github.com/numirias/firefed'
__author__ = 'numirias'
__author_email__ = 'numirias@users.noreply.github.com'
__license__ = 'MIT'
__keywords__ = 'firefox secur... | mit | Python |
da249ab6d7c344f7b3e9d90feecb73587c6b16df | Update __init__ | TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary | tmt/__init__.py | tmt/__init__.py | from os.path import join, dirname, realpath
import utils
# Create configuration dictionary that defines default parameters
cfg_filename = join(dirname(realpath(__file__)), 'tmt.cfg')
cfg = utils.read_yaml(cfg_filename)
| from os.path import join, dirname, realpath
import utils
# Create configuration dictionary that defines default parameters
config_filename = join(dirname(realpath(__file__)), 'tmt.config')
config = utils.load_config(config_filename)
# utils.check_config(config)
| agpl-3.0 | Python |
4229f4f6b7b6e7b13dcc19f88c512c41221338de | update prov metadata to point to output_generate_databases.txt | rafiqsaleh/VERCE,KNMI/VERCE,KNMI/VERCE,KNMI/VERCE,KNMI/VERCE,rafiqsaleh/VERCE,rafiqsaleh/VERCE,rafiqsaleh/VERCE,rafiqsaleh/VERCE,KNMI/VERCE | verce-hpc-pe/src/specfemGenerateDatabase.py | verce-hpc-pe/src/specfemGenerateDatabase.py | from verce.processing import *
import socket
import traceback
import json
class specfemGenerateDatabase(SeismoPreprocessingActivity):
def compute(self):
stdoutdata=None
stderrdata=None
if self.parameters["mpi_invoke"] == 'mpiexec.hydra' or se... | from verce.processing import *
import socket
import traceback
import json
class specfemGenerateDatabase(SeismoPreprocessingActivity):
def compute(self):
stdoutdata=None
stderrdata=None
if self.parameters["mpi_invoke"] == 'mpiexec.hydra' or se... | mit | Python |
55a8be94c6f1616fa02ee91dff4c8145651b98a4 | Disable -debug for Amity. | Disar/flambe,aduros/flambe,markknol/flambe,weilitao/flambe,mikedotalmond/flambe,markknol/flambe,Disar/flambe,weilitao/flambe,playedonline/flambe,mikedotalmond/flambe,playedonline/flambe,weilitao/flambe,playedonline/flambe,weilitao/flambe,markknol/flambe,aduros/flambe,Disar/flambe,playedonline/flambe,aduros/flambe,Disar... | tools/flambe.py | tools/flambe.py | #!/usr/bin/env python
from waflib import *
from waflib.TaskGen import *
import os
# Waf hates absolute paths for some reason
FLAMBE_ROOT = os.path.dirname(__file__) + "/.."
def options(ctx):
ctx.add_option("--debug", action="store_true", default=False, help="Build a development version")
def configure(ctx):
... | #!/usr/bin/env python
from waflib import *
from waflib.TaskGen import *
import os
# Waf hates absolute paths for some reason
FLAMBE_ROOT = os.path.dirname(__file__) + "/.."
def options(ctx):
ctx.add_option("--debug", action="store_true", default=False, help="Build a development version")
def configure(ctx):
... | mit | Python |
7e90d00ace0cd30a09f51d849742c8ef4b5c8336 | Fix the tests data finding now they are under sdf_timing. | SymbiFlow/python-sdf-timing,SymbiFlow/python-sdf-timing | sdf_timing/tests/parse_all_test.py | sdf_timing/tests/parse_all_test.py | #!/usr/bin/env python3
# coding: utf-8
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import os
import os.path
from sdf_timing import sd... | #!/usr/bin/env python3
# coding: utf-8
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
from sdf_timing import sdfparse
import os
datafiles... | isc | Python |
c88883141072cbc2efc9e4af2115d64423f4f89f | Print connection address. | torwag/micropython,ryannathans/micropython,oopy/micropython,tuc-osg/micropython,PappaPeppar/micropython,micropython/micropython-esp32,henriknelson/micropython,ganshun666/micropython,hiway/micropython,adafruit/micropython,pfalcon/micropython,pramasoul/micropython,hiway/micropython,mpalomer/micropython,pfalcon/micropytho... | esp8266/scripts/webrepl.py | esp8266/scripts/webrepl.py | # This module should be imported from REPL, not run from command line.
import socket
import uos
import network
import websocket
import websocket_helper
listen_s = None
client_s = None
def setup_conn(port):
global listen_s, client_s
listen_s = socket.socket()
listen_s.setsockopt(socket.SOL_SOCKET, socket.S... | # This module should be imported from REPL, not run from command line.
import socket
import uos
import websocket
import websocket_helper
listen_s = None
client_s = None
def setup_conn(port):
global listen_s, client_s
listen_s = socket.socket()
listen_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)... | mit | Python |
795aac592c60ef69b3fd66401ab52095b7cba958 | set the default language from $LANG | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/models/locale.py | subiquity/models/locale.py | # Copyright 2015 Canonical, Ltd.
#
# 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) any later version.
#
# This program is distribute... | # Copyright 2015 Canonical, Ltd.
#
# 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) any later version.
#
# This program is distribute... | agpl-3.0 | Python |
1a3d68452b984df18b6b0f29bc98c31e8aab974b | update imgur album plugin | regosen/gallery_get | gallery_plugins/plugin_imgur_album.py | gallery_plugins/plugin_imgur_album.py | # Plugin for gallery_get.
# Each definition can be one of the following:
# - a string to match
# - a regex string to match
# - a function that takes source as a parameter and returns an array or a single match. (You may assume that re and urllib are already imported.)
# If you comment out a parameter, it will use the... | # Plugin for gallery_get.
# Each definition can be one of the following:
# - a string to match
# - a regex string to match
# - a function that takes source as a parameter and returns an array or a single match. (You may assume that re and urllib are already imported.)
# If you comment out a parameter, it will use the... | mit | Python |
691b7c437171b8c3daf921c8b20e7b1f133beae8 | update auth functionality for pycryptodome | nricklin/leafpy | leafpy/auth.py | leafpy/auth.py | """
Logging in basically means getting the custom_sessionid and VIN, which are used to make
every subsequent request.
"""
from Crypto.Cipher import Blowfish
import requests
import base64
def login(username, password, region_code='NNA', initial_app_strings='geORNtsZe5I4lRGjG9GZiA'):
baseprm = b'uyI5Dj9g8VCOFDnBRUbr3... | """
Logging in basically means getting the custom_sessionid and VIN, which are used to make
every subsequent request.
"""
from Crypto.Cipher import Blowfish
import requests
import base64
def login(username, password, region_code='NNA', initial_app_strings='geORNtsZe5I4lRGjG9GZiA'):
baseprm = 'uyI5Dj9g8VCOFDnBRUbr3g... | mit | Python |
4cf491fe05100e6321b16f63594942e0d223485b | support plots for individual cores | vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer | graph_templates/cpu.py | graph_templates/cpu.py | from . import GraphTemplate
class CpuTemplate(GraphTemplate):
'''
core can be individual cores as well as total.
http://www.linuxhowtos.org/System/procstat.htm documents all states, except guest and steal(?)
everything is in percent, but note that e.g. a 16 core machine goes up to 1600% for total.
'... | from . import GraphTemplate
class CpuTemplate(GraphTemplate):
'''
only pass targets for total cpu metrics, not all cores individually
http://www.linuxhowtos.org/System/procstat.htm documents all states, except guest and steal(?)
everything is in percent, but note that e.g. a 16 core machine goes up to 1... | apache-2.0 | Python |
068cf2d97b7ed9970aefecba924c65c00e5ed56d | Fix uvcontsub call | e-koch/VLA_Lband,e-koch/VLA_Lband | 16B/16B-236/imaging/transform_and_uvsub.py | 16B/16B-236/imaging/transform_and_uvsub.py |
'''
Split out each SPW from the combined MS (concat_and_split.py), convert
to LSRK, and subtract continuum in uv-plane
'''
import os
import sys
from tasks import mstransform, uvcontsub, partition, split
myvis = '16B-236_lines.ms'
spw_num = int(sys.argv[-1])
# Load in the SPW dict in the repo on cedar
execfile(os.... |
'''
Split out each SPW from the combined MS (concat_and_split.py), convert
to LSRK, and subtract continuum in uv-plane
'''
import os
import sys
from tasks import mstransform, uvcontsub, partition, split
myvis = '16B-236_lines.ms'
spw_num = int(sys.argv[-1])
# Load in the SPW dict in the repo on cedar
execfile(os.... | mit | Python |
8dc30972dc680864d7a010c6d453335c2cf83c96 | Update test cases (#444) | pheanex/xpython,N-Parsons/exercism-python,behrtam/xpython,exercism/xpython,mweb/python,exercism/python,jmluy/xpython,exercism/xpython,smalley/python,pheanex/xpython,exercism/python,behrtam/xpython,mweb/python,smalley/python,N-Parsons/exercism-python,jmluy/xpython | exercises/sieve/sieve_test.py | exercises/sieve/sieve_test.py | import unittest
from sieve import sieve
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
class SieveTest(unittest.TestCase):
def test_no_primes_under_two(self):
self.assertEqual(sieve(1), [])
def test_find_first_prime(self):
self.assertEqual(sieve(2), [2])
def... | import unittest
from sieve import sieve
class SieveTest(unittest.TestCase):
def test_a_few_primes(self):
expected = [2, 3, 5, 7]
self.assertEqual(expected, sieve(10))
def test_prime_limit(self):
expected = [2, 3, 5, 7]
self.assertEqual(expected, sieve(7))
def test_primes... | mit | Python |
6de0188ea82fe899f2a9ec678bae0e94e4a94a0d | return True if message was sent successfully | dimagi/rapidsms-threadless-router,dimagi/rapidsms-threadless-router,caktus/rapidsms-threadless-router | threadless_router/backends/http/outgoing.py | threadless_router/backends/http/outgoing.py | import urllib2
from rapidsms.backends.base import BackendBase
EXAMPLE_URL = 'http://127.0.0.1/?identity=%(identity)s&text=%(text)s'
class HttpBackend(BackendBase):
def prepare_message(self, message):
context = {'text': message.text,
'identity': message.connection.identity}
u... | import urllib2
from rapidsms.backends.base import BackendBase
EXAMPLE_URL = 'http://127.0.0.1/?identity=%(identity)s&text=%(text)s'
class HttpBackend(BackendBase):
def prepare_message(self, message):
context = {'text': message.text,
'identity': message.connection.identity}
u... | bsd-3-clause | Python |
d381e90fc735ec12146db34035be5b8cc5bbeda6 | Fix distribution name | lintusj1/elfi,elfi-dev/elfi,lintusj1/elfi,elfi-dev/elfi,HIIT/elfi | tests/functional/test_dask_parallel.py | tests/functional/test_dask_parallel.py |
from elfi.core import *
from elfi.distributions import *
import numpy as np
import numpy.random as npr
# Define some summary statistic and discrepancy functions
def summary(x):
return np.median(x, axis=np.ndim(x)-1, keepdims=True)
def summary2(x):
return np.var(x, axis=np.ndim(x)-1, keepdims=True)
def discr... |
from elfi.core import *
from elfi.distributions import *
import numpy as np
import numpy.random as npr
# Define some summary statistic and discrepancy functions
def summary(x):
return np.median(x, axis=np.ndim(x)-1, keepdims=True)
def summary2(x):
return np.var(x, axis=np.ndim(x)-1, keepdims=True)
def discr... | bsd-3-clause | Python |
6a63fc4abd524da96ee09bfa94f7eae534a9834e | Fix small style issue w/ assertEqual vs assertEquals | softlayer/softlayer-python,nanjj/softlayer-python,allmightyspiff/softlayer-python,kyubifire/softlayer-python,Neetuj/softlayer-python,skraghu/softlayer-python | tests/managers/object_storage_tests.py | tests/managers/object_storage_tests.py | """
SoftLayer.tests.managers.object_storage_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import fixtures
from SoftLayer import testing
class ObjectStorageTests(testing.TestCase):
def set_up(self):
self.ob... | """
SoftLayer.tests.managers.object_storage_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import fixtures
from SoftLayer import testing
class ObjectStorageTests(testing.TestCase):
def set_up(self):
self.ob... | mit | Python |
392f992d8408999da35673647184226582f42034 | change build dataset tests | VEVO/hidi | tests/test_w2vbuilddatasettransform.py | tests/test_w2vbuilddatasettransform.py | import unittest
from hidi.factorization import W2VBuildDatasetTransform
class TestW2VBuildDatasetTransform(unittest.TestCase):
def setUp(self):
self.words = """Vevo is a awesome!
Vevo Vevo
"""
self.test_transform = W2VBuildDatasetTransform()
def te... | import unittest
from hidi.factorization import W2VBuildDatasetTransform
class TestW2VBuildDatasetTransform(unittest.TestCase):
def setUp(self):
self.words = """Vevo is a awesome!
Vevo Vevo
"""
self.test_transform = W2VBuildDatasetTransform()
def te... | apache-2.0 | Python |
6a35c91ef7426522664e6af3182c0d7c0b2bfb2e | Include dataset version in file metadata | Ghalko/waterbutler,Johnetordoff/waterbutler,hmoco/waterbutler,felliott/waterbutler,rdhyee/waterbutler,rafaeldelucena/waterbutler,RCOSDP/waterbutler,icereval/waterbutler,cosenal/waterbutler,kwierman/waterbutler,CenterForOpenScience/waterbutler,TomBaxter/waterbutler,chrisseto/waterbutler | waterbutler/providers/dataverse/metadata.py | waterbutler/providers/dataverse/metadata.py | from waterbutler.core import metadata
class BaseDataverseMetadata(metadata.BaseMetadata):
@property
def provider(self):
return 'dataverse'
class DataverseFileMetadata(BaseDataverseMetadata, metadata.BaseFileMetadata):
def __init__(self, raw, dataset_version):
super().__init__(raw)
... | from waterbutler.core import metadata
class BaseDataverseMetadata(metadata.BaseMetadata):
@property
def provider(self):
return 'dataverse'
class DataverseFileMetadata(BaseDataverseMetadata, metadata.BaseFileMetadata):
def __init__(self, raw, dataset_version):
super().__init__(raw)
... | apache-2.0 | Python |
360b901a96bae24898949569ade2b881eccaee69 | Fix typo causing sync_recipients_list to fail | texastribune/tt_dailyemailblast,texastribune/tt_dailyemailblast | tt_dailyemailblast/send_backends/sync.py | tt_dailyemailblast/send_backends/sync.py | from .. import email
def sync_daily_email_blasts(blast):
for l in blast.recipient_lists.all():
l.send(blast)
def sync_recipients_list(recipients_list, blast):
for r in recipients_list.recipients.all():
r.send(recipients_list, blast)
def sync_recipient(recipient, recipients_list, blast):
... | from .. import email
def sync_daily_email_blasts(blast):
for l in blast.recipient_lists.all():
l.send(blast)
def sync_recipients_list(recipients_list, blast):
for r in recipients_list.recipientss.all():
r.send(recipients_list, blast)
def sync_recipient(recipient, recipients_list, blast):
... | apache-2.0 | Python |
1f3eb0e8102d8257161d0fa1f0cabb8fd596dee2 | Add user email to Video admin display. | mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks | flicks/videos/admin.py | flicks/videos/admin.py | from django.contrib import admin
from flicks.videos.models import Award, Video
class VideoAdmin(admin.ModelAdmin):
"""Configuration for the video admin pages."""
list_display = ['title', 'user_email', 'state', 'judge_mark', 'category',
'region', 'shortlink', 'created']
list_filter = [... | from django.contrib import admin
from flicks.videos.models import Award, Video
class VideoAdmin(admin.ModelAdmin):
"""Configuration for the video admin pages."""
list_display = ['title', 'state', 'judge_mark', 'category', 'region',
'shortlink', 'created']
list_filter = ['state', 'judg... | bsd-3-clause | Python |
1e4232b70db56964352c7eb452882f4b3063be67 | Replace setup-teardown fixtures with tmpdir in test_logger.py (#453) | aabadie/joblib,tomMoral/joblib,lesteve/joblib,aabadie/joblib,karandesai-96/joblib,karandesai-96/joblib,tomMoral/joblib,lesteve/joblib,joblib/joblib,joblib/joblib | joblib/test/test_logger.py | joblib/test/test_logger.py | """
Test the logger module.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import sys
import io
import re
from joblib.logger import PrintTime
try:
# Python 2/Python 3 compat
unicode('str')
except NameError:
uni... | """
Test the logger module.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import shutil
import os
import sys
import io
from tempfile import mkdtemp
import re
from joblib.logger import PrintTime
try:
# Python 2/Python ... | bsd-3-clause | Python |
671d1ba02edc1a0f7cbe28dfc8244de3f4ebb8cf | fix reading of osm sequence number [#322] | hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2 | jobs/secondary_pipeline.py | jobs/secondary_pipeline.py | import argparse
import glob
import shutil
import json
import os
import logging
import subprocess
from osmium.replication import server
from datetime import datetime,timezone
# 0 3 * * * /home/exports/venv/bin/python /home/exports/osm-export-tool/jobs/secondary_pipeline.py /mnt/data/planet/ >> /home/exports/secondary_p... | import argparse
import glob
import shutil
import json
import os
import logging
import subprocess
from osmium.replication import server
from datetime import datetime,timezone
parser = argparse.ArgumentParser(description='osmium-tool based pipeline')
parser.add_argument('directory', help='Working directory - needs a lo... | bsd-3-clause | Python |
dfce2472c81c84a6e73315f288c41683ede92363 | Add session and scoped session to AuctionBase. | AdamGagorik/pydarkstar,LegionXI/pydarkstar | pydarkstar/auction/auctionbase.py | pydarkstar/auction/auctionbase.py | """
.. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com>
"""
import pydarkstar.darkobject
import pydarkstar.database
import contextlib
class AuctionBase(pydarkstar.darkobject.DarkObject):
"""
Base class for Auction House objects.
:param db: database object
"""
def __init__(self, db, rollback=Tr... | """
.. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com>
"""
import pydarkstar.darkobject
import pydarkstar.database
class AuctionBase(pydarkstar.darkobject.DarkObject):
"""
Base class for Auction House objects.
:param db: database object
"""
def __init__(self, db, rollback=True, fail=False, *a... | mit | Python |
1c030ad20a0cbb145c1079c6697aae666d3b3209 | Add a css_uri to the default configuration. | TiddlySpace/tiddlyspace,FND/tiddlyspace,TiddlySpace/tiddlyspace,FND/tiddlyspace,TiddlySpace/tiddlyspace,FND/tiddlyspace | tiddlywebplugins/tiddlyspace/config.py | tiddlywebplugins/tiddlyspace/config.py | """
Base configuration for TiddlySpace.
This provides the basics which may be changed in tidlywebconfig.py.
"""
from tiddlywebplugins.instancer.util import get_tiddler_locations
from tiddlywebplugins.tiddlyspace.instance import store_contents
PACKAGE_NAME = 'tiddlywebplugins.tiddlyspace'
config = {
'instance_... | """
Base configuration for TiddlySpace.
This provides the basics which may be changed in tidlywebconfig.py.
"""
from tiddlywebplugins.instancer.util import get_tiddler_locations
from tiddlywebplugins.tiddlyspace.instance import store_contents
PACKAGE_NAME = 'tiddlywebplugins.tiddlyspace'
config = {
'instance_... | bsd-3-clause | Python |
8635f8e59340bfaeddf1f6ba1180c9833964616a | Add docstring | LAL/openstack-lease-it,LAL/openstack-lease-it,guillaume-philippon/openstack-lease-it,guillaume-philippon/openstack-lease-it,LAL/openstack-lease-it,guillaume-philippon/openstack-lease-it,LAL/openstack-lease-it,guillaume-philippon/openstack-lease-it | openstack_lease_it/openstack_lease_it/decorators.py | openstack_lease_it/openstack_lease_it/decorators.py | # coding: utf-8
"""
This module define a list of homemade decorators
"""
from django.core.exceptions import PermissionDenied
def superuser_required(view):
"""
If superuser access is required for a specific view, we use
@superuser_required decorator
:param view: As parameter, we have the view function
... | # coding: utf-8
"""
This module define a list of homemade decorators
"""
from django.core.exceptions import PermissionDenied
def superuser_required(view):
"""
If superuser access is required for a specific view, we use
@superuser_required decorator
:param view: As parameter, we have the view function
... | apache-2.0 | Python |
aeadfce1bc9206abdbbbd9c19043ad6eb67d8a74 | add clamav scanner as a scanner | graingert/reportificate,chrissorchard/malucrawl,chrissorchard/malucrawl,graingert/reportificate | malware_crawl/scan/__init__.py | malware_crawl/scan/__init__.py | from .alexa import alexa_malware_scan
from .web_api import wot_malware_scan
from .fake import fake_scanner
from .clamav_html import crawl_html
from .capture_hpc import chpc_malware_scan
scanners = (chpc_malware_scan, crawl_html)
heavy_scanners = (chpc_malware_scan, crawl_html)
| from .alexa import alexa_malware_scan
from .web_api import wot_malware_scan
from .fake import fake_scanner
from .capture_hpc import chpc_malware_scan
scanners = (chpc_malware_scan,)
heavy_scanners = (chpc_malware_scan,)
| mit | Python |
815c94fb2a55214b6ef2b94ba5409fa1f2ac481b | Update dependencies.py | odb9402/OPPA,odb9402/OPPA,odb9402/OPPA,odb9402/OPPA | dependencies/dependencies.py | dependencies/dependencies.py | import rpy2.robjects as robjects
import os
import subprocess
import sys
def main():
# cmd = 'python ../setup.py install'
# subprocess.call(cmd, shell=True)
# cmd = 'wget "http://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"'
# subprocess.call(cmd, shell=True)
# cmd = 'tar --bzip2... | import rpy2.robjects as robjects
import os
import subprocess
import sys
def main():
# cmd = 'python ../setup.py install'
# subprocess.call(cmd, shell=True)
# cmd = 'wget "http://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"'
# subprocess.call(cmd, shell=True)
# cmd = 'tar --bzip2... | mit | Python |
bbb6fec01e0b1783b6743ef35c387dc0a38e2527 | Fix bug in cypher | cmusv-sc/DIWD-Team4-Wei-Lin-Tsai,cmusv-sc/DIWD-Team4-Wei-Lin-Tsai,cmusv-sc/DIWD-Team4-Wei-Lin-Tsai,cmusv-sc/DIWD-Team4-Wei-Lin-Tsai | mysite/data_2015_fall/api/generateNetwork.py | mysite/data_2015_fall/api/generateNetwork.py | from django.http import JsonResponse
from data_2015_fall.models import *
from neomodel import db
class NetworkResponse():
def __init__(self, name):
self.name = name
self.children = []
def to_dict(self):
return {
"name": self.name,
"children": [c.to_dict() for c... | from django.http import JsonResponse
from data_2015_fall.models import *
from neomodel import db
class NetworkResponse():
def __init__(self, name):
self.name = name
self.children = []
def to_dict(self):
return {
"name": self.name,
"children": [c.to_dict() for c... | unlicense | Python |
e638e1d18b7e513e45754dbad5d3d72ae494a58a | Fix Install script | havok2063/SciScript-Python | Install.py | Install.py | #!/usr/bin/python
import sys
import os
commandLineArguments = sys.argv
# Checks whether the library is being run within the SciServer-Compute environment. Returns True if the library is being run within the SciServer-Compute environment, and False if not.
def isSciServerComputeEnvironment():
"""
Checks whethe... | #!/usr/bin/python
import sys
import os
commandLineArguments = sys.argv
# Checks whether the library is being run within the SciServer-Compute environment. Returns True if the library is being run within the SciServer-Compute environment, and False if not.
def isSciServerComputeEnvironment():
"""
Checks whethe... | apache-2.0 | Python |
a9b662c25b66c58c0e2a2e0dd546c8f42875c7c4 | Add backward compatible alias | openstack/neutron-lib,openstack/neutron-lib,openstack/neutron-lib,openstack/neutron-lib | neutron_lib/api/definitions/trunk_details.py | neutron_lib/api/definitions/trunk_details.py | # All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python |
f935eb48517627df679605aaee834165380d74db | Fix DatabaseCreation from django 1.7 | jneight/django-db-geventpool,PreppyLLC-opensource/django-db-geventpool | django_db_geventpool/backends/postgresql_psycopg2/creation.py | django_db_geventpool/backends/postgresql_psycopg2/creation.py | # coding=utf-8
import django
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreationMixin16(object):
def _create_test_db(self, verbosity, autoclobber):
self.connection.closeall()
return super(DatabaseCreationMixin16, self)._c... | # coding=utf-8
import django
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation
class DatabaseCreationMixin16(object):
def _create_test_db(self, verbosity, autoclobber):
self.connection.closeall()
return super(DatabaseCreationMixin16, self)._c... | apache-2.0 | Python |
04ad247a62e6ae1d8d371dcabdc902bdaef86789 | Add base yaml support for input_data | openstack/bareon,openstack/bareon | fuel_agent/cmd/agent.py | fuel_agent/cmd/agent.py | # Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
37dbbb355c8db9d22329245db64be69f1da9bc8c | Fix typo in base.py | StackStorm/python-mistralclient,openstack/python-mistralclient,openstack/python-mistralclient,StackStorm/python-mistralclient | functionaltests/base.py | functionaltests/base.py | import os
import testtools
from tempest import clients
from tempest.common import rest_client
from mistralclient.api import client as mclient
class ClientAuth(rest_client.RestClient):
def __init__(self, auth_provider):
super(ClientAuth, self).__init__(auth_provider)
self.mistral_client = mclien... | import os
import testtools
from tempest import clients
from tempest.common import rest_client
from mistralclient.api import client as mclient
class ClientAuth(rest_client.RestClient):
def __init__(self, auth_provider):
super(ClientAuth, self).__init__(auth_provider)
self.mistral_client = mclien... | apache-2.0 | Python |
d7df3417939c6d5f5bb2dced20f1d5ce42304226 | add test for parse_yaml | scisoft/autocmake,robertodr/autocmake,robertodr/autocmake,scisoft/autocmake,miroi/autocmake,miroi/autocmake,coderefinery/autocmake,coderefinery/autocmake | autocmake/parse_yaml.py | autocmake/parse_yaml.py | def parse_yaml(stream, override={}):
import yaml
import sys
from autocmake.interpolate import interpolate
try:
config = yaml.load(stream, yaml.SafeLoader)
except yaml.YAMLError as exc:
print(exc)
sys.exit(-1)
for k in config:
if k in override:
config... | def parse_yaml(stream, override={}):
import yaml
from autocmake.interpolate import interpolate
try:
config = yaml.load(stream, yaml.SafeLoader)
except yaml.YAMLError as exc:
print(exc)
sys.exit(-1)
for k in config:
if k in override:
config[k] = override[... | bsd-3-clause | Python |
d54b3442a44b0323fad84bddee8b0b719d74c810 | fix AwardFactory | Fresnoy/kart,Fresnoy/kart | diffusion/tests/factories.py | diffusion/tests/factories.py | import factory
from django.utils import timezone
from production.tests.factories import ArtworkFactory, EventFactory, StaffTaskFactory
from utils.tests.utils import first
from .. import models
from .factories_alt import PlaceFactory # noqa
class MetaAwardFactory(factory.django.DjangoModelFactory):
class Meta:... | import factory
from django.utils import timezone
from production.tests.factories import ArtworkFactory, EventFactory, StaffTaskFactory
from utils.tests.utils import first
from .. import models
from .factories_alt import PlaceFactory # noqa
class MetaAwardFactory(factory.django.DjangoModelFactory):
class Meta:... | agpl-3.0 | Python |
2a4e2431607a8cb1ddd821de44c2d2d6991b7a5a | bump pypi version to 1.9.21 | lordzuko/appengine-mapreduce,VirusTotal/appengine-mapreduce,GoogleCloudPlatform/appengine-mapreduce,talele08/appengine-mapreduce,mikelambert/appengine-mapreduce,VirusTotal/appengine-mapreduce,ankit318/appengine-mapreduce,ankit318/appengine-mapreduce,vendasta/appengine-mapreduce,VirusTotal/appengine-mapreduce,Candreas/m... | python/src/setup.py | python/src/setup.py | #!/usr/bin/env python
"""Setup specs for packaging, distributing, and installing MR lib."""
import distribute_setup
# User may not have setuptools installed on their machines.
# This script will automatically install the right version from PyPI.
distribute_setup.use_setuptools()
# pylint: disable=g-import-not-at-top... | #!/usr/bin/env python
"""Setup specs for packaging, distributing, and installing MR lib."""
import distribute_setup
# User may not have setuptools installed on their machines.
# This script will automatically install the right version from PyPI.
distribute_setup.use_setuptools()
# pylint: disable=g-import-not-at-top... | apache-2.0 | Python |
985dd1ea9d5483964192f5a29e7513492c6e158e | Enable DVM in realview64-o3-dual-ruby.py | gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5 | tests/gem5/configs/realview64-o3-dual-ruby.py | tests/gem5/configs/realview64-o3-dual-ruby.py | # Copyright (c) 2017, 2019, 2022 Arm Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fu... | # Copyright (c) 2017, 2019, 2022 Arm Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fu... | bsd-3-clause | Python |
0caa36a8a3b51811492239680ba87f088da1e308 | fix unstopped consumers | thedrow/samsa,thedrow/samsa,wikimedia/operations-debs-python-pykafka,benauthor/pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,thedrow/samsa | tests/pykafka/rdkafka/test_simple_consumer.py | tests/pykafka/rdkafka/test_simple_consumer.py | from tests.pykafka import test_simpleconsumer
from pykafka.rdkafka import RdKafkaSimpleConsumer
class TestRdKafkaSimpleConsumer(test_simpleconsumer.TestSimpleConsumer):
def _get_simple_consumer(self, **kwargs):
# This enables automatic reuse of all tests from test_simpleconsumer
topic = self.clien... | from tests.pykafka import test_simpleconsumer
from pykafka.rdkafka import RdKafkaSimpleConsumer
class TestRdKafkaSimpleConsumer(test_simpleconsumer.TestSimpleConsumer):
def _get_simple_consumer(self, **kwargs):
# This enables automatic reuse of all tests from test_simpleconsumer
topic = self.clien... | apache-2.0 | Python |
0c25dc945cf784ba60cfbf34d4c7334859b8e924 | exclude year | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | mapreduce/dbpedia_dbm_types.py | mapreduce/dbpedia_dbm_types.py | """
Creates DBPedia type dict with entity URIs as keys and types as values.
We use shelve here since the dict is quite large in memory(~2G) and we need a set as value.
It then shipped with the job.
Format: {'Tramore': ['Town', 'Settlement', 'PopulatedPlace', 'Place'], ...}
"""
import shelve
import subprocess
TYPES_FI... | """
Creates DBPedia type dict with entity URIs as keys and types as values.
We use shelve here since the dict is quite large in memory(~2G) and we need a set as value.
It then shipped with the job.
Format: {'Tramore': ['Town', 'Settlement', 'PopulatedPlace', 'Place'], ...}
"""
import shelve
import subprocess
TYPES_FI... | apache-2.0 | Python |
9f908ec4768bf5db90256c8e3b4e06fafba997c4 | Remove unused import, add a title for the hub object. | ucla/PushHubCore | pushhub/models/hub.py | pushhub/models/hub.py | """
Classes meant to represent the PubSubHubbub Hub.
The hub itself does not have state, but does hold references to
subscribers and topics.
"""
from zope.interface import Interface, implements
from repoze.folder import Folder
class IHub(Interface):
"""Marker interface for hub implementations"""
pass
cl... | """
Classes meant to represent the PubSubHubbub Hub.
The hub itself does not have state, but does hold references to
subscribers and topics.
"""
from zope.component import provideUtility
from zope.interface import Interface, implements
from repoze.folder import Folder
class IHub(Interface):
"""Marker interfac... | bsd-3-clause | Python |
c10820e93e1fd98e748c227d58f4ec26b2d0b105 | fix error (#13907) | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/hr/doctype/department_approver/department_approver.py | erpnext/hr/doctype/department_approver/department_approver.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class DepartmentApprover(Document):
pass
def get_depart... | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class DepartmentApprover(Document):
pass
def get_depart... | agpl-3.0 | Python |
c4de05ec64b1f38be6c40ea90ea8b8ddf3fdead6 | Revert "feat: Allow utils inside Energy Point Rule condition " (#8152) | adityahase/frappe,yashodhank/frappe,saurabh6790/frappe,mhbu50/frappe,saurabh6790/frappe,adityahase/frappe,saurabh6790/frappe,yashodhank/frappe,mhbu50/frappe,adityahase/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,yashodhank/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,vjFaLk/frappe,vjFaLk/frappe,frappe/frappe,f... | frappe/social/doctype/energy_point_rule/energy_point_rule.py | frappe/social/doctype/energy_point_rule/energy_point_rule.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.cache_manager
from frappe.model.document import Document
from frappe.social.doctype.energy_point_... | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.cache_manager
from frappe.model.document import Document
from frappe.social.doctype.energy_point_... | mit | Python |
c8efdbb72eab78ed2fc735d3078ef8534dcc6ef7 | Fix different behavior of norm() with axis=None in the array API namespace | jakirkham/numpy,rgommers/numpy,seberg/numpy,simongibbons/numpy,numpy/numpy,simongibbons/numpy,seberg/numpy,charris/numpy,mattip/numpy,mattip/numpy,charris/numpy,jakirkham/numpy,mattip/numpy,anntzer/numpy,simongibbons/numpy,numpy/numpy,numpy/numpy,rgommers/numpy,pdebuyl/numpy,jakirkham/numpy,mhvk/numpy,simongibbons/nump... | numpy/_array_api/linear_algebra_functions.py | numpy/_array_api/linear_algebra_functions.py | # def cholesky():
# from .. import cholesky
# return cholesky()
def cross(x1, x2, /, *, axis=-1):
from .. import cross
return cross(x1, x2, axis=axis)
def det(x, /):
# Note: this function is being imported from a nondefault namespace
from ..linalg import det
return det(x)
def diagonal(x, ... | # def cholesky():
# from .. import cholesky
# return cholesky()
def cross(x1, x2, /, *, axis=-1):
from .. import cross
return cross(x1, x2, axis=axis)
def det(x, /):
# Note: this function is being imported from a nondefault namespace
from ..linalg import det
return det(x)
def diagonal(x, ... | bsd-3-clause | Python |
021907cb3dbd8963b9ed03dbe7e0a3f15c11065e | Update dns seeds | richardkiss/pycoin,richardkiss/pycoin | pycoin/symbols/grs.py | pycoin/symbols/grs.py | from pycoin.coins.groestlcoin.hash import groestlHash
from pycoin.coins.groestlcoin.parse import GRSParseAPI
from pycoin.coins.groestlcoin.Block import Block as GrsBlock
from pycoin.coins.groestlcoin.Tx import Tx as GrsTx
from pycoin.encoding.b58 import b2a_base58
from pycoin.encoding.hexbytes import h2b
from pycoin.ne... | from pycoin.coins.groestlcoin.hash import groestlHash
from pycoin.coins.groestlcoin.parse import GRSParseAPI
from pycoin.coins.groestlcoin.Block import Block as GrsBlock
from pycoin.coins.groestlcoin.Tx import Tx as GrsTx
from pycoin.encoding.b58 import b2a_base58
from pycoin.encoding.hexbytes import h2b
from pycoin.ne... | mit | Python |
e4ffe3787b81e2969b56a45e46cc0f3482fbadee | Remove debugging statement | ask/carrot,ask/carrot | carrot/backends/__init__.py | carrot/backends/__init__.py | """
Working with Backends.
"""
import sys
DEFAULT_BACKEND = "carrot.backends.pyamqplib.Backend"
BACKEND_ALIASES = {
"amqp": "carrot.backends.pyamqplib.Backend",
"amqplib": "carrot.backends.pyamqplib.Backend",
"stomp": "carrot.backends.pystomp.Backend",
"stompy": "carrot.backends.pystomp.Backend",
... | """
Working with Backends.
"""
import sys
DEFAULT_BACKEND = "carrot.backends.pyamqplib.Backend"
BACKEND_ALIASES = {
"amqp": "carrot.backends.pyamqplib.Backend",
"amqplib": "carrot.backends.pyamqplib.Backend",
"stomp": "carrot.backends.pystomp.Backend",
"stompy": "carrot.backends.pystomp.Backend",
... | bsd-3-clause | Python |
d9a78928b4c0ee4a05e1305da8304f9965756fd0 | Use actual consumption method | dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,puttar... | casexml/apps/stock/utils.py | casexml/apps/stock/utils.py | from decimal import Decimal
def months_of_stock_remaining(stock, daily_consumption):
if daily_consumption:
return stock / Decimal((daily_consumption * 30))
else:
return None
def stock_category(stock, daily_consumption, domain):
if stock is None:
return 'nodata'
elif stock == ... | from decimal import Decimal
def months_of_stock_remaining(stock, daily_consumption):
if daily_consumption:
return stock / Decimal((daily_consumption * 30))
else:
return None
def stock_category(stock, daily_consumption, domain):
if stock is None:
return 'nodata'
elif stock == ... | bsd-3-clause | Python |
550663cd1a8f3e32a824666445777c9f9fbf6852 | Remove this line until returning updating status to rMC is complete | sassoftware/catalog-service,sassoftware/catalog-service,sassoftware/catalog-service | catalogService/instances.py | catalogService/instances.py | #
# Copyright (c) 2008 rPath, Inc.
#
from rpath_common import xmllib
import xmlNode
class BaseInstance(xmlNode.BaseNode):
tag = 'instance'
__slots__ = [ 'id', 'instanceId', 'instanceName',
'instanceDescription',
'dnsName', 'publicDnsName', 'privateDnsName',
... | #
# Copyright (c) 2008 rPath, Inc.
#
from rpath_common import xmllib
import xmlNode
class BaseInstance(xmlNode.BaseNode):
tag = 'instance'
__slots__ = [ 'id', 'instanceId', 'instanceName',
'instanceDescription',
'dnsName', 'publicDnsName', 'privateDnsName',
... | apache-2.0 | Python |
3e81b1bff67e4a5a007bc1e7cca705d0f2742c5d | Handle unsupported iq elements properly | IgnitedAndExploded/pyfire,IgnitedAndExploded/pyfire | pyfire/elements/iq.py | pyfire/elements/iq.py | # -*- coding: utf-8 -*-
"""
pyfire.iq
~~~~~~~~~~~~~
This module handles XMPP iq packets
:copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import xml.etree.ElementTree as ET
class Iq(object):
"""This Class handles <iq> XMP... | # -*- coding: utf-8 -*-
"""
pyfire.iq
~~~~~~~~~~~~~
This module handles XMPP iq packets
:copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import xml.etree.ElementTree as ET
class Iq(object):
"""This Class handles <iq> XMP... | bsd-3-clause | Python |
0ca843ee8962add7fe2e5aa24c7a16bed7d5893b | fix attr. naming | sapcc/monasca-notification | monasca_notification/plugins/abstract_notifier.py | monasca_notification/plugins/abstract_notifier.py | # (C) Copyright 2015 Hewlett Packard Enterprise Development LP
#
# 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 applica... | # (C) Copyright 2015 Hewlett Packard Enterprise Development LP
#
# 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 applica... | apache-2.0 | Python |
70ac6919092fe19d3524da42146f253ae4711813 | Make requests absolute_uri instead of path | timofurrer/ramlient | ramlient/request.py | ramlient/request.py | # -*- coding: utf-8 -*-
"""
Module which provides functionality to make requests
to the API from the path of RAML nodes.
"""
import requests
from ramlfications.raml import AVAILABLE_METHODS
from .utils import match_type
from .exceptions import UnsupportedHTTPMethodError, UnsupportedQueryParameter
def prepa... | # -*- coding: utf-8 -*-
"""
Module which provides functionality to make requests
to the API from the path of RAML nodes.
"""
import requests
from ramlfications.raml import AVAILABLE_METHODS
from .utils import match_type
from .exceptions import UnsupportedHTTPMethodError, UnsupportedQueryParameter
def prepa... | mit | Python |
0e95e79d2d35576f50fc8d82d652b5bbc30f9bf6 | Fix typo in __init__.py | janusnic/django-herokuapp,etianen/django-herokuapp,forgingdestiny/django-herokuapp | herokuapp/project_template/project_name/settings/__init__.py | herokuapp/project_template/project_name/settings/__init__.py | """
Settings used by {{ project_name }} project.
This consists of the general production settings, with an optional import of any local
settings.
"""
# Import production settings.
from {{ project_name }}.settings.production import *
# Import optional local settings.
try:
from {{ project_name }}.settings.local im... | """
Settings used by {{ project_name }} project.
This consists of the general produciton settings, with an optional import of any local
settings.
"""
# Import production settings.
from {{ project_name }}.settings.production import *
# Import optional local settings.
try:
from {{ project_name }}.settings.local im... | bsd-3-clause | Python |
cfc1eb0bb258311b8441a93f59385cc8615462e1 | Modify search to match on substring | codeforgoodconf/sisters-of-the-road-admin,codeforgoodconf/sisters-of-the-road-admin,codeforgoodconf/sisters-of-the-road-admin | bartercheckout/views.py | bartercheckout/views.py | """
API endpoints
"""
import json
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from .models import BarterAccount
def home(request):
"""
The home page
"""
return render(request, 'index.html', {})
def list_accounts(request):
query_result = BarterAccount.o... | """
API endpoints
"""
import json
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from .models import BarterAccount
def home(request):
"""
The home page
"""
return render(request, 'index.html', {})
def list_accounts(request):
query_result = BarterAccount.o... | agpl-3.0 | Python |
e817c452b11d5decd91d6d4df8346b31a631b855 | modify the introduction for ultrasonic.py | zxc2694/STM32F429_Quadrotor,zxc2694/STM32F429_Quadrotor,zxc2694/STM32F429_Quadrotor | program/pythonGUI/ultrasonic.py | program/pythonGUI/ultrasonic.py | ################################################################################
# File name: ultrasonic.py
#
# Function: Display the flight height of quadcopter from stm32f4 using Python (matplotlib)
#
# Reference:http://electronut.in/plotting-real-time-data-from-arduino-using-python/
#
###############################... | ################################################################################
# File name: ultrasonic.py
#
# Function: Display three data from stm32f4 using Python (matplotlib)
# The one data, the flight height of quadcopter.
#
# Reference:http://electronut.in/plotting-real-time-data-from-arduino-using-python/
#... | mit | Python |
385655debed235fcb32e70a3f506a6885f3e4e67 | Add success=true to satisfy Ext | tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal | c2cgeoportal/views/echo.py | c2cgeoportal/views/echo.py | from base64 import b64encode
import os.path
import re
from pyramid.httpexceptions import HTTPBadRequest
from pyramid.response import Response
from pyramid.view import view_config
def json_base64_encode_chunks(file, chunk_size=65536):
"""
Generate a JSON-wrapped base64-encoded string.
See http://en.wikipe... | from base64 import b64encode
import os.path
import re
from pyramid.httpexceptions import HTTPBadRequest
from pyramid.response import Response
from pyramid.view import view_config
def json_base64_encode_chunks(file, chunk_size=65536):
"""
Generate a JSON-wrapped base64-encoded string.
See http://en.wikipe... | bsd-2-clause | Python |
08485cec87378ef2948733071494e502f09ef03e | Remove weave reference in stats/models/info.py | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | neuroimaging/fixes/scipy/stats/models/info.py | neuroimaging/fixes/scipy/stats/models/info.py | """
Statistical models
- model `formula`
- standard `regression` models
- `OLSModel` (ordinary least square regression)
- `WLSModel` (weighted least square regression)
- `ARModel` (autoregressive model)
- `glm.Model` (generalized linear models)
- robust statistical models
- `rlm.Model` (robust linear mo... | """
Statistical models
- model `formula`
- standard `regression` models
- `OLSModel` (ordinary least square regression)
- `WLSModel` (weighted least square regression)
- `ARModel` (autoregressive model)
- `glm.Model` (generalized linear models)
- robust statistical models
- `rlm.Model` (robust linear mo... | bsd-3-clause | Python |
ab93a68eb17801d225331fffd252aed34a3a5843 | fix pack | tommasoberlose/p2p_gnutella | Package.py | Package.py | import Constant as const
import Function as func
def query(ip, query):
pk_id = func.random_pktid(const.LENGTH_PKTID)
port = func.format_string(const.PORT, const.LENGTH_PORT, "0")
step = func.format_string(const.TTL, const.LENGTH_TTL, "0")
query = func.format_string(query, const.LENGTH_QUERY, " ")
pack = bytes(con... | import Constant as const
import Function as func
def query(ip, query):
pk_id = func.random_pktid(const.LENGTH_PKTID)
port = func.format_string(const.PORT, const.LENGTH_PORT, "0")
step = func.format_string(const.TTL, const.LENGTH_TTL, "0")
query = func.format_string(query, const.LENGTH_QUERY, " ")
pack = bytes(con... | mit | Python |
e42cef34b349a0453338d10cae11af3f71c521b0 | Fix snowballstemmer.algorithms() method | snowballstem/snowball,snowballstem/snowball,snowballstem/snowball,snowballstem/snowball,snowballstem/snowball,snowballstem/snowball,snowballstem/snowball,snowballstem/snowball | python/create_init.py | python/create_init.py | #! /bin/sh/env python
import sys
import re
import os
python_out_folder = sys.argv[1]
filematch = re.compile(r"(\w+)_stemmer\.py$")
imports = []
languages = []
for pyscript in os.listdir(python_out_folder):
match = filematch.match(pyscript)
if (match):
langname = match.group(1)
titlecase = l... | #! /bin/sh/env python
import sys
import re
import os
python_out_folder = sys.argv[1]
filematch = re.compile(r"(\w+)_stemmer\.py$")
imports = []
languages = []
for pyscript in os.listdir(python_out_folder):
match = filematch.match(pyscript)
if (match):
langname = match.group(1)
titlecase = l... | bsd-3-clause | Python |
48653332effe76d0a034a730abdba1e96cd56d8a | bump to 2.3.0 | ssut/py-googletrans | googletrans/__init__.py | googletrans/__init__.py | """Free Google Translate API for Python. Translates totally free of charge."""
__all__ = 'Translator',
__version__ = '2.3.0'
from googletrans.client import Translator
from googletrans.constants import LANGCODES, LANGUAGES
| """Free Google Translate API for Python. Translates totally free of charge."""
__all__ = 'Translator',
__version__ = '2.2.0'
from googletrans.client import Translator
from googletrans.constants import LANGCODES, LANGUAGES
| mit | Python |
77f14fc73f8447ddf3793898989fa8ec27d421f4 | rename _get_* methods to _get_objs | theatlantic/djangotoolbox | djangotoolbox/auth/models.py | djangotoolbox/auth/models.py | from django.db import models
from django.contrib.auth.models import User, Group, Permission
from djangotoolbox.fields import ListField
def get_objs(obj_cls, obj_ids):
objs = set()
if len(obj_ids) > 0:
# order_by() has to be used to override invalid default Permission filter
objs.update(obj_cl... | from django.db import models
from django.contrib.auth.models import User, Group, Permission
from djangotoolbox.fields import ListField
def get_objs(obj_cls, obj_ids):
objs = set()
if len(obj_ids) > 0:
# order_by() has to be used to override invalid default Permission filter
objs.update(obj_cl... | bsd-3-clause | Python |
68baf6b5f80e51b0e72559df7262d2d5502437dd | update layermapping for study region projection, dont transform | underbluewaters/marinemap,underbluewaters/marinemap,underbluewaters/marinemap | lingcod/studyregion/management/commands/create_study_region.py | lingcod/studyregion/management/commands/create_study_region.py | from django.core.management.base import BaseCommand, AppCommand
from optparse import make_option
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from lingcod.studyregion.models import StudyRegion
class Command(BaseCommand):
option_list = AppCommand.option_list + (
... | from django.core.management.base import BaseCommand, AppCommand
from optparse import make_option
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from lingcod.studyregion.models import StudyRegion
class Command(BaseCommand):
option_list = AppCommand.option_list + (
... | bsd-3-clause | Python |
f074444e684774833516e9c53af66bc54ddbd2c6 | update layermapping for study region projection, dont transform | google-code-export/marinemap,Alwnikrotikz/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,google-code-export/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,Alwnikrotikz/marinemap | lingcod/studyregion/management/commands/create_study_region.py | lingcod/studyregion/management/commands/create_study_region.py | from django.core.management.base import BaseCommand, AppCommand
from optparse import make_option
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from lingcod.studyregion.models import StudyRegion
class Command(BaseCommand):
option_list = AppCommand.option_list + (
... | from django.core.management.base import BaseCommand, AppCommand
from optparse import make_option
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from lingcod.studyregion.models import StudyRegion
class Command(BaseCommand):
option_list = AppCommand.option_list + (
... | bsd-3-clause | Python |
bcd357d531fcde3a3acc787627566a108f3ef1e3 | remove recursive import from locations app | catalpainternational/rapidsms,eHealthAfrica/rapidsms,unicefuganda/edtrac,ken-muturi/rapidsms,ehealthafrica-ci/rapidsms,dimagi/rapidsms,eHealthAfrica/rapidsms,peterayeni/rapidsms,peterayeni/rapidsms,catalpainternational/rapidsms,lsgunth/rapidsms,caktus/rapidsms,unicefuganda/edtrac,caktus/rapidsms,catalpainternational/ra... | locations/extensions/rapidsms/contact.py | locations/extensions/rapidsms/contact.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.db import models
class ContactLocation(models.Model):
location = models.ForeignKey('locations.Location', null=True, blank=True, help_text=
"The location which this Contact last reported from.")
class Meta:
abstract = True
| #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.db import models
from ...models import Location
class ContactLocation(models.Model):
location = models.ForeignKey(Location, null=True, blank=True, help_text=
"The location which this Contact last reported from.")
class Meta:
abs... | bsd-3-clause | Python |
d7c4406c1200e2ce3bee8b487db089795022eb05 | Fix region for django_amazon_ses | springload/madewithwagtail,springload/madewithwagtail,springload/madewithwagtail,springload/madewithwagtail | madewithwagtail/settings/grains/email.py | madewithwagtail/settings/grains/email.py | from .. import PROJECT
from .django import SITE_NAME
EMAIL_BACKEND = "django_amazon_ses.EmailBackend"
AWS_SES_REGION = "ap-southeast-2"
# Only for task failure notifications
EXCEPTION_EMAIL_RECIPIENTS = ["tech-urgent@springload.co.nz"]
# Default from address for CMS auto email messages (logs, errors..)
SERVER_EMAIL... | from .. import PROJECT
from .django import SITE_NAME
EMAIL_BACKEND = "django_amazon_ses.EmailBackend"
AWS_SES_REGION_NAME = "eu-west-1"
# Only for task failure notifications
EXCEPTION_EMAIL_RECIPIENTS = ["tech-urgent@springload.co.nz"]
# Default from address for CMS auto email messages (logs, errors..)
SERVER_EMAIL... | mit | Python |
90f4c06cd4186b08758ff599691d1ae1af522590 | Fix two mistakes of method description | openstack/cloudkitty,stackforge/cloudkitty,stackforge/cloudkitty,openstack/cloudkitty | cloudkitty/cli/processor.py | cloudkitty/cli/processor.py | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 | Python |
5b24d616fd32d5a4b8354a4cd301cc1c00370d84 | change hypothesis support toggle to default to on | felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer,felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,CenterForOpenScience/modular-file-renderer,felliott/modular-file-renderer | mfr/extensions/pdf/settings.py | mfr/extensions/pdf/settings.py | from mfr import settings
config = settings.child('PDF_EXTENSION_CONFIG')
EXPORT_TYPE = config.get('EXPORT_TYPE', 'pdf')
assert EXPORT_TYPE # mandatory config
EXPORT_MAXIMUM_SIZE = config.get('EXPORT_MAXIMUM_SIZE', '1200x1200')
ENABLE_HYPOTHESIS = config.get_bool('ENABLE_HYPOTHESIS', True)
# supports multiple file... | from mfr import settings
config = settings.child('PDF_EXTENSION_CONFIG')
EXPORT_TYPE = config.get('EXPORT_TYPE', 'pdf')
assert EXPORT_TYPE # mandatory config
EXPORT_MAXIMUM_SIZE = config.get('EXPORT_MAXIMUM_SIZE', '1200x1200')
ENABLE_HYPOTHESIS = config.get_bool('ENABLE_HYPOTHESIS', False)
# supports multiple fil... | apache-2.0 | Python |
b7e781eed46503edee25547e8de8831ee6b0cf96 | Add doc str and change logger config | DataKind-SG/healthcare_ASEAN | src/data/download/BN_disease.py | src/data/download/BN_disease.py | # This script downloads weekly dengue statistics from data.gov.bn
import os
import sys
import logging
DIRECTORY = '../../data/raw/disease_BN'
OUTFILE = "Trend of Notifiable Diseases (2008 - 2012).xlsx"
URL = "https://www.data.gov.bn/Lists/dataset/Attachments/460/Trend%20of%20Notifiable%20Diseases%20(2008%20-%202012).... | # This script downloads weekly dengue statistics from data.gov.bn
import os
import sys
import logging
DIRECTORY = '../../Data/raw/disease_BN'
OUTFILE = "Trend of Notifiable Diseases (2008 - 2012).xlsx"
URL = "https://www.data.gov.bn/Lists/dataset/Attachments/460/Trend%20of%20Notifiable%20Diseases%20(2008%20-%202012).... | mit | Python |
e3b88f023e4002492c0b8b2c94b52066e5e93871 | Fix a namespace package. | kata-csc/ckanext-oaipmh,kata-csc/ckanext-oaipmh,kata-csc/ckanext-oaipmh | ckanext/oaipmh/__init__.py | ckanext/oaipmh/__init__.py | # this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| agpl-3.0 | Python | |
b8bfae7db015098fdc9dd8ed3a8c4d459df71e43 | add utcoffset columns in the migration | Lancey6/redwind,Lancey6/redwind,Lancey6/redwind | migrations/20150401_add_event_columns.py | migrations/20150401_add_event_columns.py | """
"""
import os
import json
from sqlalchemy import (create_engine, Table, Column, String, Integer,
PickleType, Boolean, DateTime, Float, Text,
MetaData, select, ForeignKey, bindparam,
delete, and_)
from sqlalchemy.ext.declarative import declarati... | """
"""
import os
import json
from sqlalchemy import (create_engine, Table, Column, String, Integer,
PickleType, Boolean, DateTime, Float, Text,
MetaData, select, ForeignKey, bindparam,
delete, and_)
from sqlalchemy.ext.declarative import declarati... | bsd-2-clause | Python |
b4eb360aac9ea7a4dc5d7648734bc028956b4e24 | add campaigns to admin | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | coupons/admin.py | coupons/admin.py | from django.conf.urls import patterns, url
from django.contrib import admin
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import TemplateView
from .forms import CouponGenerationForm
from .models import Coupon, Campaign
class CouponAdmin(adm... | from django.conf.urls import patterns, url
from django.contrib import admin
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import TemplateView
from .forms import CouponGenerationForm
from .models import Coupon
class CouponAdmin(admin.ModelAd... | bsd-3-clause | Python |
e14f11a8818efb4b452e68535e7696e42151c242 | Fix alignment | osu-mist/catalog-api-demo,osu-mist/catalog-api-demo,osu-mist/catalog-api-demo | catalog_api_demo/catalog_api_demo/views.py | catalog_api_demo/catalog_api_demo/views.py | from django.shortcuts import render_to_response
from django.template import RequestContext
from .forms import CourseForm
import json
import requests
def get_access_token(token_url, client_id, client_secret):
token_resp = requests.post(token_url, data={
'client_id': client_id,
'client_secret': client_secret,
'... | from django.shortcuts import render_to_response
from django.template import RequestContext
from .forms import CourseForm
import json
import requests
def get_access_token(token_url, client_id, client_secret):
token_resp = requests.post(token_url, data={
'client_id': client_id,
'client_secret': client_secret,
'... | apache-2.0 | Python |
cc7dbc1bd9ec5498fc64cf96e0e44a3007f2c0e8 | fix journal title script - only count records as processed if they get saved | CottageLabs/catflap | catflap/es_bulk_utils/fix_journal_title.py | catflap/es_bulk_utils/fix_journal_title.py | import sys
from catflap.models import Journal
FIX_FIELD = 'journal_title'
strange = None # log strange things to this file handle
def fix(q=None):
# TODO do this using the scroll API http://www.elasticsearch.org/guide/reference/api/search/search-type/
everything = Journal.query(q=q, size=10000000)
proce... | import sys
from catflap.models import Journal
FIX_FIELD = 'journal_title'
strange = None # log strange things to this file handle
def fix(q=None):
# TODO do this using the scroll API http://www.elasticsearch.org/guide/reference/api/search/search-type/
everything = Journal.query(q=q, size=10000000)
proce... | mit | Python |
192ec30584d1a88d2ef44411ad1c6a3ac991091a | update path | TylerKirby/cltk,mbevila/cltk,LBenzahia/cltk,marpozzi/cltk,D-K-E/cltk,coderbhupendra/cltk,TylerKirby/cltk,eamonnbell/cltk,diyclassics/cltk,cltk/cltk,LBenzahia/cltk,kylepjohnson/cltk | cltk/tag/pos/pos_tagger.py | cltk/tag/pos/pos_tagger.py | """Tags part of speech (POS)."""
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LICENSE.'
from nltk.tokenize import wordpunct_tokenize
import os
import pickle
class POSTag(object):
"""Picks up taggers made with UnigramTagger"""
def __init__(self):
"""Initia... | """Tags part of speech (POS)."""
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LICENSE.'
from nltk.tokenize import wordpunct_tokenize
import os
import pickle
class POSTag(object):
"""Picks up taggers made with UnigramTagger"""
def __init__(self):
"""Initia... | mit | Python |
c1d889f637d6d2a931f81332a9eef3974dfa18e0 | Drop unused support to add decorators via entry points | ternaris/marv-robotics,ternaris/marv-robotics | code/marv/marv/__init__.py | code/marv/marv/__init__.py | # Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
from marv_node.io import Abort
from marv_node.io import create_group
from marv_node.io import create_stream
from marv_node.io import fork
from marv_node.io import get_logger
from marv_node.io import get_requested
from marv_node.io import get_s... | # Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import sys
from pkg_resources import iter_entry_points
from marv_node.io import Abort
from marv_node.io import create_group
from marv_node.io import create_stream
from marv_node.io import fork
from marv_node.io import get_logger
from marv_no... | agpl-3.0 | Python |
69d858948cd7cd3622e3307299a61194757f6132 | remove extra space | tonybaloney/st2contrib,armab/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,armab/st2contrib,StackStorm/st2contrib,StackStorm/st2contrib,armab/st2contrib,tonybaloney/st2contrib | packs/hpe-icsp/actions/icsp_server_data_format.py | packs/hpe-icsp/actions/icsp_server_data_format.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | apache-2.0 | Python |
b09c732a054b9e30266e88c12a706a0fadb8121d | add new zealand | The-Public-Radio/tools,The-Public-Radio/tools,The-Public-Radio/tools | PR_Production/scantest/country_code_presets.py | PR_Production/scantest/country_code_presets.py |
# A sketch of pulling backer country data and formatting the radio presets, which are
# needed in addition to the frenquency
# BAND, Deemphasis, and Channel spacing are arguments that are passed to eeprom.py
# in the form of: eeprom.py -f $frequency -b $band -d $deemphasis -s $channel_spacing
# Hong Kong, New Zela... |
# A sketch of pulling backer country data and formatting the radio presets, which are
# needed in addition to the frenquency
# BAND, Deemphasis, and Channel spacing are arguments that are passed to eeprom.py
# in the form of: eeprom.py -f $frequency -b $band -d $deemphasis -s $channel_spacing
# Hong Kong, New Zela... | mit | Python |
0a6e82485d4c4657efae629501f14c28c9287f48 | Fix flake8 test for the coersion function | wglass/collectd-haproxy | collectd_haproxy/compat.py | collectd_haproxy/compat.py | import sys
PY3 = sys.version_info >= (3,)
def iteritems(dictionary):
if PY3:
return dictionary.items()
return dictionary.iteritems()
def coerce_long(string):
if not PY3:
return long(string) # noqa
return int(string)
| import sys
PY3 = sys.version_info >= (3,)
def iteritems(dictionary):
if PY3:
return dictionary.items()
return dictionary.iteritems()
def coerce_long(string):
if not PY3:
return long(string)
return int(string)
| mit | Python |
997d41b251cc256202674989c87b829c056f0264 | Add default route for BastardBotController (webserver) | elamperti/bastardbot,elamperti/bastardbot | webserver/controllers/bastardcontroller.py | webserver/controllers/bastardcontroller.py | import cherrypy
from webserver.controllers.basecontroller import BaseController
from webserver.template import template
from models import Conversation, User, Message
class BastardController(BaseController):
@cherrypy.expose
def default(self,*args,**kwargs):
return '404 Not Found'
@che... | import cherrypy
from webserver.controllers.basecontroller import BaseController
from webserver.template import template
from models import Conversation, User, Message
class BastardController(BaseController):
@cherrypy.expose
@template("home")
def index(self, *args, **kwargs):
return {}... | mit | Python |
4c52b8f63fea11278536ec6800305b01d9bd02a8 | Add update_reservation to dummy plugin | ChameleonCloud/blazar,ChameleonCloud/blazar | blazar/plugins/dummy_vm_plugin.py | blazar/plugins/dummy_vm_plugin.py | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 | Python |
9e7a200e142e68380e6f8e622d594e7c82fccb7e | 更新 modules Groups 中的 models.py, 新增函式功能宣告註解 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/groups/models.py | commonrepo/groups/models.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | apache-2.0 | Python |
15b4f0c587bdd5772718d9d75ff5654d9b835ae5 | Copy the settings class from an old requests version | michaeljoseph/righteous,michaeljoseph/righteous | righteous/config.py | righteous/config.py | # coding: utf-8
"""
righteous.config
Settings object, lifted from https://github.com/kennethreitz/requests
"""
class Settings(object):
_singleton = {}
# attributes with defaults
__attrs__ = []
def __init__(self, **kwargs):
super(Settings, self).__init__()
self.__dict__ = self._sin... | # coding: utf-8
"""
righteous.config
Settings object, lifted from https://github.com/kennethreitz/requests
"""
from requests.config import Settings
class RighteousSettings(Settings):
pass
settings = RighteousSettings()
settings.debug = False
settings.cookies = None
settings.username = None
settings.password ... | unlicense | Python |
bc26d9afbc2967a734d984166d7921c45dbfabed | Remove extraneous bits from notebook export | deeplycloudy/lmatools | flashsort/examples/sklearn_test.py | flashsort/examples/sklearn_test.py | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
from lmatools.flashsort.autosort.autorun import run_files_with_params, test_output, logger_setup
outpath = '/Users/ebruning/out/scratch/'
logger_setup(outpath)
#files = ['/data/20040526/LMA/LYLOUT_040526_224000_0600.dat.gz', '/data/20040526/LMA/LYLOUT_040526_225... | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from lmatools.flashsort.autosort.autorun import run_files_with_params, test_output, logger_setup
# <codecell>
outpath = '/Users/ebruning/out/scratch/'
logger_setup(outpath)
# <codecell>
outpath = '.'
# <codecell>
#files = ['/data/20040526/LMA/LYLOU... | bsd-2-clause | Python |
8a97393718065b0e7b9f28d2f79c042871bd5864 | Fix create issue in notebook's spec | ESSS/conda-env,phobson/conda-env,nicoddemus/conda-env,conda/conda-env,mikecroucher/conda-env,mikecroucher/conda-env,dan-blanchard/conda-env,phobson/conda-env,dan-blanchard/conda-env,conda/conda-env,nicoddemus/conda-env,ESSS/conda-env | conda_env/specs/notebook.py | conda_env/specs/notebook.py | try:
from IPython import nbformat
except ImportError:
nbformat = None
from ..env import Environment
from .binstar import BinstarSpec
class NotebookSpec(object):
msg = None
def __init__(self, name=None, **kwargs):
self.name = name
self.nb = {}
def can_handle(self):
try:
... | try:
from IPython import nbformat
except ImportError:
nbformat = None
from ..env import Environment
from .binstar import BinstarSpec
class NotebookSpec(object):
msg = None
def __init__(self, name=None, **kwargs):
self.name = name
self.nb = {}
def can_handle(self):
try:
... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.