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 |
|---|---|---|---|---|---|---|---|---|
366371957a01a564c1860313ca04d484caf89fc1 | Create app.py | rajeshrao04/news-api | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | apache-2.0 | Python |
df3d7897d71cd7349934c215c39468630c703ebd | Add help. | drakeet/DrakeetLoveBot | app.py | app.py | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot_name = '@DrakeetLoveBo... | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot_name = '@DrakeetLoveBo... | mit | Python |
60820804840e7c4bbb9049aedfbb67a5beecfe53 | use patch for updates as in other apps | praekelt/seed-stage-based-messaging,praekelt/seed-stage-based-messaging,praekelt/seed-staged-based-messaging | scheduler/client.py | scheduler/client.py |
"""
Client for Messaging Content Store HTTP services APIs.
"""
import requests
import json
class SchedulerApiClient(object):
"""
Client for Scheduler API.
:param str api_token:
An API Token.
:param str api_url:
The full URL of the API. Defaults to
``http://seed-scheduler/... |
"""
Client for Messaging Content Store HTTP services APIs.
"""
import requests
import json
class SchedulerApiClient(object):
"""
Client for Scheduler API.
:param str api_token:
An API Token.
:param str api_url:
The full URL of the API. Defaults to
``http://seed-scheduler/... | bsd-3-clause | Python |
c9606a1d62df63b3b1b83b598efeb628d3428e20 | Bump to v0.10.1 | johanneswilm/eha-nutsurv-django,eHealthAfrica/nutsurv,johanneswilm/eha-nutsurv-django,johanneswilm/eha-nutsurv-django,eHealthAfrica/nutsurv,eHealthAfrica/nutsurv | nutsurv/__init__.py | nutsurv/__init__.py | __version__ = '0.10.1'
__url__ = 'https://github.com/eHealthAfrica/eha-nutsurv-django'
| __version__ = '0.9.0'
__url__ = 'https://github.com/eHealthAfrica/eha-nutsurv-django'
| agpl-3.0 | Python |
8b8754296a71e43315b3bb300770f2f621694bbb | add headers & load_profile support for converter | yandex/yandex-tank,yandex/yandex-tank | yandextank/version.py | yandextank/version.py | VERSION = '1.16.3'
| VERSION = '1.16.2'
| lgpl-2.1 | Python |
4a43cde46a0f12a9ad7681c63d9dea3918ac2013 | Update scripts version accordingly | wikimedia/pywikibot-core,wikimedia/pywikibot-core | scripts/__init__.py | scripts/__init__.py | """**Scripts** folder contains predefined scripts easy to use.
Scripts are only available im Pywikibot ist instaled in directory mode
and not as side package. They can be run in command line using the pwb
wrapper script::
python pwb.py <global options> <name_of_script> <options>
Every script provides a ``-help`... | """**Scripts** folder contains predefined scripts easy to use.
Scripts are only available im Pywikibot ist instaled in directory mode
and not as side package. They can be run in command line using the pwb
wrapper script::
python pwb.py <global options> <name_of_script> <options>
Every script provides a ``-help`... | mit | Python |
a68e484487289ab9aa208b88884c7b6e5537bab2 | Add basic argparse support | gforsyth/doctr_testing,doctrtesting/doctr,drdoctr/doctr | doctr/__main__.py | doctr/__main__.py | """
doctr
A tool to automatically deploy docs to GitHub pages from Travis CI.
"""
import sys
import os
import argparse
from .local import generate_GitHub_token, encrypt_variable
from .travis import setup_GitHub_push, commit_docs, push_docs
from . import __version__
def main():
parser = argparse.ArgumentParser(d... | import sys
import os
from .local import generate_GitHub_token, encrypt_variable
from .travis import setup_GitHub_push, commit_docs, push_docs
def main():
on_travis = os.environ.get("TRAVIS_JOB_NUMBER", '')
if on_travis:
# TODO: Get this automatically
repo = sys.argv[1]
if setup_GitHub... | mit | Python |
75e03a0ea08fe88d3baf054ade578dde60c181c1 | add shebang to db build script | mcogswell/cnn_treevis,mcogswell/cnn_treevis,mcogswell/cnn_treevis | scripts/build_db.py | scripts/build_db.py | #!/usr/bin/env python
import caffe
from recon import Reconstructor
def main():
'''
Usage:
build_db.py <net_id> <blob_names>... [--gpu <id>]
Options:
--gpu <id> The id of the GPU to use [default: -1]
'''
import docopt, textwrap
main_args = docopt.docopt(textwrap.dedent(main.__... | import caffe
from recon import Reconstructor
def main():
'''
Usage:
build_db.py <net_id> <blob_names>... [--gpu <id>]
Options:
--gpu <id> The id of the GPU to use [default: -1]
'''
import docopt, textwrap
main_args = docopt.docopt(textwrap.dedent(main.__doc__))
net_id = m... | mit | Python |
05b2848849553172873600ffd6344fc2b1f12d8e | Substitute a more realistic jurisdiction_id | datamade/pupa,mileswwatkins/pupa,rshorey/pupa,opencivicdata/pupa,mileswwatkins/pupa,influence-usa/pupa,datamade/pupa,influence-usa/pupa,rshorey/pupa,opencivicdata/pupa | example/__init__.py | example/__init__.py | from pupa.scrape import Jurisdiction
from .people import PersonScraper
class Example(Jurisdiction):
jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example'
def get_metadata(self):
return {
'name': 'Example',
'legislature_name': 'Example Legislature',
... | from pupa.scrape import Jurisdiction
from .people import PersonScraper
class Example(Jurisdiction):
jurisdiction_id = 'ex'
def get_metadata(self):
return {
'name': 'Example',
'legislature_name': 'Example Legislature',
'legislature_url': 'http://example.com',
... | bsd-3-clause | Python |
f136e140a57078c4f0f665051df74dffb1351f33 | fix loading in run_goal_conditioned_policy.py | vitchyr/rlkit | scripts/run_goal_conditioned_policy.py | scripts/run_goal_conditioned_policy.py | import argparse
import torch
from rlkit.core import logger
from rlkit.samplers.rollout_functions import multitask_rollout
from rlkit.torch import pytorch_util as ptu
from rlkit.envs.vae_wrapper import VAEWrappedEnv
def simulate_policy(args):
data = torch.load(args.file)
policy = data['evaluation/policy']
... | import argparse
import pickle
from rlkit.core import logger
from rlkit.samplers.rollout_functions import multitask_rollout
from rlkit.torch import pytorch_util as ptu
from rlkit.envs.vae_wrapper import VAEWrappedEnv
def simulate_policy(args):
data = pickle.load(open(args.file, "rb"))
policy = data['evaluatio... | mit | Python |
3298fff0ded49c21897a7387a7f3093c351ae04f | Use os.exelp to launch psql | lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server | scripts/run_psql.py | scripts/run_psql.py | #!/usr/bin/env python
# Copyright (C) 2011 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
from acoustid.script import run_script
import os
def main(script, opts, args):
os.execlp('psql', 'psql', *script.config.database.create_psql_args())
run_script(main)
| #!/usr/bin/env python
# Copyright (C) 2011 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
from acoustid.script import run_script
import subprocess
def main(script, opts, args):
subprocess.call(['psql'] + script.config.database.create_psql_args())
run_script(main)
| mit | Python |
05e9b7a3cf9dd46a599b9cc0d7b7944c01b5104f | remove FIXME now selenium test is working | simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote | selenium_tests/test_user_accounting.py | selenium_tests/test_user_accounting.py | from selenium_tests.AdminDriverTest import AdminDriverTest
from selenium.webdriver.common.by import By
import os
class TestUserAccounting(AdminDriverTest):
def test_create_new_entry_button(self):
self.click_first_element_located(By.LINK_TEXT, "Users")
self.click_first_button("Create New Entry")
... | from selenium_tests.AdminDriverTest import AdminDriverTest
from selenium.webdriver.common.by import By
import os
class TestUserAccounting(AdminDriverTest):
def test_create_new_entry_button(self):
self.click_first_element_located(By.LINK_TEXT, "Users")
self.click_first_button("Create New Entry")
... | bsd-3-clause | Python |
a3a35f3a967a8a875d64bad34193ab4198abd875 | Update python script to use date time objects directly to schedule things. Partially completed. | ilovepi/NCD,ilovepi/NCD,ilovepi/NCD,ilovepi/NCD | scripts/schedule.py | scripts/schedule.py | import random, fileinput
from datetime import datetime, date, time
from dateutil.rrule import rrule, DAILY
class ScheduleMaker(object):
"""docstring for ScheduleMaker"""
def __init__(self, ip_file, start_date:date, end_date: date, period:datetime, command):
super(ScheduleMaker, self).__init__()
... | from datetime import date
from dateutil.rrule import rrule, DAILY
class ClassName(object):
"""docstring for """
def __init__(self, arg):
super(, self).__init__()
self.arg = arg
ScheduleMaker(object):
"""docstring for ScheduleMaker"""
def __init__(self, ip_file, start_date, end_... | mit | Python |
5de304b53e5494fc47b157e52603d8bd36cda93b | Add boolean value alongside the boolean field name in icon label | flask-admin/flask-admin,flask-admin/flask-admin,flask-admin/flask-admin,flask-admin/flask-admin | flask_admin/model/typefmt.py | flask_admin/model/typefmt.py | import json
from markupsafe import Markup
from flask_admin._compat import text_type
try:
from enum import Enum
except ImportError:
Enum = None
def null_formatter(view, value, name):
"""
Return `NULL` as the string for `None` value
:param value:
Value to check
"""
retu... | import json
from markupsafe import Markup
from flask_admin._compat import text_type
try:
from enum import Enum
except ImportError:
Enum = None
def null_formatter(view, value, name):
"""
Return `NULL` as the string for `None` value
:param value:
Value to check
"""
retu... | bsd-3-clause | Python |
63bcd91df2b36bede393bbf9668114354c494f99 | Update urltools.py | dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiotti/Flask-AppBuilder,dpgaspar/... | flask_appbuilder/urltools.py | flask_appbuilder/urltools.py | from flask import url_for, request
def get_group_by_args():
"""
Get page arguments for group by
"""
group_by = request.args.get('group_by')
if not group_by: group_by = ''
return group_by
def get_page_args():
"""
Get page arguments, returns a dictionary
{ <VIEW_NAME>: PA... |
def get_group_by_args():
"""
Get page arguments for group by
"""
group_by = request.args.get('group_by')
if not group_by: group_by = ''
return group_by
def get_page_args():
"""
Get page arguments, returns a dictionary
{ <VIEW_NAME>: PAGE_NUMBER }
Arguments ... | bsd-3-clause | Python |
0355d4233f74ca585c92e34b2547d185a2a3d5fc | Update __init__.py | aspuru-guzik-group/selfies | selfies/__init__.py | selfies/__init__.py | #!/usr/bin/env python
"""
SELFIES: a robust representation of semantically constrained graphs with an
example application in chemistry.
SELFIES (SELF-referencIng Embedded Strings) is a general-purpose,
sequence-based, robust representation of semantically constrained graphs.
It is based on a Chomsky type-2 g... | #!/usr/bin/env python
"""
SELFIES: a robust representation of semantically constrained graphs with an
example application in chemistry.
SELFIES (SELF-referencIng Embedded Strings) is a general-purpose,
sequence-based, robust representation of semantically constrained graphs.
It is based on a Chomsky type-2 g... | apache-2.0 | Python |
28c8f6452383e8327918c215dab6bcbcafda5029 | Update ml_restore.py | pgyogesh/MarkLogic,pgyogesh/MarkLogic,pgyogesh/MarkLogic | forest-restore/ml_restore.py | forest-restore/ml_restore.py | from multiprocessing import Pool
from requests.auth import HTTPDigestAuth
import optparse
import requests
import ConfigParser
import logging
# Command line argument parsing
parser = optparse.OptionParser()
parser.add_option("-c","--config-file", dest="configfile", action="store", help="Specify the config file")
parse... | from multiprocessing import Pool
from requests.auth import HTTPDigestAuth
import optparse
import requests
import ConfigParser
import logging
# Command line argument parsing
parser = optparse.OptionParser()
parser.add_option("-c","--config-file", dest="configfile", action="store", help="Specify the config file")
parser... | mit | Python |
1f6af4efe674a1891f067af94246cc7e3800889b | 版本号:0.0.6 增加 @cache | vex1023/vxUtils | vxUtils/__init__.py | vxUtils/__init__.py | # endcoding = utf-8
'''
author :
email :
'''
__author__ = 'vex1023'
__email__ = 'vex1023@qq.com'
__version__ = '0.0.6'
__homepages__ = 'https://github.com/vex1023/vxUtils'
__logger__ = 'vxQuant.vxUtils'
from PrettyLogger import *
| # endcoding = utf-8
'''
author :
email :
'''
__author__ = 'vex1023'
__email__ = 'vex1023@qq.com'
__version__ = '0.0.5'
__homepages__ = 'https://github.com/vex1023/vxUtils'
__logger__ = 'vxQuant.vxUtils'
from PrettyLogger import *
| mit | Python |
d5563c097f0a738ccc7df4e096318ddef9a979f4 | Increase queue job timeout | zooniverse/aggregation,zooniverse/aggregation,zooniverse/aggregation | engine/web_api.py | engine/web_api.py | #! /usr/bin/env python
from flask import Flask, make_response, request
from rq import Queue
from load_redis import configure_redis
from jobs import aggregate
import os
import json
import logging
app = Flask(__name__)
env = os.getenv('FLASK_ENV', 'production')
#30 mins - http://python-rq.org/docs/results/
q = Queue('d... | #! /usr/bin/env python
from flask import Flask, make_response, request
from rq import Queue
from load_redis import configure_redis
from jobs import aggregate
import os
import json
import logging
app = Flask(__name__)
env = os.getenv('FLASK_ENV', 'production')
#30 mins - http://python-rq.org/docs/results/
q = Queue('d... | apache-2.0 | Python |
7c3c333bd7fada179b7fcd9cba08eefd7b3b42cf | check in parser sketch | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/instant_articles/parser.py | bulbs/instant_articles/parser.py | class InstantArticleParser():
def __init__(self, intermediate):
pass
def generate_body(self, intermediate):
body = ""
for key, body in intermediate.iteritems():
body.append(parse_item(key, body))
def parse_item(self, key, body):
if key == "text":
re... | class ContentTransformer(HTMLParser):
pass
class FacebookTransformer(ContentTransformer):
pass
| mit | Python |
10ce81ed374097009d710bb3cc8dcd70c1c3e2e4 | Update core.frameworks __init__.py | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | syft/core/frameworks/__init__.py | syft/core/frameworks/__init__.py | from syft.core import torch, tensorflow, numpy, encode, pandas
__all__ = ["torch", "tensorflow", "numpy", "encode", "pandas"]
| from . import torch
from . import tensorflow
from . import numpy
from . import encode
from . import pandas
__all__ = ["torch", "tensorflow", "numpy", "encode", "pandas"]
| apache-2.0 | Python |
64185e6890f4310a01755671a4d17238ec7ae6d2 | Add method for attach stars count to projects queryset. | jeffdwyatt/taiga-back,astronaut1712/taiga-back,seanchen/taiga-back,Zaneh-/bearded-tribble-back,gauravjns/taiga-back,bdang2012/taiga-back-casting,forging2012/taiga-back,joshisa/taiga-back,taigaio/taiga-back,CMLL/taiga-back,Tigerwhit4/taiga-back,EvgeneOskin/taiga-back,EvgeneOskin/taiga-back,astronaut1712/taiga-back,WALR/... | taiga/projects/stars/services.py | taiga/projects/stars/services.py | from django.db.models import F
from django.db.transaction import atomic
from django.db.models.loading import get_model
from django.contrib.auth import get_user_model
from .models import Fan, Stars
def star(project, user):
"""Star a project for an user.
If the user has already starred the project nothing hap... | from django.db.models import F
from django.db.transaction import atomic
from django.db.models.loading import get_model
from django.contrib.auth import get_user_model
from .models import Fan, Stars
def star(project, user):
"""Star a project for an user.
If the user has already starred the project nothing hap... | agpl-3.0 | Python |
24151ca5d19c3743854cacf8bccb1709a7d46a87 | Format using formatting tool | evanepio/dotmanca,evanepio/dotmanca,evanepio/dotmanca | gallery/models.py | gallery/models.py | from django.db import models
from django.urls import reverse
from dotmanca.storage import OverwriteStorage
class Gallery(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(unique=True)
added_timestamp = models.DateTimeField(auto_now_add=True)
description = models.TextField(... | from django.db import models
from django.urls import reverse
from dotmanca.storage import OverwriteStorage
class Gallery(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(unique=True)
added_timestamp = models.DateTimeField(auto_now_add=True)
description = models.TextField(... | mit | Python |
08eca76203eee2ddf2887c11d067e05b2c2d70f7 | Add allow-legacy-extension-manifests flag so that chrome can load v1 chromoting webapp | dednal/chromium.src,hgl888/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,axinging/chromium-crosswalk,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,ltilve/chromium,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,crosswalk-project/chromium... | chrome/test/functional/chromoting/chromoting_base.py | chrome/test/functional/chromoting/chromoting_base.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Common imports, setup, etc for chromoting tests."""
import os
def _SetupPaths():
"""Add chrome/test/functional to sys.path for importing pyauto_f... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Common imports, setup, etc for chromoting tests."""
import os
def _SetupPaths():
"""Add chrome/test/functional to sys.path for importing pyauto_f... | bsd-3-clause | Python |
b067b251c4d37ef9cf876a33b470733fce046807 | add settings dir to system path for wsgi | whitews/BAMA_Analytics,whitews/BAMA_Analytics,whitews/BAMA_Analytics | BAMA_Analytics/wsgi.py | BAMA_Analytics/wsgi.py | """
WSGI config for BAMA_Analytics project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BAMA_Analytics.settings")
path... | """
WSGI config for BAMA_Analytics project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BAMA_Analytics.settings")
from... | bsd-2-clause | Python |
aacb587ba875ba2a158e349b3191ead8adb9b515 | refactor to make single case type interface public | qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/app_manager.py | corehq/apps/userreports/app_manager.py | from corehq.apps.app_manager.util import ParentCasePropertyBuilder
from corehq.apps.userreports.models import DataSourceConfiguration
def get_case_data_sources(app):
"""
Returns a dict mapping case types to DataSourceConfiguration objects that have
the default set of case properties built in.
"""
... | from corehq.apps.app_manager.util import ParentCasePropertyBuilder
from corehq.apps.userreports.models import DataSourceConfiguration
def get_case_data_sources(app):
"""
Returns a dict mapping case types to DataSourceConfiguration objects that have
the default set of case properties built in.
"""
... | bsd-3-clause | Python |
e10f2b85775412dd60f11deea6e7a7f8b84edfbe | Add name for entry view URL | uranusjr/django-buysafe | buysafe/urls.py | buysafe/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns(
'buysafe.views',
url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'),
(r'^start/$', 'start'),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$', 'fail'),
(r'^check/(?P<payment_typ... | from django.conf.urls import patterns
urlpatterns = patterns(
'buysafe.views',
(r'^entry/(?P<order_id>\d+)/$', 'entry'),
(r'^start/$', 'start'),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$', 'fail'),
(r'^check/(?P<payment_type>[01])/$', 'check')
)
| bsd-3-clause | Python |
94ee0506364be2ed58e793c4d237bb6c0da7f2d2 | fix error on 0D label array | rufrozen/cudarray,rufrozen/cudarray,andersbll/cudarray,bssrdf/cudarray,rufrozen/cudarray,bssrdf/cudarray,andersbll/cudarray | cudarray/numpy_backend/nnet/special.py | cudarray/numpy_backend/nnet/special.py | import numpy as np
def softmax(X):
e = np.exp(X - np.amax(X, axis=1, keepdims=True))
return e/np.sum(e, axis=1, keepdims=True)
def categorical_cross_entropy(y_pred, y_true, eps=1e-15):
# Assumes one-hot encoding.
y_pred = np.clip(y_pred, eps, 1 - eps)
# XXX: do we need to normalize?
y_pred /... | import numpy as np
def softmax(X):
e = np.exp(X - np.amax(X, axis=1, keepdims=True))
return e/np.sum(e, axis=1, keepdims=True)
def categorical_cross_entropy(y_pred, y_true, eps=1e-15):
# Assumes one-hot encoding.
y_pred = np.clip(y_pred, eps, 1 - eps)
# XXX: do we need to normalize?
y_pred /... | mit | Python |
d827c8efd57c10750c33072920fd59ccb5dda9fe | Fix related lookup error in admin. | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | chmvh_website/resources/admin.py | chmvh_website/resources/admin.py | from django.contrib import admin
from resources import models
class CategoryAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('title', 'important')
}),
)
list_display = ('title', 'important')
search_fields = ('title',)
class ResourceAdmin(admin.ModelAdmin):
... | from django.contrib import admin
from resources import models
class CategoryAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('title', 'important')
}),
)
list_display = ('title', 'important')
search_fields = ('title',)
class ResourceAdmin(admin.ModelAdmin):
... | mit | Python |
e302014cd1d914cd2227c9898dae991640c8d748 | Update wsgi.py settings | seciadev/django_weddingsite,seciadev/django_weddingsite,seciadev/django_weddingsite | weddingsite/wsgi.py | weddingsite/wsgi.py | """
WSGI config for weddingsite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'weddingsite.settings'
from django.core.wsg... | """
WSGI config for weddingsite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weddingsite.settings")
from djan... | mpl-2.0 | Python |
b745b5e1a843195f2f067602381be038744a9390 | Bump version to 1.0.0 | weberwang/WeRoBot,FlyRabbit/WeRoBot,whtsky/WeRoBot,FlyRabbit/WeRoBot,whtsky/WeRoBot,weberwang/WeRoBot,whtsky/WeRoBot,adam139/WeRobot,adam139/WeRobot | werobot/__init__.py | werobot/__init__.py | __version__ = '1.0.0'
__author__ = 'whtsky'
__license__ = 'MIT'
__all__ = ["WeRoBot"]
try:
from werobot.robot import WeRoBot
except ImportError:
pass
| __version__ = '0.7.0'
__author__ = 'whtsky'
__license__ = 'MIT'
__all__ = ["WeRoBot"]
try:
from werobot.robot import WeRoBot
except ImportError:
pass
| mit | Python |
c4c8ca08f162686da0396fd6d9427eb5efcc6168 | Improve v7 conversion cli command | wbolster/whip-neustar | whip_neustar/cli.py | whip_neustar/cli.py | """
Command line interface module.
"""
import gzip
import logging
import sys
import aaargh
logger = logging.getLogger(__name__)
JSON_LIBS = ('ujson', 'simplejson', 'json')
for lib in JSON_LIBS:
try:
json = __import__(lib)
except ImportError:
pass
else:
break
from . import reade... | """
Command line interface module.
"""
import gzip
import logging
import sys
import aaargh
logger = logging.getLogger(__name__)
JSON_LIBS = ('ujson', 'simplejson', 'json')
for lib in JSON_LIBS:
try:
json = __import__(lib)
except ImportError:
pass
else:
break
from . import reade... | bsd-3-clause | Python |
96a49c5239b051a5ffd4371e360a74398b6532b5 | update openstack.py helper sample | karmab/kcli,karmab/kcli,karmab/kcli,karmab/kcli | extras/openstack.py | extras/openstack.py | from kvirt.config import Kconfig
cluster = 'testk'
network = "default"
api_ip = "12.0.0.253"
cidr = "12.0.0.0/24"
config = Kconfig()
config.k.delete_network_port(f"{cluster}-vip" % cluster)
config.k.create_network(name=network, cidr=cidr, overrides={'port_security_enabled': True})
config.k.create_network_port(f"{clus... | from kvirt.config import Kconfig
cluster = 'testk'
network = "default"
api_ip = "11.0.0.253"
cidr = "11.0.0.0/24"
config = Kconfig()
config.k.delete_network_port("%s-vip" % cluster)
config.k.create_network(name=network, cidr=cidr, overrides={'port_security_enabled': True})
config.k.create_network_port("%s-vip" % clus... | apache-2.0 | Python |
cdc2eeb17bcd553e79ee6985fc3bad7889ef5647 | add kwargs and make exceptions noisy by default | scrapinghub/extruct | extruct/__init__.py | extruct/__init__.py | import logging
import argparse
from lxml.html import fromstring
from extruct.jsonld import JsonLdExtractor
from extruct.rdfa import RDFaExtractor
from extruct.w3cmicrodata import MicrodataExtractor
from extruct.opengraph import OpenGraphExtractor
from extruct.microformat import MicroformatExtractor
from extruct.xmldom ... | import logging
from lxml.html import fromstring
from extruct.jsonld import JsonLdExtractor
from extruct.rdfa import RDFaExtractor
from extruct.w3cmicrodata import MicrodataExtractor
from extruct.opengraph import OpenGraphExtractor
from extruct.microformat import MicroformatExtractor
from extruct.xmldom import XmlDomHTM... | bsd-3-clause | Python |
86ea5819fed43086f347f0601f9372fa40742493 | remove unnecessary imports | mikevb1/discordbot,mikevb1/lagbot | bot.py | bot.py | """Discord bot for Discord."""
import datetime
import asyncio
import logging
import sys
import os
from discord.ext import commands
import discord
# Files and Paths
app_path = os.path.split(os.path.abspath(sys.argv[0]))[0]
data_path = os.path.join(app_path, 'data')
token_file = os.path.join(app_path, 'token.txt')
log... | """Discord bot for Discord."""
from collections import OrderedDict
import datetime
import requests
import asyncio
import logging
import json
import sys
import os
from discord.ext import commands
import discord
# Files and Paths
app_path = os.path.split(os.path.abspath(sys.argv[0]))[0]
data_path = os.path.join(app_pa... | mit | Python |
a5e87e7cf2a607c33f1fa669c42d9f13a4cffd97 | use a meaningful uri for prediction service | neoseele/prediction-aef | service/__init__.py | service/__init__.py | # -*- coding: utf-8 -*-
from flask import Flask, current_app, request, jsonify
import io
import base64
import logging
import numpy as np
import cv2
from service import model
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
if ... | # -*- coding: utf-8 -*-
from flask import Flask, current_app, request, jsonify
import io
import base64
import logging
import numpy as np
import cv2
from service import model
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
if ... | apache-2.0 | Python |
1587d6935ea472d512bb956a8aa8218d4cfd5242 | remove country lookup, using db trigger instead | justinwp/croplands,justinwp/croplands | gfsad/views/api/locations.py | gfsad/views/api/locations.py | from gfsad import api
from gfsad.models import Location
from processors import api_roles, add_user_to_posted_data, remove_relations, debug_post
from records import save_record_state_to_history
from gfsad.tasks.records import get_ndvi, build_static_records
def process_records(result=None, **kwargs):
"""
This p... | from gfsad import api
from gfsad.models import Location
from processors import api_roles, add_user_to_posted_data, remove_relations, debug_post
from records import save_record_state_to_history
from gfsad.tasks.records import get_ndvi, build_static_records
from gfsad.utils.countries import find_country
def process_rec... | mit | Python |
cb9b6fcb5b6cf6ad286758a7ceef789d6265ceae | Update service.py | SimonWang2014/DockerConsoleApp,SimonWang2014/DockerConsoleApp,liuhong1happy/DockerConsoleApp,liuhong1happy/DockerConsoleApp,SimonWang2014/DockerConsoleApp,SimonWang2014/DockerConsoleApp,liuhong1happy/DockerConsoleApp | services/service.py | services/service.py | from models.service import ServiceModel
import tornado.gen
class ServiceService():
m_service = ServiceModel()
def __init__(self):
pass
@tornado.gen.engine
def insert_service(self,service,callback=None):
model = yield tornado.gen.Task(self.m_service.insert,service)
c... | from models.service import ServiceModel
import tornado.gen
class ServiceService():
m_service = ServiceModel()
def __init__(self):
pass
def insert_service(self,service,callback=None):
model = yield tornado.gen.Task(m_service.insert,service)
callback(model)
def... | apache-2.0 | Python |
26ccb7620af2d883e9c584608cf3270e1561627c | Bump version for release | tiangolo/fastapi,tiangolo/fastapi,tiangolo/fastapi | fastapi/__init__.py | fastapi/__init__.py | """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.1.9"
from .applications import FastAPI
from .routing import APIRouter
from .params import Body, Path, Query, Header, Cookie, Form, File, Security, Depends
| """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.1.8"
from .applications import FastAPI
from .routing import APIRouter
from .params import Body, Path, Query, Header, Cookie, Form, File, Security, Depends
| mit | Python |
6f4dbc4aef65da839a9fd97345ed923251de93ce | reduce padding in logging | fedora-infra/fedimg,fedora-infra/fedimg | fedmsg.d/logging.py | fedmsg.d/logging.py | # Setup fedmsg logging.
# See the following for constraints on this format https://bit.ly/Xn1WDn
bare_format = "[%(asctime)s][%(name)s][%(levelname)s](%(threadName)s) %(message)s"
config = dict(
logging=dict(
version=1,
formatters=dict(
bare={
"datefmt": "%Y-%m-%d %H:%M:... | # Setup fedmsg logging.
# See the following for constraints on this format https://bit.ly/Xn1WDn
bare_format = "[%(asctime)s][%(name)10s %(levelname)7s](%(threadName)s) %(message)s"
config = dict(
logging=dict(
version=1,
formatters=dict(
bare={
"datefmt": "%Y-%m-%d %H:%... | agpl-3.0 | Python |
c84daa82aa3846445390c1bdf37db150671a4256 | Improve build_database step | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/steps/build_database.py | dbaas/workflow/steps/build_database.py | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from logical.models import Database
import datetime
LOG = logging.getLogger(__name__)
class BuildDatabase(BaseStep):
def __unicode__(self):
return "Creating logical database..."
def do(self, workflow_dict):
try:
... | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from logical.models import Database
import datetime
LOG = logging.getLogger(__name__)
class BuildDatabase(BaseStep):
def __unicode__(self):
return "Creating logical database..."
def do(self, workflow_dict):
try:
... | bsd-3-clause | Python |
3bde1cac6163d90287d2bef2d0ca551c8d544488 | add more multi qbit test programs | BBN-Q/pyqgl2,BBN-Q/pyqgl2 | src/python/pyqgl2/test/multi.py | src/python/pyqgl2/test/multi.py | from qgl2.qgl1 import QubitFactory, Id, X, MEAS, Y
from qgl2.qgl2 import qgl2decl, sequence, concur, seq
from qgl2.basic_sequences.qgl2_plumbing import init
@qgl2decl
def multiQbitTest() -> sequence:
q1 = QubitFactory('q1')
q2 = QubitFactory('q2')
with concur:
with seq:
init(q1)
... | from qgl2.qgl1 import QubitFactory, Id, X, MEAS
from qgl2.qgl2 import qgl2decl, sequence, concur, seq
from qgl2.basic_sequences.qgl2_plumbing import init
@qgl2decl
def multiQbitTest() -> sequence:
q1 = QubitFactory('q1')
q2 = QubitFactory('q2')
with concur:
with seq:
init(q1)
... | apache-2.0 | Python |
8a5db519f7aa810d4009ada20de46fb982da0ec8 | Fix description in __init__.py | Khan/wtforms | wtforms/__init__.py | wtforms/__init__.py | """
wtforms
~~~~~~~
WTForms is a HTTP/HTML forms handling library, written in Python.
It handles definition, validation and rendering in a flexible and i18n
friendly way. It heavily reduces boilerplate and is completely unicode
aware.
Check out the hg repository at http://www.bitb... | """
wtforms
~~~~~~~
What The Forms is a framework-agnostic way of generating HTML forms, handling
form submissions, and validating it.
Check out our trac wiki at http://dev.simplecodes.com/projects/wtforms
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see... | bsd-3-clause | Python |
294f17c5c58b864ede65f2f842b792da85bb5c85 | Bump version | spectralDNS/shenfun,spectralDNS/shenfun,spectralDNS/shenfun | shenfun/__init__.py | shenfun/__init__.py | """
This is the **shenfun** package
What is **shenfun**?
================================
``Shenfun`` is a high performance computing platform for solving partial
differential equations (PDEs) by the spectral Galerkin method. The user
interface to shenfun is very similar to
`FEniCS <https://fenicsproject.org>`_, but ... | """
This is the **shenfun** package
What is **shenfun**?
================================
``Shenfun`` is a high performance computing platform for solving partial
differential equations (PDEs) by the spectral Galerkin method. The user
interface to shenfun is very similar to
`FEniCS <https://fenicsproject.org>`_, but ... | bsd-2-clause | Python |
dd5751c353391df0f8b112b946e4a928e85cae5e | test git commit | xgds/xgds_video,xgds/xgds_video,xgds/xgds_video | xgds_video/tests.py | xgds_video/tests.py | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
from django.test import TestCase
class xgds_videoTest(TestCase):
"""
Tests for xgds_video
"""
def... | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
from django.test import TestCase
class xgds_videoTest(TestCase):
"""
Tests for xgds_video
"""
def... | apache-2.0 | Python |
fb3c48ffc6769f00fda70cf9fdba0da479ff9a4f | make readthedocs happy | alekz112/xlwings,ston380/xlwings,gdementen/xlwings,gdementen/xlwings,Juanlu001/xlwings,Juanlu001/xlwings | xlwings/__init__.py | xlwings/__init__.py | from __future__ import absolute_import
import sys
__version__ = '0.2.0'
# Python 2 vs 3
PY3 = sys.version_info[0] == 3
# Platform specific imports
if sys.platform.startswith('win'):
import xlwings._xlwindows as xlplatform
else:
import xlwings._xlmac as xlplatform
# API
from .main import Workbook, Range, Cha... | from __future__ import absolute_import
import sys
__version__ = '0.2.0'
# Python 2 vs 3
PY3 = sys.version_info[0] == 3
# Platform specific imports
if sys.platform.startswith('win'):
import xlwings._xlwindows as xlplatform
if sys.platform.startswith('darwin'):
import xlwings._xlmac as xlplatform
# API
from ... | apache-2.0 | Python |
c842b0f93117f4fca8cc195ec73f844b281a0f19 | Update server.py | cfpb/django-nudge | src/nudge/server.py | src/nudge/server.py | """
Handles commands received from a Nudge client
"""
import binascii
import pickle
from Crypto.Cipher import AES
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from reversion.models import Version, VERSION_DELETE
try:
import simplejson as json
except ImportError:
... | """
Handles commands received from a Nudge client
"""
import binascii
import pickle
from Crypto.Cipher import AES
from django.contrib.contenttypes.models import ContentType
from reversion.models import Version, VERSION_DELETE
try:
import simplejson as json
except ImportError:
import json
def valid_batch(batc... | cc0-1.0 | Python |
53661db984233f38ab18f7df039c7a93a7382cdb | Revert "[common]: Add data.cache.audio settings entry" | pkulev/xoinvader,pankshok/xoinvader | xoinvader/common.py | xoinvader/common.py | """
Module for common shared objects.
"""
import json
from os.path import dirname
import xoinvader
from xoinvader.settings import Settings as Entry
from xoinvader.utils import Point
def get_json_config(path):
"""Return Settings object made from json."""
with open(path) as fd:
config = Entry(json.... | """
Module for common shared objects.
"""
import json
from os.path import dirname
import xoinvader
from xoinvader.settings import Settings as Entry
from xoinvader.utils import Point
def get_json_config(path):
"""Return Settings object made from json."""
with open(path) as fd:
config = Entry(json.... | mit | Python |
324da23b97da9b513605610989ed8adb1ae80c4a | fix typo in config module | scott-maddox/obpds | src/obpds/config.py | src/obpds/config.py | cfg = {}
cfg['plot/semilogy/yrange'] = 1e7
cfg['plot/tight_layout'] = False | cfg = {}
cfg['plot.semilogy/yrange'] = 1e7
cfg['plot/tight_layout'] = False | agpl-3.0 | Python |
f360215dcd8cbb782af445131ab3a876b9580908 | quit requests dep | urkh/ddg | ddg.py | ddg.py | import sys
import urllib2
import json
import ipdb as pdb
def get_results(ddg):
results = []
for ret in ddg.get("RelatedTopics"):
if ret.has_key("Topics"):
for rett in ret.get("Topics"):
result_inf = {"description":rett["Text"], "url":rett["FirstURL"]}
el... | import sys
import requests
import ipdb as pdb
def get_results(ddg):
results = []
for ret in ddg.get("RelatedTopics"):
if ret.has_key("Topics"):
for rett in ret.get("Topics"):
result_inf = {"description":rett["Text"], "url":rett["FirstURL"]}
else:
... | bsd-2-clause | Python |
202a9b2ad72ffe4ab5981f9a4a886e0a36808eb6 | Add test for handling Infinity in json | mitsuhiko/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,gencer/sentry,mvaled/sentry,looker/sentry,zenefits/sentry,korealerts1/sentry,zenefits/sentry,Kryz/sentry,kevinlondon/sentry,alexm92/sentry,JamesMura/sentry,mvaled/sentry,kevinlondon/sentry,looker/sentry,beeftornado/sentry,BuildingLink/sentry,ifduyue/sentry,fel... | tests/sentry/utils/json/tests.py | tests/sentry/utils/json/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import uuid
from sentry.utils import json
from sentry.testutils import TestCase
class JSONTest(TestCase):
def test_uuid(self):
res = uuid.uuid4()
self.assertEquals(json.dumps(res), '"%s"' % res.hex)
def test_da... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import uuid
from sentry.utils import json
from sentry.testutils import TestCase
class JSONTest(TestCase):
def test_uuid(self):
res = uuid.uuid4()
self.assertEquals(json.dumps(res), '"%s"' % res.hex)
def test_da... | bsd-3-clause | Python |
0d5ad2213240984d7375289778e77b1453ff7875 | make test for free_ram support a range since it's often flaky | guidow/pyfarm-agent,pyfarm/pyfarm-agent,guidow/pyfarm-agent,pyfarm/pyfarm-agent,pyfarm/pyfarm-agent,guidow/pyfarm-agent | tests/test_agent/test_service.py | tests/test_agent/test_service.py | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Oliver Palmer
#
# 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
#
# U... | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Oliver Palmer
#
# 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
#
# U... | apache-2.0 | Python |
968c4e30ec71d2c51996868788a1b92f9f175bff | resolve not defined bug | faneshion/MatchZoo,faneshion/MatchZoo | tests/unit_test/test_datapack.py | tests/unit_test/test_datapack.py | from matchzoo.datapack import DataPack, load_datapack
import pytest
import shutil
import pandas as pd
@pytest.fixture
def data_pack():
relation = [['qid0', 'did0', 1], ['qid1', 'did1', 0]]
left = [['qid0', [1, 2]], ['qid1', [2, 3]]]
right = [['did0', [2, 3, 4]], ['did1', [3, 4, 5]]]
ctx = {'vocab_siz... | from matchzoo.datapack import DataPack, load_datapack
import pytest
import shutil
import pandas as pd
@pytest.fixture
def data_pack():
relation = [['qid0', 'did0', 1], ['qid1', 'did1', 0]]
left = [['qid0', [1, 2]], ['qid1', [2, 3]]]
right = [['did0', [2, 3, 4]], ['did1', [3, 4, 5]]]
ctx = {'vocab_siz... | apache-2.0 | Python |
6d9a9942254da2a2280106fb7b08fefb0f5457b9 | Add SNMP unit tests | brocade/pynos,SivagnanamCiena/pynos,BRCDcomm/pynos | tests/versions/base/test_snmp.py | tests/versions/base/test_snmp.py | #!/usr/bin/env python
"""
Copyright 2015 Brocade Communications Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or... | apache-2.0 | Python | |
a6caa061b4f25b22e9cbbcf35d214f7fb1bb6e51 | Print files that are checked | phase/o,phase/o,phase/o,phase/o | ide.py | ide.py | # NOTE: pass -d to this to print debugging info when the server crashes.
from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call
import sys, os, string, glob
app = Flask(__name__)
def compileO():
r = check_call(['gcc', 'o.c', '-DIDE', '-o', 'o-ide', '-lm'])
if... | # NOTE: pass -d to this to print debugging info when the server crashes.
from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call
import sys, os, string, glob
app = Flask(__name__)
def compileO():
r = check_call(['gcc', 'o.c', '-DIDE', '-o', 'o-ide', '-lm'])
if... | mit | Python |
dee38b7f7537913faea69d286682001a3b4b879a | Change reddit limit | kshvmdn/nba-scores,kshvmdn/NBAScores,kshvmdn/nba.js | streams.py | streams.py | import bs4
import html
import requests
STREAMS_URL = 'http://www.reddit.com/r/nbastreams.json?limit=30'
# STREAMS_URL = 'https://api.myjson.com/bins/40flf'
def main(teams):
submission = get_submission(request(STREAMS_URL), teams)
if submission is not None:
comments_url = 'http://reddit.com' + submiss... | import bs4
import html
import requests
STREAMS_URL = 'http://www.reddit.com/r/nbastreams.json?limit=20'
# STREAMS_URL = 'https://api.myjson.com/bins/40flf'
def main(teams):
submission = get_submission(request(STREAMS_URL), teams)
if submission is not None:
comments_url = 'http://reddit.com' + submiss... | mit | Python |
100ed05fe390588a9da646de86af90e6491b623b | bump version | vpuzzella/sixpack,blackskad/sixpack,seatgeek/sixpack,seatgeek/sixpack,llonchj/sixpack,spjwebster/sixpack,nickveenhof/sixpack,blackskad/sixpack,spjwebster/sixpack,vpuzzella/sixpack,smokymountains/sixpack,smokymountains/sixpack,smokymountains/sixpack,llonchj/sixpack,nickveenhof/sixpack,vpuzzella/sixpack,spjwebster/sixpac... | sixpack/__init__.py | sixpack/__init__.py | __version__ = '0.2.0'
| __version__ = '0.1.4'
| bsd-2-clause | Python |
ad118f0f1b011b1d15f598ae03b84c1b76e5c9d4 | Update scale_image.py | BMCV/galaxy-image-analysis,BMCV/galaxy-image-analysis | tools/scale_image/scale_image.py | tools/scale_image/scale_image.py | import argparse
import sys
import skimage.io
import skimage.transform
import scipy.misc
import warnings
import os
from PIL import Image
def scale_image(input_file, output_file, scale, order=1):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Image.MAX_IMAGE_PIXELS = 50000*50000
... | import argparse
import sys
import skimage.io
import skimage.transform
import scipy.misc
import warnings
import os
from PIL import Image
def scale_image(input_file, output_file, scale, order=1):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Image.MAX_IMAGE_PIXELS = 50000*50000
... | mit | Python |
69f85de77612ac8ed620831e1d043981395e9301 | Add pip install | techbureau/zaifbot,techbureau/zaifbot | zaifbot/__init__.py | zaifbot/__init__.py | import os, sys, subprocess
from zaifbot.errors import ZaifBotError
__version__ = '0.0.5'
class ZaifBot:
_process = []
def add_running_process(self, auto_trade_process):
self._process.append(auto_trade_process)
def start(self):
running_processes = []
for process in self._proces... | import os, sys, subprocess
from zaifbot.errors import ZaifBotError
__version__ = '0.0.5'
class ZaifBot:
_process = []
def add_running_process(self, auto_trade_process):
self._process.append(auto_trade_process)
def start(self):
running_processes = []
for process in self._proces... | mit | Python |
df707de0bb8b08011cd7e875c4f7d096f6fe2bb6 | simplify cursutils initialization | timlegrand/giterm,timlegrand/giterm | src/giterm/cursutils.py | src/giterm/cursutils.py | # -*- coding: utf-8 -*-
import curses
import pdb
import sys
screen = None
def init(stdscr):
global screen
screen = stdscr
def finalize(stdscr=None):
if not stdscr and not screen:
raise Exception('either call init() first or provide a valid window object')
stdscr = screen if screen and not ... | # -*- coding: utf-8 -*-
import curses
import pdb
import sys
screen = None
initialized = False
def init(stdscr):
global screen
screen = stdscr
global initialized
initialized = True
def finalize(stdscr):
curses.nocbreak()
stdscr.keypad(0)
curses.echo()
curses.endwin()
def debug(std... | bsd-2-clause | Python |
27fec389928c93ba0efe4ca1e4c5b34c3b73fa2c | Add a version base on djangocms version from where the code was cloned | emencia/emencia-cms-snippet,emencia/emencia-cms-snippet,emencia/emencia-cms-snippet | snippet/__init__.py | snippet/__init__.py | """
"cms.plugins.snippet" (from djangocms) clone to extend it with some facilities
"""
__version__ = '2.3.6.1'
| """
"cms.plugins.snippet" (from djangocms) clone to extend it with some facilities
""" | bsd-3-clause | Python |
7c2e67da2b26b6eebd6d11346215dbd962b3efe9 | Bump version number | mailgun/flanker | flanker/__init__.py | flanker/__init__.py | __version__ = '0.9.10'
| __version__ = '0.9.7'
| apache-2.0 | Python |
5dc128b84d2c76fc9039c412b91c1a31dd4bfa9b | Prepare v3.0.5.dev | Flexget/Flexget,Flexget/Flexget,crawln45/Flexget,ianstalk/Flexget,Flexget/Flexget,ianstalk/Flexget,malkavi/Flexget,crawln45/Flexget,crawln45/Flexget,Flexget/Flexget,malkavi/Flexget,malkavi/Flexget,ianstalk/Flexget,malkavi/Flexget,crawln45/Flexget | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
1256c71a7c4908c32920b081c62075d3c9efbadf | Prepare v3.0.12.dev | Flexget/Flexget,Flexget/Flexget,Flexget/Flexget,malkavi/Flexget,ianstalk/Flexget,ianstalk/Flexget,crawln45/Flexget,crawln45/Flexget,malkavi/Flexget,crawln45/Flexget,malkavi/Flexget,crawln45/Flexget,malkavi/Flexget,ianstalk/Flexget,Flexget/Flexget | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
4b9264c1652bcf98a58da0a0c3f56e129eb25cfe | Prepare v1.2.398.dev | qvazzler/Flexget,OmgOhnoes/Flexget,jacobmetrick/Flexget,Flexget/Flexget,poulpito/Flexget,dsemi/Flexget,LynxyssCZ/Flexget,ianstalk/Flexget,tarzasai/Flexget,tobinjt/Flexget,malkavi/Flexget,antivirtel/Flexget,JorisDeRieck/Flexget,sean797/Flexget,qk4l/Flexget,cvium/Flexget,OmgOhnoes/Flexget,oxc/Flexget,crawln45/Flexget,Fle... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
de22e547c57be633cb32d51e93a6efe9c9e90293 | Remove buggy log message if prctl is missing | hb9kns/PyBitmessage,hb9kns/PyBitmessage,hb9kns/PyBitmessage,hb9kns/PyBitmessage | src/helper_threading.py | src/helper_threading.py | import threading
try:
import prctl
def set_thread_name(name): prctl.set_name(name)
def _thread_name_hack(self):
set_thread_name(self.name)
threading.Thread.__bootstrap_original__(self)
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
threading.Thread._T... | import threading
try:
import prctl
def set_thread_name(name): prctl.set_name(name)
def _thread_name_hack(self):
set_thread_name(self.name)
threading.Thread.__bootstrap_original__(self)
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
threading.Thread._T... | mit | Python |
1b6eecc10e45aa0728ea48fd8b00419396765f1e | Complete main | landportal/landbook-importers,weso/landportal-importers,landportal/landbook-importers | IpfriExtractor/Main.py | IpfriExtractor/Main.py | """
Created on 14/01/2014
@author: Dani
"""
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir), 'CountryReconciler'))
sys.path.append(os.path.join(os.path.join(os.path.dirname(os.path.real... | '''
Created on 14/01/2014
@author: Dani
'''
import logging
from ConfigParser import ConfigParser
from es.weso.extractor.IpfriExtractor import IpfriExtractor
from es.weso.translator.ipfri_trasnlator import IpfriTranslator
def configure_log():
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logg... | mit | Python |
f1937ba3381468644c3b1b01d01a73eff0b91031 | Create v0.10 branch | plepe/pgmapcss,plepe/pgmapcss | pgmapcss/version.py | pgmapcss/version.py | __all__ = 'VERSION', 'VERSION_INFO'
#: (:class:`tuple`) The version tuple e.g. ``(0, 9, 2)``.
VERSION_INFO = (0, 10, 'dev')
#: (:class:`basestring`) The version string e.g. ``'0.9.2'``.
if len(VERSION_INFO) == 4:
VERSION = '%d.%d.%d-%s' % VERSION_INFO
elif type(VERSION_INFO[2]) == str:
VERSION = '%d.%d-%s' % ... | __all__ = 'VERSION', 'VERSION_INFO'
#: (:class:`tuple`) The version tuple e.g. ``(0, 9, 2)``.
VERSION_INFO = (0, 9, 0)
#: (:class:`basestring`) The version string e.g. ``'0.9.2'``.
if len(VERSION_INFO) == 4:
VERSION = '%d.%d.%d-%s' % VERSION_INFO
elif type(VERSION_INFO[2]) == str:
VERSION = '%d.%d-%s' % VERSI... | agpl-3.0 | Python |
140ea03a727e6f4301820efec07e0deda16ca0b4 | Set version 1.12.9 | atztogo/phono3py,atztogo/phono3py,atztogo/phono3py,atztogo/phono3py | phono3py/version.py | phono3py/version.py | # Copyright (C) 2013 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 copyright
# notic... | # Copyright (C) 2013 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 copyright
# notic... | bsd-3-clause | Python |
394ba974ebb7bf2f6400cf5bdd6550d667b7b7ef | add underscore | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/update/remove_drift.py | hoomd/update/remove_drift.py | # Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Implement RemoveDrift."""
import hoomd
from hoomd.operation import Updater
from hoomd.data.typeconverter import NDArrayValidator
from hoomd import _hoomd
imp... | # Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Implement RemoveDrift."""
import hoomd
from hoomd.operation import Updater
from hoomd.data.typeconverter import NDArrayValidator
from hoomd import _hoomd
imp... | bsd-3-clause | Python |
61ef80e2c5aab9ed58687ddcf43d53e3e669c827 | Fix issue in __init__.py | TaurusOlson/fntools | fntools/__init__.py | fntools/__init__.py | """
fntools: functional programming tools for data processing
=========================================================
"""
from .fntools import use_with, zip_with, unzip, concat, mapcat, dmap, rmap, replace,\
compose, groupby, reductions, split, assoc, dispatch, multimap,\
multistarmap, pipe, pipe_ea... | """
fntools: functional programming tools for data processing
=========================================================
"""
from .fntools import use_with, zip_with, unzip, concat, mapcat, dmap, rmap, replace,\
compose, groupby, reductions, split, assoc, dispatch, multimap,\
multistarmap, pipe, pipe_ea... | mit | Python |
4232c762888fe70a035693a8313cc0adb02e257b | update comparisons in BlackBody1D tests for new version of constants | funbaker/astropy,astropy/astropy,astropy/astropy,stargaser/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy,bsipocz/astropy,DougBurke/astropy,astropy/astropy,larrybradley/astropy,saimn/astropy,kelle/astropy,MSeifert04/astropy,MSeifert04/astropy,stargaser/astropy,stargaser/astropy,StuartLittlefair/astropy,starg... | astropy/modeling/tests/test_blackbody.py | astropy/modeling/tests/test_blackbody.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import pytest
import numpy as np
from ..blackbody import BlackBody1D
from ..fitting import LevMarLSQFitter
from ...tests.helper import assert_q... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import pytest
import numpy as np
from ..blackbody import BlackBody1D
from ..fitting import LevMarLSQFitter
from ...tests.helper import assert_q... | bsd-3-clause | Python |
f00ff91ec9521cec2ef75fc165180307b8bf8321 | test estructura temporal | JavierGarciaD/banking | banking/tests/test_credit_constructor.py | banking/tests/test_credit_constructor.py | '''
Created on 8/06/2017
@author: spectre
'''
from credit.constructor import *
import pytest
class TestEstructuraTemporal(object):
def test_one(self):
pass
def test_two(self):
pass | '''
Created on 8/06/2017
@author: spectre
'''
from credit.constructor import *
import pytest
def test_my_function():
assert Prueba(2, 1).my_function() == 3
| mit | Python |
92ec14fd32ba0c2609a8a64898036197fbb5fa70 | allow storage to overwrite files | ei-grad/django-pipeline,Tekco/django-pipeline,lexqt/django-pipeline,edx/django-pipeline,edwinlunando/django-pipeline,fahhem/django-pipeline,Kobold/django-pipeline,sjhewitt/django-pipeline,d9pouces/django-pipeline,skirsdeda/django-pipeline,airtonix/django-pipeline,ei-grad/django-pipeline,leonardoo/django-pipeline,mgorny... | pipeline/storage.py | pipeline/storage.py | import os
from datetime import datetime
from django.core.files.storage import FileSystemStorage, get_storage_class
from django.utils.functional import LazyObject
from pipeline.conf import settings
class PipelineStorage(FileSystemStorage):
def __init__(self, location=None, base_url=None, *args, **kwargs):
... | import os
from datetime import datetime
from django.core.files.storage import FileSystemStorage, get_storage_class
from django.utils.functional import LazyObject
from pipeline.conf import settings
class PipelineStorage(FileSystemStorage):
def __init__(self, location=None, base_url=None, *args, **kwargs):
... | mit | Python |
a25920e3549933e4c6c158cc9490f3eaa883ec66 | Use the same child->parent "formula" used by heapq.py. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_heapq.py | Lib/test/test_heapq.py | """Unittests for heapq."""
from test.test_support import verify, vereq, verbose, TestFailed
from heapq import heappush, heappop
import random
def check_invariant(heap):
# Check the heap invariant.
for pos, item in enumerate(heap):
if pos: # pos 0 has no parent
parentpos = (pos-1) >> 1
... | """Unittests for heapq."""
from test.test_support import verify, vereq, verbose, TestFailed
from heapq import heappush, heappop
import random
def check_invariant(heap):
# Check the heap invariant.
for pos, item in enumerate(heap):
parentpos = ((pos+1) >> 1) - 1
if parentpos >= 0:
... | mit | Python |
22937ae3ac01df89d0bf1018f62c7b9cbae76627 | change event registry to a set to make sure the same function is not called twice | panoplyio/panoply-python-sdk | panoply/events.py | panoply/events.py | class Emitter(object):
_events = None
def __init__(self, events={}):
self._events = events
def on(self, name, fn):
self._events.setdefault(name, set([])).add(fn)
return self
def fire(self, name, data):
for fn in self._events.get("*", set([])):
fn(name, data... | class Emitter(object):
_events = None
def __init__(self, events={}):
self._events = events
def on(self, name, fn):
self._events.setdefault(name, []).append(fn)
return self
def fire(self, name, data):
for fn in self._events.get("*", []):
fn(name, data)
... | mit | Python |
b12b4f47d3cd701506380c914e45b9958490392c | Add FT specs and use unittest. | ejpreciado/superlists,ejpreciado/superlists,ejpreciado/superlists | functional_tests.py | functional_tests.py | from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_start_a_list_and_retrieve_it_later(self):
# Edith has heard about a cool new onlien to-... | from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'Django' in browser.title
| mit | Python |
0f19fb03a9976beb410f52b4e53a6da31665ab15 | Fix identation errors. | microserv/frontend,microserv/frontend,microserv/frontend | editor_backend/editor_backend/views.py | editor_backend/editor_backend/views.py | from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
from django.shortcuts import render
import json
import requests
NODE_ADDR = "http://127.0.0.1:9001"
publish_base_url = "http://despina.128.no/publish"
def get_publisher_url():
r = requests.get(NOD... | from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
from django.shortcuts import render
import json
import requests
NODE_ADDR = "http://127.0.0.1:9001"
publish_base_url = "http://despina.128.no/publish"
def get_publisher_url():
r = requests.get(NOD... | mit | Python |
345fb3f60b5df1d45b44a5b2b7f162900669f1e9 | Fix typo in command | AgalmicVentures/Probe,AgalmicVentures/Probe,AgalmicVentures/Probe | Probe/Application/RawApplication.py | Probe/Application/RawApplication.py |
# Copyright (c) 2015-2018 Agalmic Ventures LLC (www.agalmicventures.com)
#
# 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 u... |
# Copyright (c) 2015-2018 Agalmic Ventures LLC (www.agalmicventures.com)
#
# 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 u... | mit | Python |
698d6bd59f810f3527c663a9f51362c018f6f394 | add french formatting for numbers | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | calebasse/settings/formats/fr/formats.py | calebasse/settings/formats/fr/formats.py | DATE_FORMAT = 'l d F Y'
SHORT_DATE_FORMAT = 'j/n/Y'
DATE_INPUT_FORMATS = ('%d/%m/%Y', '%d/%m/%Y', '%Y-%m-d')
TIME_INPUT_FORMATS = ( '%Hh%M', '%H:%M', '%H%M', '%Hh' )
DECIMAL_SEPARATOR = ','
NUMBER_GROUPING = 3
THOUSAND_SEPARATOR = ' '
| DATE_FORMAT = 'l d F Y'
SHORT_DATE_FORMAT = 'j/n/Y'
DATE_INPUT_FORMATS = ('%d/%m/%Y', '%d/%m/%Y', '%Y-%m-d')
TIME_INPUT_FORMATS = ( '%Hh%M', '%H:%M', '%H%M', '%Hh' )
| agpl-3.0 | Python |
b2f6ec1db1c6831b923cb89907bbfedea79012f0 | handle yaml in post - WIP | empirical-org/WikipediaSentences,empirical-org/WikipediaSentences | genmodel/manager.py | genmodel/manager.py | from flask import Flask, request, render_template, jsonify
import yaml
from tabulate import tabulate
import os
import psycopg2
# Connect to Database
try:
DB_NAME=os.environ['DB_NAME']
DB_USER=os.environ['DB_USER']
DB_PASS=os.environ['DB_PASS']
except KeyError as e:
raise Exception('environment variable... | from flask import Flask, request, render_template, jsonify
from tabulate import tabulate
import os
import psycopg2
# Connect to Database
try:
DB_NAME=os.environ['DB_NAME']
DB_USER=os.environ['DB_USER']
DB_PASS=os.environ['DB_PASS']
except KeyError as e:
raise Exception('environment variables for databa... | agpl-3.0 | Python |
1239d7a881f7ad88c736aac526a821658cea0f96 | check platform with correct python | stweil/letsencrypt,letsencrypt/letsencrypt,lmcro/letsencrypt,letsencrypt/letsencrypt,lmcro/letsencrypt,stweil/letsencrypt | certbot-nginx/certbot_nginx/constants.py | certbot-nginx/certbot_nginx/constants.py | """nginx plugin constants."""
import pkg_resources
import platform
if platform.system() in ('FreeBSD', 'Darwin'):
server_root_tmp = "/usr/local/etc/nginx"
else:
server_root_tmp = "/etc/nginx"
CLI_DEFAULTS = dict(
server_root=server_root_tmp,
ctl="nginx",
)
"""CLI defaults."""
MOD_SSL_CONF_DEST = "op... | """nginx plugin constants."""
import pkg_resources
import platform
if(platform.system() == ('FreeBSD' or 'Darwin')):
server_root_tmp = "/usr/local/etc/nginx"
else:
server_root_tmp = "/etc/nginx"
CLI_DEFAULTS = dict(
server_root=server_root_tmp,
ctl="nginx",
)
"""CLI defaults."""
MOD_SSL_CONF_DES... | apache-2.0 | Python |
e889cd87e1260d209775a98fb7779146f92c9333 | handle non integer issue numbers better | xchewtoyx/comicmgt,xchewtoyx/comicmgt | ooo.py | ooo.py | #!/usr/bin/python
import os
import sys
import re
from collections import defaultdict
COMIC_RE = re.compile(r'^\d+ +([^#]+)#(\d+)')
def lines(todofile):
with open(todofile) as todolines:
for line in todolines:
title_match = COMIC_RE.match(line)
if title_match:
# (title, issue)
yield ... | #!/usr/bin/python
import os
import sys
import re
from collections import defaultdict
COMIC_RE = re.compile(r'^\d+ +([^#]+)#(\d+)')
def lines(todofile):
with open(todofile) as todolines:
for line in todolines:
title_match = COMIC_RE.match(line)
if title_match:
# (title, issue)
yield ... | mit | Python |
04d1494cfcbc4508519f559d9a2093f4491c3451 | Update get_access_token.py | jquacinella/python-twitter,shichao-an/python-twitter,jakeshi/python-twitter,jeremylow/python-twitter | get_access_token.py | get_access_token.py | #!/usr/bin/env python
#
# Copyright 2007-2013 The Python-Twitter Developers
#
# 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 ... | #!/usr/bin/env python
#
# Copyright 2007-2013 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 | Python |
ebb2b2381662dcaa9a16083cae3b7e0ae9bc1065 | Reword 51 | daicang/Euler | p51.py | p51.py | # 51
# Find the smallest prime which, by replacing part of the number with the same digit,
# is part of an eight prime value family
from prime import Prime
class Solve(object):
def __init__(self):
self.p = Prime()
self.ps = self.p.prime_stream()
def get_replaced(self, p_str, r_str):
r... | # 51
# Find the smallest prime which, by replacing part of the number with the same digit,
from prime import Prime
class Solve(object):
def __init__(self):
self.p = Prime()
self.ps = self.p.prime_stream()
def get_replaced(self, p_str, r_str):
return [int(p_str.replace(r_str, str(i))) ... | mit | Python |
80e6c4d499b6c126dc0032a8175d9a6ba3bab1a8 | Add os import | j-friedrich/thunder,broxtronix/thunder,oliverhuangchao/thunder,oliverhuangchao/thunder,kcompher/thunder,poolio/thunder,kunallillaney/thunder,kunallillaney/thunder,broxtronix/thunder,pearsonlab/thunder,mikarubi/thunder,kcompher/thunder,zhwa/thunder,jwittenbach/thunder,mikarubi/thunder,zhwa/thunder,pearsonlab/thunder,j-f... | pca.py | pca.py | # pca <master> <inputFile> <outputFile> <slices> <k> <dim>
#
# performs pca on a data matrix
# input is a local text file or a file in hdfs
# format should be rows of ' ' separated values
# - example: space (rows) x time (cols)
# - rows should be whichever dim is larger
# 'dim' is dimension to subtract mean along
# '... | # pca <master> <inputFile> <outputFile> <slices> <k> <dim>
#
# performs pca on a data matrix
# input is a local text file or a file in hdfs
# format should be rows of ' ' separated values
# - example: space (rows) x time (cols)
# - rows should be whichever dim is larger
# 'dim' is dimension to subtract mean along
# '... | apache-2.0 | Python |
2cf25d10bb81f53fa415523650558b9ea10032f0 | Add rounding to nearest for the number of SQL queries per call. | catcombo/django-speedinfo,catcombo/django-speedinfo,catcombo/django-speedinfo | speedinfo/models.py | speedinfo/models.py | # coding: utf-8
from django.db import models
class ViewProfiler(models.Model):
"""
Holds profiler stats grouped by view.
"""
view_name = models.CharField('View name', max_length=255)
method = models.CharField('HTTP method', max_length=8)
anon_calls = models.PositiveIntegerField('Anonymous cal... | # coding: utf-8
from django.db import models
class ViewProfiler(models.Model):
"""
Holds profiler stats grouped by view.
"""
view_name = models.CharField('View name', max_length=255)
method = models.CharField('HTTP method', max_length=8)
anon_calls = models.PositiveIntegerField('Anonymous cal... | mit | Python |
1c738439e8d3d30d5c2f7586e6ca796e64e28873 | add service debug log. | cj1324/WebHooks2IRC | src/webhooks2irc/core/ircbot.py | src/webhooks2irc/core/ircbot.py | #!/usr/bin/env python
# coding: UTF-8
import time
import threading
import logging
from irc import client as irc_client
from webhooks2irc import settings
logger = logging.getLogger(__name__)
class IrcBotService(threading.Thread):
def __init__(self):
self.client = irc_client.Reactor()
server = se... | #!/usr/bin/env python
# coding: UTF-8
import time
import threading
from irc import client as irc_client
from webhooks2irc import settings
class IrcBotService(threading.Thread):
def __init__(self):
self.client = irc_client.Reactor()
server = self.client.server()
server.connect(settings.I... | bsd-2-clause | Python |
f34773f4ae5e8ab3ad067e5e9fd57bb4996a2186 | Bump version to 0.1.2 | bendtherules/pontoon,bendtherules/pontoon,duggan/pontoon,duggan/pontoon | pontoon/__init__.py | pontoon/__init__.py | # -*- coding: utf-8 -*-
__name__ = 'pontoon'
__description__ = 'A Python CLI for Digital Ocean'
__version__ = '0.1.2'
__author__ = 'Ross Duggan'
__author_email__ = 'ross.duggan@acm.org'
__url__ = 'https://github.com/duggan/pontoon'
__copyright__ = 'Copyright Ross Duggan 2013'
from .cache import cache
from .log import... | # -*- coding: utf-8 -*-
__name__ = 'pontoon'
__description__ = 'A Python CLI for Digital Ocean'
__version__ = '0.1.1'
__author__ = 'Ross Duggan'
__author_email__ = 'ross.duggan@acm.org'
__url__ = 'https://github.com/duggan/pontoon'
__copyright__ = 'Copyright Ross Duggan 2013'
from .cache import cache
from .log import... | mit | Python |
8a520b1824e4f7d24c3aa05c22f374baafb3f629 | Add a copyright and license comment to re2.py | facebook/pyre2,pombredanne/pyre2,andreasvc/pyre2,axiak/pyre2,simudream/pyre2,sunu/pyre2,simudream/pyre2,andreasvc/pyre2,axiak/pyre2,pombredanne/pyre2,pombredanne/pyre2,sunu/pyre2,facebook/pyre2 | re2.py | re2.py | #!/usr/bin/env python
# Copyright (c) 2010, David Reiss and Facebook, Inc. 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 copyright
# n... | #!/usr/bin/env python
# Define this first, since it is referenced by _re2.
class error(Exception):
pass
import _re2
compile = _re2._compile
| bsd-3-clause | Python |
aa57ee789731f129646dc6641087a17486353251 | Fix filtering bug in run.py | shellphish/driller | run.py | run.py | #!/usr/bin/env python
import logging
import logconfig
# silence these loggers
logging.getLogger().setLevel("CRITICAL")
logging.getLogger("driller.fuzz").setLevel("INFO")
l = logging.getLogger("driller")
l.setLevel("INFO")
import os
import sys
import redis
import fuzzer.tasks
import driller.config as config
'''
Lar... | #!/usr/bin/env python
import logging
import logconfig
# silence these loggers
logging.getLogger().setLevel("CRITICAL")
logging.getLogger("driller.fuzz").setLevel("INFO")
l = logging.getLogger("driller")
l.setLevel("INFO")
import os
import sys
import redis
import fuzzer.tasks
import driller.config as config
'''
Lar... | bsd-2-clause | Python |
aa2d675354566fa4cef801b2a553e076ad8d8c94 | remove attempt to grab terminal size (breaks when there is no terminal) | nysbc/Anisotropy,nysbc/Anisotropy | ThreeDFSC/programs/utility_functions.py | ThreeDFSC/programs/utility_functions.py | import os
import sys
def print_progress(iteration, total, prefix='', suffix='', decimals=1):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional... | import os
import sys
def print_progress(iteration, total, prefix='', suffix='', decimals=1):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional... | mit | Python |
d5b13e06c3ed31691c23de765fcb60d5972ef7d9 | Fix embedding images from tweets in threads | BeatButton/beattie,BeatButton/beattie-bot | cogs/twitter.py | cogs/twitter.py | import re
from lxml import etree
from discord.ext import commands
class Twitter:
url_expr = re.compile(r'https?:\/\/twitter\.com\/\S+\/status\/\d+')
tweet_selector = ".//div[contains(@class, 'tweet permalink-tweet')]"
img_selector = './/img[@data-aria-label-part]'
def __init__(self, bot):
s... | import re
from lxml import etree
from discord.ext import commands
class Twitter:
url_expr = re.compile(r'https?:\/\/twitter\.com\/\S+\/status\/\d+')
tweet_selector = ".//div[@class='AdaptiveMediaOuterContainer']"
img_selector = './/img[@data-aria-label-part]'
def __init__(self, bot):
self.b... | mit | Python |
3299e9a73e484df73a0b2ce3e947a980ac64d862 | Update PedidoEditar.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Campus/PedidoEditar.py | backend/Models/Campus/PedidoEditar.py | from Framework.Pedido import Pedido
from Framework.ErroNoHTTP import ErroNoHTTP
class PedidoEditar(Pedido):
def __init__(self,variaveis_do_ambiente):
super(PedidoEditar, self).__init__(variaveis_do_ambiente)
try:
self.nome = self.corpo['nome']
except:
raise ErroNoHTTP(400)
def getNome(self):
retu... | from Framework.Pedido import Pedido
from Framework.ErroNoHTTP import ErroNoHTTP
class PedidoEditar(Pedido):
def __init__(self,variaveis_do_ambiente):
super(PedidoEditar, self).__init__(variaveis_do_ambiente)
try:
self.id = self.corpo['id']
self.nome = self.corpo['nome']
except:
raise ErroNoHTTP(400)
... | mit | Python |
82f9abbb7689bea6b8961274a169568e0ff2bbeb | Add conversion for out of date processes | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/conversion/convert.py | backend/scripts/conversion/convert.py | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
import sys
def msg(s):
print s
sys.stdout.flush()
def fix_mcpub_missing_process_types(conn):
print "Fixing missing process_type entries..."
processes = list(r.db('mcpub').table('processes').filter(~r.row.has_fields('proce... | #!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
import sys
def msg(s):
print s
sys.stdout.flush()
def fix_mcpub_missing_property_types(conn):
processes = list(r.db('mcpub').table('processes').filter(~r.row.has_fields('process_type')).run(conn))
for process in processes... | mit | Python |
0eff0eb9e544e9071a49226545d227371bc4843f | Add person admin | rafal-jaworski/bazaNGObackend,rafal-jaworski/bazaNGObackend,rafal-jaworski/bazaNGObackend | bazango/contrib/organization/admin.py | bazango/contrib/organization/admin.py | from django.contrib import admin
from .models import Organization, OrganizationProfile, Category, Person
from django.utils.translation import ugettext_lazy as _
@admin.register(Organization)
class OrganizationAdmin(admin.ModelAdmin):
list_display = ['short_name', 'krs', 'register_at', 'tag_list', 'category_list',... | from django.contrib import admin
from .models import Organization, OrganizationProfile, Category
from django.utils.translation import ugettext_lazy as _
@admin.register(Organization)
class OrganizationAdmin(admin.ModelAdmin):
list_display = ['short_name', 'krs', 'register_at', 'tag_list', 'category_list', 'is_act... | bsd-3-clause | Python |
282ce26a3200dc5c5c94781dc2fc4af27a75df7f | Update version [skip ci] | julianghionoiu/tdl-client-python,julianghionoiu/tdl-client-python | previous_version.py | previous_version.py | from __future__ import print_function
PREVIOUS_VERSION = '0.21.0'
def main():
print(PREVIOUS_VERSION)
if __name__ == "__main__":
main()
| PREVIOUS_VERSION = '0.20.4'
def main():
print PREVIOUS_VERSION
if __name__ == "__main__":
main()
| apache-2.0 | Python |
9e00287611f254ec3599eb69c2b6ef8a2220ecef | Store previous version [skip ci] | julianghionoiu/tdl-client-python,julianghionoiu/tdl-client-python | previous_version.py | previous_version.py | PREVIOUS_VERSION = '0.20.4'
def main():
print PREVIOUS_VERSION
if __name__ == "__main__":
main()
| PREVIOUS_VERSION = '0.20.3'
def main():
print PREVIOUS_VERSION
if __name__ == "__main__":
main()
| apache-2.0 | Python |
86b87ba2975a0eef39887568c7af57801594fc9e | Set correct number of nodes in JSON. | fasaxc/wireless-sensor-node-server,fasaxc/wireless-sensor-node-server,fasaxc/wireless-sensor-node-server | src/api/readings.py | src/api/readings.py | # Copyright (c)Shaun Crampton 2012-2012. All rights reserved.
import time
import tornado
import cjson
from data import Session, Reading
import datetime
class ReadingsHandler(tornado.web.RequestHandler):
def get(self):
sess = Session()
self.set_header("Content-Type", "application/json")
... | # Copyright (c)Shaun Crampton 2012-2012. All rights reserved.
import time
import tornado
import cjson
from data import Session, Reading
import datetime
class ReadingsHandler(tornado.web.RequestHandler):
def get(self):
sess = Session()
self.set_header("Content-Type", "application/json")
... | bsd-2-clause | Python |
1d63a28492163a63d710a950004bf67e6e46ae41 | remove spaces | CodeCatz/TrackCat,CodeCatz/TrackCat,anuschka/TrackCat,livike/TrackCat,livike/TrackCat,livike/TrackCat,CodeCatz/TrackCat,anuschka/TrackCat,anuschka/TrackCat | TrackCat/templatetags/navigation.py | TrackCat/templatetags/navigation.py | from django import template
from django.core import urlresolvers
register = template.Library()
@register.simple_tag(takes_context=True)
def current(context, url_name, return_value=' active', **kwargs):
matches = current_url_equals(context, url_name, **kwargs)
return return_value if matches else ''
def cur... | from django import template
from django.core import urlresolvers
register = template.Library()
@register.simple_tag(takes_context=True)
def current(context, url_name, return_value=' active', **kwargs):
matches = current_url_equals(context, url_name, **kwargs)
return return_value if matches else ''
d... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.