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 |
|---|---|---|---|---|---|---|---|---|
ac0523cbc7b0b545720f9bca157165a8c2675954 | support not json parsable data | tariqdaouda/pyArango,tariqdaouda/pyArango | pyArango/index.py | pyArango/index.py | import json
from .theExceptions import (CreationError, DeletionError, UpdateError)
class Index(object) :
"""An index on a collection's fields. Indexes are meant to de created by ensureXXX functions of Collections.
Indexes have a .infos dictionary that stores all the infos about the index"""
def __init__(self... | import json
from .theExceptions import (CreationError, DeletionError, UpdateError)
class Index(object) :
"""An index on a collection's fields. Indexes are meant to de created by ensureXXX functions of Collections.
Indexes have a .infos dictionary that stores all the infos about the index"""
def __init__(self... | apache-2.0 | Python |
095d8d0136ff3942a9fcc76564a61e17dae56b71 | Fix breakage. The website is looking for user-agent header | sharuzzaman/sharuzzaman-code-repo.maybank-gia-rate | goldprice.py | goldprice.py | #!/usr/bin/python
# Maybank Gold Investment Account price scraper
# Using BeautifulSoup package
# Developed and tested on Debian Testing (Jessie)
# Initial development 25 July 2012
# Copyright (C) 2012,2013 Sharuzzaman Ahmat Raslan (sharuzzaman@gmail.com)
#
# This program is free software: you can redistribute it an... | #!/usr/bin/python
# Maybank Gold Investment Account price scraper
# Using BeautifulSoup package
# Developed and tested on Debian Testing (Jessie)
# Initial development 25 July 2012
# Copyright (C) 2012,2013 Sharuzzaman Ahmat Raslan (sharuzzaman@gmail.com)
#
# This program is free software: you can redistribute it an... | agpl-3.0 | Python |
a2582b3352582034af1b8dff99d4ac39a15d9b54 | Fix script to pass pep8 | aebm/shuffler | shuffler.py | shuffler.py | #!/usr/bin/env python3
import argparse
import random
import sys
DESCRIPTION = '''Shuffle the arguments received, if called without arguments
the lines read from stdin will be shuffled and printed to
stdout'''
def get_list():
return sys.stdin.readlines()
def print_list(list_):... | #!/usr/bin/env python3
import argparse
import random
import sys
DESCRIPTION = '''Shuffle the arguments received, if called without arguments
the lines read from stdin will be shuffled and printed to
stdout'''
def get_list():
return sys.stdin.readlines()
def print_list(list_):
... | apache-2.0 | Python |
7f356e3191344ad300f8b59f35e861833d09f693 | Fix typo | nlesc-ave/ave-rest-service | avedata/avedata.py | avedata/avedata.py | import os
import connexion
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
from flask_cors import CORS
connexion_app = connexion.App(__name__, specification_dir='../')
app = connexion_app.app
CORS(app)
app.config.update(dict(
DATABASE='ave.db'
))
app.confi... | import os
import connexion
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
from flask_corse import CORS
connexion_app = connexion.App(__name__, specification_dir='../')
app = connexion_app.app
CORS(app)
app.config.update(dict(
DATABASE='ave.db'
))
app.conf... | apache-2.0 | Python |
a556674523972bf4cb1f9cced73e6783bcf2f492 | update load and transform function to simplify data | epfahl/inaworld | inaworld/data.py | inaworld/data.py | """Load the corpus of data.
"""
import re
import pandas as pd
import toolz as tz
from . import utils
DEFAULT_DATA_PATH = 'movie_data.csv'
def strlst_to_lststr(genres):
"""Convert a string of list entries to a list of lowercase strings.
Examples
--------
>>> strlst_to_lststr('["Banking Hijinks", "A... | """Load the corpus of data.
"""
import re
import pandas as pd
import toolz as tz
def strlst_to_lststr(genres):
"""Convert a string of list entries to a list of lowercase strings.
Examples
--------
>>> strlst_to_lststr('["Banking Hijinks", "Actuarial adventure"]')
['banking hijinks', "actuarial a... | mit | Python |
6a83c4808d7f1104aba832f53bcd25fb98be1686 | Bump to 1.0 dev version | karimbahgat/PyCRS | pycrs/__init__.py | pycrs/__init__.py | """
# PyCRS
PyCRS is a pure Python GIS package for reading, writing, and converting between various
common coordinate reference system (CRS) string and data source formats.
- [Home Page](http://github.com/karimbahgat/PyCRS)
- [API Documentation](http://pythonhosted.org/PyCRS)
"""
__version__ = "1.0.0-dev"
from .... | """
# PyCRS
PyCRS is a pure Python GIS package for reading, writing, and converting between various
common coordinate reference system (CRS) string and data source formats.
- [Home Page](http://github.com/karimbahgat/PyCRS)
- [API Documentation](http://pythonhosted.org/PyCRS)
"""
__version__ = "0.1.4"
from . imp... | mit | Python |
f17971d339c943277afb5d7b2731cd87a23c0a83 | Update documentation of AxesMiddleware | jazzband/django-axes | axes/middleware.py | axes/middleware.py | from typing import Callable
from django.conf import settings
from axes.helpers import (
get_lockout_response,
get_failure_limit,
get_client_username,
get_credentials,
)
from axes.handlers.proxy import AxesProxyHandler
class AxesMiddleware:
"""
Middleware that calculates necessary HTTP reque... | from typing import Callable
from django.conf import settings
from axes.helpers import (
get_lockout_response,
get_failure_limit,
get_client_username,
get_credentials,
)
from axes.handlers.proxy import AxesProxyHandler
class AxesMiddleware:
"""
Middleware that calculates necessary HTTP reque... | mit | Python |
c1a9882a91d8914e52d67ccab59c4e4121a93198 | bump version | dswah/pyGAM | pygam/__init__.py | pygam/__init__.py | """
GAM toolkit
"""
from __future__ import absolute_import
from pygam.pygam import GAM
from pygam.pygam import LinearGAM
from pygam.pygam import LogisticGAM
from pygam.pygam import GammaGAM
from pygam.pygam import PoissonGAM
from pygam.pygam import InvGaussGAM
__all__ = ['GAM', 'LinearGAM', 'LogisticGAM', 'GammaGAM'... | """
GAM toolkit
"""
from __future__ import absolute_import
from pygam.pygam import GAM
from pygam.pygam import LinearGAM
from pygam.pygam import LogisticGAM
from pygam.pygam import GammaGAM
from pygam.pygam import PoissonGAM
from pygam.pygam import InvGaussGAM
__all__ = ['GAM', 'LinearGAM', 'LogisticGAM', 'GammaGAM'... | apache-2.0 | Python |
698f07a93dea9b57010b9c3ac33608165123bef5 | Extend timeout. | freevo/kaa-epg | src/__init__.py | src/__init__.py | import os
import logging
from socket import gethostbyname, gethostname
from kaa import ipc
from client import *
from server import *
__all__ = [ 'connect', 'DEFAULT_EPG_PORT', 'GuideClient', 'GuideServer' ]
# connected client object
_client = None
def connect(epgdb, address='127.0.0.1', logfile='/tmp/kaa-epg.log', ... | import os
import logging
from socket import gethostbyname, gethostname
from kaa import ipc
from client import *
from server import *
__all__ = [ 'connect', 'DEFAULT_EPG_PORT', 'GuideClient', 'GuideServer' ]
# connected client object
_client = None
def connect(epgdb, address='127.0.0.1', logfile='/tmp/kaa-epg.log', ... | lgpl-2.1 | Python |
1d1ac3fa0538bba2135627b972d268c90b8d3051 | Add exception | jsikel/jsikel | blckur/exceptions.py | blckur/exceptions.py | class TestException(Exception):
pass
class TestCheckFailed(TestException):
pass
class TestStatusFailed(TestException):
pass
class TestExpectFailed(TestException):
pass
| class TestException(Exception):
pass
class TestStatusFailed(TestException):
pass
class TestExpectFailed(TestException):
pass
| agpl-3.0 | Python |
a510d20cebe2aff86a6bf842d063b5df8937a7ec | Update site and project names for pylons integration. Fix behavior of empty lists. Add DSN. | tarkatronic/opbeat_python,tarkatronic/opbeat_python,inspirehep/raven-python,ticosax/opbeat_python,jbarbuto/raven-python,jmagnusson/raven-python,ronaldevers/raven-python,akalipetis/raven-python,collective/mr.poe,patrys/opbeat_python,arthurlogilab/raven-python,percipient/raven-python,inspirehep/raven-python,ronaldevers/r... | raven/contrib/pylons/__init__.py | raven/contrib/pylons/__init__.py | """
raven.contrib.pylons
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from raven.middleware import Sentry as Middleware
from raven.base import Client
def list_from_setting(config, setting):
value = config.get(setting)... | """
raven.contrib.pylons
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from raven.middleware import Sentry as Middleware
from raven.base import Client
class Sentry(Middleware):
def __init__(self, app, config):
... | bsd-3-clause | Python |
826429100092f449f73827bff3098f74ed4b0eff | Fix trakt_list test | qvazzler/Flexget,malkavi/Flexget,gazpachoking/Flexget,jacobmetrick/Flexget,ianstalk/Flexget,ianstalk/Flexget,Danfocus/Flexget,jawilson/Flexget,jacobmetrick/Flexget,jawilson/Flexget,qk4l/Flexget,jacobmetrick/Flexget,poulpito/Flexget,drwyrm/Flexget,OmgOhnoes/Flexget,Flexget/Flexget,crawln45/Flexget,qk4l/Flexget,tobinjt/F... | tests/test_trakt_list_interface.py | tests/test_trakt_list_interface.py | from __future__ import unicode_literals, division, absolute_import
import pytest
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugins.api_trakt import TraktUserAuth
from flexget.plugins.list.trakt_list import TraktSet
@pytest.mark.online
class TestTraktList(object):
"""
C... | from __future__ import unicode_literals, division, absolute_import
import pytest
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugins.api_trakt import TraktUserAuth
from flexget.plugins.list.trakt_list import TraktSet
@pytest.mark.online
class TestTraktList(object):
"""
C... | mit | Python |
cc894fea8e357f4bfdb3b34cf249f9f0ca817aff | make sample number a required argument in pair-test.py | perlinm/qcdg-nv-simulation,perlinm/qcdg-nv-simulation,perlinm/qcdg-nv-simulation | pair-test.py | pair-test.py | #!/usr/bin/python3
import sys, os
import subprocess as sp
import numpy as np
import matplotlib.pyplot as plt
if len(sys.argv) not in [3,4]:
print("usage: {} cutoff_start cutoff_end samples".format(sys.argv[0]))
exit(1)
start = int(sys.argv[1])
end = int(sys.argv[2])
samples = int(sys.argv[3])
if not start <... | #!/usr/bin/python3
import sys, os
import subprocess as sp
import numpy as np
import matplotlib.pyplot as plt
if len(sys.argv) not in [3,4]:
print("usage: {} cutoff_start cutoff_end [samples]".format(sys.argv[0]))
exit(1)
start = int(sys.argv[1])
end = int(sys.argv[2])
try:
samples = sys.argv[3]
except:
... | mit | Python |
595c6a01601422fd8cd25a8818be6c02a564acfd | Fix out-of-date names in oauth_utils | Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService | d4s2_auth/oauth_utils.py | d4s2_auth/oauth_utils.py | import requests
from requests_oauthlib import OAuth2Session
from models import OAuthService
def make_oauth(oauth_service):
return OAuth2Session(oauth_service.client_id,
redirect_uri=oauth_service.redirect_uri,
scope=oauth_service.scope.split())
def authorizatio... | import requests
from requests_oauthlib import OAuth2Session
from models import OAuthService
def make_oauth(oauth_service):
return OAuth2Session(oauth_service.client_id,
redirect_uri=oauth_service.redirect_uri,
scope=oauth_service.scope.split())
def authorizatio... | mit | Python |
e91a8ebe5858d6ce039f64fb28cb964ad72faa5c | add a manange command to serve with prod config | rsalmond/seabus,rsalmond/seabus,rsalmond/seabus,rsalmond/seabus,rsalmond/seabus | manage.py | manage.py | #!/usr/bin/env python
import flask_migrate
import flask_script
from seabus.web.socketio import socketio
from seabus.common.database import db
from seabus.web.web import create_app
from seabus.nmea_listen.listener import listen
app = create_app('Prod')
manager = flask_script.Manager(app)
flask_migrate.Migrate(app, db... | #!/usr/bin/env python
import flask_migrate
import flask_script
from seabus.web.socketio import socketio
from seabus.common.database import db
from seabus.web.web import create_app
from seabus.nmea_listen.listener import listen
app = create_app('Dev')
manager = flask_script.Manager(app)
flask_migrate.Migrate(app, db)... | mit | Python |
3955aa821415f1e7630b7f1511bcd3609d26334d | fix division name | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_mb_winnipeg/people.py | ca_mb_winnipeg/people.py | from __future__ import unicode_literals
from utils import CanadianScraper, CanadianPerson as Person
import re
from six.moves.urllib.parse import urljoin
COUNCIL_PAGE = 'http://winnipeg.ca/council/'
class WinnipegPersonScraper(CanadianScraper):
def scrape(self):
page = self.lxmlize(COUNCIL_PAGE, 'utf-8... | from __future__ import unicode_literals
from utils import CanadianScraper, CanadianPerson as Person
import re
from six.moves.urllib.parse import urljoin
COUNCIL_PAGE = 'http://winnipeg.ca/council/'
class WinnipegPersonScraper(CanadianScraper):
def scrape(self):
page = self.lxmlize(COUNCIL_PAGE, 'utf-8... | mit | Python |
3017a23893a21a7783480c69cecfcabf70c1f446 | Fix tests | orchardmile/mongo-connector,orchardmile/mongo-connector | tests/test_algolia.py | tests/test_algolia.py | # Copyright 2013-2014 MongoDB, 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 writin... | # Copyright 2013-2014 MongoDB, 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 writin... | apache-2.0 | Python |
4ebf63772505d562f6b95c6a2a72b8b34fa9686c | Update aligner tests | MontrealCorpusTools/Montreal-Forced-Aligner | tests/test_aligner.py | tests/test_aligner.py | import os
import pytest
from aligner.aligner import TrainableAligner
def test_sick_mono(sick_dict, sick_corpus, generated_dir):
a = TrainableAligner(sick_corpus, sick_dict, os.path.join(generated_dir, 'sick_output'),
temp_directory=os.path.join(generated_dir, 'sickcorpus'), skip_input=Tr... | import os
import pytest
from aligner.aligner import TrainableAligner
def test_sick_mono(sick_dict, sick_corpus, generated_dir):
a = TrainableAligner(sick_corpus, sick_dict, os.path.join(generated_dir, 'sick_output'),
temp_directory=os.path.join(generated_dir, 'sickcorpus'))
a.train_m... | mit | Python |
e38ae10a684fd0e1161d28d458d2eabdbf597c1d | select query, get language from tablename | Vesihiisi/COH-tools | wlmhelpers.py | wlmhelpers.py | import pymysql
def selectQuery(query, connection):
cursor = connection.cursor()
cursor.execute(query)
result = cursor.fetchall()
return result
def getNumberOfRows(connection, tablename):
cursor = connection.cursor()
query = "SELECT COUNT(*) FROM `" + tablename + "`"
cursor.execute(query)... | import pymysql
def getNumberOfRows(connection, tablename):
cursor = connection.cursor()
query = "SELECT COUNT(*) FROM `" + tablename + "`"
cursor.execute(query)
result = cursor.fetchone()
return result[0]
def showTables(connection):
cursor = connection.cursor()
cursor.execute("show table... | mit | Python |
a3570205c90dd8757a833aed4f4069fbd33028e0 | Remove fixed owner and make loged in user instead | PNNutkung/Coursing-Field,PNNutkung/Coursing-Field,PNNutkung/Coursing-Field | course/views.py | course/views.py | from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from mainmodels.models import Category, Course, CourseInCategory
# Create your views here.
def createCourse(req):
if req.method == 'POST':
try:
courseName = req.POST['courseName']
courseC... | from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from mainmodels.models import Category, Course, CourseInCategory
from django.contrib.auth.models import User
# Create your views here.
def createCourse(req):
if req.method == 'POST':
try:
courseName ... | apache-2.0 | Python |
06f9598601a4701bf56b213764d645135ac5815e | Create Asciinema | coala/coala-bears,coala/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala/coala-bears,coala/coala-bears,coala-analyzer/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala/coala-bears,coala-analyzer/coala-be... | bears/python/PythonPackageInitBear.py | bears/python/PythonPackageInitBear.py | import os
from coalib.results.Result import Result
from coalib.bears.GlobalBear import GlobalBear
class PythonPackageInitBear(GlobalBear):
LANGUAGES = {'Python', 'Python 3', 'Python 2'}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
LICENSE = 'AGPL-3.0'
ASCI... | import os
from coalib.results.Result import Result
from coalib.bears.GlobalBear import GlobalBear
class PythonPackageInitBear(GlobalBear):
LANGUAGES = {'Python', 'Python 3', 'Python 2'}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
LICENSE = 'AGPL-3.0'
def... | agpl-3.0 | Python |
ee5ef2ae9b146a6fb06fd9891502a8f66af06cce | remove hard coded path | ctSkennerton/BioSQL-Extensions | tests/test_biosqlx.py | tests/test_biosqlx.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `biosqlx` package."""
import os
import unittest
from io import StringIO
from click.testing import CliRunner
from biosqlx import biosqlx
from biosqlx import cli
class TestExportSequence(unittest.TestCase):
"""Tests for `biosqlx` package."""
def set... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `biosqlx` package."""
import unittest
from io import StringIO
from click.testing import CliRunner
from biosqlx import biosqlx
from biosqlx import cli
class TestExportSequence(unittest.TestCase):
"""Tests for `biosqlx` package."""
def setUp(self):... | mit | Python |
00e42da665ac25e9d793f331adf4ce58c5bd67b9 | Remove not existing import | yaph/logya,yaph/logya,elaOnMars/logya,elaOnMars/logya,elaOnMars/logya | tests/test_content.py | tests/test_content.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from logya.content import read
def test_read_markdown():
doc = read('tests/fixtures/site/content/markdown.md')
assert isinstance(doc, dict)
assert '/test/markdown/' == doc['url']
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from logya.content import read, write
def test_read_markdown():
doc = read('tests/fixtures/site/content/markdown.md')
assert isinstance(doc, dict)
assert '/test/markdown/' == doc['url']
| mit | Python |
dd635d5ae86f39b8746de01a1320fe7b970df554 | mark test as "run last" using pytest-ordering | arne-cl/discoursegraphs | tests/test_corpora.py | tests/test_corpora.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Arne Neumann <discoursegraphs.programming@arne.cl>
from copy import deepcopy
import pkgutil
from tempfile import NamedTemporaryFile, mkdtemp
import networkx as nx
import pytest
import discoursegraphs as dg
from discoursegraphs.corpora import pcc
@pytest.mark.... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Arne Neumann <discoursegraphs.programming@arne.cl>
from copy import deepcopy
import pkgutil
from tempfile import NamedTemporaryFile, mkdtemp
import networkx as nx
import pytest
import discoursegraphs as dg
from discoursegraphs.corpora import pcc
@pytest.mark.... | bsd-3-clause | Python |
86847172f732f2b27a82336f5da1f29592bf6cd6 | Put some parentheses there | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | monitoring/post_to_slack/src/snapshot_reports.py | monitoring/post_to_slack/src/snapshot_reports.py | # -*- encoding: utf-8
import datetime as dt
import boto3
def pprint_timedelta(seconds):
"""
Returns a pretty-printed summary of a duration as seconds.
e.g. "1h", "2d 3h", "1m 4s".
"""
days, seconds = divmod(seconds, 86400)
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmo... | # -*- encoding: utf-8
import datetime as dt
import boto3
def pprint_timedelta(seconds):
"""
Returns a pretty-printed summary of a duration as seconds.
e.g. "1h", "2d 3h", "1m 4s".
"""
days, seconds = divmod(seconds, 86400)
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmo... | mit | Python |
6f7890c8b29670f613b6a551ebac2b383f3a7a64 | Test units mismatch in recipe | chrisgilmerproj/brewday,chrisgilmerproj/brewday | tests/test_recipes.py | tests/test_recipes.py | import unittest
from brew.constants import IMPERIAL_UNITS
from brew.constants import SI_UNITS
from brew.recipes import Recipe
from fixtures import grain_additions
from fixtures import hop_additions
from fixtures import recipe
from fixtures import yeast
class TestRecipe(unittest.TestCase):
def setUp(self):
... | import unittest
from brew.constants import IMPERIAL_UNITS
from brew.constants import SI_UNITS
from brew.recipes import Recipe
from fixtures import grain_additions
from fixtures import hop_additions
from fixtures import recipe
class TestRecipe(unittest.TestCase):
def setUp(self):
# Define Grains
... | mit | Python |
0fc99faf79a3e12c6dc23586af9f5d7734d3c3c0 | Rewrite routing tests | nickfrostatx/malt | tests/test_routing.py | tests/test_routing.py | # -*- coding: utf-8 -*-
"""Test that the package exists and has specified metadata."""
from malt.routing import Router
import pytest
def test_get_and_post():
router = Router()
def get_root():
pass
def post_root():
pass
def get_home():
pass
router.add_rule('GET', '/', g... | # -*- coding: utf-8 -*-
"""Test that the package exists and has specified metadata."""
from malt import Malt
import pytest
@pytest.fixture
def app():
app = Malt()
@app.get('/')
def root(request):
return Response('Hello World!\n')
return app
def test_base_routing():
app = Malt()
@... | mit | Python |
59c8c407df2aec220677324b77f5910f25a5d062 | Make binary_accuracy's type-checking stricter | delta2323/chainer,anaruse/chainer,kashif/chainer,jnishi/chainer,keisuke-umezawa/chainer,kikusu/chainer,wkentaro/chainer,chainer/chainer,benob/chainer,chainer/chainer,niboshi/chainer,ktnyt/chainer,okuta/chainer,rezoo/chainer,aonotas/chainer,wkentaro/chainer,hvy/chainer,jnishi/chainer,tkerola/chainer,hvy/chainer,cupy/cup... | chainer/functions/evaluation/binary_accuracy.py | chainer/functions/evaluation/binary_accuracy.py | import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class BinaryAccuracy(function.Function):
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 2)
x_type, t_type = in_types
type_check.expect(
x_type... | import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class BinaryAccuracy(function.Function):
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 2)
x_type, t_type = in_types
type_check.expect(
x_type... | mit | Python |
28ae68d405514364855fbdece5b22f636e802d12 | Update versions | conan-io/conan-package-tools | cpt/__init__.py | cpt/__init__.py |
__version__ = '0.39.0-dev'
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
from os import getenv
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace("-dev"... |
__version__ = '0.37.0'
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
from os import getenv
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace("-dev", ""... | mit | Python |
d5aef03683f77400cd56160852c650de09d0a8bb | Fix deprecated unittest API usage. | scoder/cython,cython/cython,da-woods/cython,scoder/cython,da-woods/cython,cython/cython,da-woods/cython,cython/cython,scoder/cython,scoder/cython,cython/cython,da-woods/cython | Cython/Build/Tests/TestStripLiterals.py | Cython/Build/Tests/TestStripLiterals.py | from Cython.Build.Dependencies import strip_string_literals
from Cython.TestUtils import CythonTest
class TestStripLiterals(CythonTest):
def t(self, before, expected):
actual, literals = strip_string_literals(before, prefix="_L")
self.assertEqual(expected, actual)
for key, value in litera... | from Cython.Build.Dependencies import strip_string_literals
from Cython.TestUtils import CythonTest
class TestStripLiterals(CythonTest):
def t(self, before, expected):
actual, literals = strip_string_literals(before, prefix="_L")
self.assertEquals(expected, actual)
for key, value in liter... | apache-2.0 | Python |
7e1ed594dadca06c256424f7a950a323138171f3 | Support Conan 1.23 | conan-io/conan-package-tools | cpt/__init__.py | cpt/__init__.py |
__version__ = '0.32.0-dev'
NEWEST_CONAN_SUPPORTED = "1.23.000"
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.repl... |
__version__ = '0.31.1'
NEWEST_CONAN_SUPPORTED = "1.22.200"
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace(... | mit | Python |
90b602a1965418efef706c92bc4da8fc14e013d9 | Change cache policy to only include analytics api endpoints | uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics | data_aggregator/cache.py | data_aggregator/cache.py | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import re
from gcs_clients import RestclientGCSClient
FOREVER = 0
class DataAggregatorGCSCache(RestclientGCSClient):
def get_cache_expiration_time(self, service, url, status=None):
if "canvas" == service:
... | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from gcs_clients import RestclientGCSClient
FOREVER = 0
class DataAggregatorGCSCache(RestclientGCSClient):
def get_cache_expiration_time(self, service, url, status=None):
if "canvas" == service:
return FO... | apache-2.0 | Python |
05ab8c591f487aec84b68832393cd2fdca68ef38 | Implement secure RBAC for auto_allocated_topology API | mahak/neutron,openstack/neutron,mahak/neutron,mahak/neutron,openstack/neutron,openstack/neutron | neutron/conf/policies/auto_allocated_topology.py | neutron/conf/policies/auto_allocated_topology.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 u... | # 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 u... | apache-2.0 | Python |
b5e4d0c42947260bcc6e2e033f6a6dd294edfa39 | Use snake_case for final PDF and folder name | Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export | create_books.py | create_books.py | """Creates a PDF from an article of the project „Mathe für Nicht-Freaks“."""
import os
import shelve
import requests
from mfnf.api import HTTPMediaWikiAPI
from mfnf.parser import ArticleParser
from mfnf.utils import CachedFunction
from mfnf.sitemap import parse_sitemap
from mfnf.latex import LatexExporter, MediaWiki... | """Creates a PDF from an article of the project „Mathe für Nicht-Freaks“."""
import os
import shelve
import requests
from mfnf.api import HTTPMediaWikiAPI
from mfnf.parser import ArticleParser
from mfnf.utils import CachedFunction
from mfnf.sitemap import parse_sitemap
from mfnf.latex import LatexExporter, MediaWiki... | apache-2.0 | Python |
4b3e1a1fa2dadcccd65d974a27c72169a68c6a61 | Add subtraction and scalar multiplication tests for Terrain | jackromo/RandTerrainPy | tests/test_terrain.py | tests/test_terrain.py | import unittest
from randterrainpy import *
class TerrainTesterPy(unittest.TestCase):
def setUp(self):
self.ter1 = Terrain(1, 1)
self.ter2 = Terrain(2, 4)
self.ter3 = Terrain(1, 1)
def test_getitem(self):
self.assertEqual(self.ter1[0, 0], 0)
self.assertEqual(self.ter2... | import unittest
from randterrainpy import *
class TerrainTesterPy(unittest.TestCase):
def setUp(self):
self.ter1 = Terrain(1, 1)
self.ter2 = Terrain(2, 4)
self.ter3 = Terrain(1, 1)
def test_getitem(self):
self.assertEqual(self.ter1[0, 0], 0)
self.assertEqual(self.ter2... | mit | Python |
5d082a9178ae70a3f1adca07e1ef9263a15ee1e3 | Fix default alarm_state_history_driver value | openstack/monasca-persister,openstack/monasca-persister,stackforge/monasca-persister,stackforge/monasca-persister,openstack/monasca-persister,stackforge/monasca-persister | monasca_persister/conf/repositories.py | monasca_persister/conf/repositories.py | # (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | # (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | apache-2.0 | Python |
9c02cfa250b0aa8f867d136cc57d405a7d4f3ec0 | check if website is not None | gdesmott/manger-veggie,gdesmott/manger-veggie,gdesmott/manger-veggie,gdesmott/manger-veggie | restaurant/management/commands/populate.py | restaurant/management/commands/populate.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
#from optparse import make_option
from restaurant.models import Restaurant
from geopy.geocoders import Nominatim
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
)
def create_restaurant(self, name, address, w... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
#from optparse import make_option
from restaurant.models import Restaurant
from geopy.geocoders import Nominatim
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
)
def create_restaurant(self, name, address, w... | agpl-3.0 | Python |
2ab3a73124685565877d4755056dced391305216 | Fix multichan | Flat/JiyuuBot,Zaexu/JiyuuBot | modules/multichan.py | modules/multichan.py | @self.command(help="Displays channels being served")
def chans(self, msginfo):
tosend = ", ".join(self.conman.instances["irc"].joined_chans)
tosend = "%s channels currently served by %s: %s" % (len(self.conman.instances["irc"].joined_chans), self.glob_confman.get("IRC", "NICK"), tosend)
self.conman.gen_send... | @self.command(help="Displays channels being served")
def chans(self, msginfo):
tosend = ", ".join(self.conman.instances["irc"].joined_chans)
tosend = "%s channels currently served by %s: %s" % (len(self.conman.instances["irc"].joined_chans), self.glob_confman.get("IRC", "NICK"), tosend)
self.conman.gen_send... | agpl-3.0 | Python |
3f6713a7367e2f14fc900e5c100d62e049dfeace | Update easynetwork_example.py | Idrias/easynet | easynet/easynetwork_example.py | easynet/easynetwork_example.py | #!/usr/bin/python3
import easynet.easyclient as easyclient
import easynet.easyserver as easyserver
import time
myserver = easyserver.Server("localhost", 1337)
myserver.start()
myclient = easyclient.Client("localhost", 1336, "localhost", 1337)
myclient.start()
time.sleep(0.1)
myclient.send(b'Hello Server!')
myserve... | #!/usr/bin/python3
import easyclient as easyclient # when easyclient is in same folder, otherwise import easynet.easyclient as easyclient
import easyserver as easyserver # same as above
import time
myserver = easyserver.Server("localhost", 1337)
myserver.start()
myclient = easyclient.Client("localhost", 1336, "local... | mit | Python |
39d0c69745c1d2811992712ad4174409d296cb52 | Use --no-patch with "git show" | google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Ti... | slave/skia_slave_scripts/run_bench.py | slave/skia_slave_scripts/run_bench.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia benchmarking executable. """
from build_step import BuildStep
from utils import shell_utils
import os
import re
i... | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia benchmarking executable. """
from build_step import BuildStep
from utils import shell_utils
import os
import re
i... | bsd-3-clause | Python |
c983a2de4c223d9f6ac78d4a0a3e14a6b6a90756 | fix in DirectorDistance example | lisitsyn/shogun,Saurabh7/shogun,geektoni/shogun,Saurabh7/shogun,shogun-toolbox/shogun,sorig/shogun,karlnapf/shogun,lisitsyn/shogun,lisitsyn/shogun,karlnapf/shogun,Saurabh7/shogun,besser82/shogun,besser82/shogun,shogun-toolbox/shogun,shogun-toolbox/shogun,geektoni/shogun,shogun-toolbox/shogun,lambday/shogun,lambday/shog... | examples/undocumented/python_modular/distance_director_euclidian_modular.py | examples/undocumented/python_modular/distance_director_euclidian_modular.py | import numpy
from shogun.Features import RealFeatures
try:
from shogun.Distance import DirectorDistance
except ImportError:
print "recompile shogun with --enable-swig-directors"
import sys
sys.exit(0)
class DirectorEuclidianDistance(DirectorDistance):
def __init__(self):
DirectorDistance.__init__(self, True)
... | import numpy
try:
from shogun.Distance import DirectorDistance
except ImportError:
print "recompile shogun with --enable-swig-directors"
import sys
sys.exit(0)
class DirectorEuclidianDistance(DirectorDistance):
def __init__(self):
DirectorDistance.__init__(self, True)
def distance_function(self, idx_a, idx_b)... | bsd-3-clause | Python |
f0c374eba55cdeb56bf3526ea0da041556f6ffe2 | Fix tests on python 3 | sciyoshi/yamlmod | tests/test_yamlmod.py | tests/test_yamlmod.py | import os
import sys
from nose.tools import *
try:
from importlib import reload
except ImportError:
pass
def setup_yamlmod():
import yamlmod
reload(yamlmod)
def teardown_yamlmod():
import yamlmod
for hook in sys.meta_path:
if isinstance(hook, yamlmod.YamlImportHook):
sys.meta_path.remove(hook)
break
... | import os
import sys
from nose.tools import *
def setup_yamlmod():
import yamlmod
reload(yamlmod)
def teardown_yamlmod():
import yamlmod
for hook in sys.meta_path:
if isinstance(hook, yamlmod.YamlImportHook):
sys.meta_path.remove(hook)
break
@with_setup(setup_yamlmod, teardown_yamlmod)
def test_import_... | mit | Python |
87791c10f9063c48dc238ba8561bcc83d865cd0d | Use optional arg for vimtips | JokerQyou/bot | botcommands/vimtips.py | botcommands/vimtips.py | # coding: utf-8
import requests
def vimtips(msg=None):
try:
tip = requests.get('http://vim-tips.com/random_tips/json').json()
except Exception as e:
return None
return u'%s\n%s' % (tip['Content'], tip['Comment'], )
| # coding: utf-8
import requests
def vimtips(msg):
try:
tip = requests.get('http://vim-tips.com/random_tips/json').json()
except Exception as e:
return None
return u'%s\n%s' % (tip['Content'], tip['Comment'], )
| bsd-2-clause | Python |
cfdf3ed724b40d69e6bfce47a66f40249240c129 | make tmpdir if it doesn't exist | vpsfreecz/brutus,vpsfreecz/brutus,vpsfreecz/brutus | tests/testgenerate.py | tests/testgenerate.py | #!/usr/bin/python
import os, shutil, subprocess
import yaml
from brutus.db import Database
from brutus.generate import generate_all
tmpdir = "tmp"
filename = os.path.join(tmpdir, "test.pickle")
rootdir = os.path.join(tmpdir, "output")
def cleanup():
try:
os.remove(filename)
except FileNotFoundError... | #!/usr/bin/python
import os, shutil, subprocess
import yaml
from brutus.db import Database
from brutus.generate import generate_all
tmpdir = "tmp"
filename = os.path.join(tmpdir, "test.pickle")
rootdir = os.path.join(tmpdir, "output")
def cleanup():
try:
os.remove(filename)
except FileNotFoundError:... | bsd-2-clause | Python |
3c4e407430297ab5c011d67db2e2d6ad660d7c0c | Fix a typo in the instructions. | newrelic/newrelic-python-kata,newrelic/newrelic-python-kata,tebriel/newrelic-python-kata,newrelic/newrelic-python-kata,tebriel/newrelic-python-kata,tebriel/newrelic-python-kata | initialize_db.py | initialize_db.py | from random import randint
from os import environ
import requests
def setup_postgression():
url = 'http://api.postgression.com'
db_url = requests.get(url).text
with open('db_url.txt', 'w') as f:
f.write(db_url)
def run_django_commands(*args):
environ.setdefault("DJANGO_SETTINGS_MODULE", "ne... | from random import randint
from os import environ
import requests
def setup_postgression():
url = 'http://api.postgression.com'
db_url = requests.get(url).text
with open('db_url.txt', 'w') as f:
f.write(db_url)
def run_django_commands(*args):
environ.setdefault("DJANGO_SETTINGS_MODULE", "ne... | mit | Python |
8880aff128c1e430ee62691de3492fc5f65d6877 | fix bug | FederatedAI/FATE,FederatedAI/FATE,FederatedAI/FATE | python/federatedml/framework/homo/blocks/base.py | python/federatedml/framework/homo/blocks/base.py | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
9d5bf8b31b3de277422af5a294a6aca50f1eb2cc | Fix examples/print_request.py | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | python/g1/http/servers/examples/print_request.py | python/g1/http/servers/examples/print_request.py | """Simple web app that prints out requests."""
import json
from startup import startup
import g1.asyncs.agents.parts
import g1.http.servers.parts
from g1.apps import asyncs
from g1.asyncs import kernels
LABELS = g1.http.servers.parts.define_server(
host='127.0.0.1',
port=8000,
reuse_address=True,
re... | """Simple web app that prints out requests."""
import json
from startup import startup
import g1.asyncs.agents.parts
import g1.http.servers.parts
from g1.apps import asyncs
from g1.asyncs import kernels
LABELS = g1.http.servers.parts.define_server(
host='127.0.0.1',
port=8000,
reuse_address=True,
re... | mit | Python |
3b7d1424da0e3ea7d9df928ab73d1b76f370acb0 | remove benchmarks | aaronkl/RoBO,automl/RoBO,aaronkl/RoBO,aaronkl/RoBO,numairmansur/RoBO,numairmansur/RoBO,automl/RoBO | robo/test/test_task_branin.py | robo/test/test_task_branin.py | '''
Created on 14.07.2015
@author: aaron
'''
import unittest
import numpy as np
from robo.task.branin import Branin
class TestTaskBranin(unittest.TestCase):
def test_branin(self):
branin = Branin()
# Check batch computation
n_points = 10
X = np.random.rand(n_points, branin.n_dim... | '''
Created on 14.07.2015
@author: aaron
'''
import unittest
import numpy as np
from robo.task.branin import Branin
class TestTaskBranin(unittest.TestCase):
def test_branin(self):
branin = Branin()
# Check batch computation
n_points = 10
X = np.random.rand(n_points, branin.n_dim... | bsd-3-clause | Python |
f365d0804b516ced454ad4cd7d0119d83adea98d | Add CLI help and command to print README. | mjrusso/mountain | mountain/mountain.py | mountain/mountain.py | # -*- coding: utf-8 -*-
__version__ = "0.1.0"
import sys
from .join import expand_manifest
from .split import split_combined_document
from .utils import write_files
def join(manifest_path, combined_document_path):
print("Reading manifest from `%s`." % manifest_path)
write_files(expand_manifest(manifest_pa... | # -*- coding: utf-8 -*-
__version__ = "0.1.0"
import sys
from .join import expand_manifest
from .split import split_combined_document
from .utils import write_files
def join(manifest_path, combined_document_path):
print("Reading manifest from `%s`." % manifest_path)
write_files(expand_manifest(manifest_pa... | mit | Python |
f0ecbfbc5e0fb10a48c122f81ce61d4b16893448 | use transforms in grid script benchmark | OEP/volpy,OEP/volpy | benchmarks/grid.py | benchmarks/grid.py | import numpy as np
import volpy
from libbenchmark import render, get_parser
import math
def main():
parser = _get_parser()
args = parser.parse_args()
transform = np.eye(4)
if args.rotate:
args.rotate = np.array(args.rotate) * math.pi / 180
transform = volpy.rotatexyz(*args.rotate).do... | import numpy as np
import volpy
from libbenchmark import render, get_parser
def main():
parser = _get_parser()
args = parser.parse_args()
grid = volpy.Grid(np.ones(args.grid_shape), default=args.default)
scene = volpy.Scene(emit=grid, scatter=args.scatter)
image = render(scene, args)
image.sa... | mit | Python |
ecfc74bfc93ddea277105fd2386d64ffe751c819 | Fix `series_list` in `user_page` not being populated properly | wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp | cogs/routes/user_page.py | cogs/routes/user_page.py | """
Copyright (c) 2017 Genome Research Ltd.
Authors:
* Simon Beal <sb48@sanger.ac.uk>
* Christopher Harrison <ch12@sanger.ac.uk>
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... | """
Copyright (c) 2017 Genome Research Ltd.
Authors:
* Simon Beal <sb48@sanger.ac.uk>
* Christopher Harrison <ch12@sanger.ac.uk>
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... | agpl-3.0 | Python |
931a858dc1cfde1652d21e1ccd60a82dde683ce3 | Add simple "yo" bot command | paultag/moxie,loandy/moxie,mileswwatkins/moxie,mileswwatkins/moxie,paultag/moxie,loandy/moxie,loandy/moxie,paultag/moxie,rshorey/moxie,rshorey/moxie,rshorey/moxie,mileswwatkins/moxie | moxie/butterfield.py | moxie/butterfield.py | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import Service
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
@asyncio.coroutine
def events(bot):
docker = Docker()
events = docker.events
events.saferun()
stream... | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import Service
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
@asyncio.coroutine
def events(bot):
docker = Docker()
events = docker.events
events.saferun()
stream... | mit | Python |
c8d66eb6a9d624cfb321b34abd9ec778d52d3266 | Fix copy for python2 | rparini/cxroots,rparini/cxroots | cxroots/Misc.py | cxroots/Misc.py | from numpydoc.docscrape import FunctionDoc
def remove_para(*paras):
def wrapper(func):
doc = FunctionDoc(func)
for i, p in enumerate(doc['Parameters'][:]):
if p.name.split(':')[0].rstrip() in paras:
del doc['Parameters'][i]
func.__doc__ = doc
return func... | from numpydoc.docscrape import FunctionDoc
def remove_para(*paras):
def wrapper(func):
doc = FunctionDoc(func)
for i, p in enumerate(doc['Parameters'].copy()):
if p.name.split(':')[0].rstrip() in paras:
del doc['Parameters'][i]
func.__doc__ = doc
return ... | bsd-3-clause | Python |
2b8f025e94e593fc4d8cdaafb2b1344a9ea82a1a | allow continues reading and check if tag changes | thedarkman/ttleagueterminal,thedarkman/ttleagueterminal | terminal.py | terminal.py | #!/usr/bin/python
from TTLeague import Match, Game, Player
import RPi.GPIO as GPIO
import MFRC522
import signal
import json
import requests
from time import sleep
# init empty configuration
config = {}
try:
# try to load config from file
config = json.load(open('config.json'))
except Exception, e:
print("E... | from TTLeague import Match, Game, Player
import RPi.GPIO as GPIO
import MFRC522
import signal
import json
import requests
from time import sleep
# init empty configuration
config = {}
try:
# try to load config from file
config = json.load(open('config.json'))
except Exception, e:
print("Error while getting ... | mit | Python |
fe5e86254a1e2a2e8838988210531fc30467ee7f | Add further information to absorption correction cif | xia2/i19 | command_line/write_absorption_correction_cif.py | command_line/write_absorption_correction_cif.py | from __future__ import division
import datetime
import iotbx.cif.model
import os
import re
def find_scale_dir():
assert os.path.exists('xia2.json')
from xia2.Schema.XProject import XProject
xinfo = XProject.from_json(filename='xia2.json')
crystals = xinfo.get_crystals()
assert len(crystals) == 1
crystal = ... | from __future__ import division
import datetime
import iotbx.cif.model
import os
import xia2.XIA2Version
def find_scale_dir():
assert os.path.exists('xia2.json')
from xia2.Schema.XProject import XProject
xinfo = XProject.from_json(filename='xia2.json')
crystals = xinfo.get_crystals()
assert len(crystals) == ... | bsd-3-clause | Python |
fa6edcb1ad04ca0ff698da8fa4965ea02915758e | Fix the name of CHANGES.txt | larsbutler/coveragepy,hugovk/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,larsbutler/coveragepy,nedbat/coveragepy,7WebPages/coveragepy,blueyed/coveragepy,blueyed/coveragepy,blueyed/coveragepy,hugovk/coveragepy,jayhetee/coveragepy,7WebPages/coveragepy,hugovk/coveragepy,hugovk/coveragepy,larsbutler/coveragepy,blueyed... | coverage/__init__.py | coverage/__init__.py | """Code coverage measurement for Python.
Ned Batchelder
http://nedbatchelder.com/code/coverage
"""
__version__ = "3.0.1" # see detailed history in CHANGES.txt
from coverage.control import coverage
from coverage.data import CoverageData
from coverage.cmdline import main, CoverageScript
from coverage.misc import C... | """Code coverage measurement for Python.
Ned Batchelder
http://nedbatchelder.com/code/coverage
"""
__version__ = "3.0.1" # see detailed history in CHANGES
from coverage.control import coverage
from coverage.data import CoverageData
from coverage.cmdline import main, CoverageScript
from coverage.misc import Cover... | apache-2.0 | Python |
8c6c96d5a0cdeadb59e6f6ab8649f1dbc1fc12b7 | delete multiple sites at once | appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform | openedx/core/djangoapps/appsembler/sites/management/commands/remove_site.py | openedx/core/djangoapps/appsembler/sites/management/commands/remove_site.py | import traceback
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from django.db import transaction
from openedx.core.djangoapps.appsembler.sites.utils import delete_site
class Command(BaseCommand):
"""
Remove a Tahoe website from LMS records.
Must be use... | from django.core.management.base import BaseCommand, CommandError
from django.contrib.sites.models import Site
from django.db import transaction
from openedx.core.djangoapps.appsembler.sites.utils import delete_site
class Command(BaseCommand):
"""
Remove a Tahoe website from LMS records.
Must be used `r... | agpl-3.0 | Python |
69baf66b13331d5936e8c540a2bb7eccb1d64cb7 | Add view for user to download invoice | Chris7/django-invoice,Chris7/django-invoice,simonluijk/django-invoice | invoice/views.py | invoice/views.py | from django.shortcuts import get_object_or_404
from invoice.models import Invoice
from invoice.pdf import draw_pdf
from invoice.utils import pdf_response
def pdf_view(request, pk):
invoice = get_object_or_404(Invoice, pk=pk)
return pdf_response(draw_pdf, invoice.file_name(), invoice)
def pdf_user_view(reque... | from django.shortcuts import get_object_or_404
from invoice.models import Invoice
from invoice.pdf import draw_pdf
from invoice.utils import pdf_response
def pdf_view(request, pk):
invoice = get_object_or_404(Invoice, pk=pk)
return pdf_response(draw_pdf, invoice.file_name(), invoice)
| bsd-3-clause | Python |
c3abd04da6c4ecc5d9464261c5c30d3eb527b04f | Bump version number | hugovk/coveragepy,larsbutler/coveragepy,blueyed/coveragepy,7WebPages/coveragepy,hugovk/coveragepy,larsbutler/coveragepy,nedbat/coveragepy,hugovk/coveragepy,7WebPages/coveragepy,hugovk/coveragepy,blueyed/coveragepy,jayhetee/coveragepy,nedbat/coveragepy,larsbutler/coveragepy,blueyed/coveragepy,jayhetee/coveragepy,jayhete... | coverage/__init__.py | coverage/__init__.py | """Code coverage measurement for Python.
Ned Batchelder
http://nedbatchelder.com/code/coverage
"""
__version__ = "3.3.2a1" # see detailed history in CHANGES.txt
__url__ = "http://nedbatchelder.com/code/coverage"
from coverage.control import coverage, process_startup
from coverage.data import CoverageData
from c... | """Code coverage measurement for Python.
Ned Batchelder
http://nedbatchelder.com/code/coverage
"""
__version__ = "3.3.1" # see detailed history in CHANGES.txt
__url__ = "http://nedbatchelder.com/code/coverage"
from coverage.control import coverage, process_startup
from coverage.data import CoverageData
from cov... | apache-2.0 | Python |
6b090757799b6c5928b5cf9c0722d870ff822205 | Fix poorly written sentence | alphagov/notifications-api,alphagov/notifications-api | app/v2/template/post_template.py | app/v2/template/post_template.py | from flask import jsonify, request
from app import authenticated_service
from app.dao import templates_dao
from app.schema_validation import validate
from app.utils import get_template_instance
from app.v2.errors import BadRequestError
from app.v2.template import v2_template_blueprint
from app.v2.template.template_sch... | from flask import jsonify, request
from app import authenticated_service
from app.dao import templates_dao
from app.schema_validation import validate
from app.utils import get_template_instance
from app.v2.errors import BadRequestError
from app.v2.template import v2_template_blueprint
from app.v2.template.template_sch... | mit | Python |
6d51b0aa6e18d0cd99485861d60a7f20f40cb97a | tweak osm import query | cubgs53/usaddress,frankleng/usaddress,ahlusar1989/probablepeople,markbaas/usaddress,yl2695/usaddress | training/import_osm.py | training/import_osm.py | import requests
import codecs
query1 = """<union>
<query type="way">
<has-kv k="addr:full"/>
<has-kv k="addr:city"/>
<has-kv k="addr:street"/>
<bbox-query e="%s" n="%s" s="%s" w="%s"/>
</query>
<query type="node">
<has-kv k="addr:full"/>
<has-kv k="addr:city"/>
<has-kv k="addr:street"/>
<bbox-query... | import requests
import codecs
query1 = """<union>
<query type="way">
<has-kv k="addr:full"/>
<has-kv k="addr:city"/>
<has-kv k="addr:street"/>
<bbox-query e="%s" n="%s" s="%s" w="%s"/>
</query>
<query type="node">
<has-kv k="addr:full"/>
<has-kv k="addr:city"/>
<has-kv k="addr:street"/>
<bbox-query... | mit | Python |
9de3e898b0ce1d8970052d2052e4215bc2f12491 | bump version to 2.11 | romonzaman/newfies-dialer,Star2Billing/newfies-dialer,Star2Billing/newfies-dialer,romonzaman/newfies-dialer,Star2Billing/newfies-dialer,saydulk/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,saydulk/newfies-dialer,romonzaman/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,Star2B... | newfies/newfies_dialer/__init__.py | newfies/newfies_dialer/__init__.py | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Bi... | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Bi... | mpl-2.0 | Python |
014cb038b8e3a22c90864c842d2c049d3e9637d4 | Use recipe bootstrap | CoherentLabs/depot_tools,CoherentLabs/depot_tools | tests/recipes_test.py | tests/recipes_test.py | #!/usr/bin/env python
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs simulation tests and lint on the recipes."""
import os
import subprocess
ROOT_DIR = os.path.dirname(os.path.dirname(os.p... | #!/usr/bin/env python
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs simulation tests and lint on the recipes."""
import os
import subprocess
ROOT_DIR = os.path.dirname(os.path.dirname(os.p... | bsd-3-clause | Python |
b2371e4a19930ec32c0b212798203142c7c69f74 | Update fields.py | oscarmcm/django-places,oscarmcm/django-places,oscarmcm/django-places | places/fields.py | places/fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
from django.db import models
from django.utils.six import with_metaclass
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from . import Places
from .forms import PlacesField... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
from django.db import models
from django.utils.six import with_metaclass
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from . import Places
from .forms import PlacesField... | mit | Python |
94f795dbbac32cbe1c83da1fb3cd3e55fdceef11 | Test de pycharm par Simon. | adrien-bellaiche/ia-cdf-rob-2015 | testFile.py | testFile.py | __author__ = 'adrie_000'
import numpy as np
import numpy.matrixlib as nm
'test'
p = nm.matrix([[3, 3, 3], [3, 5, 7]])
q = p - p.mean(1)
print q
r = [np.array([q.getA()[0][k], q.getA()[1][k]]) for k in range(q.shape[1])]
print r
d = [np.linalg.norm(w) for w in r]
print d | __author__ = 'adrie_000'
import numpy as np
import numpy.matrixlib as nm
p = nm.matrix([[3, 3, 3], [3, 5, 7]])
q = p - p.mean(1)
print q
r = [np.array([q.getA()[0][k], q.getA()[1][k]]) for k in range(q.shape[1])]
print r
d = [np.linalg.norm(w) for w in r]
print d | apache-2.0 | Python |
1bf981bd62d56e608cea8e7f0f0132af8cf25b70 | Fix NXOS tests to allow mocked data to raise | spotify/napalm,napalm-automation/napalm,spotify/napalm | test/nxos/conftest.py | test/nxos/conftest.py | """Test fixtures."""
from builtins import super
import pytest
from napalm.base.mock import raise_exception
from napalm.base.test import conftest as parent_conftest
from napalm.base.test.double import BaseTestDouble
from napalm.nxos import nxos
@pytest.fixture(scope="class")
def set_device_parameters(request):
""... | """Test fixtures."""
from builtins import super
import pytest
from napalm.base.test import conftest as parent_conftest
from napalm.base.test.double import BaseTestDouble
from napalm.nxos import nxos
@pytest.fixture(scope="class")
def set_device_parameters(request):
"""Set up the class."""
def fin():
... | apache-2.0 | Python |
3d25ebd40d55925c3b0c03454fc8543cd5e39ac9 | update import script for Salford (closes #1162) | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_salford.py | polling_stations/apps/data_collection/management/commands/import_salford.py | from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 4326
districts_srid = 4326
council_id = 'E08000006'
elections = ['local.2018-05-03']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Salford'
geom_type = 'geojson'
def district_recor... | from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 4326
districts_srid = 4326
council_id = 'E08000006'
elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Salford'
geom_type = 'geojson'
def district_record... | bsd-3-clause | Python |
1f7e355a3a325284c912265ce178d15129555375 | Add a news model | bm424/churchmanager,bm424/churchmanager | models.py | models.py | import urllib
from django.db import models
from django.core.validators import RegexValidator
from django.utils.text import slugify
from image_cropping import ImageRatioField
class Church(models.Model):
class Meta:
verbose_name_plural = "Churches"
ordering = ['name']
name = models.CharField(m... | import urllib
from django.db import models
from django.core.validators import RegexValidator
from django.utils.text import slugify
from image_cropping import ImageRatioField
class Church(models.Model):
class Meta:
verbose_name_plural = "Churches"
ordering = ['name']
name = models.CharField(m... | mit | Python |
dd3a8cddc1ca7efe09bb9887a5fdc6b9b989b734 | Bump version for pypi to 0.2018.07.04.1917 | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2018.07.04.1917'
| __version__ = '0.2018.07.04.1637'
| mit | Python |
013048e1d68174e71d4579e28efd0339144ce186 | Make function! and Use 4 tabs, not 8 tabs. | Yokan-Study/study,Yokan-Study/study,Yokan-Study/study | 2017/11.07/python/jya_homework2.py | 2017/11.07/python/jya_homework2.py | ```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
```
**Make function!**
`like:`
```python
def sum(number):
# .. TODO
return 0
```
`I want to reuse this function, like:`
```python
one_to_ten = sum(range(1,11))
one_to_five = sum(ra... | ```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
``` | mit | Python |
eb121b797e803be295fb2abeef91ebcdab2e75cf | Normalize data | alexey-ernest/ml-for-trading | plot_multiple.py | plot_multiple.py |
import os
import pandas as pd
import matplotlib.pyplot as plt
def symbol_to_path(symbol, base_dir="data"):
"""Return CSV file path given ticker symbol."""
return os.path.join(base_dir, "{}.csv".format(str(symbol)))
def get_data(symbols, dates):
"""Read stock data (adjusted close) for given symbols from ... |
import os
import pandas as pd
import matplotlib.pyplot as plt
def symbol_to_path(symbol, base_dir="data"):
"""Return CSV file path given ticker symbol."""
return os.path.join(base_dir, "{}.csv".format(str(symbol)))
def get_data(symbols, dates):
"""Read stock data (adjusted close) for given symbols from ... | mit | Python |
f81680a0bfe04b9e38fda53038e00346246bb1eb | make test more portable | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint_test/resttest/apitest/sitetest.py | mint_test/resttest/apitest/sitetest.py | #!/usr/bin/python
#
# Copyright (c) 2009 rPath, Inc.
#
# All Rights Reserved
#
import testsetup
import os
import re
import time
from conary import conaryclient
from conary import constants as conaryConstants
from conary.lib import util
from mint import buildtypes
from mint import constants
from rpath_proddef import... | #!/usr/bin/python
#
# Copyright (c) 2009 rPath, Inc.
#
# All Rights Reserved
#
import testsetup
import os
import re
import time
from conary import conaryclient
from conary import constants as conaryConstants
from conary.lib import util
from mint import buildtypes
from mint import constants
import restbase
from rest... | apache-2.0 | Python |
a2b1addd08c82162d7554aff2636d370cee68922 | Update 0008.py | 12wang3/python,fairyzoro/python,EricSekyere/python,haiyangd/python-show-me-the-code-,fairyzoro/python,yangzilong1986/python,Show-Me-the-Code/python,YGIronMan/python,starlightme/python,snailwalker/python,Show-Me-the-Code/python,snailwalker/python,hooting/show-me-the-code-python,fairyzoro/python,DIYgod/python,merfii/Pyth... | renzongxian/0008/0008.py | renzongxian/0008/0008.py | # Source:https://github.com/Show-Me-the-Code/show-me-the-code
# Author:renzongxian
# Date:2014-12-20
# Python 3.4
"""
第 0008 题:一个HTML文件,找出里面的正文。
"""
import urllib.request
import re
def get_body(url):
html_content = urllib.request.urlopen(url).read()
r = re.compile('<p>(?:<.[^>]*>)?(.*?)(?:<.[^>]*>)?</p>')... | # Source:https://github.com/Show-Me-the-Code/show-me-the-code
# Author:renzongxian
# Date:2014-12-20
# Python 3.4
"""
第 0008 题:一个HTML文件,找出里面的正文。
"""
import urllib.request
import re
def get_body(url):
html_content = urllib.request.urlopen(url).read()
r = re.compile('<p>(?:<.[^>]*>)?(.*?)(?:<.[^>]*>)?</p>')... | mit | Python |
c32e163e3a5ea5ed9f8b3c95df7ad94c7c90bf80 | add missing import | AngelTsanev/AntColony | lib/simulator.py | lib/simulator.py | from rgbmatrix import RGBMatrix
from rgbmatrix import graphics
from field import Field
from color import Color
from ant import Ant
import time
Matrix = RGBMatrix(32, 2, 1)
Matrix.pwmBits = 11
Matrix.brightness = 50
def colorize(foods, base, ants):
for food in foods:
Matrix.SetPixel(food[0],... | from rgbmatrix import RGBMatrix
from rgbmatrix import graphics
from field import Field
from color import Color
from ant import Ant
Matrix = RGBMatrix(32, 2, 1)
Matrix.pwmBits = 11
Matrix.brightness = 50
def colorize(foods, base, ants):
for food in foods:
Matrix.SetPixel(food[0], food[1], 0, ... | mit | Python |
59f6a67dd7457da92f0ab1ff8a78e672dfdb1bdc | Remove help from `argparse` to use as parent. | DerWeh/pyplot | plotter/plotn.py | plotter/plotn.py | """existing plotting script to test with."""
import argparse
def parse_arguments():
print __doc__
parser = argparse.ArgumentParser(description=__doc__.split('\n',1)[0],add_help=False)
parser.add_argument('-s', '--start', action='store', type=int, default=0,
help='the number of the f... | """existing plotting script to test with."""
import argparse
def parse_arguments():
print __doc__
parser = argparse.ArgumentParser(description=__doc__.split('\n',1)[0])
parser.add_argument('-s', '--start', action='store', type=int, default=0,
help='the number of the first iteration ... | mit | Python |
ab2e26f388e174d7d66ba659430f7b772e5c2199 | Update dump_ast.py | sztomi/code-generator,rashadkm/code-generator,sztomi/code-generator,sztomi/code-generator,rashadkm/code-generator,rashadkm/code-generator | src/dump_ast.py | src/dump_ast.py | #!/usr/bin/python
# vim: set fileencoding=utf-8
import clang.cindex
import asciitree # must be version 0.2
import sys
def node_children(node):
return (c for c in node.get_children() if c.location.file.name == sys.argv[1])
def print_node(node):
text = node.spelling or node.displayname
kind = str(node.kind)... | #!/usr/bin/python
# vim: set fileencoding=utf-8
import clang.cindex
import asciitree
import sys
def node_children(node):
return (c for c in node.get_children() if c.location.file.name == sys.argv[1])
def print_node(node):
text = node.spelling or node.displayname
kind = str(node.kind)[str(node.kind).index(... | mit | Python |
84d734fe0df15c9968222346b13c6f06530a96b6 | fix command line argument parsing test | itoed/fabric,qinrong/fabric,fernandezcuesta/fabric,rodrigc/fabric,sdelements/fabric,TarasRudnyk/fabric,ploxiln/fabric,pashinin/fabric,pgroudas/fabric,bitprophet/fabric,felix-d/fabric,bspink/fabric,tekapo/fabric,bitmonk/fabric,MjAbuz/fabric,rane-hs/fabric-py3,elijah513/fabric,getsentry/fabric,kmonsoor/fabric,rbramwell/f... | test/test_plumbing.py | test/test_plumbing.py | def setUp(self):
pass
def test_cli_arg_parsing(self):
tests = [
("abc", ("abc", [], {}, [])),
("ab:c", ("ab", ['c'], {}, [])),
("a:b=c", ('a', [], {'b':'c'}, [])),
("a:b=c,d", ('a', ['d'], {'b':'c'}, [])),
("a:b=c,d=e", ('a', [], {'b':'c','d':'e'}, [])),
]
for cli... | def setUp(self):
pass
def test_cli_arg_parsing(self):
tests = [
("abc", ("abc", [], {})),
("ab:c", ("ab", ['c'], {})),
("a:b=c", ('a', [], {'b':'c'})),
("a:b=c,d", ('a', ['d'], {'b':'c'})),
("a:b=c,d=e", ('a', [], {'b':'c','d':'e'})),
]
for cli, output in tests:
... | bsd-2-clause | Python |
29d3aa6bf6a7a670b24ff423cb687a0c6d862208 | Remove outdated comment | springload/draftjs_exporter,springload/draftjs_exporter,springload/draftjs_exporter | tests/test_exports.py | tests/test_exports.py | from __future__ import absolute_import, unicode_literals
import json
import os
import unittest
from draftjs_exporter.constants import BLOCK_TYPES, ENTITY_TYPES, INLINE_STYLES
from draftjs_exporter.defaults import BLOCK_MAP
from draftjs_exporter.html import HTML
from tests.test_entities import Image, Link
fixtures_pa... | from __future__ import absolute_import, unicode_literals
import json
import os
import unittest
from draftjs_exporter.constants import BLOCK_TYPES, ENTITY_TYPES, INLINE_STYLES
from draftjs_exporter.defaults import BLOCK_MAP
from draftjs_exporter.html import HTML
from tests.test_entities import Image, Link
fixtures_pa... | mit | Python |
da954862019e3f836952d746b04bbb1f7d3035bc | update version to 0.7.1 | Widukind/dlstats,Widukind/dlstats | dlstats/version.py | dlstats/version.py | VERSION = (0, 7, 1)
def version_str():
if len(VERSION) == 3:
return "%s.%s.%s" % VERSION
elif len(VERSION) == 4:
return "%s.%s.%s-%s" % VERSION
else:
raise IndexError("Incorrect format for the VERSION tuple")
| VERSION = (0, 7, 0)
def version_str():
if len(VERSION) == 3:
return "%s.%s.%s" % VERSION
elif len(VERSION) == 4:
return "%s.%s.%s-%s" % VERSION
else:
raise IndexError("Incorrect format for the VERSION tuple")
| agpl-3.0 | Python |
440d1e5a578dc79e55d4bd3b399134948650beb9 | test errors | scrapinghub/extruct | tests/test_extruct.py | tests/test_extruct.py | # -*- coding: utf-8 -*-
import json
import unittest
import pytest
import extruct
from tests import get_testdata, jsonize_dict, replace_node_ref_with_node_id
class TestGeneric(unittest.TestCase):
maxDiff = None
def test_all(self):
body = get_testdata('songkick', 'elysianfields.html')
expect... | # -*- coding: utf-8 -*-
import json
import unittest
import pytest
import extruct
from tests import get_testdata, jsonize_dict, replace_node_ref_with_node_id
class TestGeneric(unittest.TestCase):
maxDiff = None
def test_all(self):
body = get_testdata('songkick', 'elysianfields.html')
expect... | bsd-3-clause | Python |
513b5aecf1e34e775d98f12c41c9bd526a8504a5 | Improve compiler configuration in otf2 package | tmerrick1/spack,EmreAtes/spack,EmreAtes/spack,matthiasdiener/spack,iulian787/spack,lgarren/spack,TheTimmy/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,skosukhin/spack,skosukhin/spack,iulian787/spack,TheTimmy/spack,skosukhin/spack,EmreAtes/spack,tmerrick1/spack,lgarren/spack,LLNL/spack,TheTimmy/spack,EmreAte... | var/spack/packages/otf2/package.py | var/spack/packages/otf2/package.py | # FIXME: Add copyright
from spack import *
from contextlib import closing
import os
class Otf2(Package):
"""The Open Trace Format 2 is a highly scalable, memory efficient event
trace data format plus support library."""
homepage = "http://www.vi-hps.org/score-p"
url = "http://www.vi-hps.org/u... | # FIXME: Add copyright
from spack import *
import os
class Otf2(Package):
"""The Open Trace Format 2 is a highly scalable, memory efficient event
trace data format plus support library."""
homepage = "http://www.vi-hps.org/score-p"
url = "http://www.vi-hps.org/upload/packages/otf2/otf2-1.4.ta... | lgpl-2.1 | Python |
bcad44ba03708a05cfbd86608c1d52e79c1394b5 | Remove broken import | deepchem/deepchem,ktaneishi/deepchem,Agent007/deepchem,ktaneishi/deepchem,miaecle/deepchem,peastman/deepchem,lilleswing/deepchem,miaecle/deepchem,peastman/deepchem,Agent007/deepchem,Agent007/deepchem,lilleswing/deepchem,miaecle/deepchem,deepchem/deepchem,ktaneishi/deepchem,lilleswing/deepchem | deepchem/models/tf_new_models/graph_topology.py | deepchem/models/tf_new_models/graph_topology.py | """Manages Placeholders for Graph convolution networks.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import warnings
import... | """Manages Placeholders for Graph convolution networks.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import warnings
import... | mit | Python |
e9a30627897bd0eb00c10d5fe758c9673eae87fd | update function in case more than one uri present | erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,fabianvf/scrapi | scrapi/harvesters/addis_ababa.py | scrapi/harvesters/addis_ababa.py | '''
Harvester for the Addis Ababa University Institutional Repository for the SHARE project
Example API call: http://etd.aau.edu.et/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
from scrapi.base import helpers
def oai_process_uris... | '''
Harvester for the Addis Ababa University Institutional Repository for the SHARE project
Example API call: http://etd.aau.edu.et/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
from scrapi.base import helpers
def oai_process_uris... | apache-2.0 | Python |
0728964b7799845723a110328a46bc9c6d4c8614 | Fix examples/python3-urllib/run.py | ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls | examples/python3-urllib/run.py | examples/python3-urllib/run.py | import sys
import ssl
import urllib.error
import urllib.request
host = sys.argv[1]
port = sys.argv[2]
cafile = sys.argv[3] if len(sys.argv) > 3 else None
try:
urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile)
except ssl.CertificateError:
print("FAIL")
except urllib.error.URLError as exc:
... | import sys
import ssl
import urllib.error
import urllib.request
host = sys.argv[1]
port = sys.argv[2]
cafile = sys.argv[3] if len(sys.argv) > 3 else None
try:
urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile)
except urllib.error.URLError as exc:
if not isinstance(exc.reason, ssl.SSLError):... | mit | Python |
f7b351a43d99a6063c49dfdf8db60c654fd89b74 | Add django setup for some initialization | CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,felliott/scrapi,mehanig/scrapi,fabianvf/scrapi,felliott/scrapi | scrapi/processing/postgres.py | scrapi/processing/postgres.py | from __future__ import absolute_import
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webview.settings")
import django
import logging
from api.webview.models import Document
from scrapi import events
from scrapi.processing.base import BaseProcessor
django.setup()
logger = logging.getLogger(__name__)
... | from __future__ import absolute_import
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webview.settings")
import logging
from api.webview.models import Document
from scrapi import events
from scrapi.processing.base import BaseProcessor
logger = logging.getLogger(__name__)
class PostgresProcessor(BasePr... | apache-2.0 | Python |
8df261cb9183e5933f49c441f3af8940f8449059 | Improve finders code coverage, fix tests not running due to inheretince approach with __init__ | PyCQA/isort,PyCQA/isort | tests/test_finders.py | tests/test_finders.py | from unittest.mock import patch
import pytest
from isort import finders, settings
from isort.finders import FindersManager
class TestFindersManager:
def test_init(self):
assert FindersManager(settings.DEFAULT_CONFIG)
class ExceptionOnInit(finders.BaseFinder):
def __init__(*args, **k... | from unittest.mock import patch
from isort import finders, settings
from isort.finders import FindersManager
class TestFindersManager:
def test_init(self):
assert FindersManager(settings.DEFAULT_CONFIG)
class ExceptionOnInit(finders.BaseFinder):
def __init__(*args, **kwargs):
... | mit | Python |
0ea1153438c1d98232a921c8d14d401a541e95fd | Fix regex example, the model must not be a unicode string. | vmuriart/grako,frnknglrt/grako | examples/regex/regex_parser.py | examples/regex/regex_parser.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from parser_base import RegexParser
import model
class RegexSemantics(object):
def __init__(self):
super(RegexSemantics, self).__init__()
self._count = 0
def START(self, ast):
re... | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from parser_base import RegexParser
import model
class RegexSemantics(object):
def __init__(self):
super(RegexSemantics, self).__init__()
self._count = 0
def START(self, ast):
re... | bsd-2-clause | Python |
bb86870b4494d6f001d82a824f85b31de5912bd5 | Update session.py | TingPing/plugins,TingPing/plugins | HexChat/session.py | HexChat/session.py | from __future__ import print_function
import hexchat
__module_name__ = "session"
__module_author__ = "TingPing"
__module_version__ = "1"
__module_description__ = "Saves current session for next start"
# To use just disable auto-connect and start using 'Quit and Save' from the menu.
def load_session():
for pref in he... | from __future__ import print_function
import xchat as hexchat
__module_name__ = "session"
__module_author__ = "TingPing"
__module_version__ = "1"
__module_description__ = "Saves current session for next start"
# To use just disable auto-connect and start using 'Quit and Save' from the menu.
def load_session():
for p... | mit | Python |
0da74f42f7d7311859a340b0e72c1b8902287d5c | Allow for local run of example and demos installed with tool. | CERN/TIGRE,CERN/TIGRE,CERN/TIGRE,CERN/TIGRE | Python/tigre/utilities/sample_loader.py | Python/tigre/utilities/sample_loader.py | from __future__ import division
import os
import numpy as np
import scipy.io
import scipy.ndimage.interpolation
def load_head_phantom(number_of_voxels=None):
if number_of_voxels is None:
number_of_voxels = np.array((128, 128, 128))
dirname = os.path.dirname(__file__)
dirname = os.path.join(dirname... | from __future__ import division
import os
import numpy as np
import scipy.io
import scipy.ndimage.interpolation
def load_head_phantom(number_of_voxels=None):
if number_of_voxels is None:
number_of_voxels = np.array((128, 128, 128))
dirname = os.path.dirname(__file__)
dirname = os.path.join(dirname... | bsd-3-clause | Python |
eb7e89f8c4ce1ef928dafee160f28966818db669 | Add TxT import (#2643) | intel-analytics/analytics-zoo,intel-analytics/analytics-zoo,intel-analytics/analytics-zoo | pyzoo/zoo/models/recommendation/__init__.py | pyzoo/zoo/models/recommendation/__init__.py | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | apache-2.0 | Python |
cef6c095681f478ad1a04691573ec308bd15143c | fix import for HQPillow | qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,gmimano/c... | corehq/pillows/group.py | corehq/pillows/group.py | from django.conf import settings
from corehq.apps.groups.models import Group
from dimagi.utils.decorators.memoized import memoized
from pillowtop.listener import AliasedElasticPillow
from .mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING
from .base import HQPillow
class GroupPillow(HQPillow):
"""
Sim... | from corehq.apps.groups.models import Group
from corehq.pillows.mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING
from dimagi.utils.decorators.memoized import memoized
from pillowtop.listener import AliasedElasticPillow
from django.conf import settings
class GroupPillow(HQPillow):
"""
Simple/Common Cas... | bsd-3-clause | Python |
ff7ce0ca2a8019e67d512b47a4a340f176d96adf | update example to reflect current API | stscieisenhamer/glue,saimn/glue,stscieisenhamer/glue,JudoWill/glue,JudoWill/glue,saimn/glue | doc/simple_glue.py | doc/simple_glue.py | from glue.core.message import DataMessage, SubsetMessage
from glue.core import HubListener, Data, DataCollection
class MyClient(HubListener):
def register_to_hub(self, hub):
""" Sign up to receive DataMessages from the hub """
hub.subscribe(self, # subscribing object
... | from glue.core.message import DataMessage, SubsetMessage
from glue.core import Hub, HubListener, Data, DataCollection
class MyClient(HubListener):
def register_to_hub(self, hub):
""" Sign up to receive DataMessages from the hub """
hub.subscribe(self, # subscribing object
... | bsd-3-clause | Python |
52eef06d6ab50f5287949ab8b33f145a58f1cb44 | bump version 0.1.4 -> 0.1.5 | connectome-neuprint/neuprint-python,connectome-neuprint/neuprint-python | neuprint/__init__.py | neuprint/__init__.py | __version__ = (0, 1, 5)
__verstr__ = "0.1.5"
from .client import Client
from .fetch import *
| __version__ = (0, 1, 4)
__verstr__ = "0.1.4"
from .client import Client
from .fetch import *
| bsd-3-clause | Python |
7ebfd6ca59b167ae4b9cf582c20f517bd5500f24 | fix final 2.6 test issue | tmlee/pyrollbar,Affirm/pyrollbar,rollbar/pyrollbar,xbmc-catchuptv-au/script.module.rollbar,juggernaut/pyrollbar | rollbar/test/__init__.py | rollbar/test/__init__.py | import difflib
import pprint
import unittest
# from http://hg.python.org/cpython/file/67ada6ab7fe2/Lib/unittest/util.py
# for Python 2.6 support
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(res... | import difflib
import pprint
import unittest
# from http://hg.python.org/cpython/file/67ada6ab7fe2/Lib/unittest/util.py
# for Python 2.6 support
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(res... | mit | Python |
fcd85a1b15ca8b82f892bba171c21f9a1b4f6e4a | Correct URI and list categories | acigna/pywez,acigna/pywez,acigna/pywez | SOAPpy/tests/alanbushTest.py | SOAPpy/tests/alanbushTest.py | #!/usr/bin/env python
# Copyright (c) 2001 actzero, inc. All rights reserved.
import sys
sys.path.insert (1, '..')
import SOAP
ident = '$Id$'
SoapEndpointURL = 'http://www.alanbushtrust.org.uk/soap/compositions.asp'
MethodNamespaceURI = 'urn:alanbushtrust-org-uk:soap.methods'
SoapAction = MethodNamespaceURI + ... | #!/usr/bin/env python
# Copyright (c) 2001 actzero, inc. All rights reserved.
import sys
sys.path.insert (1, '..')
import SOAP
ident = '$Id$'
SoapEndpointURL = 'http://www.alanbushtrust.org.uk/soap/compositions.asp'
MethodNamespaceURI = 'urn:alanbushtrust-org-uk:soap:methods'
SoapAction = MethodNamespaceURI + ... | mit | Python |
5e2d8aad2771122da26507b67630c055e2f13de3 | make reindent. | pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments | external/markdown-processor.py | external/markdown-processor.py | # -*- coding: utf-8 -*-
"""
The Pygments Markdown Preprocessor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Markdown_ preprocessor that renders source code
to HTML via Pygments. To use it, invoke Markdown like so::
from markdown import Markdown
md = Markdown()
md.pre... | # -*- coding: utf-8 -*-
"""
The Pygments Markdown Preprocessor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Markdown_ preprocessor that renders source code
to HTML via Pygments. To use it, invoke Markdown like so::
from markdown import Markdown
md = Markdown()
md.pre... | bsd-2-clause | Python |
9eb440774a7fba22fbafcb9958a185cec8461649 | Fix #722: aggregate_coverage.py does not aggregate the coverage reports of the same tracked lines | yapdns/yapdnsbeat,yapdns/yapdnsbeat | scripts/aggregate_coverage.py | scripts/aggregate_coverage.py | #!/usr/bin/env python
"""Simple script to concatenate coverage reports.
"""
import os
import sys
import argparse
import fnmatch
def main(arguments):
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_arg... | #!/usr/bin/env python
"""Simple script to concatenate coverage reports.
"""
import os
import sys
import argparse
import fnmatch
def main(arguments):
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_arg... | mit | Python |
bc2c0395b3374c0f6abfb7bead9a9e5acd468263 | Update expedia.py | twiindan/selenium_lessons | Selenium/exercices/solutions/expedia.py | Selenium/exercices/solutions/expedia.py | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
# Configure the baseURL
baseUrl = "https://www.expedia.es"
# Create a webDriver instance and maximize window
driver = webdriver.Firefox()
driver.maximize_window()
# Navigage to URL and put ... | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
# Configure the baseURL
baseUrl = "https://www.expedia.es"
# Create a webDriver instance and maximize window
driver = webdriver.Firefox()
driver.maximize_window()
# Navigage to URL and put ... | apache-2.0 | Python |
d53a4a9fe6f37c9886977bd27a1d8caad7eb7c1c | Use black as default text colour | tonioo/rst2pdf,sychen/rst2pdf,aquavitae/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8,sychen/rst2pdf,aquavitae/rst2pdf-py3-dev,aquavitae/rst2pdf,tonioo/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8,aquavitae/rst2pdf-py3-dev | rst2pdf/pygments2json.py | rst2pdf/pygments2json.py | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
'''
Creates a rst2pdf stylesheet for each pygments style.
'''
import sys
import os
import simplejson
from pygments.token import STANDARD_TYPES
from pygments import styles as pstyles
def css2rl(css):
dstyles = {}
# First create a dumb stylesheet
... | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
'''
Creates a rst2pdf stylesheet for each pygments style.
'''
import sys
import os
import simplejson
from pygments.token import STANDARD_TYPES
from pygments import styles as pstyles
def css2rl(css):
dstyles = {}
# First create a dum... | mit | Python |
9091035443e06beeea359e373e4809f4965c7ffe | Add Events::EventBusPolicy (#1386) | ikben/troposphere,ikben/troposphere,cloudtools/troposphere,cloudtools/troposphere,johnctitus/troposphere,johnctitus/troposphere | troposphere/events.py | troposphere/events.py | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject
from . import AWSProperty
from .validators import integer
class Condition(AWSProperty):
props = {
'Key': (basestring, False),
'Type': (basestring, False),
... | # Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
class EcsParameters(AWSProperty):
props = {
"TaskCount": (int, False),
"TaskDefinitionArn": (basestring, True),
}
class InputTransformer(AWSProp... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.