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 |
|---|---|---|---|---|---|---|---|---|
f0b2d3f622fa73020c7eccf435f544955d17453f | change immuttable arguments | xrg/openerp-server,xrg/openerp-server | bin/addons/base/ir/ir_board.py | bin/addons/base/ir/ir_board.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 | Python |
0284ab8ce97b2df7eecd41a8e1d622d035bd0142 | add more labels | OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic | ogusa/constants.py | ogusa/constants.py | VAR_LABELS = {'Y': 'GDP ($Y_t$)', 'C': 'Consumption ($C_t$)',
'L': 'Labor ($L_t$)', 'G': 'Government Expenditures',
'T_H': 'Lump sum transfers',
'B': 'Wealth ($B_t$)', 'I_total': 'Investment ($I_t$)',
'K': 'Capital Stock ($K_t$)',
'K_d': 'Domesticall... | VAR_LABELS = {'Y': 'GDP ($Y_t$)', 'C': 'Consumption ($C_t$)',
'K': 'Capital Stock ($K_t$)', 'L': 'Labor ($L_t$)',
'nssmat': 'Labor Supply', 'n_mat': 'Labor Supply'}
ToGDP_LABELS = {'D': 'Debt-to-GDP ($D_{t}/Y_t$)'}
| mit | Python |
10a9c56c52d43e650c3aae3553d6a9eff1891529 | drop blank lines | xmindltd/xmind-sdk-python,codeskyblue/xmind-sdk-python,paladin74/xmind-sdk-python,kjherold/xmind-sdk-python,nacerix/xmind-sdk-python | example.py | example.py | #-*- coding: utf-8 -*-
import xmind
from xmind.core import workbook,saver
from xmind.core.topic import TopicElement
w = xmind.load("test.xmind") # load an existing file or create a new workbook if nothing is found
s1=w.getPrimarySheet() # get the first sheet
s1.setTitle("first sheet") # set its title
r1=s1.getRootTop... | #-*- coding: utf-8 -*-
import xmind
from xmind.core import workbook,saver
from xmind.core.topic import TopicElement
w = xmind.load("test.xmind") # load an existing file or create a new workbook if nothing is found
s1=w.getPrimarySheet() # get the first sheet
s1.setTitle("first sheet") # set its title
r1=s1.getRootTop... | mit | Python |
7d556a01371c532a3cc80ea413220b3a9e6c561b | Use a different BASE_URL when testing locally | Socialsquare/RunningCause,Socialsquare/RunningCause,Socialsquare/RunningCause,Socialsquare/RunningCause | RunningCause/settings/local.py | RunningCause/settings/local.py | from .base import *
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'kraen@socialsquare.dk'
EMAIL_HOST_PASSWORD = 'jxzfqgdifixeirhy'
SECRET_KEY = 'you-will-never-guess-this'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CACHES = {
... | from .base import *
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'kraen@socialsquare.dk'
EMAIL_HOST_PASSWORD = 'jxzfqgdifixeirhy'
SECRET_KEY = 'you-will-never-guess-this'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CACHES = {
... | mit | Python |
c2d4c4cc91cc907d7ad1afc67f2369c92eeb9972 | add option to profile | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | corehq/apps/app_manager/management/commands/benchmark_direct_ccz.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.management.commands.benchmark_build_times import Timer
f... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.management.commands.benchmark_build_times import Timer
f... | bsd-3-clause | Python |
15e36fc2b33284f4de41ff5e50a03212e1eb14bb | improve check for deleted domain | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/cleanup/management/commands/delete_es_docs_in_domain.py | corehq/apps/cleanup/management/commands/delete_es_docs_in_domain.py | import sys
from django.core.management import BaseCommand
from corehq.apps.domain.models import Domain
from corehq.apps.es import AppES, CaseES, CaseSearchES, FormES, GroupES, UserES
from corehq.apps.es.registry import registry_entry
from corehq.apps.es.transient_util import doc_adapter_from_info
class Command(Base... | import sys
from django.core.management import BaseCommand
from corehq.apps.domain.models import Domain
from corehq.apps.es import AppES, CaseES, CaseSearchES, FormES, GroupES, UserES
from corehq.apps.es.registry import registry_entry
from corehq.apps.es.transient_util import doc_adapter_from_info
class Command(Base... | bsd-3-clause | Python |
a8cd6ae38eb23961fed0125bcf5472feaf78d85a | Remove unneed @Inject, unnecessary complicated logic | google/dpy | example.py | example.py | #!/usr/bin/python
#
# This example run a simple webserver that isolate the parameter injection out
# of the actual logic. The real logic method Hello is not depending on any of
# the handler logic and hence it can be easily tested.
#
# To test the example, try link:
# http://localhost:8000/?greet=Greeting&user=My%20F... | #!/usr/bin/python
#
# This example run a simple webserver that isolate the parameter injection out
# of the actual logic. The real logic method Hello is not depending on any of
# the handler logic and hence it can be easily tested.
#
# To test the example, try link:
# http://localhost:8000/Hello?greet=Greeting&user=M... | mit | Python |
9f363aee856b46570707af844092126dfa6ecf1e | Use the best model from the leader board in the prediction web app. | bzamecnik/ml,bzamecnik/ml-playground,bzamecnik/ml,bzamecnik/ml-playground,bzamecnik/ml | instrument-classification/predict_webapp.py | instrument-classification/predict_webapp.py | from flask import Flask, redirect, render_template, request
from gevent.wsgi import WSGIServer
from predict import InstrumentClassifier
from leaderboard import LeaderBoard
app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 1 * 2**20
model_dir = 'data/working/single-notes-2000/models'
model_id = LeaderBoard(mod... | from flask import Flask, redirect, render_template, request
from gevent.wsgi import WSGIServer
from predict import InstrumentClassifier
app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 1 * 2**20
model = InstrumentClassifier(model_dir='data/working/single-notes-2000/model')
@app.route('/')
def hello():
r... | mit | Python |
966b7800ea4817efb37e00a0be29c376fa8a7113 | Make modules uninstallable | OCA/l10n-switzerland,OCA/l10n-switzerland | l10n_ch_base_bank/__manifest__.py | l10n_ch_base_bank/__manifest__.py | # Copyright 2012-2017 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{'name': 'Switzerland - Bank type',
'summary': 'Types and number validation for swiss electronic pmnt. DTA, ESR',
'version': '11.0.1.1.0',
'author': "Camptocamp,Odoo Community Association (OCA)",
'category': 'Localizat... | # Copyright 2012-2017 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{'name': 'Switzerland - Bank type',
'summary': 'Types and number validation for swiss electronic pmnt. DTA, ESR',
'version': '11.0.1.1.0',
'author': "Camptocamp,Odoo Community Association (OCA)",
'category': 'Localizat... | agpl-3.0 | Python |
7f538d4a165a60f3af702b19f473a2bb04f5d3ac | update example.py | Lh4cKg/simple-geolang-toolkit | example.py | example.py | #!/usr/bin/env python
# -*- coding: utf-8 -*
import geolang as _ka
K2L = _ka.KA2LAT
L2K = _ka.LAT2KA
U2T = _ka.UNI2LAT
_2KA = _ka._2KA
_2LAT = _ka._2LAT
encode_slugify = _ka.encode_slugify
# print(K2L)
# print(L2K)
# print(U2T)
_try_2ka = "I Love You Python And Django"
"""
>>> _try_2ka = "I Love You Python And Dj... | import geolang as _ka
encode_slugify = _ka.encode_slugify
K2L = _ka.KA2LAT
print(encode_slugify("მე\'მიყვარს-ანი და ის/ჩემი ცხოვბრებაა! ჩ"))
print(K2L) | mit | Python |
08ed63a50de1a74309d89909f621f6e8f77aa9e1 | replace rcapache2 with service to appease systemd | pietsch/oval,pietsch/oval,pietsch/oval | fabfile.py | fabfile.py | import os
from fabric.api import *
#: The user to use for the remote commands
user = 'root'
#: The machine(s) where the application will be deployed
hosts = ['129.70.43.31']
#: The remote installation directory
install_dir = '/var/www/wsgi-scripts/'
env.user = user
env.hosts = hosts
def deploy():
local('COPYFIL... | import os
from fabric.api import *
#: The user to use for the remote commands
user = 'root'
#: The machine(s) where the application will be deployed
hosts = ['129.70.12.31']
#: The remote installation directory
install_dir = '/var/www/wsgi-scripts/'
env.user = user
env.hosts = hosts
def deploy():
local('COPYFIL... | bsd-3-clause | Python |
25b56a4bb7c5937671a509aa92b9fd28d972bff9 | Use pip2pi, not dir2pi for deploys | istresearch/traptor,istresearch/traptor | fabfile.py | fabfile.py | from fabric.api import *
"""
Overview
========
This fabric file automates the process of pip packaging and
deploying your new pip package to our private pip repository.
Requirements
------------
- Must have fabric installed via `pip install fabric`
- Must have your setup.py working ... | from fabric.api import *
"""
Overview
========
This fabric file automates the process of pip packaging and
deploying your new pip package to our private pip repository.
Requirements
------------
- Must have fabric installed via `pip install fabric`
- Must have your setup.py working ... | mit | Python |
c294cfff7c43ba30fdf558d86ae652ef48d6a687 | Update fabfile | John-Lin/pigrelay | fabfile.py | fabfile.py | from fabric.api import task, local
@task
def snort_unsock():
local('snort -i em1 -A unsock -l /tmp -c /etc/snort/etc/snort.conf')
@task
def snort_console():
local('snort -i em1 -c /etc/snort/etc/snort.conf -A console')
@task
def pigrelay():
local('python pigrelay.py &')
@task
def hpigrelay_start():
... | from fabric.api import task, local
@task
def snort_unsock():
local('snort -i em1 -A unsock -l /tmp -c /etc/snort/etc/snort.conf')
@task
def snort_console():
local('snort -i em1 -c /etc/snort/etc/snort.conf -A console')
@task
def pigrelay():
local('python pigrelay.py &')
@task
def hpigrelay():
lo... | apache-2.0 | Python |
84e0d8297e0f66ad22d48cd3e62e2f08d3417770 | update fabfile | h1ds/h1ds,h1ds/h1ds,h1ds/h1ds,h1ds/h1ds,h1ds/h1ds,h1ds/h1ds | fabfile.py | fabfile.py | """Fabric scripts.
Require mkvirtualenv to be installed on all machines and to be run in,
and WORKON_HOME defined in .bash_profile.
"""
from __future__ import with_statement
import os
from fabric.api import *
env.project = "h1ds"
env.git_url = "git@code.h1svr.anu.edu.au:h1ds/h1ds.git"
def dev():
"""localhost... | """Fabric scripts.
Require mkvirtualenv to be installed on all machines and to be run in,
and WORKON_HOME defined in .bash_profile.
"""
from __future__ import with_statement
import os
from fabric.api import *
env.project = "h1ds"
env.git_url = "git@code.h1svr.anu.edu.au:h1ds/h1ds.git"
def dev():
"""localhost... | mit | Python |
f3e9393ef59854e67a6d7f15d32d87f563ec1830 | Update station.py | elailai94/EasyTicket | Source-Code/Station/station.py | Source-Code/Station/station.py | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.2 16/04/2015
#==============================================================================
# Station module (sta... | #==============================================================================
# EasyTicket
#
# @description: Module for providing methods to work with Station objects
# @author: Elisha Lai
# @version: 1.2 16/04/2015
#==============================================================================
# Station module (sta... | mit | Python |
5a1134a72a142304999490ea8963d93619416fe8 | Fix warnings from previous script. | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | fabfile.py | fabfile.py | from fabric.api import cd, run
ACTIVATE_ENV = '. env/bin/activate'
REMOTE_PROJECT_DIR = '/home/chathan/chmvh-website'
required_packages = (
'git',
'libjpeg-dev',
'libpq-dev',
'postgresql', 'postgresql-contrib',
'nginx',
'python3-dev', 'python3-pip',
'zlib1g-dev',
)
def configure_gunicor... | from fabric.api import cd, run
ACTIVATE_ENV = '. env/bin/activate'
REMOTE_PROJECT_DIR = '/home/chathan/chmvh-website'
required_packages = (
'git',
'libjpeg-dev',
'libpq-dev',
'postgresql', 'postgresql-contrib',
'nginx',
'python3-dev', 'python3-pip',
'zlib1g-dev',
)
def configure_gunicor... | mit | Python |
d9734d354d214f9d4fa0e5666d8cd362c3a780d3 | update fabfile | summerAI/serapis | fabfile.py | fabfile.py | """
Steps:
-get the summer.ai.pem key
-login to the env.host machine and add your public key to the machine's authorized keys
http://www.perrygeo.com/running-python-with-compiled-code-on-aws-lambda.html
"""
from fabric.api import *
import time
# the user to use for the remote commands
env.user = 'ec2-user'
# the ser... | """
Steps:
-get the summer.ai.pem key
-login to the env.host machine and add your public key to the machine's authorized keys
-make sure you have '
http://www.perrygeo.com/running-python-with-compiled-code-on-aws-lambda.html
"""
from fabric.api import *
import time
# the user to use for the remote commands
env.user ... | mit | Python |
7499942a0b0cb21acc6e31cde3678cdda66519b6 | Bump version to 0.0.4 | eliangcs/dache | dache/__init__.py | dache/__init__.py | import six
from six.moves.urllib.parse import urlparse
from dache.backends.base import CacheKeyWarning # noqa
from dache.utils.module_loading import import_string
__version__ = '0.0.4'
__all__ = ('register_backend', 'Cache', 'CacheKeyWarning')
_BACKENDS = {
'file': 'dache.backends.filebased.FileBasedCache',... | import six
from six.moves.urllib.parse import urlparse
from dache.backends.base import CacheKeyWarning # noqa
from dache.utils.module_loading import import_string
__version__ = '0.0.3'
__all__ = ('register_backend', 'Cache', 'CacheKeyWarning')
_BACKENDS = {
'file': 'dache.backends.filebased.FileBasedCache',... | bsd-3-clause | Python |
f0ba3ac7024cd70b7047c6c7f0c4476a4aa644fa | Remove mistakenly passed dataset argument | tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io | tensorflow_io/lmdb/python/kernel_tests/lmdb_dataset_ops_test.py | tensorflow_io/lmdb/python/kernel_tests/lmdb_dataset_ops_test.py | # Copyright 2019 The TensorFlow 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 applic... | # Copyright 2019 The TensorFlow 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 applic... | apache-2.0 | Python |
39b5b7ece92fe3b4cdf4683ee6b315d2479a4876 | correct dump file | previtus/MGR-Project-Code,previtus/MGR-Project-Code,previtus/MGR-Project-Code | Settings/test_symbolic_links.py | Settings/test_symbolic_links.py | def Setup(Settings,DefaultModel):
# test_symbolic_links.py
Settings["experiment_name"] = "testtesttest_symbolic_links"
Settings["graph_histories"] = ['together']
n=0
Settings["models"][n]["model_type"] = 'simple_cnn_with_top'
Settings["models"][n]["dataset_name"] = "5556x_markable_640x640... | def Setup(Settings,DefaultModel):
# test_symbolic_links.py
Settings["experiment_name"] = "testtesttest_symbolic_links"
Settings["graph_histories"] = ['together']
n=0
Settings["models"][n]["model_type"] = 'simple_cnn_with_top'
Settings["models"][n]["dataset_name"] = "5556x_markable_640x640... | mit | Python |
1e2b8068d0262f67c576ba6a3ddefc6c7e863150 | Fix typo in comments | carlpett/salt-vault,cldmnky/salt-vault | _modules/vault.py | _modules/vault.py | # -*- coding: utf-8 -*-
'''
:maintainer: Calle Pettersson <cpettsson@gmail.com>
:maturity: new
:depends: python-requests
:platform: all
Interact with Hashicorp Vault
'''
import logging
import salt.crypt
import salt.exceptions
log = logging.getLogger(__name__)
def read_secret(path, key=None):
''... | # -*- coding: utf-8 -*-
'''
:maintainer: Calle Pettersson <cpettsson@gmail.com>
:maturity: new
:depends: python-requests
:platform: all
Interact with Hashicorp Vault
'''
import logging
import salt.crypt
import salt.exceptions
log = logging.getLogger(__name__)
def read_secret(path, key=None):
''... | apache-2.0 | Python |
1a433e15699e7812d29278665c0de540cd6866dd | Use Compatibility.string instead of basestring | cevaris/commons,cevaris/commons,abel-von/commons,pombredanne/commons,nkhuyu/commons,Yasumoto/commons,nkhuyu/commons,brutkin/commons,VaybhavSharma/commons,atollena/commons,WCCCEDU/twitter-commons,pombredanne/commons,jsirois/commons,imsut/commons,ericzundel/commons,VaybhavSharma/commons,nkhuyu/commons,abel-von/commons,Ya... | src/python/twitter/pants/targets/util.py | src/python/twitter/pants/targets/util.py | # ==================================================================================================
# Copyright 2013 Foursquare Labs, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... | # ==================================================================================================
# Copyright 2013 Foursquare Labs, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... | apache-2.0 | Python |
5a44392b810800c4440b04aa92a4614e45c12e86 | Fix fake game one script | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...models import (
Transcript, TranscriptPhraseDownvote
)
class Command(BaseCommand):
help = 'Creates random votes for all phrases in a random... | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...models import (
Transcript, TranscriptPhraseDownvote
)
class Command(BaseCommand):
help = 'Creates random votes for all phrases in a random... | mit | Python |
3b5f6eb5a1aa585b37f2b4d38842a4a35bb3a0d0 | Fix mkdir exception when closing the env (#3280) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | activemq_xml/tests/conftest.py | activemq_xml/tests/conftest.py | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import stat
import tarfile
import pytest
from datadog_checks.dev import TempDir, docker_run
from .common import CONFIG, HERE, URL
@pytest.fixture(scope="session", autouse=True)
def dd_environment()... | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import stat
import tarfile
import pytest
from datadog_checks.dev import TempDir, docker_run
from .common import CONFIG, HERE, URL
@pytest.fixture(scope="session", autouse=True)
def dd_environment()... | bsd-3-clause | Python |
b217a6546faa41dba1179bf86b49376f5492cb10 | fix a typo | cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/db-webcrawler,cmu-db/cmdbac | analysis/analyze_repository.py | analysis/analyze_repository.py | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
from utils import filter_repository
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
fro... | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
from utils import filter_repository
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
fro... | apache-2.0 | Python |
6f14394bc7e613526ba88e69ebbb0e82a2f67e07 | remove some now un-necessary grid.get response body hackery | nicko7i/vcnc,nicko7i/vcnc,nicko7i/vcnc,nicko7i/vcnc,nicko7i/vcnc,nicko7i/vcnc,nicko7i/vcnc | api-python/velstor/api/grid.py | api-python/velstor/api/grid.py | import requests
import json
from velstor.api.util import urlencode
from velstor.api.fulfill202 import fulfill202
# grid.py: Operations about grid jobs
def get(session, jobid):
"""Retrieves details about a grid job.
Args:
session (:class:`~velstor.api.session.Session`): Provides security informatio... | import requests
import json
from velstor.api.util import urlencode
from velstor.api.fulfill202 import fulfill202
# grid.py: Operations about grid jobs
def get(session, jobid):
"""Retrieves details about a grid job.
Args:
session (:class:`~velstor.api.session.Session`): Provides security informatio... | apache-2.0 | Python |
451f1ac01b81ee645bef6d831365781f714d4f64 | add thread title length validation | abilian/abilian-sbe,abilian/abilian-sbe,abilian/abilian-sbe,abilian/abilian-sbe,abilian/abilian-sbe | abilian/sbe/apps/forum/forms.py | abilian/sbe/apps/forum/forms.py | # coding=utf-8
"""
"""
from __future__ import absolute_import, print_function, unicode_literals
import bleach
from wtforms import BooleanField, StringField, TextAreaField
from abilian.i18n import _l
from abilian.web.forms import Form, RichTextWidget
from abilian.web.forms.fields import FileField
from abilian.web.form... | # coding=utf-8
"""
"""
from __future__ import absolute_import, print_function, unicode_literals
import bleach
from wtforms import BooleanField, StringField, TextAreaField
from abilian.i18n import _l
from abilian.web.forms import Form, RichTextWidget
from abilian.web.forms.fields import FileField
from abilian.web.form... | lgpl-2.1 | Python |
58d8f75fca9e5fc7e57fdff8d05c9ca108def319 | Bump version to 0.30.3 | thombashi/DataProperty | dataproperty/__version__.py | dataproperty/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright {}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.30.3"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright {}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.30.2"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
7859e87695401c9daab7bfcae6120f2296c74021 | add more example funcs for remote exec verification | alfredodeza/remoto,ceph/remoto | remoto/tests/fake_module.py | remoto/tests/fake_module.py | """
this is just a stub module to use to test the `import_module` functionality in
remoto
"""
import sys
def function(conn):
return True
def fails():
raise Exception('failure from fails() function')
def unexpected_fail():
sys.exit(1)
def noop():
sys.exit(0)
def passes():
pass
| """
this is just a stub module to use to test the `import_module` functionality in
remoto
"""
def function(conn):
return True
| mit | Python |
80c4299e6ceb418ac20998727b3c0bd7356ebfd3 | Change a message | thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons | tko_project_task_actions_assign/models/project_task.py | tko_project_task_actions_assign/models/project_task.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... | agpl-3.0 | Python |
b82e4d079c2ceb2a52ca581e33a6aff884c61454 | Add black2b hash to generate param_id for bfv scheme (#4509) | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | syft/frameworks/torch/he/fv/encryption_params.py | syft/frameworks/torch/he/fv/encryption_params.py | from hashlib import blake2b
class EncryptionParams:
"""A class to hold the encryption parameters for easy access by any component of scheme.
Attribute:
poly_modulus: The polynomial modulus directly affects the number of coefficients in
plaintext polynomials, the size of ciphertext element... | class EncryptionParams:
"""A class to hold the encryption parameters for easy access by any component of scheme.
Attribute:
poly_modulus: The polynomial modulus directly affects the number of coefficients in
plaintext polynomials, the size of ciphertext elements, the computational
... | apache-2.0 | Python |
5363a5b0040383e7b93f783a2bb2dad175fa8f1c | fix create_or_update with no defaults. | python-bonobo/bonobo,python-bonobo/bonobo,hartym/bonobo,hartym/bonobo,hartym/bonobo,python-bonobo/bonobo | bonobo/contrib/django/utils.py | bonobo/contrib/django/utils.py | def create_or_update(model, *, defaults=None, save=True, **kwargs):
"""
Create or update a django model instance.
:param model:
:param defaults:
:param kwargs:
:return: object, created, updated
"""
obj, created = model._default_manager.get_or_create(defaults=defaults, **kwargs)
up... | def create_or_update(model, *, defaults=None, save=True, **kwargs):
"""
Create or update a django model instance.
:param model:
:param defaults:
:param kwargs:
:return: object, created, updated
"""
obj, created = model._default_manager.get_or_create(defaults=defaults, **kwargs)
up... | apache-2.0 | Python |
a754af358a50f0c9901719c6dda4d08217a17b99 | add direction to message | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | unregister/app.py | unregister/app.py | import rapidsms
from rapidsms.apps.base import AppBase
from .models import Blacklist
from django.conf import settings
import re
from rapidsms_httprouter.models import Message
class App (AppBase):
def handle (self, message):
#make sure the message is striped for example we want a user sendingh in "quit" to... | import rapidsms
from rapidsms.apps.base import AppBase
from .models import Blacklist
from django.conf import settings
import re
from rapidsms_httprouter.models import Message
class App (AppBase):
def handle (self, message):
#make sure the message is striped for example we want a user sendingh in "quit" to... | bsd-3-clause | Python |
061e2ac2f3c7f44615c44d4b5fa1438ce6501b9a | use six.add_metaclass for python 2 and 3 | evansde77/pluggage | src/pluggage/factory_plugin.py | src/pluggage/factory_plugin.py | #!/usr/bin/env python
"""
_factory_plugin_
Plugin base class that can be inherited to register
a class with a factory
"""
import six
from .registry import get_factory
from .registry import PluggageMeta
@six.add_metaclass(PluggageMeta)
class PluggagePlugin(object):
"""
_PluggagePlugin_
Inherit from this... | #!/usr/bin/env python
"""
_factory_plugin_
Plugin base class that can be inherited to register
a class with a factory
"""
from .registry import get_factory
from .registry import PluggageMeta
class PluggagePlugin(object):
"""
_PluggagePlugin_
Inherit from this class to trigger registration
with the... | apache-2.0 | Python |
44a579aac0d4e02b9f9bfcf26daacfc839d437ae | increment version | osspeak/osspeak,osspeak/osspeak,osspeak/osspeak | osspeak/version.py | osspeak/version.py | _version = (0, 1, 3)
version = '.'.join(str(n) for n in _version)
release_notes = [
] | _version = (0, 1, 2)
version = '.'.join(str(n) for n in _version)
release_notes = [
] | mit | Python |
61db609636503ddbf304cc974c8d3e6b704c099c | bump version | collab-project/django-require-license,collab-project/django-require-license | require_license/__init__.py | require_license/__init__.py | # Copyright Collab 2015
"""
`django-require-license` application.
"""
#: Application version.
__version__ = (1, 0, 0, 'b2')
def short_version(version=None):
"""
Return short application version.
For example: ``1.0.0``.
:rtype: str
"""
v = version or __version__
return '.'.join([str(x) f... | # Copyright Collab 2015
"""
`django-require-license` application.
"""
#: Application version.
__version__ = (1, 0, 0, 'b1')
def short_version(version=None):
"""
Return short application version.
For example: ``1.0.0``.
:rtype: str
"""
v = version or __version__
return '.'.join([str(x) f... | mit | Python |
b7d11ab90db071d54211f09117d1b57765c933db | Bump jaxlib version to 0.1.35 | google/jax,google/jax,tensorflow/probability,tensorflow/probability,google/jax,google/jax | jaxlib/version.py | jaxlib/version.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
589e71dbc5c9e7fd4bd83c6cbc6d8fab15f134f7 | Fix the uri testserver to run on python3 | thaim/ansible,thaim/ansible | test/integration/targets/uri/files/testserver.py | test/integration/targets/uri/files/testserver.py | import sys
if __name__ == '__main__':
if sys.version_info[0] >= 3:
import http.server
import socketserver
PORT = int(sys.argv[1])
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()
else:
... | import mimetypes
if __name__ == '__main__':
mimetypes.init()
mimetypes.add_type('application/json', '.json')
import SimpleHTTPServer
SimpleHTTPServer.test()
| mit | Python |
6b6c3c75c227e54ecd7b791ca36f02844c9669f7 | debug in ctcf_match.py: take argv[1] as k | yk-tanigawa/QLoop-dev,yk-tanigawa/QLoop-dev,yk-tanigawa/QLoop-dev,yk-tanigawa/QLoop-dev | ctcf_match.py | ctcf_match.py | import sys, string;
def enumerate_substr(sequence, k):
substr = set([]);
for i in range(0, len(sequence) - k + 1):
substr.add(sequence[i: i + k]);
return substr;
def replace_N(str_set):
expanded_set = set([]);
for x in str_set:
npos = x.find('N');
if(npos < 0):
... | import sys, string;
def enumerate_substr(sequence, k):
substr = set([]);
for i in range(0, len(sequence) - k + 1):
substr.add(sequence[i: i + k]);
return substr;
def replace_N(str_set):
expanded_set = set([]);
for x in str_set:
npos = x.find('N');
if(npos < 0):
... | mit | Python |
60b333a4ea50159878f87cf8a3bd48070e724442 | allow domain names with 0-9 in it | desec-io/desec-stack,desec-io/desec-stack,desec-io/desec-stack,desec-io/desec-stack | desecapi/urls.py | desecapi/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from views import *
from rest_framework.urlpatterns import format_suffix_patterns
apiurls = [
url(r'^$', Root.as_view(), name='root'),
url(r'^domains/$', DomainList.as_view(), name='domain-list'),
url(r'^domains/(?P<name>[... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from views import *
from rest_framework.urlpatterns import format_suffix_patterns
apiurls = [
url(r'^$', Root.as_view(), name='root'),
url(r'^domains/$', DomainList.as_view(), name='domain-list'),
url(r'^domains/(?P<name>[... | mit | Python |
90d7c818bb690dafa0dd6c9717353f489f95045c | fix __manifest__ | OCA/l10n-romania,OCA/l10n-romania | l10n_ro_partner_create_by_vat/__manifest__.py | l10n_ro_partner_create_by_vat/__manifest__.py | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Romania - Partner Create by VAT",
"category": "Localization",
"summary": "Romania - Partner Create by VAT",
"depends": ["l10n_ro_config"],
"license": "AGPL-3",
"version": "14.0.1.4.0",
"author": "NextERP Romania... | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Romania - Partner Create by VAT",
"category": "Localization",
"summary": "Romania - Partner Create by VAT",
"depends": ["l10n_ro_config"],
"data": [],
"license": "AGPL-3",
"version": "14.0.1.4.0",
"author": ... | agpl-3.0 | Python |
69dfa0e7e3eb97d6326418e9ac2cfdf430001476 | add symmetry to call_say{,2} and heard/heard2 | hanw/connectal,csail-csg/connectal,cambridgehackers/connectal,csail-csg/connectal,cambridgehackers/connectal,chenm001/connectal,cambridgehackers/connectal,chenm001/connectal,hanw/connectal,chenm001/connectal,csail-csg/connectal,cambridgehackers/connectal,hanw/connectal,cambridgehackers/connectal,hanw/connectal,chenm001... | examples/echopy/testecho.py | examples/echopy/testecho.py | #!/usr/bin/python
# Copyright (c) 2014 Quanta Research Cambridge, Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, ... | #!/usr/bin/python
# Copyright (c) 2014 Quanta Research Cambridge, Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, ... | mit | Python |
2985d2a630eada621430719bede910c035645576 | move Factory.createDatabase into try block | anandology/pyjamas,Hasimir/pyjs,pyjs/pyjs,lancezlin/pyjs,pyjs/pyjs,Hasimir/pyjs,gpitel/pyjs,minghuascode/pyj,anandology/pyjamas,pombredanne/pyjs,gpitel/pyjs,gpitel/pyjs,pombredanne/pyjs,pombredanne/pyjs,spaceone/pyjs,spaceone/pyjs,Hasimir/pyjs,lancezlin/pyjs,minghuascode/pyj,Hasimir/pyjs,pyjs/pyjs,gpitel/pyjs,pombredan... | examples/gears/GearsDemo.py | examples/gears/GearsDemo.py | from pyjamas.gears import Factory
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Grid import Grid
from pyjamas.ui.TextBox import TextBox
from pyjamas.ui.Button import Button
from pyjamas import log
from datetime import Datetime
class DbTest():
def __init__(self):
... | from pyjamas.gears import Factory
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Grid import Grid
from pyjamas.ui.TextBox import TextBox
from pyjamas.ui.Button import Button
from pyjamas import log
from datetime import Datetime
class DbTest():
def __init__(self):
... | apache-2.0 | Python |
77817c27eb3eab4dd3c970b0763b7fa689027175 | put another script behind name==main check | tschmorleiz/amcat,tschmorleiz/amcat,amcat/amcat,amcat/amcat,amcat/amcat,tschmorleiz/amcat,amcat/amcat,amcat/amcat,tschmorleiz/amcat,amcat/amcat,tschmorleiz/amcat | amcat/scripts/article_upload/tmp.py | amcat/scripts/article_upload/tmp.py | #inverting bzk aliases dict
from amcat.scripts.article_upload.bzk_aliases import BZK_ALIASES
if __name__ == '__main__':
new_dict = {}
for entry in BZK_ALIASES.items():
for alias in entry[1]:
new_dict[alias] = entry[0]
print(new_dict)
# WVA: WAAROM STAAT DIT HIER? IS DIT NIET HETZE... | #inverting bzk aliases dict
from amcat.scripts.article_upload.bzk_aliases import BZK_ALIASES
new_dict = {}
for entry in BZK_ALIASES.items():
for alias in entry[1]:
new_dict[alias] = entry[0]
print(new_dict)
| agpl-3.0 | Python |
d18a4e2b2abbfc698d5b4f34d4a6d707442f450e | fix BTC -> MONA | wakiyamap/electrum-mona,wakiyamap/electrum-mona,wakiyamap/electrum-mona,wakiyamap/electrum-mona | lib/i18n.py | lib/i18n.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... | mit | Python |
314a5f46393c4a9e65135130a51b10cc1448c884 | delete all local djcelery tables | chirilo/airmozilla,tannishk/airmozilla,anu7495/airmozilla,ehsan/airmozilla,zofuthan/airmozilla,anjalymehla/airmozilla,mozilla/airmozilla,tannishk/airmozilla,lcamacho/airmozilla,ehsan/airmozilla,lcamacho/airmozilla,mozilla/airmozilla,ehsan/airmozilla,anjalymehla/airmozilla,EricSekyere/airmozilla,blossomica/airmozilla,ch... | airmozilla/base/management/commands/reset-old-djcelery-tables.py | airmozilla/base/management/commands/reset-old-djcelery-tables.py | from django.db.utils import ProgrammingError
from django.core.management.base import BaseCommand
class Command(BaseCommand): # pragma: no cover
"""We USED to have djcelery installed but it was an ancient version.
And we never used it. Because those tables lingering, we can't execute
`./manage.py syncdb` ... | from django.db.utils import ProgrammingError
from django.core.management.base import BaseCommand
class Command(BaseCommand): # pragma: no cover
"""We USED to have djcelery installed but it was an ancient version.
And we never used it. Because those tables lingering, we can't execute
`./manage.py syncdb` ... | bsd-3-clause | Python |
598c3594f5a8acd5992dd273b0d48688e05cb4a2 | Fix _invoke method which wasn't updated to the new primitive interface | smarr/PySOM,SOM-st/PySOM,SOM-st/RTruffleSOM,SOM-st/PySOM,SOM-st/RPySOM,SOM-st/RPySOM,SOM-st/RTruffleSOM,smarr/RTruffleSOM,smarr/PySOM,smarr/RTruffleSOM | src/som/vmobjects/primitive.py | src/som/vmobjects/primitive.py | from som.vmobjects.abstract_object import AbstractObject
class Primitive(AbstractObject):
_immutable_fields_ = ["_invoke", "_is_empty", "_signature", "_holder",
"_universe"]
def __init__(self, signature_string, universe, invoke, is_empty=False):
AbstractObject.__i... | from som.vmobjects.abstract_object import AbstractObject
class Primitive(AbstractObject):
_immutable_fields_ = ["_invoke", "_is_empty", "_signature", "_holder",
"_universe"]
def __init__(self, signature_string, universe, invoke, is_empty=False):
AbstractObject.__in... | mit | Python |
ed5e0c2c11bd658b896ff3765e5bd48955761899 | Clean up in benchmarks/python-graph-bench.py | wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy | graal/edu.uci.python.benchmark/src/benchmarks/python-graph-bench.py | graal/edu.uci.python.benchmark/src/benchmarks/python-graph-bench.py | __author__ = 'zwei'
import sys, os, time
# setup paths
python_graph_path = os.path.join(os.path.dirname(__file__), 'python-graph')
python_graph_core_path = os.path.join(python_graph_path, 'core')
sys.path.append(python_graph_path)
sys.path.append(python_graph_core_path)
import pygraph
from pygraph.algorithms.accessi... | __author__ = 'zwei'
import sys, os, time
# setup paths
python_graph_path = os.path.join(os.path.dirname(__file__), 'python-graph')
python_graph_core_path = os.path.join(python_graph_path, 'core')
sys.path.append(python_graph_path)
sys.path.append(python_graph_core_path)
import pygraph
from pygraph.algorithms.accessi... | bsd-3-clause | Python |
a69b32a20091e4eed427abcc28362615db696d38 | fix bug modified: ch03/quick_sort.py | Mooophy/DMA,Mooophy/DMA | ch03/quick_sort.py | ch03/quick_sort.py | def quick_sort(arr):
"""
:param : arr
:return: sorted arr
:pros : tidy and terse, no write operation on original data, good for multi-threading
:cons : passing by copy, quite high space complexity compared with C.L.R.S way.
"""
if len(arr) < 2:
return arr
pivot = arr[0]
less ... | def quick_sort(arr):
"""
:param : arr
:return: sorted arr
:pros : tidy and terse, no write operation on original data, good for multi-threading
:cons : passing by copy, quite high space complexity compared with C.L.R.S way.
"""
if len(arr) < 2:
return arr
pivot = arr[0]
less ... | mit | Python |
af30dce95e866ffaa4ecc7df29c1b56570cca255 | Update __init__.py | CENDARI/editorsnotes,CENDARI/editorsnotes,CENDARI/editorsnotes,CENDARI/editorsnotes,CENDARI/editorsnotes | editorsnotes/__init__.py | editorsnotes/__init__.py | __version__ = '0.2.1'
VERSION = __version__
| __version__ = '2.0.1'
VERSION = __version__
| agpl-3.0 | Python |
633c03f8779aa3f55f1ac614d70ebc498c3ccb5f | update lattice example to show data attributes | simphony/simphony-mayavi | examples/lattice_example.py | examples/lattice_example.py | from mayavi.scripts import mayavi2
from simphony.cuds.lattice import make_hexagonal_lattice
from simphony.core.cuba import CUBA
lattice = make_hexagonal_lattice('test', 0.1, (5, 4))
temperature = 0.2
for node in lattice.iter_nodes():
node.data[CUBA.TEMPERATURE] = temperature
lattice.update_node(node)
tem... | from mayavi.scripts import mayavi2
from simphony.cuds.lattice import make_hexagonal_lattice
lattice = make_hexagonal_lattice('test', 0.1, (5, 4))
# Now view the data.
@mayavi2.standalone
def view():
from mayavi.modules.glyph import Glyph
from simphony_mayavi.sources.api import LatticeSource
mayavi.new... | bsd-2-clause | Python |
1a40ba091a56bfeb276c80ff50df93d4172afb0c | Add ability to add a primary and secondary account in instagram_connect.py | dalimatt/Instastalk | instagram_connect.py | instagram_connect.py | from dependencies import bottle
from dependencies.bottle import route, request
from dependencies.instagram import client
from dependencies.workflow import Workflow
import os
import sys
account_type = sys.argv[1]
_wf = None
def wf():
global _wf
if _wf is None:
_wf = Workflow()
return _wf
... | import dependencies.bottle
from dependencies.bottle import route, request
from dependencies.instagram import client
from dependencies.workflow import Workflow
import os
_wf = None
def wf():
global _wf
if _wf is None:
_wf = Workflow()
return _wf
bottle.debug(True)
app = bottle.app()
CON... | mit | Python |
9dc11697ec5dd7ea39ba128c681c1c8a81eb8930 | Remove os.path import | European-XFEL/h5tools-py | karabo_data/tests/mockdata/basler_camera.py | karabo_data/tests/mockdata/basler_camera.py | """Script that creates a mock-run for the basler camera"""
from .base import DeviceBase
class BaslerCamera(DeviceBase):
"""
Basler Camera device
Based on example /gpfs/exfel/exp/SPB/201930/p900061/raw/r0055/RAW-R0055-DA01-S00000.h5
"""
def __init__(self, device_id, nsamples=None, sensor_size=None)... | """Script that creates a mock-run for the basler camera"""
from os.path import join as op_join
from .base import DeviceBase
class BaslerCamera(DeviceBase):
"""
Basler Camera device
Based on example /gpfs/exfel/exp/SPB/201930/p900061/raw/r0055/RAW-R0055-DA01-S00000.h5
"""
def __init__(self, device... | bsd-3-clause | Python |
360928eed1c9c92a79d7e257383c47ddce152ae4 | split casting code out of command loop; modified command loop parsing | BartMassey/fishing | fishing.py | fishing.py | # Copyright © 2013 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.
# Simple fishing game
# Player repeatedly casts and gets fish
# with different likelihoods and point values.
import random
catches = [
... | # Copyright © 2013 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.
# Simple fishing game
# Player repeatedly casts and gets fish
# with different likelihoods and point values.
import random
catches = [
... | mit | Python |
a595e75968fa26a49b3d08661b9a0e3bb192929e | Install sun java when using cloudera | samuel/kokki | kokki/cookbooks/cloudera/recipes/default.py | kokki/cookbooks/cloudera/recipes/default.py |
from kokki import *
env.include_recipe("java.jre")
apt_list_path = '/etc/apt/sources.list.d/cloudera.list'
apt = (
"deb http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
"deb-src http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
).format(distro=env.system.lsb['codename'])
Execute("apt-ge... |
from kokki import *
apt_list_path = '/etc/apt/sources.list.d/cloudera.list'
apt = (
"deb http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
"deb-src http://archive.cloudera.com/debian {distro}-cdh3 contrib\n"
).format(distro=env.system.lsb['codename'])
Execute("apt-get update", action="nothing")
Ex... | bsd-3-clause | Python |
11cca487c02c7fbc03a913ada966fa174c69b940 | Test initialization | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/pytest/test_simulation.py | hoomd/pytest/test_simulation.py | from hoomd.snapshot import Snapshot
from hoomd.simulation import Simulation
import numpy
import pytest
@pytest.fixture(scope="function")
def get_snapshot(device):
def make_snapshot(n=10, particle_types=['A']):
s = Snapshot(device.comm)
if s.exists:
s.configuration.box = [20, 20, 20, 0,... | from hoomd.snapshot import Snapshot
import numpy
import pytest
@pytest.fixture(scope="function")
def get_snapshot(device):
def make_snapshot(n=10, particle_types=['A']):
s = Snapshot(device.comm)
if s.exists:
s.configuration.box = [20, 20, 20, 0, 0, 0]
s.particles.N = n
... | bsd-3-clause | Python |
911b3cbc919db57d5d1fd6d08253cc36201a9dd9 | add docstrings | megfault/aDTN-python | utils.py | utils.py | from binascii import hexlify, unhexlify
from nacl.utils import random as rand
from nacl.secret import SecretBox
from nacl.hash import sha256
from nacl.encoding import HexEncoder
from logging import basicConfig, debug, DEBUG
basicConfig(filename='aDTN.log', level=DEBUG,
format='[%(relativeCreated)8d] %(mess... | from binascii import hexlify, unhexlify
from nacl.utils import random as rand
from nacl.secret import SecretBox
from nacl.hash import sha256
from nacl.encoding import HexEncoder
from logging import basicConfig, debug, DEBUG
basicConfig(filename='aDTN.log', level=DEBUG,
format='[%(relativeCreated)8d] %(mess... | agpl-3.0 | Python |
132535781ffa571bcccf95229fce7c7f8cd4de0c | Use generic autocomplete field for content_object | 596acres/django-livinglots-steward | livinglots_steward/admin.py | livinglots_steward/admin.py | from django.contrib import admin
from django.core.urlresolvers import reverse
from admin_enhancer.admin import EnhancedModelAdminMixin
class StewardAdminMixin(EnhancedModelAdminMixin):
def stewarded_target(self, obj):
try:
return '<a href="%s" target="_blank">%s</a>' % (
obj.... | from django.contrib import admin
from django.core.urlresolvers import reverse
from admin_enhancer.admin import EnhancedModelAdminMixin
class StewardAdminMixin(EnhancedModelAdminMixin):
def stewarded_target(self, obj):
try:
return '<a href="%s" target="_blank">%s</a>' % (
obj.... | bsd-3-clause | Python |
0b69f5882f251162e7898b9eadaa6874b76215d7 | Add new environment variable so we can create articles with different committer and author | pluralsight/guides-cms,paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms | example_config.py | example_config.py | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | agpl-3.0 | Python |
3787109295b2f3123543ea48fbaa0e6abd3c23b1 | add nawatts as authorized user (#8905) | hail-is/hail,cseed/hail,hail-is/hail,cseed/hail,hail-is/hail,hail-is/hail,cseed/hail,danking/hail,hail-is/hail,cseed/hail,hail-is/hail,cseed/hail,danking/hail,hail-is/hail,cseed/hail,danking/hail,danking/hail,danking/hail,cseed/hail,danking/hail,danking/hail,cseed/hail,hail-is/hail,danking/hail | ci/ci/constants.py | ci/ci/constants.py | GITHUB_CLONE_URL = 'https://github.com/'
GITHUB_STATUS_CONTEXT = 'ci-test'
AUTHORIZED_USERS = {
'danking',
'cseed',
'konradjk',
'jigold',
'patrick-schultz',
'lfrancioli',
'akotlar',
'tpoterba',
'chrisvittal',
'catoverdrive',
'johnc1231',
'nawatts',
'mkveerapen'
}
| GITHUB_CLONE_URL = 'https://github.com/'
GITHUB_STATUS_CONTEXT = 'ci-test'
AUTHORIZED_USERS = {
'danking',
'cseed',
'konradjk',
'jigold',
'patrick-schultz',
'lfrancioli',
'akotlar',
'tpoterba',
'chrisvittal',
'catoverdrive',
'GreatBrando',
'johnc1231',
'gsarma',
... | mit | Python |
df4eb5cecfe730b462f1f073e0e4481c53cb0ce9 | Set rq.worker logger in settings.py to NullHandler. | viaregio/django-rq,mjec/django-rq,lechup/django-rq,meteozond/django-rq,viaregio/django-rq,ui/django-rq,meteozond/django-rq,1024inc/django-rq,sbussetti/django-rq,sbussetti/django-rq,mjec/django-rq,ryanisnan/django-rq,1024inc/django-rq,ui/django-rq,lechup/django-rq,ryanisnan/django-rq | django_rq/tests/settings.py | django_rq/tests/settings.py | # -*- coding: utf-8 -*-
INSTALLED_APPS = ['django_rq']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"rq_console": {
"format": "%(asctim... | # -*- coding: utf-8 -*-
INSTALLED_APPS = ['django_rq']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"rq_console": {
"format": "%(asctim... | mit | Python |
25a288b6e879d8afed6ed113d9f93d0c7934901a | use reference for weight, not estimate | rabitt/mir_eval,craffel/mir_eval,urinieto/mir_eval,faroit/mir_eval,rabitt/mir_eval,urinieto/mir_eval,bmcfee/mir_eval,bmcfee/mir_eval,faroit/mir_eval,craffel/mir_eval | evaluators/tempo_eval.py | evaluators/tempo_eval.py | #!/usr/bin/env python
'''
Utility script for computing all tempo metrics.
Usage:
./tempo_eval.py REFERENCE.TXT ESTIMATED.TXT
'''
import argparse
import sys
import os
import eval_utilities
import numpy as np
import mir_eval
def process_arguments():
'''Argparse function to get the program parameters'''
par... | #!/usr/bin/env python
'''
Utility script for computing all tempo metrics.
Usage:
./tempo_eval.py REFERENCE.TXT ESTIMATED.TXT
'''
import argparse
import sys
import os
import eval_utilities
import numpy as np
import mir_eval
def process_arguments():
'''Argparse function to get the program parameters'''
par... | mit | Python |
993cc700f65a876e5720a8c99ec9fbf14e3dc1a0 | rename function names | suryaambrose/naoqi_bridge,ros-naoqi/naoqi_bridge,ros-naoqi/naoqi_bridge,ArthurVal/RIDDLE_naoqi_bridge,lsouchet/naoqi_bridge,suryaambrose/naoqi_bridge,ArthurVal/RIDDLE_naoqi_bridge,lsouchet/naoqi_bridge | naoqi_driver/src/naoqi_driver/naoqi_moveto.py | naoqi_driver/src/naoqi_driver/naoqi_moveto.py | #!/usr/bin/env python
# Copyright (C) 2014 Aldebaran Robotics
#
# 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 applic... | #!/usr/bin/env python
# Copyright (C) 2014 Aldebaran Robotics
#
# 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 applic... | bsd-3-clause | Python |
3e7ae569c7e68099820000015f815eb0d45ff891 | Fix warning in overwritegradecells | alope107/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,ellisonbg/nbgrader,jupyter/nbgrader,dementrock/nbgrader,MatKallada/nbgrader,EdwardJKim/nbgrader,jupyter/nbgrader,dementrock/nbgrader,jupyter/nbgrader,ellisonbg/nbgrader,modulexcite/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,a... | nbgrader/preprocessors/overwritegradecells.py | nbgrader/preprocessors/overwritegradecells.py | from IPython.nbconvert.preprocessors import Preprocessor
from IPython.utils.traitlets import Unicode
from nbgrader import utils
from nbgrader.api import Gradebook
from sqlalchemy.orm.exc import NoResultFound
class OverwriteGradeCells(Preprocessor):
"""A preprocessor to save information about grade cells."""
d... | from IPython.nbconvert.preprocessors import Preprocessor
from IPython.utils.traitlets import Unicode
from nbgrader import utils
from nbgrader.api import Gradebook
from sqlalchemy.orm.exc import NoResultFound
class OverwriteGradeCells(Preprocessor):
"""A preprocessor to save information about grade cells."""
d... | bsd-3-clause | Python |
d233b80be2655783560cf388c15bb1e9a8880ff0 | Remove unused import | cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader | client/can_uart.py | client/can_uart.py | import msgpack
class Frame:
"""
A single CAN frame.
"""
def __init__(self, id=0, data=None, extended=False, transmission_request=False):
if data is None:
data = bytes()
self.id = id
self.data = data
self.transmission_request = transmission_request
sel... | from collections import namedtuple
from msgpack import Packer, Unpacker
class Frame:
"""
A single CAN frame.
"""
def __init__(self, id=0, data=None, extended=False, transmission_request=False):
if data is None:
data = bytes()
self.id = id
self.data = data
se... | bsd-2-clause | Python |
d54e86c59fe9b54f0340a12955a2f8cff15fd769 | make plot smaller so it fits onscreen | guziy/basemap,matplotlib/basemap,matplotlib/basemap,guziy/basemap | examples/setwh.py | examples/setwh.py | # examples of using the 'width' and 'height' keywords
# to the Basemap constructor.
from matplotlib.toolkits.basemap import Basemap
from pylab import arange, show, title, figure
# setup projection parameters
lat_0 = 40.
lon_0 = -100.
width = 6000000.
height = 2.*width/3.
delat = 25.
circles = arange(0.,90.+delat,dela... | # examples of using the 'width' and 'height' keywords
# to the Basemap constructor.
from matplotlib.toolkits.basemap import Basemap
from pylab import arange, show, title, figure
# setup projection parameters
lat_0 = 40.
lon_0 = -100.
width = 6000000.
height = 2.*width/3.
delat = 25.
circles = arange(0.,90.+delat,dela... | mit | Python |
aa82633260a4e12c7e67d1076fe7a5b9e4522841 | update sanity check for test errors | stanfordmlgroup/ngboost,stanfordmlgroup/ngboost | experiments/sanity_check.py | experiments/sanity_check.py | import numpy as np
from torch.distributions.log_normal import LogNormal
from sklearn.tree import DecisionTreeRegressor
from ngboost import SurvNGBoost
from experiments.evaluation import calculate_concordance_naive
from ngboost.scores import MLE_surv, CRPS_surv
def main():
m, n = 100, 50
X = np.random.rand(m... | import numpy as np
from torch.distributions.log_normal import LogNormal
from sklearn.tree import DecisionTreeRegressor
from ngboost import SurvNGBoost
from experiments.evaluation import calculate_concordance_naive
from ngboost.scores import MLE_surv, CRPS_surv
def main():
m, n = 100, 50
X = np.random.rand(m... | apache-2.0 | Python |
147387daca78f869196b8d558f67265a7506752c | remove references to reporter/[add|edit] since these are being hijacked by hq/views (to allow for automatic creation of reporterprofiles) | unicefuganda/edtrac,eHealthAfrica/rapidsms,caktus/rapidsms,ken-muturi/rapidsms,caktus/rapidsms,dimagi/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,ken-muturi/rapidsms,peterayeni/rapidsms,catalpainternational/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,catalpainternational/rapidsms,peterayeni/rapidsms,eHe... | reporters/urls.py | reporters/urls.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.conf.urls.defaults import *
import reporters.views as views
urlpatterns = patterns('',
url(r'^reporters$', views.index),
# these are being hijacked by hq/reporters
#url(r'^reporters/add$', views.add_reporter, name="add-r... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.conf.urls.defaults import *
import reporters.views as views
urlpatterns = patterns('',
url(r'^reporters$', views.index),
url(r'^reporters/add$', views.add_reporter, name="add-reporter"),
url(r'^reporters/(?P<pk>\d+)$', v... | bsd-3-clause | Python |
18c071b0ebe95e014fa9d89a67f297c8a514ac1b | Add dictionary funcion to tools.py | AbdallahS/ggp-hsfc,AbdallahS/ggp-hsfc,AbdallahS/ggp-hsfc,AbdallahS/ggp-hsfc | examples/tools.py | examples/tools.py | #-----------------------------------------------------
# A collection of playermoves. This can be iterated over
# to generate all combinations of joint moves.
#
# Builds a set of arrays of the moves for each player.
# eg. result[xplayer] = [(move 1 2), (move 3 2)]
# result[oplayer] = [noop]
#----------------------... | #-----------------------------------------------------
# A collection of playermoves. This can be iterated over
# to generate all combinations of joint moves.
#
# Builds a set of arrays of the moves for each player.
# eg. result[xplayer] = [(move 1 2), (move 3 2)]
# result[oplayer] = [noop]
#----------------------... | bsd-2-clause | Python |
6cce3cb8a02b945dbd7ef44e4d8a1e97ddde5bea | order tests | film42/bitcoin-exchange,film42/bitcoin-exchange,film42/bitcoin-exchange | exchange/tests.py | exchange/tests.py | from django.test import TestCase
from models import *
from decimal import *
class OrderCRUD(TestCase):
def test_crud_order(self):
order = Order.objects.create(amount=5, limit=5)
self.assertEqual(order.amount, 5)
self.assertEqual(order.from_currency, '')
self.assertEqual(order.limi... | from django.test import TestCase
# Create your tests here.
| mit | Python |
288fc9c1c16f080d8e0649a1ff1220805fc86647 | remove trace | timothydmorton/qa_explorer,timothydmorton/qa_explorer | explorer/match.py | explorer/match.py |
import scipy.spatial.kdtree, numpy
from scipy import version
from numpy import sin,cos,deg2rad,rad2deg,arcsin
import numpy as np
import dask.array as da
import time
scipy_version = ('.'.join(version.version.split('.')[0:2])).split('.')[0:2]
def match_lists(ra1, dec1, ra2, dec2, dist, numNei=1):
"""crossmatches ... |
import scipy.spatial.kdtree, numpy
from scipy import version
from numpy import sin,cos,deg2rad,rad2deg,arcsin
import numpy as np
import dask.array as da
import time
scipy_version = ('.'.join(version.version.split('.')[0:2])).split('.')[0:2]
def match_lists(ra1, dec1, ra2, dec2, dist, numNei=1):
"""crossmatches ... | mit | Python |
c25a723d74da1bbaecd50605bce4fd7e227be5dd | add --with-bashcompletiondir option (#22167) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/kmod/package.py | var/spack/repos/builtin/packages/kmod/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 Kmod(AutotoolsPackage):
"""kmod is a set of tools to handle common tasks with Linux kernel... | # 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 Kmod(AutotoolsPackage):
"""kmod is a set of tools to handle common tasks with Linux kernel... | lgpl-2.1 | Python |
7068bb32ab676b1a43f503991731eb354f983aa3 | Simplify money transfer example | amolenaar/roles,amolenaar/roles | example.py | example.py | """Classic roles example, using the roles module.
Based on the DCI PoC of David Byers and Serge Beaumont
(see: http://groups.google.com/group/object-composition/files)
"""
from typing import Protocol
from roles import RoleType
from roles.context import context
class Account(Protocol):
balance: float
def w... | """Classic roles example, using the roles module.
Based on the DCI PoC of David Byers and Serge Beaumont
(see: http://groups.google.com/group/object-composition/files)
"""
from typing import Protocol
from roles import RoleType
from roles.context import context
class Account(Protocol):
balance: float
def w... | bsd-3-clause | Python |
700912cc3db69cfd99e33b715dcba7b6717aa225 | Remove the address_ prefix from line1 and line2 in the Address model. | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | apps/bluebottle_utils/models.py | apps/bluebottle_utils/models.py | from django.db import models
from django_countries import CountryField
class Address(models.Model):
"""
A postal address.
"""
line1 = models.CharField(max_length=100, blank=True)
line2 = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=100, blank=True)
state ... | from django.db import models
from django_countries import CountryField
class Address(models.Model):
"""
A postal address.
"""
address_line1 = models.CharField(max_length=100, blank=True)
address_line2 = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=100, blank... | bsd-3-clause | Python |
41cc3404a4d9f4a569c619551a7cac42b0c82592 | add version 0.9-7 to r-sf (#20851) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-sf/package.py | var/spack/repos/builtin/packages/r-sf/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 RSf(RPackage):
"""Simple Features for R
Support for simple features, a standardized w... | # 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 RSf(RPackage):
"""Support for simple features, a standardized way to encode spatial
... | lgpl-2.1 | Python |
efaa172668b8961734fa8a10650dc3191b4a7348 | Allow local.json to be missing | kch8qx/osf.io,acshi/osf.io,binoculars/osf.io,abought/osf.io,mluo613/osf.io,cslzchen/osf.io,chrisseto/osf.io,ticklemepierce/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,kwierman/osf.io,brandonPurvis/osf.io,icereval/osf.io,TomBaxter/osf.io,doublebits/osf.io,mluke93/osf.io,wearpants/osf.io,alexschiller/osf.io,billyhunt/osf.... | website/project/metadata/authorizers/__init__.py | website/project/metadata/authorizers/__init__.py | import json
import os
import logging
logger = logging.getLogger(__name__)
HERE = os.path.dirname(os.path.realpath(__file__))
groups = json.load(open('{0}/defaults.json'.format(HERE)))
fp = None
try:
fp = open('{0}/local.json'.format(HERE))
except IOError:
logger.info('No local.json found to populate lists of... | import json
import os
import logging
logger = logging.getLogger(__name__)
HERE = os.path.dirname(os.path.realpath(__file__))
groups = json.load(open('{0}/defaults.json'.format(HERE)))
try:
fp = open('{0}/local.json'.format(HERE))
except IOError:
logger.info('No local.json found to populate lists of DraftRegi... | apache-2.0 | Python |
78e752e65f7b734fe6739685f42abcdea05f83bf | add JWTIdentityPolicy into __init__ file. (#157) | aio-libs/aiohttp_security | aiohttp_security/__init__.py | aiohttp_security/__init__.py | from .abc import AbstractAuthorizationPolicy, AbstractIdentityPolicy
from .api import (authorized_userid, forget, has_permission, is_anonymous,
login_required, permits, remember, setup)
from .cookies_identity import CookiesIdentityPolicy
from .session_identity import SessionIdentityPolicy
from .jwt_id... | from .abc import AbstractAuthorizationPolicy, AbstractIdentityPolicy
from .api import (authorized_userid, forget, has_permission, is_anonymous,
login_required, permits, remember, setup)
from .cookies_identity import CookiesIdentityPolicy
from .session_identity import SessionIdentityPolicy
__version__... | apache-2.0 | Python |
aed05a14368e89dceb16a6849264ee667714a171 | remove sample fraction. | yishayv/lyacorr,yishayv/lyacorr | extract_sdss_qso_spectra.py | extract_sdss_qso_spectra.py | import itertools
import random
import cProfile
import numpy as np
import astropy.table as table
import read_spectrum_fits
from hdf5_spectrum_container import Hdf5SpectrumContainer
import common_settings
from qso_data import QSORecord, QSOData
MAX_SPECTRA = 220000
MAX_WAVELENGTH_COUNT = 4992
settings = common_setti... | import itertools
import random
import cProfile
import numpy as np
import astropy.table as table
import read_spectrum_fits
from hdf5_spectrum_container import Hdf5SpectrumContainer
import common_settings
from qso_data import QSORecord, QSOData
MAX_SPECTRA = 220000
MAX_WAVELENGTH_COUNT = 4992
settings = common_setti... | mit | Python |
07823ae7f7368f4bc4a4e4436129319f7215150b | Use random.choices when available for better performance | joke2k/faker,joke2k/faker,danhuss/faker | faker/utils/distribution.py | faker/utils/distribution.py | # coding=utf-8
import bisect
from sys import version_info
from faker.generator import random
def random_sample():
return random.uniform(0.0, 1.0)
def cumsum(it):
total = 0
for x in it:
total += x
yield total
def choice_distribution(a, p):
assert len(a) == len(p)
if version_inf... | # coding=utf-8
import bisect
from faker.generator import random
def random_sample():
return random.uniform(0.0, 1.0)
def cumsum(it):
total = 0
for x in it:
total += x
yield total
def choice_distribution(a, p):
assert len(a) == len(p)
cdf = list(cumsum(p))
normal = cdf[-1]
... | mit | Python |
7e29c7ec693b1cb661c51a3b0093abe83f65537f | Fix server hostname | zouzias/digitalocean-deploy-ambari,zouzias/digitalocean-deploy-ambari | fabfile.py | fabfile.py | from fabric.api import env
from fabric.operations import run, put, sudo,local
#env.use_ssh_config = True
# CHANGE ME (change the PEM file)
env.user = 'root'
env.key_filename = '~/.ssh/digitalocean_rsa'
domain = 'zouzias.org'
# Populate host names
with open('ambari-server.txt') as f:
env.hosts = f.readlines()[... | from fabric.api import env
from fabric.operations import run, put, sudo,local
#env.use_ssh_config = True
# CHANGE ME (change the PEM file)
env.user = 'root'
env.key_filename = '~/.ssh/digitalocean_rsa'
domain = 'zouzias.org'
# Populate host names
with open('ambari-server.txt') as f:
env.hosts = f.readlines()
... | apache-2.0 | Python |
4a2e813562cba246c2ffad4c0c9008061a80f7a2 | remove unused global statement | steder/giraffe,steder/giraffe,steder/giraffe | fabfile.py | fabfile.py | import os
import boto
from fabric.api import cd, env, run, task
from fabric.operations import put
name_tag = "giraffe"
def get_hosts():
ec2 = boto.connect_ec2()
hosts = []
for i in ec2.get_only_instances():
if i.tags.get("Name") == name_tag:
hosts.append("{}@{}".format(
... | import os
import boto
from fabric.api import cd, env, run, task
from fabric.operations import put
name_tag = "giraffe"
def get_hosts():
global instances
ec2 = boto.connect_ec2()
hosts = []
for i in ec2.get_only_instances():
if i.tags.get("Name") == name_tag:
hosts.append("{}@{}".... | mit | Python |
4e0db2766a719a347cbdf5b3e2fadd5a807d4a83 | Remove deleted test from ignore list | compas-dev/compas | tests/ipy_test_runner.py | tests/ipy_test_runner.py | from __future__ import print_function
import os
import pytest
HERE = os.path.dirname(__file__)
if __name__ == '__main__':
# Fake Rhino modules
pytest.load_fake_module('Rhino')
pytest.load_fake_module('Rhino.Geometry', fake_types=['RTree', 'Sphere', 'Point3d'])
pytest.run(HERE)
| from __future__ import print_function
import os
import pytest
HERE = os.path.dirname(__file__)
if __name__ == '__main__':
# Fake Rhino modules
pytest.load_fake_module('Rhino')
pytest.load_fake_module('Rhino.Geometry', fake_types=['RTree', 'Sphere', 'Point3d'])
pytest.run(HERE, ['tests/compas/files/... | mit | Python |
c6ae2a8267d8203becb6a194f4d28fd5ead0b2c4 | create function sql_where_none_if | anselmobd/fo2,anselmobd/fo2,anselmobd/fo2,anselmobd/fo2 | src/utils/functions/queries.py | src/utils/functions/queries.py | from pprint import pprint
def sql_where(field, value, operation="=", conector="AND", quote = ""):
if bool(field) and value is not None:
if not quote and isinstance(value, str):
quote = "'"
return f"{conector} {field} {operation} {quote}{value}{quote}"
return ""
def none_if(value,... | from pprint import pprint
def sql_where(field, value, operation="=", conector="AND", quote = ""):
if bool(field) and value is not None:
if not quote and isinstance(value, str):
quote = "'"
return f"{conector} {field} {operation} {quote}{value}{quote}"
return ""
def none_if(value,... | mit | Python |
a0c66e7fc19782fe4df32cf7cc22b08b169216a7 | Make `sanitise_filename()` compatible with Python 3 | skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines | skylines/lib/files.py | skylines/lib/files.py | # -*- coding: utf-8 -*-
"""This library helps storing data files in the server file system."""
import os
import shutil
import re
from flask import current_app
from skylines.lib.types import is_string, is_bytes
igc_filename_numbers_regex = re.compile(r"([\w_-]+)_(\d+)")
def sanitise_filename(name):
assert is_s... | # -*- coding: utf-8 -*-
"""This library helps storing data files in the server file system."""
import os
import shutil
import re
from flask import current_app
from skylines.lib.types import is_string
igc_filename_numbers_regex = re.compile(r"([\w_-]+)_(\d+)")
def sanitise_filename(name):
assert is_string(name... | agpl-3.0 | Python |
d6209b1578177a71a531b6c51f008c3ad47b90f1 | backup and clean deployment | Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back | fabfile.py | fabfile.py | from __future__ import with_statement
import os
from datetime import datetime
import logging
from fabric.api import *
from fabric.contrib import files
API_SERVERS = {'bhs-dev': 'test-api.myjewishidentity.org',
'bhs-prod': 'api.dbs.bh.org.il'}
LAST_UPDATE_FILE = '/var/run/bhs/last_update'
env.user = 'bh... | from __future__ import with_statement
import os
from datetime import datetime
import logging
from fabric.api import *
from fabric.contrib import files
API_SERVERS = {'bhs-dev': 'test-api.myjewishidentity.org',
'bhs-prod': 'api.dbs.bh.org.il'}
LAST_UPDATE_FILE = '/var/run/bhs/last_update'
env.user = 'bh... | agpl-3.0 | Python |
3da37ec0cf7a73e2ee0a706a8666bd486c106d6d | fix up path to test data folder | googlei18n/ufo2ft,moyogo/ufo2ft,jamesgk/ufo2ft,googlefonts/ufo2ft,jamesgk/ufo2fdk | tests/outlineOTF_test.py | tests/outlineOTF_test.py | from fontTools.ttLib import TTFont
from defcon import Font
from ufo2ft.outlineOTF import OutlineTTFCompiler
import unittest
import os
def getTestUFO():
dirname = os.path.dirname(__file__)
return Font(os.path.join(dirname, 'data', 'TestFont.ufo'))
class TestOutlineTTCompiler(unittest.TestCase):
def setU... | from fontTools.ttLib import TTFont
from defcon import Font
from ufo2ft.outlineOTF import OutlineTTFCompiler
import unittest
import os
def getTestUFO():
dirname = os.path.dirname(__file__)
return Font(os.path.join(dirname, 'testdata', 'TestFont.ufo'))
class TestOutlineTTCompiler(unittest.TestCase):
def ... | mit | Python |
3dec166f8a5493eab155753790dcbff2941d0ebe | Fix fabfile. We use the tour branch as default | ecobasa/ecobasa,ecobasa/ecobasa,ecobasa/ecobasa | fabfile.py | fabfile.py | from fabric.api import *
from fabvenv import virtualenv
def staging():
env.hosts = ['ecobasa@server.sinnwerkstatt.com']
env.path = '/srv/ecobasa.sinnwerkstatt.com/ecobasa/'
env.virtualenv_path = '/srv/ecobasa.sinnwerkstatt.com/ecobasaenv/'
env.push_branch = 'tour'
env.push_remote = 'origin'
def ... | from fabric.api import *
from fabvenv import virtualenv
def staging():
env.hosts = ['ecobasa@server.sinnwerkstatt.com']
env.path = '/srv/ecobasa.sinnwerkstatt.com/ecobasa/'
env.virtualenv_path = '/srv/ecobasa.sinnwerkstatt.com/ecobasaenv/'
env.push_branch = 'master'
env.push_remote = 'origin'
de... | bsd-3-clause | Python |
bdd92bce4a7288e2e868e938769da4c5520b62dc | Fix RNG in tests | MoyTW/RL_Arena_Experiment | tests/sim/test_runner.py | tests/sim/test_runner.py | import unittest
import hunting.resources as resources
from hunting.constants import *
from hunting.level.map import LevelMap, LevelTile
from hunting.sim.ais import TestMonster, DummyAI
from hunting.sim.entities import GameObject, Fighter
from hunting.sim.runner import run_level, run_turn
import hunting.level.parser as ... | import unittest
import hunting.resources as resources
from hunting.constants import *
from hunting.level.map import LevelMap, LevelTile
from hunting.sim.ais import TestMonster, DummyAI
from hunting.sim.entities import GameObject, Fighter
from hunting.sim.runner import run_level, run_turn
import hunting.level.parser as ... | mit | Python |
6290b81234f92073262a3fa784ae4e94f16192a8 | Test we have access to envvar when we have no file | henriquebastos/python-decouple,flaviohenriqu/python-decouple,mrkschan/python-decouple,henriquebastos/django-decouple,liukaijv/python-decouple | tests/test_autoconfig.py | tests/test_autoconfig.py | # coding: utf-8
import os
import pytest
from mock import patch
from decouple import AutoConfig
def test_autoconfig_env():
config = AutoConfig()
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'env', 'project')
with patch.object(config, '_caller_path', return_value=path):
assert 'ENV' ... | # coding: utf-8
import os
import pytest
from mock import patch
from decouple import AutoConfig
def test_autoconfig_env():
config = AutoConfig()
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'env', 'project')
with patch.object(config, '_caller_path', return_value=path):
assert 'ENV' ... | mit | Python |
31d3dbbeaa8804220ada122dcc54b08f2c8b2d6d | Fix coding style goof | Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger | tests/test_experiment.py | tests/test_experiment.py | import pytest
import mock
def is_uuid(thing):
return len(thing) == 36
@pytest.mark.usefixtures('active_config')
class TestExperimentBaseClass(object):
@pytest.fixture
def klass(self):
from dallinger.experiment import Experiment
return Experiment
@pytest.fixture
def exp(self, kl... | import pytest
import mock
def is_uuid(thing):
return len(thing) == 36
@pytest.mark.usefixtures('active_config')
class TestExperimentBaseClass(object):
@pytest.fixture
def klass(self):
from dallinger.experiment import Experiment
return Experiment
@pytest.fixture
def exp(self, kl... | mit | Python |
da76c1e4685cdcd98640600852b2f5a8354c3603 | fix broken test | chfw/moban,chfw/moban | tests/test_hash_store.py | tests/test_hash_store.py | import os
from moban.utils import HashStore
class TestHashStore:
def setUp(self):
self.fixture = ('test.out', 'test content'.encode('utf-8'))
def tearDown(self):
os.unlink('.moban.hashes')
def test_simple_use_case(self):
hs = HashStore()
flag = hs.is_file_changed(*self.fi... | import os
from moban.utils import HashStore
class TestHashStore:
def tearDown(self):
os.unlink('.moban.hashes')
def test_simple_use_case(self):
hs = HashStore()
flag = hs.is_file_changed('test.out', 'test content')
assert flag is True
hs.close()
def test_simple_us... | mit | Python |
5251c84a8e409a279cf8dc205673d57406be0782 | Make tests a little better | pellaeon/django-rest-framework-webdav | tests/test_serializer.py | tests/test_serializer.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from pprint import pprint
from django.test import TestCase
from mock import Mock
from rest_framework_webdav.serializers import *
from rest_framework_webdav.resources import *
from .resources import MockResource
class TestPropfindSerializer(Tes... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from pprint import pprint
from django.test import TestCase
from mock import Mock
from rest_framework_webdav.serializers import *
from rest_framework_webdav.resources import *
from .resources import MockResource
class TestPropfindSerializer(Tes... | agpl-3.0 | Python |
6a5baf766181ebefe384fd457c205473c4064daf | fix bug with admin.site.urls include | jezdez/django-robots,jezdez/django-robots,jscott1971/django-robots,jscott1971/django-robots,jazzband/django-robots,jazzband/django-robots | tests/test_utils/urls.py | tests/test_utils/urls.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import django.contrib.sitemaps.views
import django.views.i18n
import django.views.static
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.sitem... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import django.contrib.sitemaps.views
import django.views.i18n
import django.views.static
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.sitem... | bsd-3-clause | Python |
efcd6b79e3832246b4a3d1187574a50636aac309 | Fix test_installation.py | Temelio/ansible-role-collectd | molecule/default/tests/test_installation.py | molecule/default/tests/test_installation.py | """
Role tests
"""
import os
import pytest
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('name', [
('collectd'),
('collectd-core'),
])
def test_packages(host, name):
"""
... | """
Role tests
"""
import os
import pytest
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('name', [
('collectd'),
('collectd-core'),
])
def test_packages(host, name):
"""
... | mit | Python |
d976bc3b992811911e5b28cf29df1df936ca7cc5 | Add a middleware class to fix Firefox's bad AJAX redirect handling | pculture/mirocommunity,natea/Miro-Community,pculture/mirocommunity,natea/Miro-Community,pculture/mirocommunity,pculture/mirocommunity | localtv/subsite/__init__.py | localtv/subsite/__init__.py | import urlparse
from django.conf import settings
from django.contrib.sites.models import Site
from localtv import models
class FixAJAXMiddleware:
"""
Firefox doesn't handle redirects in XMLHttpRequests correctly (it doesn't
set X-Requested-With) so we fake it with a GET argument.
"""
def process_... | from django.conf import settings
from django.contrib.sites.models import Site
from localtv import models
def context_processor(request):
sitelocation = models.SiteLocation.objects.get(
site=Site.objects.get_current())
display_submit_button = sitelocation.display_submit_button
if display_subm... | agpl-3.0 | Python |
08c9a5cad73015c6cc1b02be363f4044deebfc14 | update plot axes and output name | qinglan233/vass,qinglan233/vass,qinglan233/vass,qinglan233/vass | log_parser/plot_log_data.py | log_parser/plot_log_data.py | ######################################################
# -*- coding: utf-8 -*-
# File Name: plot_log_data.py
# Author: James Hong & Qian Li
# Created Date: 2017-11-29
# Description: Plot data from parsed logs
######################################################
#!/usr/bin/env python
import json
import argparse
impor... | ######################################################
# -*- coding: utf-8 -*-
# File Name: plot_log_data.py
# Author: James Hong & Qian Li
# Created Date: 2017-11-29
# Description: Plot data from parsed logs
######################################################
#!/usr/bin/env python
import json
import argparse
impor... | apache-2.0 | Python |
61037e9c3423114ac326746b2021047d081f908f | update plot font, grid, nbins | qinglan233/vass,qinglan233/vass,qinglan233/vass,qinglan233/vass | log_parser/plot_log_data.py | log_parser/plot_log_data.py | ######################################################
# -*- coding: utf-8 -*-
# File Name: plot_log_data.py
# Author: James Hong & Qian Li
# Created Date: 2017-11-29
# Description: Plot data from parsed logs
######################################################
#!/usr/bin/env python
import json
import argparse
impor... | ######################################################
# -*- coding: utf-8 -*-
# File Name: plot_log_data.py
# Author: James Hong & Qian Li
# Created Date: 2017-11-29
# Description: Plot data from parsed logs
######################################################
#!/usr/bin/env python
import json
import argparse
impor... | apache-2.0 | Python |
3026cc1b6a7891dbf0892c6059bc477c913f627a | change pathof fonts file | amueller/word_cloud | examples/wordcloud_cn.py | examples/wordcloud_cn.py | # - * - coding: utf - 8 -*-
"""
create wordcloud with chinese
=======================
Wordcloud is a very good tools, but if you want to create
Chinese wordcloud only wordcloud is not enough. The file
shows how to use wordcloud with Chinese. First, you need a
Chinese word segmentation library jieba, jieba is now the
m... | # - * - coding: utf - 8 -*-
"""
create wordcloud with chinese
=======================
Wordcloud is a very good tools, but if you want to create
Chinese wordcloud only wordcloud is not enough. The file
shows how to use wordcloud with Chinese. First, you need a
Chinese word segmentation library jieba, jieba is now the
m... | mit | Python |
e1368fda55463e083ddd0f0ebf9bf8eb3e774b7d | update wps climdaps example | b-cube/OWSLib,Jenselme/OWSLib,jachym/OWSLib,jaygoldfinch/OWSLib,dblodgett-usgs/OWSLib,KeyproOy/OWSLib,ocefpaf/OWSLib,QuLogic/OWSLib,robmcmullen/OWSLib,jaygoldfinch/OWSLib,kalxas/OWSLib,tomkralidis/OWSLib,bird-house/OWSLib,mbertrand/OWSLib,JuergenWeichand/OWSLib,geographika/OWSLib,geopython/OWSLib,kwilcox/OWSLib,gfusca/... | examples/wps-climdaps.py | examples/wps-climdaps.py | from owslib.wps import WebProcessingService, monitorExecution
verbose = True
# get multiple outputs
wps = WebProcessingService('http://rsg.pml.ac.uk/wps/generic.cgi', verbose=verbose)
processid = 'dummyprocess'
inputs = [("input1", '1'), ("input2", '2')]
# list of tuple (output identifier, asReference attribute)
out... | from owslib.wps import WebProcessingService, monitorExecution
verbose = True
# get multiple outputs
wps = WebProcessingService('http://rsg.pml.ac.uk/wps/generic.cgi', verbose=verbose)
processid = 'dummyprocess'
inputs = [("input1", '1'), ("input2", '2')]
# list of tuple (output identifier, asReference attribute)
out... | bsd-3-clause | Python |
14df0cbb7c8e948c46a69a398af4ec2e502dc7dd | Update sonic.py | pirate/bookmark-archiver,pirate/bookmark-archiver,pirate/bookmark-archiver | archivebox/search/backends/sonic.py | archivebox/search/backends/sonic.py | from typing import List, Generator
from sonic import IngestClient, SearchClient
from archivebox.util import enforce_types
from archivebox.config import SEARCH_BACKEND_HOST_NAME, SEARCH_BACKEND_PORT, SEARCH_BACKEND_PASSWORD, SONIC_BUCKET, SONIC_COLLECTION
MAX_SONIC_TEXT_LENGTH = 2000
@enforce_types
def index(snapsho... | from typing import List, Generator
from sonic import IngestClient, SearchClient
from archivebox.util import enforce_types
from archivebox.config import SEARCH_BACKEND_HOST_NAME, SEARCH_BACKEND_PORT, SEARCH_BACKEND_PASSWORD, SONIC_BUCKET, SONIC_COLLECTION
MAX_SONIC_TEXT_LENGTH = 20000
@enforce_types
def index(snapsh... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.