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 |
|---|---|---|---|---|---|---|---|---|
bdc8b54cbb6cb20d18d9a012e66de63bb10ed194 | Fix for Ubuntu 14.04 | NaturalHistoryMuseum/inselect,NaturalHistoryMuseum/inselect | inselect/lib/sort_document_items.py | inselect/lib/sort_document_items.py | from itertools import izip
from operator import itemgetter
# Warning: lazy load of scipy and sklearn via local imports
def _do_kde(values):
"""Uses kernel denstity estimation to assign values to clusters using
minima. Returns a generator of ints that are bin numbers.
"""
from scipy.signal import argr... | from itertools import izip
from operator import itemgetter
# Warning: lazy load of scipy and sklearn via local imports
def _do_kde(values):
"""Uses kernel denstity estimation to assign values to clusters using
minima. Returns a generator of ints that are bin numbers.
"""
from scipy.signal import argr... | bsd-3-clause | Python |
a82365e7045ba1a5cbbdf2a93e098315721812fe | Fix amazon price bug | morefreeze/scrapy_projects,morefreeze/scrapy_projects,morefreeze/scrapy_projects,morefreeze/scrapy_projects | book/book/spiders/amazon.py | book/book/spiders/amazon.py | # -*- coding: utf-8 -*-
import scrapy
from items import BookItem
def safe_list_get(l, idx, default=''):
return l[idx] if len(l) > idx else default
class AmazonSpider(scrapy.Spider):
name = "amazon"
allowed_domains = ["amazon.cn"]
start_urls = (
'https://www.amazon.cn/s/?node=1841471071&ie=UT... | # -*- coding: utf-8 -*-
import scrapy
from items import BookItem
def safe_list_get(l, idx, default=''):
return l[idx] if len(l) > idx else default
class AmazonSpider(scrapy.Spider):
name = "amazon"
allowed_domains = ["amazon.cn"]
start_urls = (
'https://www.amazon.cn/s/?node=1841471071&ie=UT... | mit | Python |
5fd43fcf5627e7c659cbc4a4f366aae027a6f0f1 | Fix coverage of new zoom error handling code path. | kou/zulip,showell/zulip,tommyip/zulip,synicalsyntax/zulip,punchagan/zulip,kou/zulip,punchagan/zulip,punchagan/zulip,hackerkid/zulip,kou/zulip,hackerkid/zulip,brainwane/zulip,hackerkid/zulip,showell/zulip,andersk/zulip,zulip/zulip,rht/zulip,showell/zulip,hackerkid/zulip,shubhamdhama/zulip,rishig/zulip,timabbott/zulip,to... | zerver/tests/test_create_video_call.py | zerver/tests/test_create_video_call.py | import json
import mock
from zerver.lib.test_classes import ZulipTestCase
from typing import Dict
class TestFeedbackBot(ZulipTestCase):
def setUp(self) -> None:
user_profile = self.example_user('hamlet')
self.login(user_profile.email, realm=user_profile.realm)
def test_create_video_call_succes... | import mock
from zerver.lib.test_classes import ZulipTestCase
from typing import Dict
class TestFeedbackBot(ZulipTestCase):
def setUp(self) -> None:
user_profile = self.example_user('hamlet')
self.login(user_profile.email, realm=user_profile.realm)
def test_create_video_call_success(self) -> N... | apache-2.0 | Python |
9302d0180fa544eb1600070dd65e964d6fe02c9f | Remove unused import and comment | CamDavidsonPilon/lifelines | lifelines/fitters/mixture_cure_fitter.py | lifelines/fitters/mixture_cure_fitter.py | # -*- coding: utf-8 -*-
import autograd.numpy as anp
from lifelines.fitters import ParametricUnivariateFitter
class MixtureCureFitter(ParametricUnivariateFitter):
CURED_FRACTION_PARAMETER_NAME = "cured_fraction_"
def __init__(self, base_fitter, *args, **kwargs):
self._base_fitter = base_fitter
... | # -*- coding: utf-8 -*-
import autograd.numpy as anp
from autograd.scipy.special import expit
from lifelines.fitters import ParametricUnivariateFitter
# What should the name of the fitter actually be?
class MixtureCureFitter(ParametricUnivariateFitter):
CURED_FRACTION_PARAMETER_NAME = "cured_fraction_"
def __... | mit | Python |
705970cedde66acfd380057e4e95cef8f8963c7d | Update tests to use correct tag | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/test/experimental/dataflow/module-initialization/multiphase.py | python/ql/test/experimental/dataflow/module-initialization/multiphase.py | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from testlib import *
# These are defined so that we can evaluate the test code.
NONSOURCE = "not a source" #$ importTimeFlow="ModuleVariableNode for Global Variable NONSOURCE in Module multiphase"
SOURCE = "source" #$ importTimeFlow... | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from testlib import *
# These are defined so that we can evaluate the test code.
NONSOURCE = "not a source" #$ importTimeFlow="ModuleVariableNode for Global Variable NONSOURCE in Module multiphase"
SOURCE = "source" #$ importTimeFlow... | mit | Python |
6ea489abb85775655f2b56d7c8ed59f3db2272bf | Add decorator to wrap values in class instance | pymanopt/pymanopt,pymanopt/pymanopt | pymanopt/tools/__init__.py | pymanopt/tools/__init__.py | import collections
import functools
import typing
def make_enum(name, fields):
return collections.namedtuple(name, fields)(*range(len(fields)))
class ndarraySequenceMixin:
# The following attributes ensure that operations on sequences of
# np.ndarrays with scalar numpy data types such as np.float64 don'... | import collections
import functools
import typing
def make_enum(name, fields):
return collections.namedtuple(name, fields)(*range(len(fields)))
class ndarraySequenceMixin:
# The following attributes ensure that operations on sequences of
# np.ndarrays with scalar numpy data types such as np.float64 don'... | bsd-3-clause | Python |
001a2656765d49c0ebb61ae6c10d37c008054073 | fix vocab2lex | phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts | 02_amtraining/base_scripts/vocab2lex.py | 02_amtraining/base_scripts/vocab2lex.py | #!/usr/bin/env python3
import sys
def main(phone_map, abbreviations):
phone_map = {v[0]: v[1].strip()
for v in (l.split(None, 1)
for l in open(phone_map, encoding='utf-8'))}
abbr_map = {v[0]: v[1].strip().split(',')
for v in (l.split(None, 1)
... | #!/usr/bin/env python3
import sys
def main(phone_map, abbreviations):
phone_map = {v[0]: v[1].strip()
for v in (l.split(None, 1)
for l in open(phone_map, encoding='utf-8'))}
abbr_map = {v[0]: v[1].strip().split(',')
for v in (l.split(None, 1)
... | bsd-3-clause | Python |
f76ba4ba273dc3d7973a44b356cea5f6d86ea136 | Add message about debug to print of server exception | genestack/python-client | genestack_client/genestack_exceptions.py | genestack_client/genestack_exceptions.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2016 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
class GenestackException(Exception):
"""
Th... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2016 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
class GenestackException(Exception):
"""
Th... | mit | Python |
492a266002a0c2b11cf8471968ce7d831e482b27 | remove overwrite of parsed dirname | probcomp/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,fivejjs/crosscat,fivejjs/crosscat,fivejjs/crosscat,probcomp/crosscat,fivejjs/crosscat,probcomp/crosscat,probcomp/crosscat,probcomp/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,mit-proba... | crosscat/tests/timing_analysis.py | crosscat/tests/timing_analysis.py | import crosscat.utils.timing_test_utils as ttu
from crosscat.utils.general_utils import Timer, MapperContext, NoDaemonPool
import experiment_runner.experiment_utils as experiment_utils
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dirname', default='t... | import crosscat.utils.timing_test_utils as ttu
from crosscat.utils.general_utils import Timer, MapperContext, NoDaemonPool
import experiment_runner.experiment_utils as experiment_utils
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dirname', default='t... | apache-2.0 | Python |
eeac3fdef1a297b5382b773cd3c5c33eb830e1c7 | remove unintended change | charnpreetsingh/jupyter-alabaster-theme,charnpreetsingh/jupyter-alabaster-theme,ellisonbg/jupyter-alabaster-theme,jupytercalpoly/jupyter-alabaster-theme,ellisonbg/jupyter-alabaster-theme,charnpreetsingh/jupyter-alabaster-theme,ellisonbg/jupyter-alabaster-theme,jupytercalpoly/jupyter-alabaster-theme,jupytercalpoly/jupyt... | jupyter_alabaster_theme/__init__.py | jupyter_alabaster_theme/__init__.py | """Jupyter Alabaster theme."""
import os
import subprocess
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(__file__))
return [cur_dir]
def bash(fileName):
"""Runs a bash scrip... | """Jupyter Alabaster theme."""
import os
import subprocess
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(__file__))
return [cur_dir]
def bash(fileName):
"""Runs a bash scrip... | bsd-3-clause | Python |
c183111a61d6f69735e56760be0ba8727724c0be | add version 1.5 (#27527) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-python-rapidjson/package.py | var/spack/repos/builtin/packages/py-python-rapidjson/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPythonRapidjson(PythonPackage):
"""Python wrapper around rapidjson."""
homepage = "... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPythonRapidjson(PythonPackage):
"""Python wrapper around rapidjson."""
homepage = "... | lgpl-2.1 | Python |
9b2d66934f6dd279d63627a5efb96412b83f02c5 | Update pipelines.py | geekan/google-scholar-crawler | googlescholar/googlescholar/pipelines.py | googlescholar/googlescholar/pipelines.py | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy import signals
import json
import codecs
from collections import OrderedDict
class JsonWithEncodingPipeline(object):
def __init__(... | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import redis
from scrapy import signals
import json
import codecs
from collections import OrderedDict
class JsonWithEncodingPipeline(object):
... | apache-2.0 | Python |
88c8c9b6f728c07774e3b36a081746ee6e8ff414 | convert header to h1 modified: cl/corpus_importer/import_columbia/convert_columbia_html.py | voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener,voutilad/courtlistener | cl/corpus_importer/import_columbia/convert_columbia_html.py | cl/corpus_importer/import_columbia/convert_columbia_html.py | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 16:32:17 2016
@author: elliott
"""
import re
def convert_columbia_html(text):
conversions = [('italic','em'),
('block_quote','blockquote'),
('bold','strong'),
('underline','u'),
(... | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 16:32:17 2016
@author: elliott
"""
import re
def convert_columbia_html(text):
conversions = [('italic','em'),
('block_quote','blockquote'),
('bold','strong'),
('underline','u'),
(... | agpl-3.0 | Python |
76f697cad3e5dcaeb91c10e6c5f21db23ed8e407 | Fix import of celery decorator "task". | django-helpdesk/django-helpdesk,gwasser/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,gwasser/django-helpdesk,gwasser/django-helpdesk,django-helpdesk/django-helpdesk,django-helpdesk/django-helpdesk,gwasser/django-helpdesk,django-helpdesk/django-helpdesk | helpdesk/tasks.py | helpdesk/tasks.py | from celery.decorators import task
from .email import process_email
@task()
def helpdesk_process_email():
process_email()
| from celery import task
from .email import process_email
@task()
def helpdesk_process_email():
process_email()
| bsd-3-clause | Python |
3d6e196f4ba14191b4824f99ff63b3fb8dda6094 | fix cmp | hardc0d3/sppy,hardc0d3/sppy,hardc0d3/sppy | sppy_dict_test/test_cursor.py | sppy_dict_test/test_cursor.py | from sppy.spapi_cffi import SophiaApi
from sppy.spapi_cffi_codecs import *
from sppy.spapi_dict import SophiaDict
from sppy.spapi_cursor_dict import SophiaCursorDict
import config1_2_2 as conf
dbname = conf.default_db_name
sp = conf.sp
codec_u32 = conf.codec_u32
dict_db_config = conf.dict_db_default_config
keycount = ... | from sppy.spapi_cffi import SophiaApi
from sppy.spapi_cffi_codecs import *
from sppy.spapi_dict import SophiaDict
from sppy.spapi_cursor_dict import SophiaCursorDict
import config1_2_2 as conf
dbname = conf.default_db_name
sp = conf.sp
codec_u32 = conf.codec_u32
dict_db_config = conf.dict_db_default_config
keycount = ... | bsd-2-clause | Python |
24d52876e1a09cf8041da282b93e688a1d2c5a6d | Set version to v2.0.18.dev0 | honnibal/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy | spacy/about.py | spacy/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy'
__version__ = '2.0.18.dev0'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython'
__u... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy'
__version__ = '2.0.17'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython'
__uri__ ... | mit | Python |
3647185427e7fd879968614460fcc7dbbfeb5ad4 | remove automatic reading of instance config | robinandeer/chanjo-report,robinandeer/chanjo-report | chanjo_report/server/app.py | chanjo_report/server/app.py | # -*- coding: utf-8 -*-
from flask import Flask, request
from flask.ext.babel import Babel
from .config import DefaultConfig
from .extensions import api
from .utils import pretty_date
def create_app(app_name=None, config=None):
"""Create a Flask app (Flask Application Factory)."""
if app_name is None:
... | # -*- coding: utf-8 -*-
from flask import Flask, request
from flask.ext.babel import Babel
from .config import DefaultConfig
from .extensions import api
from .utils import pretty_date
def create_app(app_name=None, config=None):
"""Create a Flask app (Flask Application Factory)."""
if app_name is None:
... | mit | Python |
9add6d09c0f1b526d879b91aca900ac1ceeb8940 | fix a word | seamile/WeedLab,seamile/Weeds,seamile/Weeds,seamile/WeedLab | Scripts/ass_editor.py | Scripts/ass_editor.py | #!/usr/bin/env python
# coding: utf8
import re
stime = re.compile('\d{1,2}\:\d\d\:\d\d[,.]\d\d')
def stime_add(strtime, seconds):
strtime = strtime.replace(',', '.')
h, m, s = [float(i) for i in strtime.split(':')]
total = h * 3600 + m * 60 + s + seconds
s = total % 60
total -= s
m = total % ... | #!/usr/bin/env python
# coding: utf8
import re
stime = re.compile('\d{1,2}\:\d\d\:\d\d[,.]\d\d')
def stime_add(strtime, secodes):
strtime = strtime.replace(',', '.')
h, m, s = [float(i) for i in strtime.split(':')]
total = h * 3600 + m * 60 + s + secodes
s = total % 60
total -= s
m = total % ... | mit | Python |
0a543ca0d52515f0e9b5b12a2ae1231772ad46a1 | change type | amuehlem/misp-modules,MISP/misp-modules,MISP/misp-modules,VirusTotal/misp-modules,MISP/misp-modules,VirusTotal/misp-modules,VirusTotal/misp-modules,amuehlem/misp-modules,amuehlem/misp-modules | misp_modules/modules/expansion/onyphe.py | misp_modules/modules/expansion/onyphe.py | import json
# -*- coding: utf-8 -*-
import json
try:
from onyphe import Onyphe
except ImportError:
print("pyonyphe module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domains'], 'output': ['hostname', 'domain', 'ip-src', 'ip-dst','url']}
# poss... | import json
# -*- coding: utf-8 -*-
import json
try:
from onyphe import Onyphe
except ImportError:
print("pyonyphe module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domains'], 'output': ['hostname', 'domain', 'ip-src', 'ip-dst','url']}
# poss... | agpl-3.0 | Python |
ac2e251f165c4d8a11fe65bbfbf1562ea2020e97 | Fix the exception about the missing secret key when generating docs. | littleweaver/django-daguerre,mislavcimpersak/django-daguerre,Styria-Digital/django-daguerre,littleweaver/django-daguerre,mislavcimpersak/django-daguerre,Styria-Digital/django-daguerre | docs/dummy-settings.py | docs/dummy-settings.py | DATABASES = {
"default": {
"NAME": ":memory:",
"ENGINE": "django.db.backends.sqlite3",
}
}
SECRET_KEY = "NOT SECRET" | DATABASES = {
"default": {
"NAME": ":memory:",
"ENGINE": "django.db.backends.sqlite3",
}
} | bsd-3-clause | Python |
57eee9f01074a3f75872aedad696e517cd402543 | add caching to song analysis | ucbvislab/radiotool | radiotool/composer/song.py | radiotool/composer/song.py | import hashlib
import pickle
import os
from ..algorithms import librosa_analysis
from track import Track
class Song(Track):
"""A :py:class:`radiotool.composer.Track`
subclass that wraps a music .wav file.
Allows access to a musical analysis of the song.
"""
def __init__(self, fn, name="Song name"... |
from ..algorithms import librosa_analysis
from track import Track
class Song(Track):
"""A :py:class:`radiotool.composer.Track`
subclass that wraps a music .wav file.
Allows access to a musical analysis of the song.
"""
def __init__(self, fn, name="Song name"):
self._analysis = None
... | isc | Python |
04d75d0cda60c7143f108d42ffb80f2d3e728b65 | bump version | vmalloc/waiting | waiting/__version__.py | waiting/__version__.py | __version__ = "1.1.0.dev1"
| __version__ = "1.0.1"
| bsd-3-clause | Python |
b1935880ceeb63e31d7ff15e589ce3942b185fcd | Update server.py | canmogol/LightGap,canmogol/LightGap,canmogol/LightGap,canmogol/LightGap | web-ecma-262/server.py | web-ecma-262/server.py | from flask import Flask, Response, request, send_from_directory, make_response, redirect
import time
app = Flask(__name__, static_url_path='')
@app.before_request
def before_request():
authenticatedMethods = ['/list', '/another']
session_id = request.cookies.get('session_id')
if session_id is None and any(request.... | from flask import Flask, request, send_from_directory, make_response, redirect
import time
app = Flask(__name__, static_url_path='')
@app.before_request
def before_request():
authenticatedMethods = ['/list', '/another']
session_id = request.cookies.get('session_id')
if session_id is None and any(request.path in s ... | apache-2.0 | Python |
2bae13fa085b3a16242916a8b39a61e4e4fdff36 | Order movies by title | Cinemair/cinemair-server,Cinemair/cinemair-server | cinemair/movies/services.py | cinemair/movies/services.py | from .models import Movie
def get_all_movies():
return Movie.objects.all().order_by("name")
| from .models import Movie
def get_all_movies():
return Movie.objects.all()
| mit | Python |
172b6a7183ce68933ad9bd4a501f76fef2270b49 | Expand Python demonstration of onion concept. | dtusar/coco,oaelhara/numbbo,oaelhara/numbbo,dtusar/coco,NDManh/numbbo,NDManh/numbbo,oaelhara/numbbo,oaelhara/numbbo,dtusar/coco,dtusar/coco,dtusar/coco,dtusar/coco,NDManh/numbbo,oaelhara/numbbo,NDManh/numbbo,dtusar/coco,NDManh/numbbo,dtusar/coco,NDManh/numbbo,oaelhara/numbbo,oaelhara/numbbo,NDManh/numbbo,NDManh/numbbo,... | documentation/onion.py | documentation/onion.py | ##
## onion.py - example to show how the wrapping of functions in the C
## code works.
##
## This is a simplified version of the numbbo_problem_t /
## numbbo_transformed_problem_t structure of the C code for
## illustation purposes. The idea behind the C code is the same but we
## need much more boilerplate code to ... | ##
## onion.py - example to show how the wrapping of functions in the C
## code works.
##
## This is a simplified version of the numbbo_problem_t /
## numbbo_transformed_problem_t structure of the C code for
## illustation purposes. The idea behind the C code is the same but we
## need much more boilerplate code to ... | bsd-3-clause | Python |
4fb425ceb3ea1022b5f2ebf0cc0d262deda4280c | Clarify fallback to ami_name() | elifesciences/builder,elifesciences/builder | src/buildercore/bakery.py | src/buildercore/bakery.py | __description__ = """Module that deals with AMI baking!
We bake new AMIs to avoid long deployments and the occasional
runtime bugs that crop up while building brand new machines."""
from buildercore import core, utils, bootstrap, config
def ami_name(stackname):
# elife-api.2015-12-31
return "%s.%s" % (core.p... | __description__ = """Module that deals with AMI baking!
We bake new AMIs to avoid long deployments and the occasional
runtime bugs that crop up while building brand new machines."""
from buildercore import core, utils, bootstrap, config
def ami_name(stackname):
# elife-api.2015-12-31
return "%s.%s" % (core.p... | mit | Python |
18fcf970be1cd1862f4967b7175475e4593bfbb4 | Fix 'yank selftest' | andrrizzi/yank,andrrizzi/yank,choderalab/yank,andrrizzi/yank,choderalab/yank | Yank/commands/selftest.py | Yank/commands/selftest.py | #!/usr/local/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Run YANK self tests after installation.
"""
#==============================... | #!/usr/local/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Run YANK self tests after installation.
"""
#==============================... | mit | Python |
eecaf4d2f3c62b308697f6865a5e120d0409870b | Store the context in the local.store. | zhangg/trove,mmasaki/trove,redhat-openstack/trove,citrix-openstack-build/trove,citrix-openstack/build-trove,denismakogon/trove-guestagent,fabian4/trove,mmasaki/trove,mmasaki/trove,citrix-openstack-build/trove,cp16net/trove,cp16net/trove,openstack/trove,redhat-openstack/trove,changsimon/trove,zhujzhuo/openstack-trove,re... | reddwarf/common/context.py | reddwarf/common/context.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | apache-2.0 | Python |
6c2b309657c78f9d5358dba31fbe43eb2b76c47d | Fix backend API config setting for docker | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | cla_public/config/docker.py | cla_public/config/docker.py | from cla_public.config.base import *
DEBUG = os.environ.get('SET_DEBUG', False) == 'True'
SECRET_KEY = os.environ['SECRET_KEY']
# TODO - change this to True when serving over HTTPS
SESSION_COOKIE_SECURE = False
HOST_NAME = os.environ['HOST_NAME']
BACKEND_API = {
'url': os.environ['BACKEND_BASE_URI'] + '/check... | from cla_public.config.base import *
DEBUG = os.environ.get('SET_DEBUG', False) == 'True'
SECRET_KEY = os.environ['SECRET_KEY']
# TODO - change this to True when serving over HTTPS
SESSION_COOKIE_SECURE = False
HOST_NAME = os.environ['HOST_NAME']
BACKEND_API = {
'url': os.environ['BACKEND_BASE_URI']
}
| mit | Python |
00e0f719f886be5a1560f9365043f437b37e4c7b | Update bootbox path | cburmeister/flask-bones,cburmeister/flask-bones,cburmeister/flask-bones | app/assets.py | app/assets.py | from flask_assets import Bundle, Environment, Filter
class ConcatFilter(Filter):
"""
Filter that merges files, placing a semicolon between them.
Fixes issues caused by missing semicolons at end of JS assets, for example
with last statement of jquery.pjax.js.
"""
def concat(self, out, hunks, **... | from flask_assets import Bundle, Environment, Filter
class ConcatFilter(Filter):
"""
Filter that merges files, placing a semicolon between them.
Fixes issues caused by missing semicolons at end of JS assets, for example
with last statement of jquery.pjax.js.
"""
def concat(self, out, hunks, **... | mit | Python |
b0e91228195d28a34a44ba5ab065f6d3d4388a9b | Fix main.py | Ezibenroc/simplex | main.py | main.py | #!/usr/bin/env python3
from simplex import LinearProgram, Parser
if __name__ == '__main__':
lp = LinearProgram()
parser = Parser(lp, 'example2.in')
parser.parse()
print(lp.runSimplex())
| from simplex import LinearProgram, Parser
if __name__ == '__main__':
lp = LinearProgram()
parser = Parser(lp, 'example2.in')
parser.parse()
print(lp.runSimplex())
| mit | Python |
f40cb329c2610d1d90c1169d8fd833c872804e1b | Make minor change to some error messages. | lumenlearning/python3-canvaslms-api | canvaslms/__init__.py | canvaslms/__init__.py | ###############################################################################
# python3-canvaslms-api Source Code
# Copyright (C) 2013 Lumen LLC.
#
# This file is part of the python3-canvaslms-api module Source Code.
#
# python3-canvaslms-api is free software: you can redistribute it and/or modify
# it under the t... | ###############################################################################
# python3-canvaslms-api Source Code
# Copyright (C) 2013 Lumen LLC.
#
# This file is part of the python3-canvaslms-api module Source Code.
#
# python3-canvaslms-api is free software: you can redistribute it and/or modify
# it under the t... | agpl-3.0 | Python |
9df1d59ed50982b24a55addcb38c785d280f333e | allow customizing how expressions are built | lmtierney/watir-snake | nerodia/locators/row/selector_builder.py | nerodia/locators/row/selector_builder.py | import logging
from ..element.selector_builder import SelectorBuilder as ElementSelectorBuilder
from ...exception import Error
try:
from re import Pattern
except ImportError:
from re import _pattern_type as Pattern
class SelectorBuilder(ElementSelectorBuilder):
def _build_wd_selector(self, selectors):
... | import logging
from ..element.selector_builder import SelectorBuilder as ElementSelectorBuilder
from ...exception import Error
try:
from re import Pattern
except ImportError:
from re import _pattern_type as Pattern
class SelectorBuilder(ElementSelectorBuilder):
def _build_wd_selector(self, selectors):
... | mit | Python |
7ff706c67d55b9bc89a08102846fc68523422071 | Update test_cli.py | rrwen/google_streetview | google_streetview/tests/test_cli.py | google_streetview/tests/test_cli.py | # -*- coding: utf-8 -*-
from os import listdir, makedirs, remove
from os.path import isdir, isfile
from google_streetview.cli import run
from shutil import rmtree
from tempfile import TemporaryFile, TemporaryDirectory
from unittest import TestCase
import json
class cliTest(TestCase):
def setUp(self):
tempfile... | # -*- coding: utf-8 -*-
from os import listdir, makedirs, remove
from os.path import isdir, isfile
from google_streetview.cli import run
from shutil import rmtree
from tempfile import TemporaryFile, TemporaryDirectory
from unittest import TestCase
import json
class cliTest(TestCase):
def setUp(self):
tempfile... | mit | Python |
0e3d41b813aee900d538a0c337d27e8328ce1c0c | Fix super weird Python bug | kpj/PyWave | main.py | main.py | """
Reproduction of figure from Sawai et al. (2005)
"""
import numpy as np
from progressbar import ProgressBar
from configuration import get_config
from lattice_initializer import Generator
from utils import animate_evolution
def integrate_system(system):
""" Integrate ODE-CA hybrid with simple Euler method
... | """
Reproduction of figure from Sawai et al. (2005)
"""
import numpy as np
from progressbar import ProgressBar
from configuration import get_config
from lattice_initializer import Generator
from utils import animate_evolution
def integrate_system(system):
""" Integrate ODE-CA hybrid with simple Euler method
... | mit | Python |
4a2a808a877ba96810b13e1d025a095b85c84998 | comment print | callicles/Honeyword-generators | main.py | main.py | import pprint
import argparse
import mutators
from algorithms.password_leaner import password_leaner
from algorithms.tokeniser import tokeniser
from algorithms import generators
pp = pprint.PrettyPrinter(indent=1)
def main(password):
for i in range(10):
nicolasObject = password_leaner(password)
#... | import pprint
import argparse
import mutators
from algorithms.password_leaner import password_leaner
from algorithms.tokeniser import tokeniser
from algorithms import generators
pp = pprint.PrettyPrinter(indent=1)
def main(password):
for i in range(10):
nicolasObject = password_leaner(password)
p... | mit | Python |
f41163ee64ab34188a70be95b0d587562d92b858 | Fix crash if no Accept-Language header was not set | youtify/youtify,youtify/youtify,youtify/youtify | main.py | main.py | import os
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util
import toplist
from model import get_current_youtify_user
from model import create_youtify_user
class MainHandler(webapp.RequestHandler)... | import os
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util
import toplist
from model import get_current_youtify_user
from model import create_youtify_user
class MainHandler(webapp.RequestHandler)... | mit | Python |
f9ad793122b601874b9010ed3074fb71be0cec27 | fix example start main.py file | Upper-Polo/weather-app | main.py | main.py | # weather-app
# main.py
from sys import argv, exit
def main():
try:
api_key = argv[1]
except IndexError:
print('Pass in AP key')
exit(0)
payload = {
"appid": api_key,
"q": "Lexington,us",
"units": "imperial",
}
r = requests.get("http://api.openweat... | # weather-app
# main.py
from sys import argv, exit
def main():
try:
api_key = argv[1]
except IndexError:
print('Pass in AP key')
exit(0)
payload = {
"appid": api_key,
"q": "Lexington,us",
"units": "imperial",
}
r = requests.get("http://api.openweathermap.org/data/2.5/weather", params=payload)... | mit | Python |
d3a1f72fe7694c6388aa2ab2ac24492ed89dc2c4 | add robot.txt route | di3goleite/vim-bootstrap,avelino/vim-bootstrap,nemith/vim-bootstrap,avelino/vim-bootstrap,agnaldomarinho/vim-bootstrap,nemith/vim-bootstrap,agnaldomarinho/vim-bootstrap,lerrua/vim-bootstrap,agnaldomarinho/vim-bootstrap,camponez/vim-bootstrap,lerrua/vim-bootstrap,camponez/vim-bootstrap,dmoliveira/vim-bootstrap,avelino/v... | main.py | main.py | # -*- coding: utf-8 -*-
import os
import json
import requests
import jinja2
from jinja2 import Template
from bottle import Bottle, request, response, static_file
from bottle import TEMPLATE_PATH as T
PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)))
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'vi... | # -*- coding: utf-8 -*-
import os
import json
import requests
import jinja2
from jinja2 import Template
from bottle import Bottle, request, response, static_file
from bottle import TEMPLATE_PATH as T
PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)))
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'vi... | mit | Python |
adb8fca98a0e5b998a2ba84565fe86d6625cd2ed | trim suffix '?1' off of imgur links | d-chen/reddit-image-scraper | main.py | main.py | from bs4 import BeautifulSoup, SoupStrainer
import json
import os
import re
import requests
import sys
DOWNLOAD_DIR = "/downloaded"
# Get the subreddit
def get_reddit_page(subreddit):
url = "http://www.reddit.com/r/" + subreddit + ".json"
resp = requests.get(url)
return resp.text
# Find the 'i.imgur.com/... | from bs4 import BeautifulSoup, SoupStrainer
import json
import os
import re
import requests
import sys
DOWNLOAD_DIR = "/downloaded"
# Get the subreddit
def get_reddit_page(subreddit):
url = "http://www.reddit.com/r/" + subreddit + ".json"
resp = requests.get(url)
return resp.text
# Find the 'i.imgur.com/... | mit | Python |
83af69d02d3c20f557b3b1c6bc6bfe38c5d93869 | Update repo, migrate vim template to vim-bootstrap repo | agnaldomarinho/vim-bootstrap,nemith/vim-bootstrap,nemith/vim-bootstrap,dmoliveira/vim-bootstrap,lerrua/vim-bootstrap,di3goleite/vim-bootstrap,avelino/vim-bootstrap,avelino/vim-bootstrap,lerrua/vim-bootstrap,lerrua/vim-bootstrap,camponez/vim-bootstrap,di3goleite/vim-bootstrap,dmoliveira/vim-bootstrap,dmoliveira/vim-boot... | main.py | main.py | # -*- coding: utf-8 -*-
import os
import json
import requests
import jinja2
from jinja2 import Template
from bottle import Bottle, request, response, static_file
from bottle import TEMPLATE_PATH as T
PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)))
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'vi... | # -*- coding: utf-8 -*-
import os
import json
import requests
import jinja2
from jinja2 import Template
from bottle import Bottle, request, response, static_file
from bottle import TEMPLATE_PATH as T
PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)))
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'vi... | mit | Python |
b4680ade17107cfc70c660f865bc314878bcaff9 | add a bit more code to main.py but need to look up the standard template to get it running | dcroc16/skunk_works,dcroc16/skunk_works,dcroc16/skunk_works,dcroc16/skunk_works,dcroc16/skunk_works,dcroc16/skunk_works | main.py | main.py | import webapp2
import jinja2
ENV = jinja2.Environment()
class MainHandler(webapp2.RequestHandler):
def get(self):
app = webapp2.
| import webapp2
class Main(webapp2.RequestHandler):
| mit | Python |
d218aa13241914f3ac4795d7b202bb3bdb1cb3bd | Print alert | ligyxy/Go-Home-Alert | main.py | main.py | #!/usr/bin/python
# -*-coding:UTF-8 -*-
from datetime import datetime
import json
import requests
import time
with open('conn.json', 'r') as conn_file:
conn = json.load(conn_file)
end_time = datetime.strptime(conn['end_time'], '%H:%M').time()
def send_message(metro_time):
print("Mail sent")
request_ur... | #!/usr/bin/python
# -*-coding:UTF-8 -*-
from datetime import datetime
import json
import requests
import time
with open('conn.json', 'r') as conn_file:
conn = json.load(conn_file)
end_time = datetime.strptime(conn['end_time'], '%H:%M').time()
def send_message(metro_time):
request_url = 'https://api.mailgu... | mit | Python |
73a268c4151c9f204c6d50213b5006b78c7cce48 | check if on pi correctly-ier | jeremybmerrill/bigappleserialbus,jeremybmerrill/bigappleserialbus,jeremybmerrill/bigappleserialbus,jeremybmerrill/bigappleserialbus | onpi.py | onpi.py | import subprocess
def onPi():
uname_m = subprocess.Popen(["uname", "-m"], stdout = subprocess.PIPE, stderr = subprocess.STDOUT).communicate()[0]
return uname_m.strip() == "armv6l"
| import subprocess
def onPi():
uname_m = subprocess.Popen(["uname", "-m"], stdout = subprocess.PIPE, stderr = subprocess.STDOUT).communicate()[0]
return uname_m == "armv6l"
| apache-2.0 | Python |
388722c24f768af9ee95c9771b71e8269be9ea95 | Update version.py | VUIIS/dax,VUIIS/dax | dax/version.py | dax/version.py | VERSION = '0.10.1'
| VERSION = '0.10.dev'
| mit | Python |
ea0c296e6ce401873c8eaa52b02a2c67d5544c54 | Add when_file_changed to toplevel import | juju-solutions/charms.reactive,juju-solutions/charms.reactive | charms/reactive/__init__.py | charms/reactive/__init__.py | # Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope ... | # Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope ... | apache-2.0 | Python |
ef7c58df6b3e9367880678f84ceb6c888b468172 | Add --staged option to deploy cmd. | hirokiky/ebi | ebi/commands/deploy.py | ebi/commands/deploy.py | import logging
import subprocess
import sys
import time
from .. import appversion
logger = logging.getLogger(__name__)
def main(parsed):
if parsed.version:
version = parsed.version
else:
version = str(int(time.time()))
appversion.make_application_version(parsed.app_name, version, parsed... | import logging
import subprocess
import sys
import time
from .. import appversion
logger = logging.getLogger(__name__)
def main(parsed):
if parsed.version:
version = parsed.version
else:
version = str(int(time.time()))
appversion.make_application_version(parsed.app_name, version, parsed... | mit | Python |
fe9e95f11fffcad4e86c7e09a1b53b7bfe862efa | Refactor config.py | tforrest/soda-automation,tforrest/soda-automation | app/config.py | app/config.py | import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_restful import Api
# set up app
app = Flask(__name__)
# set up Api
api = Api(app)
# set up database
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['FLASKDB']
db = SQLAlchemy(app)
| import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_restful import Api
from api import api as a
# set up app
app = Flask(__name__)
# set up Api
api = Api(app)
api.add_resource(a.MailChimpApi,'/<list_id>')
# set up database
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['FLASKDB']... | mit | Python |
33d12e9406617490cedaa27bd6d0413d3c05dad7 | Change ‘GX’ to ‘variable’. Include HVAR in the list of tables to remove. | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/varLib/mutator.py | Lib/fontTools/varLib/mutator.py | """
Instantiate a variation font. Run, eg:
$ python mutator.py ./NotoSansArabic-VF.ttf wght=140 wdth=85
"""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._g_l_y_f import GlyphCoordinates
from fontTools.... | """
Instantiate a variation font. Run, eg:
$ python mutator.py ./NotoSansArabic-GX.ttf wght=140 wdth=85
"""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._g_l_y_f import GlyphCoordinates
from fontTools.... | mit | Python |
a53729f80b7b822be29bf52e2fa9738f604c3aec | remove unnecessary import | mode89/editor | features/steps/core.py | features/steps/core.py | from editor import *
@given("an instance of editor")
def instance_of_editor(context):
context.editor = Editor()
@when("open {file_name}")
def open_file(context, file_name):
context.editor.open(file_name)
@then("see file content")
def see_file_content(context):
pass
@then("editor is in normal mode")
def ... | from editor import *
import os
@given("an instance of editor")
def instance_of_editor(context):
context.editor = Editor()
@when("open {file_name}")
def open_file(context, file_name):
context.editor.open(file_name)
@then("see file content")
def see_file_content(context):
pass
@then("editor is in normal m... | mit | Python |
a4c20880056d8895dd8bc22251e3df13ace3081a | save frappe loggers site wise | almeidapaulopt/frappe,StrellaGroup/frappe,saurabh6790/frappe,StrellaGroup/frappe,mhbu50/frappe,saurabh6790/frappe,frappe/frappe,yashodhank/frappe,mhbu50/frappe,frappe/frappe,mhbu50/frappe,yashodhank/frappe,yashodhank/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,saurabh6790/frappe,StrellaGroup/frappe,yashodhank/fr... | frappe/utils/logger.py | frappe/utils/logger.py | # imports - compatibility imports
from __future__ import unicode_literals
# imports - standard imports
import logging
import os
from logging.handlers import RotatingFileHandler
# imports - third party imports
from six import text_type
# imports - module imports
import frappe
default_log_level = logging.DEBUG
def... | # imports - compatibility imports
from __future__ import unicode_literals
# imports - standard imports
import logging
import os
from logging.handlers import RotatingFileHandler
# imports - third party imports
from six import text_type
# imports - module imports
import frappe
default_log_level = logging.DEBUG
def... | mit | Python |
27d48d906f7a390da2923fb281f06e6bd40b1148 | Update assignment6.py | LamaHamadeh/Microsoft-DAT210x | Module-3/assignment6.py | Module-3/assignment6.py | '''
author: Lama Hamadeh
'''
import pandas as pd
import matplotlib.pyplot as plt
#
# TODO: Load up the Seeds Dataset into a Dataframe
# It's located at 'Datasets/wheat.data'
#
# .. your code here ..
wheat_dataset=pd.read_csv('/Users/ADB3HAMADL/Desktop/Anaconda_Packages/DAT210x-master/Module3/Datasets/wheat.data',i... | import pandas as pd
import matplotlib.pyplot as plt
#
# TODO: Load up the Seeds Dataset into a Dataframe
# It's located at 'Datasets/wheat.data'
#
# .. your code here ..
wheat_dataset=pd.read_csv('/Users/ADB3HAMADL/Desktop/Anaconda_Packages/DAT210x-master/Module3/Datasets/wheat.data',index_col = 0)
#
# TODO: Drop t... | mit | Python |
f2544dc553d0c0d87c6a2c925cc44e6d0dbd9a7d | check if the object is alredy bound to the peer | dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi | PLC/Methods/BindObjectToPeer.py | PLC/Methods/BindObjectToPeer.py | # $Id$
# $URL$
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Filter import Filter
from PLC.Auth import Auth
from PLC.Persons import Persons
from PLC.Sites import Sites
from PLC.Nodes import Nodes
from PLC.Slices import Slices
from PLC.Peers import Peers
from PLC.Faults import *
cl... | # $Id$
# $URL$
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Filter import Filter
from PLC.Auth import Auth
from PLC.Persons import Persons
from PLC.Sites import Sites
from PLC.Nodes import Nodes
from PLC.Slices import Slices
from PLC.Peers import Peers
from PLC.Faults import *
cl... | bsd-3-clause | Python |
52e4b70917fe84b65de81a65b0560ab4361988e2 | Use OrderedDict to order Dict | Bigless27/Python-Projects | Roman-Numerals/Roman.py | Roman-Numerals/Roman.py | from collections import OrderedDict
class Roman(object):
def __init__(self, number):
self.number = int(number)
self.convert_table = self.make_table()
print self.convert_table
while True:
choice = raw_input("Type Yes or No for modern Roman Numeral Convert: ").lower()
if choice == "yes":... | from collections import defaultdict
class Roman(object):
def __init__(self, number):
self.number = int(number)
self.convert_table = self.make_table()
while True:
choice = raw_input("Type Yes or No for modern Roman Numeral Convert: ").lower()
if choice == "yes":
print "You made it"
... | mit | Python |
6fbb875f9440440954beeb161a7a49ed391ef25e | Add in tests. | reticulatingspline/CFB | test.py | test.py | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
#
#
###
from supybot.test import *
class CFBTestCase(PluginTestCase):
plugins = ('CFB',)
def testCFB(self):
# cfbarrests, cfbbowls, cfbcoachsalary, cfbconferences, cfbcountdown, cfbgamestats, cfbheisman,
# cfbheismanvoting, cfbi... | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
#
#
###
from supybot.test import *
class CFBTestCase(PluginTestCase):
plugins = ('CFB',)
def testCFB(self):
# cfbarrests, cfbbowls, cfbcoachsalary, cfbconferences, cfbcountdown, cfbgamestats, cfbheisman,
# cfbheismanvoting, cfbi... | mit | Python |
6f9605a9e982003eedb9c7cd422dd920b758d219 | Add in tests. | reticulatingspline/Series | test.py | test.py | # coding=utf8
###
# Copyright (c) 2010, Terje Hoaas
# Copyright (c) 2014, spline
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyri... | # coding=utf8
###
# Copyright (c) 2010, Terje Hoaas
# Copyright (c) 2014, spline
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyri... | mit | Python |
b86ff65fe13105a11b569c3761f3cf1b8570b9e9 | Improve comments in test.py | Auctoris/ctypes_demo,Auctoris/ctypes_demo | test.py | test.py | from foo import Foo
# We'll create a Foo object with a value of 5...
f=Foo(5)
# Calling f.bar() will print a message including the value...
print ('f=Foo(5)')
print ('\t'),
# Note that Foo.bar() has it's own print routine (via std::cout).
f.bar()
print
# Now we'll use foobar to add a value to that stored in our Foo ... | from foo import Foo
# We'll create a Foo object with a value of 5...
f=Foo(5)
# Calling f.bar() will print a message including the value...
print ('f=Foo(5)')
print ('\t'),
f.bar()
print
# Now we'll use foobar to add a value to that stored in our Foo object, f
print ("print (f.foobar(7)) = "),
print (f.foobar(7))
pr... | mit | Python |
c23640764cab39e3fe4b7b33438e34d6c29c0f48 | test ... | ryanrhymes/scandex | test.py | test.py | #!/usr/bin/env python
import httplib
import os
import socket
import sys
def test():
print "hello"
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
server_address = '/var/run/docker.sock'
sock.connect(server_address)
pass
def test2():
server_address = '/var/run/docker.sock'
conn ... | #!/usr/bin/env python
import httplib
import os
import socket
import sys
def test():
print "hello"
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
server_address = '/var/run/docker.sock'
sock.connect(server_address)
pass
def test2():
server_address = '/var/run/docker.sock'
h = h... | mit | Python |
d4f704eeeeda8d46c045b91e99cbd14c69c7b14c | remove arg | vsoch/singularity-python,vsoch/singularity-python | singularity/analysis/reproduce/criteria.py | singularity/analysis/reproduce/criteria.py | '''
Copyright (C) 2017 The Board of Trustees of the Leland Stanford Junior
University.
Copyright (C) 2016-2017 Vanessa Sochat.
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... | '''
Copyright (C) 2017 The Board of Trustees of the Leland Stanford Junior
University.
Copyright (C) 2016-2017 Vanessa Sochat.
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... | agpl-3.0 | Python |
9e43ac34b3697b092d76815fad817424c7ee9be1 | fix uuid | tjcsl/director,tjcsl/director,tjcsl/director,tjcsl/director | web3/apps/vms/forms.py | web3/apps/vms/forms.py | import uuid
import re
from django import forms
from django.conf import settings
from django.utils.text import slugify
from ..users.models import User
from .models import VirtualMachine
from .helpers import call_api
class VirtualMachineForm(forms.ModelForm):
name = forms.CharField(max_length=32, widget=forms.Tex... | import uuid
import re
from django import forms
from django.conf import settings
from django.utils.text import slugify
from ..users.models import User
from .models import VirtualMachine
from .helpers import call_api
class VirtualMachineForm(forms.ModelForm):
name = forms.CharField(max_length=32, widget=forms.Tex... | mit | Python |
1f53b0b9475c8c27c5788afecdd5057612a4632d | revert back to JSON based cogatlas initialization | burnash/NeuroVault,NeuroVault/NeuroVault,erramuzpe/NeuroVault,chrisfilo/NeuroVault,NeuroVault/NeuroVault,chrisfilo/NeuroVault,burnash/NeuroVault,burnash/NeuroVault,chrisfilo/NeuroVault,erramuzpe/NeuroVault,erramuzpe/NeuroVault,erramuzpe/NeuroVault,NeuroVault/NeuroVault,erramuzpe/NeuroVault,NeuroVault/NeuroVault,NeuroVa... | neurovault/apps/statmaps/migrations/0026_populate_cogatlas.py | neurovault/apps/statmaps/migrations/0026_populate_cogatlas.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import json, os
dir = os.path.abspath(os.path.dirname(__file__))
def populate_cogatlas(apps, schema_editor):
CognitiveAtlasTask = apps.get_model("statmaps", "CognitiveAtlasTask")
CognitiveAtlasContrast = a... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from neurovault.apps.statmaps.tasks import repopulate_cognitive_atlas
from django.db import models, migrations
import os
dir = os.path.abspath(os.path.dirname(__file__))
# COGNITIVE ATLAS
##################################################################... | mit | Python |
45a1e0364daedd3b524db8fa945231fb718983d4 | remove printouts | qedsoftware/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajub... | corehq/apps/reports/flot.py | corehq/apps/reports/flot.py | from collections import defaultdict
import json
import time
from dimagi.utils.parsing import string_to_datetime
def date_to_flot_time(inputdate):
return time.mktime(inputdate.timetuple()) * 1000
def get_cumulative_counts(data):
# <3 python
daily_data = sorted([[date_to_flot_time(item), data.count(item... | from collections import defaultdict
import json
import time
from dimagi.utils.parsing import string_to_datetime
def date_to_flot_time(inputdate):
return time.mktime(inputdate.timetuple()) * 1000
def get_cumulative_counts(data):
# <3 python
daily_data = sorted([[date_to_flot_time(item), data.count(item... | bsd-3-clause | Python |
b8d8172d6747b3e6cde7cafd4dab9fbee7ad7e79 | update autoreload for upcoming cherrypy deprecation | csira/cherryontop | cherryontop/spinup.py | cherryontop/spinup.py | import cherrypy
from cherryontop.cache import map_all_routes
def _create_dispatcher():
dispatcher = cherrypy.dispatch.RoutesDispatcher()
map_all_routes(dispatcher)
return dispatcher
def _daemonize():
daemonizer = cherrypy.process.plugins.Daemonizer(cherrypy.engine)
daemonizer.subscribe()
si... | import cherrypy
from cherryontop.cache import map_all_routes
def _create_dispatcher():
dispatcher = cherrypy.dispatch.RoutesDispatcher()
map_all_routes(dispatcher)
return dispatcher
def _daemonize():
daemonizer = cherrypy.process.plugins.Daemonizer(cherrypy.engine)
daemonizer.subscribe()
si... | bsd-3-clause | Python |
a6c80c09569d2890718725cd2146325270806036 | Change how to set port numbers in jps.forwarder | OTL/jps | jps/forwarder.py | jps/forwarder.py | import zmq
from .args import ArgumentParser
from .env import get_pub_port
from .env import get_sub_port
def command():
parser = ArgumentParser(description='jps forwarder')
args = parser.parse_args()
main(args.publisher_port, args.subscriber_port)
def main(pub_port=None, sub_port=None):
'''main of fo... | import zmq
from .args import ArgumentParser
from .common import DEFAULT_PUB_PORT
from .common import DEFAULT_SUB_PORT
def command():
parser = ArgumentParser(description='jps forwarder')
args = parser.parse_args()
main(args.publisher_port, args.subscriber_port)
def main(pub_port=DEFAULT_PUB_PORT, sub_por... | apache-2.0 | Python |
2d0a5f56acf9035f883849e780fe36f7534a4251 | Use a more precise pattern to id ^R ezproxy url tokens. | WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight | TWLight/ezproxy/urls.py | TWLight/ezproxy/urls.py | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^u/(?P<url>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)$',
login_required(views.EZProxyAuth.as_view()),
name='ezproxy_auth_u'
... | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^u/(?P<url>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)$',
login_required(views.EZProxyAuth.as_view()),
name='ezproxy_auth_u'
... | mit | Python |
8838a65874a593e0897ddde3717cdcba12217de8 | Fix session_history to train item_stats on full train data set | pilipolio/recsys_challenge | recsys_challenge/predictors/session_history.py | recsys_challenge/predictors/session_history.py | import os
import numpy as np
import pandas as pd
from recsys_challenge.base import Session, evaluate, validation_dataset
from recsys_challenge.predictors import item_pop
def predict_sessions(test_clicks, item_stats, n_clicks_threshold, rate_threshold):
predicted_test_clicks = test_clicks.merge(
on='ITEM... | import os
import numpy as np
import pandas as pd
from recsys_challenge.base import Session, evaluate, validation_dataset
from recsys_challenge.predictors import item_pop
def predict_sessions(test_clicks, item_stats, n_clicks_threshold, rate_threshold):
predicted_test_clicks = test_clicks.merge(
on='ITEM... | mit | Python |
bea1648c92e12685f6326f3d1aee86c9dcd34d80 | Update BVT-IS-ROOT-PASSWORD-DELETED to only check /etc/shadow | iamshital/azure-linux-automation,konkasoftci/azure-linux-automation,FreeBSDonHyper-V/azure-freebsd-automation,Nidylei/azure-linux-automation,v-sirebb/azure-linux-automation,hglkrijger/azure-linux-automation,Nidylei/azure-linux-automation,konkasoftci/azure-linux-automation,FreeBSDonHyper-V/azure-freebsd-automation,konka... | remote-scripts/BVT-IS-ROOT-PASSWORD-DELETED.py | remote-scripts/BVT-IS-ROOT-PASSWORD-DELETED.py | #!/usr/bin/python
from azuremodules import *
def RunTest():
UpdateState("TestRunning")
RunLog.info("Checking if root password is deleted or not...")
passwd_output = Run("cat /etc/shadow | grep root")
root_passwd = passwd_output.split(":")[1]
if ('*' in root_passwd or '!' in root_passwd):
... | #!/usr/bin/python
from azuremodules import *
def RunTest(command):
UpdateState("TestRunning")
RunLog.info("Checking if root password is deleted or not...")
temp = Run(command)
timeout = 0
output = temp
if ("Root password deleted" in output) :
RunLog.info('waagent.log reports that root ... | apache-2.0 | Python |
bbbb7cc8058c962c6d63ff320da2b3f675634585 | update test | creimers/cmsplugin_seocheck,creimers/cmsplugin_seocheck,creimers/cmsplugin_seocheck | cmsplugin_seocheck/tests.py | cmsplugin_seocheck/tests.py | from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from cms.api import create_page, create_title
from cms.middleware.toolbar import ToolbarMiddleware
from cms.toolbar.toolbar import CMSToolbar
from cms.toolbar.items import ModalItem
from djangocms_helper.utils import create_... | from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from cms.api import create_page, create_title
from cms.middleware.toolbar import ToolbarMiddleware
from cms.toolbar.toolbar import CMSToolbar
from cms.toolbar.items import ModalItem
from djangocms_helper.utils import create_... | bsd-2-clause | Python |
8970c3a77db3de0a0036ea6e1dd53ab37d54ac00 | fix migration to not depend on model.meta. | openspending/spendb,pudo/spendb,johnjohndoe/spendb,pudo/spendb,spendb/spendb,USStateDept/FPA_Core,pudo/spendb,USStateDept/FPA_Core,nathanhilbert/FPA_Core,johnjohndoe/spendb,CivicVision/datahub,nathanhilbert/FPA_Core,openspending/spendb,spendb/spendb,johnjohndoe/spendb,CivicVision/datahub,USStateDept/FPA_Core,CivicVisio... | migration/versions/003_sources.py | migration/versions/003_sources.py | from datetime import datetime
from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
dataset = Table('dataset', meta, autoload=True)
account = Table('account', meta, autoload=True)
source_table = Table('source', meta,
Column(... | from datetime import datetime
from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
dataset = Table('dataset', meta, autoload=True)
account = Table('account', meta, autoload=True)
source_table = Table('source', meta,
db.Colu... | agpl-3.0 | Python |
460425e32bbbe5e0d117a81661ff83a49204170a | Update P02_deleteBigFiles moved debug line and added uncomment line | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | # It’s not uncommon for a few unneeded but humongous files or folders to take up the
# bulk of the space on your hard drive. If you’re trying to free up room on your
# computer, you’ll get the most bang for your buck by deleting the most massive of
# the unwanted files. But first you have to find them.
#
# Write a prog... | # It’s not uncommon for a few unneeded but humongous files or folders to take up the
# bulk of the space on your hard drive. If you’re trying to free up room on your
# computer, you’ll get the most bang for your buck by deleting the most massive of
# the unwanted files. But first you have to find them.
#
# Write a prog... | mit | Python |
3d96b93242d33ad6ad014afe7d216bb1dbe4f2fa | Change filter to use tab delimiter | Duke-GCB/TrackHubGenerator,Duke-GCB/TrackHubGenerator | bin/filter.py | bin/filter.py | #!/usr/bin/env python
import sys
import argparse
import csv
def filter_scores(input, output, threshhold=0.0, source_index=3):
"""
Filters a predictions bed file by returning only rows where the score is
above the threshold
:param input: An input stream or open file
:param output: An output stream... | #!/usr/bin/env python
import sys
import argparse
import csv
def filter_scores(input, output, threshhold=0.0, source_index=3):
"""
Filters a predictions bed file by returning only rows where the score is
above the threshold
:param input: An input stream or open file
:param output: An output stream... | mit | Python |
a1bf9deac445cf08658180ed41e0c5238d2a0c28 | 更新 modules main/__init__.py, 修正 PEP8 警告 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/main/__init__.py | commonrepo/main/__init__.py | default_app_config = 'commonrepo.main.apps.MainAppConfig'
| default_app_config = 'commonrepo.main.apps.MainAppConfig' | apache-2.0 | Python |
ec972881c957ccf4135ecf8a32c7943f6ea7622e | make iwatch script 2/3 fiendly | rciorba/misc,rciorba/misc,rciorba/misc,rciorba/misc,rciorba/misc | bin/iwatch.py | bin/iwatch.py | #!python
from __future__ import print_function
import sys
from os import path
from inotify import adapters, constants
import six
def wait_for_dir(watched_path):
watched_path = six.binary_type(watched_path.encode('utf-8'))
i = adapters.InotifyTree(watched_path, mask=constants.IN_CLOSE_WRITE)
for event in ... | #!python
import sys
from os import path
from inotify import adapters, constants
def wait_for_dir(watched_path):
i = adapters.InotifyTree(watched_path, mask=constants.IN_CLOSE_WRITE)
for event in i.event_gen():
if event is not None:
filename = path.basename(event[3])
if filenam... | unlicense | Python |
b1cd20adf0b76f8038308ad76416b2c1330bd29d | change image type to front cover | rpetti/scripts,rpetti/scripts,rpetti/scripts | bin/yt-mp3.py | bin/yt-mp3.py | #!/usr/bin/python
import json
import tempfile
import subprocess
import re
import os
import shutil
import sys
from pprint import pprint
mypwd = os.getcwd()
tempdir = tempfile.mkdtemp()
os.chdir(tempdir)
#TODO change to variable
url=sys.argv[1]
json_data = subprocess.check_output(["youtube-dl","-j",url])
metadata = j... | #!/usr/bin/python
import json
import tempfile
import subprocess
import re
import os
import shutil
import sys
from pprint import pprint
mypwd = os.getcwd()
tempdir = tempfile.mkdtemp()
os.chdir(tempdir)
#TODO change to variable
url=sys.argv[1]
json_data = subprocess.check_output(["youtube-dl","-j",url])
metadata = j... | mit | Python |
a28f2a481220c71b18d80fa9993074708af7cbda | make black | nschloe/matplotlib2tikz,m-rossi/matplotlib2tikz | test/test_contourf.py | test/test_contourf.py | # -*- coding: utf-8 -*-
#
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import multivariate_normal
from helpers import assert_equality
def plot():
mean = np.array([1, 1])
cov = np.eye(2)
nbins = 5
fig = plt.figure()
ax = plt.gca()
x_max = 2
x_min = 0
y_max = 2
... | # -*- coding: utf-8 -*-
#
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import multivariate_normal
from helpers import assert_equality
def plot():
mean = np.array([1, 1])
cov = np.eye(2)
nbins = 5
fig = plt.figure()
ax = plt.gca()
x_max = 2
x_min = 0
y_max = 2
... | mit | Python |
bef9fb7f778666e602bfc5b27a65888f7459d0f9 | Add a custom save() method to CommentForm | andreagrandi/bloggato,andreagrandi/bloggato | blog/forms.py | blog/forms.py | from .models import BlogPost, BlogComment
from django.forms import ModelForm
class BlogPostForm(ModelForm):
class Meta:
model = BlogPost
exclude = ('user',)
def save(self, user, commit=True):
post = super(BlogPostForm, self).save(commit=False)
post.user = user
if commi... | from .models import BlogPost, BlogComment
from django.forms import ModelForm
class BlogPostForm(ModelForm):
class Meta:
model = BlogPost
exclude = ('user',)
def save(self, user, commit=True):
post = super(BlogPostForm, self).save(commit=False)
post.user = user
if commi... | mit | Python |
19e537f7185581ce696dfc68565fe62d0232c3fe | Allow full diff when test fails | gpodder/podcastparser | test_podcastparser.py | test_podcastparser.py | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | # -*- coding: utf-8 -*-
#
# test_podcastparser: Test Runner for the podcastparser (2012-12-29)
# Copyright (c) 2012, 2013, 2014, Thomas Perl <m@thp.io>
# Copyright (c) 2013, Stefan Kögl <stefan@skoegl.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is here... | isc | Python |
2c376ce046ba5932b280e3555f07447f7dabf585 | Improve test app | EDITD/queue_util | tests/test_app/app.py | tests/test_app/app.py | #!env python
import sys
import time
from threading import Thread
from queue_util import Consumer, Producer
MAX_RUN_TIME = 120.0
def main(rabbit_queue_name, rabbit_host='127.0.0.1', rabbit_port=5672):
messages = [i for i in range(42, 690)]
producer = Producer(
rabbit_queue_name,
rabbit_ho... | #!env python
import sys
import time
from threading import Thread
from queue_util import Consumer, Producer
MAX_RUN_TIME = 180.0
def main(rabbit_queue_name, rabbit_host='127.0.0.1', rabbit_port=5672):
messages = [i for i in range(42, 690)]
producer = Producer(
rabbit_queue_name,
rabbit_ho... | mit | Python |
61b18c988979f6a28023f3300d274bf3b7a8278d | Make test info url pass | pytube/pytube | tests/test_extract.py | tests/test_extract.py | # -*- coding: utf-8 -*-
"""Unit tests for the :module:`extract <extract>` module."""
from pytube import extract
def test_extract_video_id():
url = 'https://www.youtube.com/watch?v=9bZkp7q19f0'
video_id = extract.video_id(url)
assert video_id == '9bZkp7q19f0'
def test_extract_watch_url():
video_id = ... | # -*- coding: utf-8 -*-
"""Unit tests for the :module:`extract <extract>` module."""
from pytube import extract
def test_extract_video_id():
url = 'https://www.youtube.com/watch?v=9bZkp7q19f0'
video_id = extract.video_id(url)
assert video_id == '9bZkp7q19f0'
def test_extract_watch_url():
video_id = ... | unlicense | Python |
23c81e358ac103397807d85bf653191fd4c55525 | add option for appdrawer | Archman/felapps,Archman/felapps,Archman/felapps | tests/test_felapps.py | tests/test_felapps.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test script for felapps package
# Tong Zhang, 2015-10-03
#
import felapps
import sys
def testApp(appname=None):
if appname == 'imageviewer':
felapps.imageviewer.run(maximize=True, logon=False, debug=True)
elif appname == 'felformula':
felapps.... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test script for felapps package
# Tong Zhang, 2015-10-03
#
import felapps
import sys
def testApp(appname=None):
if appname == 'imageviewer':
felapps.imageviewer.run(maximize=True, logon=False, debug=True)
elif appname == 'felformula':
felapps.... | mit | Python |
e3e65e3c1fea3cc23a2866d4c087215f4253eaf1 | test mosaic quads | planetlabs/planet-client-python,planetlabs/planet-client-python | tests/test_mosaics.py | tests/test_mosaics.py | # Copyright 2015 Planet Labs, 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 2015 Planet Labs, 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 |
1ffbcd5ba5d6f49b317d08200fbfe6a717e3bfe4 | Test plugin settings | 5monkeys/content-io | tests/test_plugins.py | tests/test_plugins.py | import cio
from cio.conf import settings
from cio.plugins import plugins
from cio.backends import storage
from cio.plugins.exceptions import UnknownPlugin
from cio.plugins.txt import TextPlugin
from tests import BaseTest
class PluginTest(BaseTest):
def test_resolve_plugin(self):
with self.assertRaises(Un... | import cio
from cio.conf import settings
from cio.plugins import plugins
from cio.backends import storage
from cio.plugins.exceptions import UnknownPlugin
from cio.plugins.txt import TextPlugin
from tests import BaseTest
class PluginTest(BaseTest):
def test_resolve_plugin(self):
with self.assertRaises(Un... | bsd-3-clause | Python |
5d6bc9a9eec2927d31925e52acf519d5c9b26081 | add doc | OceanPARCELS/parcels,OceanPARCELS/parcels | tests/test_scripts.py | tests/test_scripts.py | from parcels import (FieldSet, ParticleSet, JITParticle, AdvectionRK4,
plotTrajectoriesFile)
from datetime import timedelta as delta
import numpy as np
import pytest
from os import path
from parcels.tools.loggers import logger
import sys
def create_outputfiles(dir):
datafile = path.join(path.... | from parcels import (FieldSet, ParticleSet, JITParticle, AdvectionRK4,
plotTrajectoriesFile)
from datetime import timedelta as delta
import numpy as np
import pytest
from os import path
import sys
def create_outputfiles(dir):
datafile = path.join(path.dirname(__file__), 'test_data', 'testfiel... | mit | Python |
6f0ee3dc8eac3092764311a79954fbf4fddb8ef5 | Improve CLI-testing. | seblin/shcol | testsuite/test_cli.py | testsuite/test_cli.py | import shcol
import sys
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
DUMMY_ITEM = 'spam'
class ArgumentParserTest(unittest.TestCase):
def setUp(self):
self.parser = shcol.cli.ArgumentParser('shcol', shcol.__version__)
def _get_stderr_output(s... | import shcol
import sys
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class ArgumentParserTest(unittest.TestCase):
def setUp(self):
self.parser = shcol.cli.ArgumentParser('shcol', shcol.__version__)
def _get_stderr_output(self, args):
o... | bsd-2-clause | Python |
e5131b0abdd7ac81d388f0b36842a046f2e9e659 | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
77b71e8bc9c68a5c0e084529c47b4983b0e86018 | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
3559e569ad81969ae47759560ef639e3c900a8e1 | remove unused import | ARM-software/lisa,credp/lisa,credp/lisa,credp/lisa,ARM-software/lisa,ARM-software/lisa,ARM-software/lisa,credp/lisa | tools/get_sd_flags.py | tools/get_sd_flags.py | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, Arm Limited and contributors.
#
# 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/li... | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, Arm Limited and contributors.
#
# 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/li... | apache-2.0 | Python |
c7a498193b9f53bd97a5519646a2447f6a7f5fe5 | fix site | JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn | src/sitemap.py | src/sitemap.py | from os import path
from jinja2 import Environment
from jinja2.loaders import FileSystemLoader
root_folder_path = path.dirname(path.dirname(__file__))
def generate_sitemap(urls):
sitemap_content = _generate_sitemap_content(urls)
with open(path.join(root_folder_path, 'build', 'sitemap.xml'), 'w') as sitemap_... | from os import path
from jinja2 import Environment
from jinja2.loaders import FileSystemLoader
root_folder_path = path.dirname(path.dirname(__file__))
def generate_sitemap(urls):
sitemap_content = _generate_sitemap_content(urls)
with open(path.join(root_folder_path, 'build', 'sitemap.xml'), 'w') as sitemap_... | apache-2.0 | Python |
f8de9446aad4bc9de77d3be5ad1b9c6c68fc6951 | Fix @mock.patch decorator | indirectlylit/kolibri,learningequality/kolibri,mrpau/kolibri,mrpau/kolibri,indirectlylit/kolibri,mrpau/kolibri,mrpau/kolibri,learningequality/kolibri,learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri | kolibri/core/auth/test/test_utils.py | kolibri/core/auth/test/test_utils.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import uuid
import mock
from django.core.management.base import CommandError
from django.test import TestCase
from ..models import Facility
from kolibri.core.auth.management import utils
class GetFa... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import uuid
import mock
from django.core.management.base import CommandError
from django.test import TestCase
from ..models import Facility
from kolibri.core.auth.management import utils
class GetFa... | mit | Python |
74117037d13143746c1a2006360ff7775b8dbea2 | Make modules uninstallable | OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_stock_account/__openerp__.py | l10n_br_stock_account/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization WMS Accounting',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website'... | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization WMS Accounting',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website'... | agpl-3.0 | Python |
4fe01965407dbbbba24adf71f8b589813b6f494e | fix flag cnt | Nic30/HWToolkit | hwt/serializer/serializer_filter.py | hwt/serializer/serializer_filter.py | from hwt.synthesizer.unit import Unit
from hwt.serializer.mode import _serializeExclude_eval
from typing import Optional, Tuple
class SerializerFilter(object):
"""
Base class for filters used to exclude some Unit instances from
target HDL (in order to prevent code duplication, archetype colisions etc.)
... | from hwt.synthesizer.unit import Unit
from hwt.serializer.mode import _serializeExclude_eval
from typing import Optional, Tuple
class SerializerFilter(object):
"""
Base class for filters used to exclude some Unit instances from
target HDL (in order to prevent code duplication, archetype colisions etc.)
... | mit | Python |
c8a58373d0e4ca1dcaf93bfb39d732643f00b7b9 | add unit tests for content views | mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea | ichnaea/content/tests/test_views.py | ichnaea/content/tests/test_views.py | from pyramid.testing import DummyRequest
from pyramid.testing import setUp
from pyramid.testing import tearDown
from unittest2 import TestCase
from webtest import TestApp
from ichnaea import main
def _make_app():
wsgiapp = main({}, database='sqlite://')
return TestApp(wsgiapp)
class TestContentViews(TestCa... | from unittest2 import TestCase
from webtest import TestApp
from ichnaea import main
def _make_app():
wsgiapp = main({}, database='sqlite://')
return TestApp(wsgiapp)
class TestContentViews(TestCase):
def test_homepage(self):
app = _make_app()
app.get('/', status=200)
def test_map(... | apache-2.0 | Python |
0c55d91e3683b0aa80ef3a42a15683377dadabf0 | use prob to filter | shanzi/detie | detie/bayes.py | detie/bayes.py | from nltk.classify import PositiveNaiveBayesClassifier
from detie.data import PickleData, DictData
def features(words):
return {char: True for char in words}
def train(spam_words, unlabeled_words):
spams = list(map(features, spam_words))
unlabeled = list(map(features, unlabeled_words))
model = Posi... | from nltk.classify import PositiveNaiveBayesClassifier
from detie.data import PickleData, DictData
def features(words):
return {char: True for char in words}
def train(spam_words, unlabeled_words):
spams = list(map(features, spam_words))
unlabeled = list(map(features, unlabeled_words))
model = Posi... | bsd-3-clause | Python |
2db8704a6967377f1cae4c1433cc369a66ed098d | bump reported version number | Khan/git-bigfile | gitbigfile/__init__.py | gitbigfile/__init__.py | """
gitbigfile package
Copyright (c) 2012-2013 Benjamin Bertrand
See LICENSE for more details
"""
__version__ = '0.3.1'
__author__ = 'modified by Khan Academy, original Benjamin Bertrand'
__license__ = 'MIT'
| """
gitbigfile package
Copyright (c) 2012-2013 Benjamin Bertrand
See LICENSE for more details
"""
__version__ = '0.1.2'
__author__ = 'Benjamin Bertrand'
__license__ = 'MIT'
| mit | Python |
0ff76293fa070f162df4358bea3b7a4b7019a2ee | Remove unneccessary methods from clause | j0gurt/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,AleksN... | src/ggrc/models/clause.py | src/ggrc/models/clause.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from sqlalchemy.orm import validates
from ggrc import db
from ggrc.models.except... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from sqlalchemy.orm import validates
from ggrc import db
from ggrc.models.except... | apache-2.0 | Python |
9b53985d17e258e76f2a2e1b1c0e4b9bcc16dabe | print python version when testing | tsadm/webapp,tsadm/webapp | src/tsadm/tests/__init__.py | src/tsadm/tests/__init__.py | import sys
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.contrib.auth.models import User
print(sys.version, file=sys.stderr)
class TSAdmTestBase(TestCase):
def setUp(self):
self.user = User.objects.create_user(username='tester')
self.client.force_login(s... | from django.core.urlresolvers import reverse
from django.test import TestCase
from django.contrib.auth.models import User
class TSAdmTestBase(TestCase):
def setUp(self):
self.user = User.objects.create_user(username='tester')
self.client.force_login(self.user)
def getURL(self, urlTag, kwargs=N... | bsd-3-clause | Python |
78be804dd97d39e7ca9b3189f8dfe5b8ec182195 | Use warnings package to add software warnings. | Tanner/twttr | parser.py | parser.py | #! /usr/bin/env python
import re
import sys
import warnings
class Instruction:
"""Class that represents a twttr instruction."""
def __init__(self, instruction):
match = re.match(r"([a-zA-Z]+): (.*)", instruction)
if match == None:
raise ValueError('Instruction is not valid format of "author: status"')
s... | #! /usr/bin/env python
import re
import sys
class Instruction:
"""Class that represents a twttr instruction."""
def __init__(self, instruction):
match = re.match(r"([a-zA-Z]+): (.*)", instruction)
if match == None:
raise ValueError('Instruction is not valid format of "author: status"')
self.author = mat... | mit | Python |
34072121b9fc6d1b0ec740cb3d22034971ef0141 | Convert to simpler search form | datagutten/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,klette/comics | comics/search/urls.py | comics/search/urls.py | from django.conf.urls.defaults import *
from haystack.views import SearchView
from haystack.forms import SearchForm
urlpatterns = patterns('',
url(r'^$', SearchView(form_class=SearchForm), name='haystack_search'),
)
| from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^', include('haystack.urls')),
)
| agpl-3.0 | Python |
d0985fa59782bc264e07896b2fec1d1dcf97b950 | update und basis | CoderDojoPotsdam/Defend,CoderDojoPotsdam/Defend | player.py | player.py | class Player(object):
pass
| mit | Python | |
0ee5d308454aaba3c94b1c9923e911653ffff85e | change halo params | adrn/gala,adrn/gary,adrn/gala,adrn/gary,adrn/gary,adrn/gala | streamteam/potential/apw.py | streamteam/potential/apw.py | # coding: utf-8
""" Potential used in Price-Whelan et al. (in prep.) TODO """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import numpy as np
from astropy import log as logger
import astropy.units as u
# Project
from ... | # coding: utf-8
""" Potential used in Price-Whelan et al. (in prep.) TODO """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import numpy as np
from astropy import log as logger
import astropy.units as u
# Project
from ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.