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
d0e8d8d9e6e029f0af5dd50e507565fb67bf90b1
update example script
daler/ucscsession
ucscsession/scripts/ucscsession_example.py
ucscsession/scripts/ucscsession_example.py
import webbrowser from ucscsession import UCSCSession import pybedtools # ----------------------------------------------------------------------------- # Note: most methods return a requests.Response object # ----------------------------------------------------------------------------- # ---------------------------...
import webbrowser from ucscsession import UCSCSession import pybedtools # Begin a session. u = UCSCSession() # Demonstration of uploading custom tracks; this uses example data from # pybedtools. for fn in ['a.bed', 'b.bed']: x = pybedtools.example_bedtool(fn)\ .saveas(trackline='track name=%s' % fn) r...
bsd-2-clause
Python
c8ecbda2b8c4d1a03285527dd11a27db74f746e7
change IdP configuration order, enabled first
appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform
openedx/core/djangoapps/appsembler/tpa_admin/api.py
openedx/core/djangoapps/appsembler/tpa_admin/api.py
from rest_framework import generics, viewsets from rest_framework.permissions import IsAuthenticated from openedx.core.djangoapps.appsembler.sites.permissions import AMCAdminPermission from openedx.core.lib.api.authentication import ( OAuth2AuthenticationAllowInactiveUser, ) from third_party_auth.models import SAM...
from rest_framework import generics, viewsets from rest_framework.permissions import IsAuthenticated from openedx.core.djangoapps.appsembler.sites.permissions import AMCAdminPermission from openedx.core.lib.api.authentication import ( OAuth2AuthenticationAllowInactiveUser, ) from third_party_auth.models import SAM...
agpl-3.0
Python
67a0bab4da1d31aba150ce5cb7831daaea1523de
Increase BQ_DEFAULT_TABLE_EXPIRATION_MS in e2etest settings
ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing
openprescribing/openprescribing/settings/e2etest.py
openprescribing/openprescribing/settings/e2etest.py
from __future__ import absolute_import from .test import * DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': utils.get_env_setting('E2E_DB_NAME'), 'USER': utils.get_env_setting('DB_USER'), 'PASSWORD': utils.get_env_setting('DB_PASS'), 'HO...
from __future__ import absolute_import from .test import * DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': utils.get_env_setting('E2E_DB_NAME'), 'USER': utils.get_env_setting('DB_USER'), 'PASSWORD': utils.get_env_setting('DB_PASS'), 'HO...
mit
Python
2660096db01f88cd0e71860935862fe969204666
Fix a script missed in refactor
somic/paasta,Yelp/paasta,somic/paasta,Yelp/paasta
paasta_tools/contrib/check_registered_slaves_aws.py
paasta_tools/contrib/check_registered_slaves_aws.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import unicode_literals import argparse import sys from paasta_tools.autoscaling.autoscaling_cluster_lib import get_scaler from paasta_tools.mesos_tools import get_mesos_master from paasta_tools.utils import load_system_paasta_config def c...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import unicode_literals import argparse import sys from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr_slaves from paasta_tools.autoscaling.autoscaling_clu...
apache-2.0
Python
d406cf8f4812fce7314f10d3a4b1303d54230099
Remove unused import.
pyhmsa/pyhmsa
src/pyhmsa/util/signal.py
src/pyhmsa/util/signal.py
#!/usr/bin/env python """ ================================================================================ :mod:`signal` -- Signal pattern ================================================================================ .. module:: signal :synopsis: signal pattern .. inheritance-diagram:: pyhmsa.util.signal """ ...
#!/usr/bin/env python """ ================================================================================ :mod:`signal` -- Signal pattern ================================================================================ .. module:: signal :synopsis: signal pattern .. inheritance-diagram:: pyhmsa.util.signal """ ...
mit
Python
9a5135f9cd27cf24d27b2393fd071073b4485ac7
add test gat_plot_slice
dgwakeman/mne-python,pravsripad/mne-python,larsoner/mne-python,wmvanvliet/mne-python,jniediek/mne-python,adykstra/mne-python,trachelr/mne-python,rkmaddox/mne-python,leggitta/mne-python,Teekuningas/mne-python,Teekuningas/mne-python,cjayb/mne-python,larsoner/mne-python,jmontoyam/mne-python,cmoutard/mne-python,Eric89GXL/m...
mne/viz/tests/test_decoding.py
mne/viz/tests/test_decoding.py
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: Simplified BSD import os.path as op import warnings from nose.tools import assert_raises from mne.decoding import GeneralizationAcrossTime from mne import io, Epochs, read_events, pick_types from mne.utils import requires_sklearn, run_tests_if_main im...
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: Simplified BSD import os.path as op import warnings from nose.tools import assert_raises from mne.decoding import GeneralizationAcrossTime from mne import io, Epochs, read_events, pick_types from mne.utils import requires_sklearn, run_tests_if_main im...
bsd-3-clause
Python
476d7da17c7d22415cbd16b625ba8e443a750f0f
update change_upstream_proxy example
syjzwjj/mitmproxy,meizhoubao/mitmproxy,mosajjal/mitmproxy,dufferzafar/mitmproxy,gzzhanghao/mitmproxy,tekii/mitmproxy,Kriechi/mitmproxy,ikoz/mitmproxy,syjzwjj/mitmproxy,byt3bl33d3r/mitmproxy,onlywade/mitmproxy,noikiy/mitmproxy,ZeYt/mitmproxy,syjzwjj/mitmproxy,ParthGanatra/mitmproxy,ikoz/mitmproxy,cortesi/mitmproxy,fimad...
examples/change_upstream_proxy.py
examples/change_upstream_proxy.py
# This scripts demonstrates how mitmproxy can switch to a second/different upstream proxy # in upstream proxy mode. # # Usage: mitmdump -U http://default-upstream-proxy.local:8080/ -s "change_upstream_proxy.py host" from libmproxy.protocol.http import send_connect_request alternative_upstream_proxy = ("localhost", 808...
# This scripts demonstrates how mitmproxy can switch to a different upstream proxy # in upstream proxy mode. # # Usage: mitmdump -s "change_upstream_proxy.py host" from libmproxy.protocol.http import send_connect_request alternative_upstream_proxy = ("localhost", 8082) def should_redirect(flow): return flow.reques...
mit
Python
5af79b94c6f1b0117e229db23811d3e1c58ff3fa
Add password encrpytion and try to fix mailgun again
joehand/DataNews,joehand/DataNews
config.py
config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False SECRET_KEY = 'this_is_so_secret' #used for development, reset in prod SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path.join(b...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): DEBUG = False TESTING = False SECRET_KEY = 'this_is_so_secret' #used for development, reset in prod SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path.join(b...
bsd-3-clause
Python
cdbf0f2c82360c866d8c26f2d8a9539fa943df6b
Bump version 1.0.0.
junaruga/rpm-py-installer,junaruga/rpm-py-installer
rpm_py_installer/version.py
rpm_py_installer/version.py
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '1.0.0'
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.9.2'
mit
Python
9b5c1892dd4731df564d627ae9dafe95bd82b6a9
Bump version 0.7.1.
junaruga/rpm-py-installer,junaruga/rpm-py-installer
rpm_py_installer/version.py
rpm_py_installer/version.py
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.7.1'
"""Version string.""" # main = X.Y.Z # sub = .devN for pre-alpha releases VERSION = '0.7.0'
mit
Python
2d2513ce860503a7ab69e56f47998ca075efaa3b
Add new production hosts
okfn/rtei,okfn/rtei,okfn/rtei,okfn/rtei
rtei/settings/production.py
rtei/settings/production.py
import sys from .base import * DEBUG = False # Update database configuration with $DATABASE_URL. import dj_database_url db_from_env = dj_database_url.config() DATABASES['default'].update(db_from_env) SECRET_KEY = os.environ.get('SECRET_KEY') # AWS S3 settings DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3Boto...
import sys from .base import * DEBUG = False # Update database configuration with $DATABASE_URL. import dj_database_url db_from_env = dj_database_url.config() DATABASES['default'].update(db_from_env) SECRET_KEY = os.environ.get('SECRET_KEY') # AWS S3 settings DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3Boto...
agpl-3.0
Python
1df00cb6adf8b9cac677f5f6a272331ab5388c90
Update main.py
Densvin/RSSVK,Densvin/RSSVK
vkfeed/pages/main.py
vkfeed/pages/main.py
# -*- coding: utf-8 -*- '''Generates the main page.''' from __future__ import unicode_literals import re import urllib import webapp2 import vkfeed.utils class MainPage(webapp2.RequestHandler): '''Generates the main page.''' def get(self): '''Processes a GET request.''' self.response.h...
# -*- coding: utf-8 -*- '''Generates the main page.''' from __future__ import unicode_literals import re import urllib import webapp2 import RSSvk.utils class MainPage(webapp2.RequestHandler): '''Generates the main page.''' def get(self): '''Processes a GET request.''' self.response.he...
bsd-2-clause
Python
15129d5cc4c3a4981a41bebbfc6ace855004cd20
Add organizational structure.
weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016
students/psbriant/session08/circle.py
students/psbriant/session08/circle.py
""" Name: Paul Briant Date: 11/29/16 Class: Introduction to Python Session: 08 Assignment: Circle Lab Description: Classes for Circle Lab """ class Circle: def __init__(self, radius): """ """ self.radius = radius self.diameter = radius * 2 @classmethod def from_...
class Circle: def __init__(self, radius): """ """ self.radius = radius self.diameter = radius * 2 @classmethod def from_diameter(cls, diameter): self = cls(diameter / 2) return self def __str__(self): return "A circle ob...
unlicense
Python
c79723b179b0bfeda9b324139d8478bf4f24c1e5
add unicode char to test print
LettError/glyphNameFormatter,LettError/glyphNameFormatter
Lib/glyphNameFormatter/test.py
Lib/glyphNameFormatter/test.py
def printRange(rangeName): from glyphNameFormatter import GlyphName from glyphNameFormatter.unicodeRangeNames import getRangeByName from glyphNameFormatter.data import unicode2name_AGD for u in range(*getRangeByName(rangeName)): g = GlyphName(uniNumber=u) name = g.getName() if...
def printRange(rangeName): from glyphNameFormatter import GlyphName from glyphNameFormatter.unicodeRangeNames import getRangeByName from glyphNameFormatter.data import unicode2name_AGD for u in range(*getRangeByName(rangeName)): g = GlyphName(uniNumber=u) name = g.getName() if...
bsd-3-clause
Python
c09274936df73668afd14ccac6d7f7c322d5e8b8
Add naive logging in Main.py
shunghsiyu/pdf-processor
Main.py
Main.py
"""Main Module of PDF Splitter""" import argparse import logging import os from PyPDF2 import PdfFileWriter from Util import all_pdf_files_in_directory, split_on, concat_pdf_pages, is_landscape, write_pdf_file parser = \ argparse.ArgumentParser( description='Split all the pages of multiple PDF files in a...
"""Main Module of PDF Splitter""" import argparse import os from PyPDF2 import PdfFileWriter from Util import all_pdf_files_in_directory, split_on, concat_pdf_pages, is_landscape, write_pdf_file parser = \ argparse.ArgumentParser( description='Split all the pages of multiple PDF files in a directory by d...
mit
Python
6d4038653bf237a285f99e68288454ce9ebdfc92
Add allowed hosts
jasisz/cinderella,jasisz/cinderella
cinderella/cinderella/settings/production.py
cinderella/cinderella/settings/production.py
from .base import * DEBUG = False ALLOWED_HOSTS = ['188.226.249.33', 'cinderella.li'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['DB_NAME'], 'USER': os.environ['DB_USER'], 'PASSWORD': os.environ['DB_PASSWORD'], 'HOST':...
from .base import * DEBUG = False ALLOWED_HOSTS = ['cinderella.io'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['DB_NAME'], 'USER': os.environ['DB_USER'], 'PASSWORD': os.environ['DB_PASSWORD'], 'HOST': '127.0.0.1', ...
mit
Python
c0787c468e1b71d7e9db93b5f5990ae9bb506d82
FIX other two sample data load for Windows
massmutual/pystruct,pystruct/pystruct,amueller/pystruct,d-mittal/pystruct,wattlebird/pystruct,pystruct/pystruct,d-mittal/pystruct,wattlebird/pystruct,massmutual/pystruct,amueller/pystruct
pystruct/datasets/dataset_loaders.py
pystruct/datasets/dataset_loaders.py
import cPickle from os.path import dirname from os.path import join import numpy as np def load_letters(): """Load the OCR letters dataset. This is a chain classification task. Each example consists of a word, segmented into letters. The first letter of each word is ommited from the data, as it ...
import cPickle from os.path import dirname from os.path import join import numpy as np def load_letters(): """Load the OCR letters dataset. This is a chain classification task. Each example consists of a word, segmented into letters. The first letter of each word is ommited from the data, as it ...
bsd-2-clause
Python
19a9465424400ca1a194e5516c44ca77a0f5591a
add Alpha Vantage API key to config file
jamesottinger/MoneyWatch,jamesottinger/MoneyWatch,jamesottinger/MoneyWatch
moneywatch/moneywatchconfig.py
moneywatch/moneywatchconfig.py
#!/usr/bin/python #=============================================================================== # Copyright (c) 2016, James Ottinger. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # MoneyWatch - https://github.com/jamesottinger/moneywatch...
#!/usr/bin/python #=============================================================================== # Copyright (c) 2016, James Ottinger. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # MoneyWatch - https://github.com/jamesottinger/moneywatch...
bsd-3-clause
Python
04c67e99af363cd8eea4414f59a9294a84faaa6d
Fix test layout
muffins-on-dope/bakery,muffins-on-dope/bakery,muffins-on-dope/bakery
tests/api/test_views.py
tests/api/test_views.py
# -*- coding: utf-8 -*- import httpretty import json from django.test import TestCase from django.utils.encoding import smart_str from bakery.auth.models import BakeryUser from bakery.cookies.models import Cookie from bakery.utils.test import read class TestApi(TestCase): def test_cookies_list_empty(self): ...
# -*- coding: utf-8 -*- import json from django.test import TestCase from django.utils.encoding import smart_str from bakery.auth.models import BakeryUser from bakery.cookies.models import Cookie from bakery.utils.test import read import httpretty class TestApi(TestCase): def test_cookies_list_empty(self): ...
bsd-3-clause
Python
6940035d7827a6a2aa719e537f122c07a91bd7c1
support werkzeug==1.0.0
claytonbrown/dokku,dokku/dokku,progrium/dokku,claytonbrown/dokku,progrium/dokku,claytonbrown/dokku,dokku/dokku,progrium/dokku,dokku/dokku,claytonbrown/dokku,dokku/dokku,claytonbrown/dokku,progrium/dokku,progrium/dokku,dokku/dokku,progrium/dokku,claytonbrown/dokku,dokku/dokku,dokku/dokku,dokku/dokku,progrium/dokku,clayt...
tests/apps/multi/app.py
tests/apps/multi/app.py
import os from flask import Flask, render_template try: from werkzeug.wsgi import SharedDataMiddleware except ImportError: from werkzeug.middleware.shared_data import SharedDataMiddleware app = Flask(__name__) @app.route('/') def hello_world(): return render_template('index.html') app.wsgi_app = SharedDa...
import os from flask import Flask, render_template from werkzeug.wsgi import SharedDataMiddleware app = Flask(__name__) @app.route('/') def hello_world(): return render_template('index.html') app.wsgi_app = SharedDataMiddleware(app.wsgi_app, { '/': os.path.join(os.path.dirname(__file__), 'static') }) app.wsgi_ap...
mit
Python
d45bbe102efec23656d1329b5c3e6a785c69acee
switch base test cases of pickle backend from tests.backend.ini to tests.backend.common
ssato/python-anyconfig,ssato/python-anyconfig
tests/backend/pickle.py
tests/backend/pickle.py
# # Copyright (C) 2017 Satoru SATOH <ssato @ redhat.com> # Copyright (C) 2017 Red Hat, Inc. # License: MIT # # pylint: disable=missing-docstring,invalid-name,too-few-public-methods from __future__ import absolute_import import anyconfig.backend.pickle as TT import tests.backend.common as TBC class HasParserTrait(TBC...
# # Copyright (C) 2017 Satoru SATOH <ssato @ redhat.com> # License: MIT # # pylint: disable=missing-docstring from __future__ import absolute_import try: import anyconfig.backend.pickle as TT except ImportError: TT = None import tests.backend.ini from tests.common import dicts_equal CNF_0 = dict(a=0, b="bbb...
mit
Python
f0ef4f5e269d7f2d7fd347e8f458c1c9ce1ffb34
Fix bug in redis hook
synw/django-mqueue,synw/django-mqueue,synw/django-mqueue
mqueue/hooks/redis/__init__.py
mqueue/hooks/redis/__init__.py
import redis import time from mqueue.conf import DOMAIN from mqueue.hooks.redis import serializer from mqueue.conf import HOOKS conf = HOOKS["redis"] R = redis.StrictRedis(host=conf["host"], port=conf["port"], db=conf["db"]) event_num = int(time.time()) def save(event, conf): global event_num global R na...
import redis import time from mqueue.conf import DOMAIN from mqueue.hooks.redis import serializer from mqueue.conf import HOOKS conf = HOOKS["redis"] R = redis.StrictRedis(host=conf["host"], port=conf["port"], db=conf["db"]) event_num = int(time.time()) def save(event, conf): name = DOMAIN+"_event"+str(event_num...
mit
Python
54035774d3b9aece86e68f047e9ff4a270d344cb
add mountain climbing emoji #2001
c2corg/v6_ui,c2corg/v6_ui,c2corg/v6_ui,c2corg/v6_ui
c2corg_ui/format/emoji_databases/c2c_activities.py
c2corg_ui/format/emoji_databases/c2c_activities.py
SVG_CDN = "/static/img/documents/activities/" emoji = { ":rock_climbing:": { "category": "activitiy", "name": "rock climbing", "svg_name": "rock_climbing", "unicode": "1f9d7", }, ":skitouring:": { "category": "activitiy", "name": "ski touring", "svg_n...
SVG_CDN = "/static/img/documents/activities/" emoji = { ":rock_climbing:": { "category": "activitiy", "name": "rock climbing", "svg_name": "rock_climbing", "unicode": "1f9d7", }, ":skitouring:": { "category": "activitiy", "name": "ski touring", "svg_n...
agpl-3.0
Python
d5167d8ba1b3107e5ce121eca76b5496bf8d6448
Truncate a long log message.
ohsu-qin/qipipe
qipipe/registration/ants/template.py
qipipe/registration/ants/template.py
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
bsd-2-clause
Python
52b98755a8b26fb50d90b7988ee8ee16053e5c11
Update lint.py to automatically find .py files
wbond/oscrypto
lint.py
lint.py
# coding: utf-8 from __future__ import unicode_literals import os from pylint.lint import Run cur_dir = os.path.dirname(__file__) rc_path = os.path.join(cur_dir, './.pylintrc') print('Running pylint...') files = [] for root, dirnames, filenames in os.walk('oscrypto/'): for filename in filenames: if no...
# coding: utf-8 from __future__ import unicode_literals import os from pylint.lint import Run cur_dir = os.path.dirname(__file__) rc_path = os.path.join(cur_dir, './.pylintrc') print('Running pylint...') files = [ '__init__.py', '_osx_ctypes.py', '_osx_public_key.py', '_osx_symmetric.py', '_os...
mit
Python
671ff419731084681edaf3fdc826c1139383c325
add Raises to orthogonal_procrustes docstring
mgaitan/scipy,pbrod/scipy,sonnyhu/scipy,ortylp/scipy,petebachant/scipy,raoulbq/scipy,gef756/scipy,aeklant/scipy,jonycgn/scipy,ortylp/scipy,e-q/scipy,richardotis/scipy,giorgiop/scipy,gef756/scipy,zaxliu/scipy,efiring/scipy,mhogg/scipy,piyush0609/scipy,woodscn/scipy,felipebetancur/scipy,pyramania/scipy,gdooper/scipy,rmcg...
scipy/linalg/_procrustes.py
scipy/linalg/_procrustes.py
""" Solve the orthogonal Procrustes problem. """ from __future__ import division, print_function, absolute_import import numpy as np from .decomp_svd import svd __all__ = ['orthogonal_procrustes'] def orthogonal_procrustes(A, B, compute_scale=False, check_finite=True): """ Compute the matrix solution of t...
""" Solve the orthogonal Procrustes problem. """ from __future__ import division, print_function, absolute_import import numpy as np from .decomp_svd import svd __all__ = ['orthogonal_procrustes'] def orthogonal_procrustes(A, B, compute_scale=False, check_finite=True): """ Compute the matrix solution of t...
bsd-3-clause
Python
d8b4dbfed17be90846ea4bc47b5f7b39ad944c24
Remove raw SQL from oscar_calculate_scores
lijoantony/django-oscar,bnprk/django-oscar,bnprk/django-oscar,binarydud/django-oscar,saadatqadri/django-oscar,amirrpp/django-oscar,Jannes123/django-oscar,amirrpp/django-oscar,MatthewWilkes/django-oscar,MatthewWilkes/django-oscar,django-oscar/django-oscar,jmt4/django-oscar,faratro/django-oscar,Jannes123/django-oscar,son...
oscar/apps/analytics/scores.py
oscar/apps/analytics/scores.py
from django.db.models import F from oscar.core.loading import get_model ProductRecord = get_model('analytics', 'ProductRecord') Product = get_model('catalogue', 'Product') class Calculator(object): # Map of field name to weight weights = { 'num_views': 1, 'num_basket_additions': 3, '...
from django.db import connection, transaction from oscar.core.loading import get_model ProductRecord = get_model('analytics', 'ProductRecord') Product = get_model('catalogue', 'Product') class Calculator(object): # Map of field name to weight weights = {'num_views': 1, 'num_basket_additions':...
bsd-3-clause
Python
52b1448c6eb91ca9d59c7f2be5fa60f93262d52b
Bump version to 2.2.0
r1chardj0n3s/pip-check-reqs
pip_check_reqs/__init__.py
pip_check_reqs/__init__.py
__version__ = '2.2.0'
__version__ = '2.1.1'
mit
Python
695ea0a9b9768c713e03f9d3ec3ca4a702de0347
Update repeaterBotScript.py
Busterz/Telegram-Echo-Bot
script/repeaterBotScript.py
script/repeaterBotScript.py
# For the Repeater Bot import telepot # your bot key bot = telepot.Bot("[YOUR_TOKEN]") def handle(msg): chat_id = msg['chat']['id'] chat_msg = msg['text'] bot.sendMessage(chat_id, chat_msg) bot.message_loop(handle)
# For the Repeater Bot import telepot # your bot key bot = telepot.Bot("228412441:AAH0hKP-WOlcFGsZRaSCETVKIFBZf7C4gXc") def handle(msg): chat_id = msg['chat']['id'] chat_msg = msg['text'] bot.sendMessage(chat_id, chat_msg) bot.message_loop(handle)
mit
Python
2033166b57ec566c763a9ff70df9a4123243160d
Bump version to 1.17.4
platformio/platformio-api
platformio_api/__init__.py
platformio_api/__init__.py
# Copyright 2014-present Ivan Kravets <me@ikravets.com> # # 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...
# Copyright 2014-present Ivan Kravets <me@ikravets.com> # # 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...
apache-2.0
Python
1ce9101f4ac12e400e0ba09a2221c16f3b02f0ab
Add iter_plugins_dirs() test
rossant/podoc,podoc/podoc,podoc/podoc,rossant/podoc
podoc/tests/test_plugin.py
podoc/tests/test_plugin.py
# -*- coding: utf-8 -*- """Test plugin system.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import os.path as op from ..core import save_text from ..plugin import (IPluginRegistry, IPlugi...
# -*- coding: utf-8 -*- """Test plugin system.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import os.path as op from ..core import save_text from ..plugin import IPluginRegistry, IPlugin...
bsd-3-clause
Python
7fa19f13df92a3ddea6f69519539ead6cdeab3af
implement list --version option
openstack/reno
reno/lister.py
reno/lister.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
Python
98edde06a481cc18727a8c030bc670f7ab43b73f
increase timeout
efiop/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol,efiop/dvc
scripts/pyinstaller/sign.py
scripts/pyinstaller/sign.py
import argparse import os import pathlib import sys from subprocess import STDOUT, check_call if sys.platform != "darwin": raise NotImplementedError parser = argparse.ArgumentParser() parser.add_argument( "--application-id", required=True, help="Certificate ID (should be added to the keychain).", ) ar...
import argparse import os import pathlib import sys from subprocess import STDOUT, check_call if sys.platform != "darwin": raise NotImplementedError parser = argparse.ArgumentParser() parser.add_argument( "--application-id", required=True, help="Certificate ID (should be added to the keychain).", ) ar...
apache-2.0
Python
8284279a5e92679976637bc9f966f4b776636e82
Use copies of net to avoid cross-talk between tests.
GutenkunstLab/SloppyCell,GutenkunstLab/SloppyCell
Testing/test_InitialConditions.py
Testing/test_InitialConditions.py
import copy import unittest import scipy from TestNetwork import net net = copy.deepcopy(net) net.compile() net.setInitialVariableValue('A', 1.0) net.setInitialVariableValue('B', 2.0) class test_ics(unittest.TestCase): def test_default_initial_conditions(self): """Test that default ICs are handled correc...
import copy import unittest import scipy from TestNetwork import net net = copy.deepcopy(net) net.compile() net.setInitialVariableValue('A', 1.0) net.setInitialVariableValue('B', 2.0) class test_ics(unittest.TestCase): def test_default_initial_conditions(self): """Test that default ICs are handled correc...
bsd-3-clause
Python
35b9de04035e8e2d19c7d891ce758e95a5bc4679
Split bord.py into logical functions.
rpisharody/bord,rpisharody/bord
bord.py
bord.py
#!/usr/bin/python3 """ bord - The Board for your website bord is a static site generator written in Python 3. There are many static site generators like bord. This one is mine. Written by Rahul Pisharody. MIT Licence """ import argparse import os import re import markdown from jinja2 import Fi...
#!/usr/bin/python3 """ bord - The Board for your website bord is a static site generator written in Python 3. There are many static site generators like bord. This one is mine. Written by Rahul Pisharody. MIT Licence """ import os import re import markdown from jinja2 import FileSystemLoa...
mit
Python
aac855cb0339f87e1046811b9097858201cfe841
isolate helper functions
rigetticomputing/grove,rigetticomputing/grove
grove/alpha/jordan_gradient/gradient_helper.py
grove/alpha/jordan_gradient/gradient_helper.py
import numpy as np def real_to_binary(number, precision=16): """ Convert real decimal to precision-bit binary fraction :param float number: Real decimal over [0, 1). :param int precision: Number of bits of binary precision. :return float bf: Binary fraction representation of real decimal. """ ...
import numpy as np from jordan_gradient import gradient_estimator def real_to_binary(number, precision=16): """ Convert real decimal to precision-bit binary fraction :param float number: Real decimal over [0, 1). :param int precision: Number of bits of binary precision. :return float bf: Binary fr...
apache-2.0
Python
4aa1b4d79ef7777f060a05c70ead7a27dc6ed6e9
Add plot_coef
termoshtt/cujak,termoshtt/cujak
fft2d/plot.py
fft2d/plot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import fft2d import numpy as np import matplotlib.pyplot as plt import argparse def _load_size(prop): Lx = prop.Lx if prop.Lx > 0 else 1.0 Ly = prop.Ly if prop.Ly > 0 else 1.0 return Lx, Ly def plot_field(filename, figure_ext): arr, prop = fft2d.load(f...
#!/usr/bin/env python # -*- coding: utf-8 -*- import fft2d import numpy as np import matplotlib.pyplot as plt import argparse def main(args): arr, prop = fft2d.load(args.filename) Nx, Ny = arr.shape Lx = prop.Lx if prop.Lx > 0 else 1.0 Ly = prop.Ly if prop.Ly > 0 else 1.0 X, Y = np.meshgrid(np.l...
bsd-2-clause
Python
7ee29cfee740d6096fca8379253073077890a54c
Add more info to the redis example.
seabirdzh/disco,discoproject/disco,oldmantaiter/disco,pooya/disco,oldmantaiter/disco,simudream/disco,pombredanne/disco,seabirdzh/disco,discoproject/disco,simudream/disco,discoproject/disco,ErikDubbelboer/disco,mozilla/disco,mozilla/disco,pombredanne/disco,ErikDubbelboer/disco,mwilliams3/disco,pooya/disco,mwilliams3/dis...
examples/util/wordcount_redis.py
examples/util/wordcount_redis.py
""" Usage: python wordcount_redis.py redis://redis_server:6379:0 redis://redis_server:6379:1 The input is read from db 0 and the output is written to db 1. The inputs should be of the form (key, list_of_values) (they are read from the server with the lrange command. See the redis documentation for more info). The ou...
from disco.schemes.scheme_redis import redis_output_stream from disco.worker.task_io import task_output_stream from disco.core import Job, result_iterator class WordCount(Job): reduce_output_stream = (task_output_stream, redis_output_stream) @staticmethod def map(line, params): k, v = line ...
bsd-3-clause
Python
a08c04151e88eb95ae05484adb8b3f64ef91bd87
Update example
gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf
examples/tools/print_mo_and_dm.py
examples/tools/print_mo_and_dm.py
#!/usr/bin/env python # # Author: Qiming Sun <osirpt.sun@gmail.com> # import sys import numpy from pyscf import gto, scf, tools ''' Formatted output for 2D array ''' mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz') nf = mol.nao_nr() orb = numpy.random.random((nf,4)) # # Print orbital coefficients # tools.dump_m...
#!/usr/bin/env python # # Author: Qiming Sun <osirpt.sun@gmail.com> # import sys import numpy from pyscf import gto, tools ''' Formatted output for 2D array ''' mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz') nf = mol.nao_nr() orb = numpy.random.random((nf,4)) # # Print orbital coefficients # tools.dump_mat.du...
apache-2.0
Python
ad595aae697abbf7c7de79a4a2448f0c47133934
Make viewer runnable from outer dirs.
mihneadb/python-execution-trace,mihneadb/python-execution-trace,mihneadb/python-execution-trace
execution_trace/viewer/viewer.py
execution_trace/viewer/viewer.py
# Run with `python viewer.py PATH_TO_RECORD_JSON. import json import os import sys from flask import Flask, jsonify from flask.helpers import send_from_directory app = Flask(__name__) viewer_root = os.path.abspath(os.path.dirname(__file__)) # `main` inits these. # File containing `record` output. record_path = No...
# Run with `python viewer.py PATH_TO_RECORD_JSON. import json import sys from flask import Flask, jsonify from flask.helpers import send_from_directory app = Flask(__name__) # `main` inits these. # File containing `record` output. record_path = None # 0 is source, 1:N is state record_data = [] @app.route("/") de...
mit
Python
385fbdc0401c979a71b0ff326852292bbb6a6ceb
Print coverages and deal with missing files
charanpald/APGL
exp/influence2/ProcessResults.py
exp/influence2/ProcessResults.py
import numpy import matplotlib matplotlib.use("GTK3Agg") import matplotlib.pyplot as plt from exp.influence2.ArnetMinerDataset import ArnetMinerDataset from apgl.util.Latex import Latex from apgl.util.Util import Util from apgl.util.Evaluator import Evaluator ranLSI = False numpy.set_printoptions(suppress=True,...
import numpy import matplotlib matplotlib.use("GTK3Agg") import matplotlib.pyplot as plt from exp.influence2.ArnetMinerDataset import ArnetMinerDataset from apgl.util.Latex import Latex from apgl.util.Util import Util from apgl.util.Evaluator import Evaluator numpy.set_printoptions(suppress=True, precision=3, l...
bsd-3-clause
Python
1c939a99e377ff1dfe037c47dd99f635d3cb0a1f
Remove Cotswold election id (update expected)
chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_cotswold.py
polling_stations/apps/data_collection/management/commands/import_cotswold.py
from data_collection.management.commands import BaseXpressWebLookupCsvImporter class Command(BaseXpressWebLookupCsvImporter): council_id = 'E07000079' addresses_name = 'CotswoldPropertyPostCodePollingStationWebLookup-2017-03-27.TSV' stations_name = 'CotswoldPropertyPostCodePollingStationWebLookup-2017-03-2...
from data_collection.management.commands import BaseXpressWebLookupCsvImporter class Command(BaseXpressWebLookupCsvImporter): council_id = 'E07000079' addresses_name = 'CotswoldPropertyPostCodePollingStationWebLookup-2017-03-27.TSV' stations_name = 'CotswoldPropertyPostCodePollingStationWebLookup-2017-03-2...
bsd-3-clause
Python
55fd2ec6454df9c62e40c5115be94a00bf944bc4
Allow list_classes.py to be loaded without side-effects
amolenaar/gaphor,amolenaar/gaphor
examples/list_classes.py
examples/list_classes.py
#!/usr/bin/python """This script lists classes and optionally attributes from UML model created with Gaphor. """ import optparse import sys from gaphor import UML from gaphor.application import Session # Setup command line options. usage = "usage: %prog [options] file.gaphor" def main(): parser = optparse.Opt...
#!/usr/bin/python """This script lists classes and optionally attributes from UML model created with Gaphor. """ import optparse import sys from gaphor import UML from gaphor.application import Session # Setup command line options. usage = "usage: %prog [options] file.gaphor" parser = optparse.OptionParser(usage=u...
lgpl-2.1
Python
8a348c30e2381e76f09355f3cf23a9e87e060d80
Update without_end.py
RCoon/CodingBat,RCoon/CodingBat
Python/String_1/without_end.py
Python/String_1/without_end.py
# Given a string, return a version without the first and last char, so "Hello" # yields "ell". The string length will be at least 2. # without_end('Hello') --> 'ell' # without_end('java') --> 'av' # without_end('coding') --> 'odin' def without_end(str): return str[1:len(str) - 1] print(without_end('Hello')) print(...
# Given a string, return a version without the first and last char, so "Hello" # yields "ell". The string length will be at least 2. # without_end('Hello') -> 'ell' # without_end('java') -> 'av' # without_end('coding') -> 'odin' def without_end(str): return str[1:len(str) - 1] print(without_end('Hello')) print(wit...
mit
Python
9259bcd9d4dd745a5f34dff8dd4286eecf4a62f2
Update verifyAuthenticodePS.py
jgstew/tools,jgstew/tools,jgstew/tools,jgstew/tools
Python/verifyAuthenticodePS.py
Python/verifyAuthenticodePS.py
# NOTE: This is Windows Only - tested in Python2.7.1 # https://twitter.com/jgstew/status/1011657455275610112 # https://github.com/jgstew/tools/blob/master/CMD/PS_VerifyFileSig.bat # https://github.com/jgstew/tools/blob/master/Python/verifyAuthenticode.py # powershell -ExecutionPolicy Bypass -command "(Get-Authenticod...
# NOTE: This is Windows Only - tested in Python2.7.1 # https://twitter.com/jgstew/status/1011657455275610112 # https://github.com/jgstew/tools/blob/master/CMD/PS_VerifyFileSig.bat # https://github.com/jgstew/tools/blob/master/Python/verifyAuthenticode.py # powershell -ExecutionPolicy Bypass -command "(Get-Authenticod...
mit
Python
f1ef248f046c91683df8e6837249cc407a5f1cf2
Update ngrokwebhook.py
jbogarin/ciscosparkapi
examples/ngrokwebhook.py
examples/ngrokwebhook.py
#sample script that reads ngrok info from localhost:4040 and create Cisco Spark Webhook #typicall ngrok is called "ngrok http 8080" to redirect localhost:8080 to Internet #accesible ngrok url # #To use script simply launch ngrok, then launch this script. After ngrok is killed, run this #script a second time to re...
#sample script that reads ngrok info from localhost:4040 and create Cisco Spark Webhook #typicall ngrok is called "ngrok http 8080" to redirect localhost:8080 to Internet #accesible ngrok url # #To use script simply launch ngrok, then launch this script. After ngrok is killed, run this #script a second time to re...
mit
Python
fc8bfc1f2cda0844adbf1d831a1a5e1888f8949b
add regression test for behavior when fallbackfee is disabled
ElementsProject/elements,ElementsProject/elements,ElementsProject/elements,ElementsProject/elements,ElementsProject/elements,ElementsProject/elements
test/functional/wallet_fallbackfee.py
test/functional/wallet_fallbackfee.py
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test wallet replace-by-fee capabilities in conjunction with the fallbackfee.""" from test_framework.tes...
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test wallet replace-by-fee capabilities in conjunction with the fallbackfee.""" from test_framework.tes...
mit
Python
94c1b54ef1db5180c5f1d07e857bf91d6b6fbf25
fix for python2.7 on windows
mocobeta/janome,nakagami/janome,nakagami/janome,mocobeta/janome
examples/usage_stream.py
examples/usage_stream.py
# -*- coding: utf-8 -*- from janome.tokenizer import Tokenizer import sys from io import open PY3 = sys.version_info[0] == 3 print(u'Tokenize (stream mode)') t = Tokenizer(mmap=True) with open('text_lemon.txt', encoding='utf-8') as f: text = f.read() if not PY3: text = unicode(text) for token in t...
# -*- coding: utf-8 -*- from janome.tokenizer import Tokenizer import sys from io import open PY3 = sys.version_info[0] == 3 print(u'Tokenize (stream mode)') t = Tokenizer(mmap=True) with open('text_lemon.txt', encoding='utf-8') as f: text = f.read() if not PY3: text = unicode(text, 'utf-8') for t...
apache-2.0
Python
331cef286380f3369344dbc9a60e460619c17405
fix dnn
FederatedAI/FATE,FederatedAI/FATE,FederatedAI/FATE
federatedml/nn/homo_nn/zoo/dnn.py
federatedml/nn/homo_nn/zoo/dnn.py
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
apache-2.0
Python
cee0a7a3af8f17c69e4c9701a363f50904321bd1
fix daemonizer.kill
hansroh/aquests,hansroh/aquests
aquests/lib/daemonize.py
aquests/lib/daemonize.py
import os import sys import time import signal from . import killtree, processutil class Daemonizer: def __init__(self, chdir="/", procname = None, umask=0o22): self.chdir = chdir self.procname = procname self.umask = umask self.pidfile = os.path.join (chdir, '.pid') def runAsDaemon(self): if status (sel...
import os import sys import time import signal from . import killtree, processutil class Daemonizer: def __init__(self, chdir="/", procname = None, umask=0o22): self.chdir = chdir self.procname = procname self.umask = umask self.pidfile = os.path.join (chdir, '.pid') def runAsDaemon(self): if status (sel...
mit
Python
f5c5fef9cfdc94ad2d1b7d95f990e288251f57fe
Add search analyzer to search
fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide
froide/helper/search/__init__.py
froide/helper/search/__init__.py
import importlib from django.conf import settings from elasticsearch_dsl import analyzer, tokenizer from django_elasticsearch_dsl import Index from .signal_processor import CelerySignalProcessor from .queryset import SearchQuerySetWrapper from .registry import search_registry __all__ = [ 'CelerySignalProcessor...
import importlib from django.conf import settings from elasticsearch_dsl import analyzer, tokenizer from django_elasticsearch_dsl import Index from .signal_processor import CelerySignalProcessor from .queryset import SearchQuerySetWrapper from .registry import search_registry __all__ = [ 'CelerySignalProcessor...
mit
Python
56b38e64aeea12269b36d11849e0952377510c16
Change method of listening to state changes
robjohnson189/home-assistant,florianholzapfel/home-assistant,aequitas/home-assistant,aronsky/home-assistant,mKeRix/home-assistant,adrienbrault/home-assistant,keerts/home-assistant,DavidLP/home-assistant,stefan-jonasson/home-assistant,ewandor/home-assistant,Teagan42/home-assistant,robjohnson189/home-assistant,nkgilley/h...
homeassistant/components/automation/template.py
homeassistant/components/automation/template.py
""" homeassistant.components.automation.template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Offers template automation rules. For more details about this automation rule, please refer to the documentation at https://home-assistant.io/components/automation/#template-trigger """ import logging from homeassistant...
""" homeassistant.components.automation.template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Offers template automation rules. For more details about this automation rule, please refer to the documentation at https://home-assistant.io/components/automation/#template-trigger """ import logging from homeassistant...
mit
Python
3f80950f1fa9c5bad018a8cdaa9f6ae70168e4e1
Update main.py
Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System
device/src/main.py
device/src/main.py
#This is the file executing while STM32 MCU bootup, and in this file, #it will call other functions to fullfill the project. #Communication module: LoRa. #Communication method with gateway via LoRa. #Uart port drive LoRa module. #Parse JSON between device and gateway via LoRa channel. #LoRa module: E32-TTL-100 #Pin s...
#This is the file executing while STM32 MCU bootup, and in this file, #it will call other functions to fullfill the project. #Communication module: LoRa. #Communication method with gateway via LoRa. #Uart port drive LoRa module. #Parse JSON between device and gateway via LoRa channel. #LoRa module: E32-TTL-100 #Pin s...
mit
Python
608c55bb681667a6e1fe65e328676a3a99deb391
Update mupenGenerator.py
nadenislamarre/recalbox-configgen,digitalLumberjack/recalbox-configgen,recalbox/recalbox-configgen
configgen/generators/mupen/mupenGenerator.py
configgen/generators/mupen/mupenGenerator.py
#!/usr/bin/env python import Command import mupenControllers import recalboxFiles from generators.Generator import Generator class MupenGenerator(Generator): # Main entry of the module # Configure mupen and return a command def generate(self, system, rom, playersControllers): # Settings recalbox d...
#!/usr/bin/env python import Command import mupenControllers import recalboxFiles from generators.Generator import Generator class MupenGenerator(Generator): # Main entry of the module # Configure mupen and return a command def generate(self, system, rom, playersControllers): # Settings recalbox d...
mit
Python
ad3554ae58f65a295ac94c131d8193e0b2e7e6f8
Add reminder to look at the number of terms returned
nlesc-sherlock/concept-search,nlesc-sherlock/concept-search,nlesc-sherlock/concept-search,nlesc-sherlock/concept-search
termsuggester/word2vec.py
termsuggester/word2vec.py
from gensim.models import Word2Vec import logging logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) logger.addHandler(logging.StreamHandler()) class Word2VecSuggester(): def __init__(self, modelfile): try: self.model = Word2Vec.load(modelfile) logger.info('Load Wo...
from gensim.models import Word2Vec import logging logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) logger.addHandler(logging.StreamHandler()) class Word2VecSuggester(): def __init__(self, modelfile): try: self.model = Word2Vec.load(modelfile) logger.info('Load Wo...
apache-2.0
Python
73a375a3adb140c270444e886b3df842e0b28a86
Fix formatting tests: cfloat and cdouble as well as np.float and np.double are the same; make sure we test 4 bytes float.
chiffa/numpy,gfyoung/numpy,ekalosak/numpy,hainm/numpy,sigma-random/numpy,GrimDerp/numpy,sonnyhu/numpy,embray/numpy,GaZ3ll3/numpy,nbeaver/numpy,dimasad/numpy,gmcastil/numpy,musically-ut/numpy,kirillzhuravlev/numpy,simongibbons/numpy,ContinuumIO/numpy,simongibbons/numpy,mindw/numpy,ogrisel/numpy,rgommers/numpy,pelson/num...
numpy/core/tests/test_print.py
numpy/core/tests/test_print.py
import numpy as np from numpy.testing import * def check_float_type(tp): for x in [0, 1,-1, 1e10, 1e20] : assert_equal(str(tp(x)), str(float(x))) def test_float_types(): """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and n...
import numpy as np from numpy.testing import * def check_float_type(tp): for x in [0, 1,-1, 1e10, 1e20] : assert_equal(str(tp(x)), str(float(x))) def test_float_types(): """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and n...
bsd-3-clause
Python
27d920372b215da7cb2625ce6d7d3f3666bf16e9
Improve spelling
openfisca/country-template,openfisca/country-template
openfisca_country_template/variables/housing.py
openfisca_country_template/variables/housing.py
# -*- coding: utf-8 -*- # This file defines the variables of our legislation. # A variable is property of a person, or an entity (e.g. a household). # See http://openfisca.org/doc/variables.html # Import from openfisca-core the common python objects used to code the legislation in OpenFisca from openfisca_core.model_...
# -*- coding: utf-8 -*- # This file defines the variables of our legislation. # A variable is property of a person, or an entity (e.g. a household). # See http://openfisca.org/doc/variables.html # Import from openfisca-core the common python objects used to code the legislation in OpenFisca from openfisca_core.model_...
agpl-3.0
Python
ce02f48ea85b64a5a4503b22d3fb324c521904d0
Enable graphiql only when DEBUG=True
maferelo/saleor,tfroehlich82/saleor,car3oon/saleor,tfroehlich82/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,UITools/saleor,itbabu/saleor,mociepka/saleor,jreigel/saleor,car3oon/saleor,KenMutemi/saleor,mociepka/saleor,KenMutemi/saleor,jreigel/saleor,maferelo/saleor,tfroehlich82/saleor,car3oon/saleor,itbabu/saleor,Hy...
saleor/urls.py
saleor/urls.py
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps.views import sitemap from django.contrib.staticfiles.views import serve from graphene_django.views import GraphQLView from .cart.urls impor...
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps.views import sitemap from django.contrib.staticfiles.views import serve from graphene_django.views import GraphQLView from .cart.urls impor...
bsd-3-clause
Python
0bb0720616bebd308abae5cbee8d60c4dfa98fe4
Add a metric ton of test cases (some of which currently fail)
feincms/feincms-cleanse,matthiask/html-sanitizer
feincms_cleanse/tests.py
feincms_cleanse/tests.py
from django.test import TestCase from feincms_cleanse import cleanse_html class CleanseTestCase(TestCase): def run_tests(self, entries): for before, after in entries: after = before if after is None else after result = cleanse_html(before) self.assertEqual(result, afte...
from django.test import TestCase from feincms_cleanse import cleanse_html class CleanseTestCase(TestCase): def test_01_cleanse(self): entries = [ (u'<p>&nbsp;</p>', u''), (u'<span style="font-weight: bold;">Something</span><p></p>', u'<strong>Something</strong>'),...
bsd-3-clause
Python
cc934035033eff97ac698d9fa9b54b38dd2fbe9d
Update main.py
RoboCupULaval/UI-Debug
main.py
main.py
# Under MIT License, see LICENSE.txt import sys import argparse import warnings from PyQt5.QtWidgets import QApplication from qtpy import QtCore from Controller.MainController import MainController __author__ = 'RoboCupULaval' def argumentParser(argument): """ Argument parser """ parser = argparse.Argument...
# Under MIT License, see LICENSE.txt import sys import argparse from PyQt5.QtWidgets import QApplication from qtpy import QtCore from Controller.MainController import MainController __author__ = 'RoboCupULaval' def argumentParser(argument): """ Argument parser """ parser = argparse.ArgumentParser(descript...
mit
Python
473ff95fcd1ac784cc3492a4727d668a10270594
add today filter
anddev68/Notif-ClassChange-NIT-GC
main.py
main.py
# -*- coding: utf-8 -*- import sys import urllib import subprocess import argparse import datetime # Constants URL = "http://www.gifu-nct.ac.jp/gakka/keijiyou/keijiyou.pdf" LOCALPDF = "keijiyou.pdf" LOCALTEXT = "keijiyou.txt" def download(): urllib.urlretrieve(URL, LOCALPDF) def pre_parse(): cmd = "pdftote...
# -*- coding: utf-8 -*- import sys import urllib import subprocess import argparse # Constants URL = "http://www.gifu-nct.ac.jp/gakka/keijiyou/keijiyou.pdf" LOCALPDF = "keijiyou.pdf" LOCALTEXT = "keijiyou.txt" def download(): urllib.urlretrieve(URL, LOCALPDF) def pre_parse(): cmd = "pdftotext -raw " + LOCAL...
mit
Python
34bd4dec6bc60ff676874c13cb993a8123bd0ddc
handle the exception of an invalid bitly url
swaroopsm/Console-Bitly
main.py
main.py
#!/usr/bin/python import urllib import urllib2 import json import settings as s class ConsoleBitly: def shorten(self,req): url="http://api.bitly.com/v3/shorten?login="+s.bitly_username+"&apiKey="+s.bitly_apikey+"&longUrl="+req print "Please wait... \n" response=urllib2.urlopen(url) a = json.loads(response.rea...
#!/usr/bin/python import urllib import urllib2 import json import settings as s class ConsoleBitly: def shorten(self,req): url="http://api.bitly.com/v3/shorten?login="+s.bitly_username+"&apiKey="+s.bitly_apikey+"&longUrl="+req print "Please wait... \n" response=urllib2.urlopen(url) a = json.loads(response.rea...
mit
Python
b57e12c4e01559ce5bcb1588b14758429ad552df
Revert "fix: error instance to pytest"
jamesstidard/sanic-envconfig
tests/test_envconfig.py
tests/test_envconfig.py
import pytest @pytest.mark.parametrize("attribute, value", [ ('ATTRIBUTE_STR', 'default_str'), ('ATTRIBUTE_INT', 1), ('ATTRIBUTE_FLOAT', 1.5), ('ATTRIBUTE_BOOL', True), ]) def test_get_attributes(config, attribute, value): assert getattr(config, attribute) == value def test_set_existing_attribut...
import pytest @pytest.mark.parametrize("attribute, value", [ ('ATTRIBUTE_STR', 'default_str'), ('ATTRIBUTE_INT', 1), ('ATTRIBUTE_FLOAT', 1.5), ('ATTRIBUTE_BOOL', True), ]) def test_get_attributes(config, attribute, value): assert getattr(config, attribute) == value def test_set_existing_attribut...
mit
Python
f5ffdefed84c7ddc6dbb4ea897e9f476b5b4d245
Add squares to table.
oskarijarvelin/4dttt
main.py
main.py
class Square: def __init__(self, coords): pass def add_mark(self, player): pass class Line: def __init__(self, params): pass def squares(self): pass def win(self): pass def not_winnable(self): pass class TTT_Table: def __init__(self, base, power, players): self.base = base s...
class Square: def __init__(self, coords): pass def add_mark(self, player): pass class Line: def __init__(self, params): pass def squares(self): pass def win(self): pass def not_winnable(self): pass class TTT_Table: def __init__(self, base, power, players): self.base = base s...
agpl-3.0
Python
a28eedba060934d498ac38e8704022dc38c43758
Add stringio from six
danielecook/python-cli-skeleton
tests/test_utilities.py
tests/test_utilities.py
from subprocess import Popen, PIPE from six import StringIO import sys class Capturing(list): def __enter__(self): self._stdout = sys.stdout sys.stdout = self._stringio = StringIO() return self def __exit__(self, *args): self.extend(self._stringio.getvalue().splitlines()) ...
from subprocess import Popen, PIPE from StringIO import StringIO import sys class Capturing(list): def __enter__(self): self._stdout = sys.stdout sys.stdout = self._stringio = StringIO() return self def __exit__(self, *args): self.extend(self._stringio.getvalue().splitlines()...
mit
Python
603d0dbb3ce2911b62f3274e68b93812da9acf2d
Remove SuperOnline and UyduNet DNS addresses
isair/youtubekapatildimi,isair/youtubekapatildimi
main.py
main.py
# -*- coding: utf-8 -*- """ main.py Jan 14, 2014 Copyright (C) 2014 Baris Sencan """ import os import redis from flask import Flask, render_template, url_for from flask.ext.compress import Compress app = Flask(__name__) # Enable gzip compression. Compress(app) # Static file loading helper. app.jinja_env.globals['s...
# -*- coding: utf-8 -*- """ main.py Jan 14, 2014 Copyright (C) 2014 Barış Şencan """ import os import redis from flask import Flask, render_template, url_for from flask.ext.compress import Compress app = Flask(__name__) # Enable gzip compression. Compress(app) # Static file loading helper. app.jinja_env.globals['s...
apache-2.0
Python
9c7660fd63bc1c48a0533e867c7d18faf9d90c03
Make use thru uwsgi easier
pictuga/morss,pictuga/morss,pictuga/morss
main.py
main.py
#!/usr/bin/env python from morss import main, cgi_wrapper as application if __name__ == '__main__': main()
#!/usr/bin/env python from morss import main if __name__ == '__main__': main()
agpl-3.0
Python
b3e61d648be5c5d28cfe3a7ef69f918c2a2c33a1
optimize the logic of mail
goace/bitcoin-ticker
main.py
main.py
# -*- coding: utf-8 -*- import mail import simplejson import urllib2 import time def moniter(m, send_to, high, low): req = urllib2.Request("https://data.btcchina.com/data/ticker") opener = urllib2.build_opener() last_sent = 0 while True: try: f = opener.open(req) da...
# -*- coding: utf-8 -*- import mail import simplejson import urllib2 import time from config import * def moniter(m, send_to, high, low): req = urllib2.Request("https://data.btcchina.com/data/ticker") opener = urllib2.build_opener() last_sent = 0 while True: try: f = opener.open(...
mit
Python
3cff942af436f16aab2078e6aeedd3073f4a5522
Add Flask-Mail, and null user loader
mikeboers/Flask-Roots,mikeboers/Flask-Roots
flask_roots/extension.py
flask_roots/extension.py
from __future__ import absolute_import import os from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.images import Images from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.acl import AuthManager class Roots(object): def __init__(self, app): self.extensions =...
from __future__ import absolute_import import os from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.images import Images # from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.acl import AuthManager class Roots(object): def __init__(self, app): self.extensions...
bsd-3-clause
Python
18897bf535b4885b9dfbf0a014c92656e8ed74b7
Update main to return properly formatted data
avinassh/Laozi,avinassh/Laozi
main.py
main.py
import telegram import tornado.ioloop import tornado.web from tornado.options import define, options from goodreads_api import get_book_details_by_name, BookNotFound from utils import get_formatted_book_data from settings import TELEGRAM_ACCESS_TOKEN, WEBHOOK_URL define("port", default=5000, help="run on the given po...
import telegram import tornado.ioloop import tornado.web from tornado.options import define, options from goodreads_api import get_book_details_by_name, BookNotFound from settings import TELEGRAM_ACCESS_TOKEN, WEBHOOK_URL define("port", default=5000, help="run on the given port", type=int) bot = telegram.Bot(token=T...
mit
Python
f9aa61fa326f9737e2af971a420da9c0652612ae
revise BaseDoctype to add generic generation method
tLDP/python-tldp,tLDP/python-tldp,tLDP/python-tldp
tldp/doctypes/common.py
tldp/doctypes/common.py
#! /usr/bin/python from __future__ import absolute_import, division, print_function import os from ..utils import logger class SignatureChecker(object): @classmethod def signatureLocation(cls, f): f.seek(0) buf = f.read(1024).lower() for sig in cls.signatures: try: ...
#! /usr/bin/python from __future__ import absolute_import, division, print_function import os from ..utils import logger class SignatureChecker(object): @classmethod def signatureLocation(cls, f): f.seek(0) buf = f.read(1024).lower() for sig in cls.signatures: try: ...
mit
Python
577ebb6d4dc037bc912aa11d525ca4f2f09e7940
set default schema to defm
SANDAG/pydefm,SANDAG/pydefm,SANDAG/defm,SANDAG/pydefm
db/log.py
db/log.py
from sqlalchemy.orm import sessionmaker from forecast import util from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy import MetaData from pysandag.database import get_connection_string import os def n...
from sqlalchemy.orm import sessionmaker from forecast import util from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy import MetaData from pysandag.database import get_connection_string import os def n...
unknown
Python
7c5dad065fc3cb391609c9dd9a8d1b3effc197b1
fix typo
un33k/problems
paths/recursive_total_path.py
paths/recursive_total_path.py
import cProfile def numberOfPaths(nXm_matrix): """ Returns the total number of paths from the top left to the bottom right by moving right and down in a 2D array of size n x m. Where cells can only contain `1` or `0` while real paths can only contain `1`. """ hight = len(nXm_matrix) wi...
import cProfile def numberOfPaths(nXm_matrix): """ Returns the total number of paths from the top left to the bottom right by moving right and down in a 2D array of size n x m. Where cells can only contain `1` or `0` while real paths can only contain `1`. """ hight = len(nXm_matrix) wi...
bsd-2-clause
Python
f4bedfed9a7324574695c065f8a1b7132d5f4708
update ftbfs logic
paultag/ethel,paultag/ethel
ethel/commands/build.py
ethel/commands/build.py
from ethel.runners.sbuild import sbuild from ethel.utils import upload import glob import os # target package firehose def run(dsc, package, job, firehose): suite = job['suite'] arch = job['arch'] info, out, ftbfs = sbuild(dsc, suite, arch) changes = "{source}*{arch}.changes".format( source=...
from ethel.runners.sbuild import sbuild from ethel.utils import upload import glob import os # target package firehose def run(dsc, package, job, firehose): suite = job['suite'] arch = job['arch'] info, out, ftbfs = sbuild(dsc, suite, arch) changes = "{source}*{arch}.changes".format( source=...
mit
Python
026f7d8c07d5ec4e307caa692c66a04653565f52
修复 notebook js 函数未转换的 bug
chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts
pyecharts/render/engine.py
pyecharts/render/engine.py
# coding=utf-8 import re from jinja2 import Environment from pyecharts.commons.types import Any, Optional from ..commons.utils import write_utf8_html_file from ..datasets import EXTRA, FILENAMES from ..globals import CurrentConfig class RenderEngine: def __init__(self, env: Optional[Environment] = None): ...
# coding=utf-8 import re from jinja2 import Environment from pyecharts.commons.types import Any, Optional from ..commons.utils import write_utf8_html_file from ..datasets import EXTRA, FILENAMES from ..globals import CurrentConfig class RenderEngine: def __init__(self, env: Optional[Environment] = None): ...
mit
Python
c5d224818903ccad9624ac4cb3449af82faa55f9
fix typo
houqp/floyd-cli,houqp/floyd-cli,mckayward/floyd-cli,mckayward/floyd-cli
floyd/main.py
floyd/main.py
import click import sys from distutils.version import LooseVersion import floyd from floyd.cli.utils import get_cli_version from floyd.cli.auth import login, logout from floyd.cli.data import data from floyd.cli.experiment import clone, delete, info, init, logs, output, status, stop from floyd.cli.run import run, rest...
import click import sys from distutils.version import LooseVersion import floyd from floyd.cli.utils import get_cli_version from floyd.cli.auth import login, logout from floyd.cli.data import data from floyd.cli.experiment import clone, delete, info, init, logs, output, status, stop from floyd.cli.run import run, rest...
apache-2.0
Python
41d3298eb716ad813a82f56fbfb2771373338c09
Make this test pass by checking for 61 which is what OS X uses as connection refused, apparently
lindenlab/eventlet,collinstocks/eventlet,lindenlab/eventlet,collinstocks/eventlet,lindenlab/eventlet,tempbottle/eventlet,tempbottle/eventlet
greentest/test__socket_errors.py
greentest/test__socket_errors.py
# Copyright (c) 2008-2009 AG Projects # Author: Denis Bilenko # # 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, copy, mo...
# Copyright (c) 2008-2009 AG Projects # Author: Denis Bilenko # # 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, copy, mo...
mit
Python
e25ff765e423511da57f04c96227d2ca69e7c149
Update focal_loss.py
mkocabas/focal-loss-keras
focal_loss.py
focal_loss.py
from keras import backend as K ''' Compatible with tensorflow backend ''' def focal_loss(gamma=2., alpha=.25): def focal_loss_fixed(y_true, y_pred): pt_1 = tf.where(tf.equal(y_true, 1), y_pred, tf.ones_like(y_pred)) pt_0 = tf.where(tf.equal(y_true, 0), y_pred, tf.zeros_like(y_pred)) return -K.mean(...
from keras import backend as K ''' Compatible with tensorflow backend ''' def focal_loss(gamma=2., alpha=.25): def focal_loss_fixed(y_true, y_pred): pt_1 = tf.where(tf.equal(y_true, 1), y_pred, tf.ones_like(y_pred)) pt_0 = tf.where(tf.equal(y_true, 0), y_pred, tf.zeros_like(y_pred)) return -K.sum(a...
mit
Python
6b992aa75c0f553ca5066cda269e93d4f63ea4a5
Optimize banned host validation test
qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
corehq/util/tests/test_validation.py
corehq/util/tests/test_validation.py
from random import sample from corehq.util.validation import is_url_or_host_banned from django.test import TestCase def sample_range(start, stop): yield start num_samples = min(8, stop - start) for middle in sample(xrange(start + 1, stop), num_samples): yield middle yield stop class Validati...
from corehq.util.validation import is_url_or_host_banned from django.test import TestCase def inclusive_range(start, stop): return range(start, stop + 1) class ValidationTestCase(TestCase): def testBannedHosts(self): self.assertTrue(is_url_or_host_banned('anything.commcarehq.org')) for i i...
bsd-3-clause
Python
a4b7be1a8c6d44c272ce25acf9513054d6bee4ad
Fix in listports to work with windows
Blinkinlabs/BlinkyPendant,timtomch/BlinkyPendant,Blinkinlabs/BlinkyPendant,Blinkinlabs/BlinkyPendant,timtomch/BlinkyPendant,timtomch/BlinkyPendant
python_loader/listports.py
python_loader/listports.py
"""BlinkyTape Python communication library. This code assumes stock serialLoop() in the firmware. Commands are issued in 3-byte blocks, with pixel data encoded in RGB triplets in range 0-254, sent sequentially and a triplet ending with a 255 causes the accumulated pixel data to display (a show command). ...
"""BlinkyTape Python communication library. This code assumes stock serialLoop() in the firmware. Commands are issued in 3-byte blocks, with pixel data encoded in RGB triplets in range 0-254, sent sequentially and a triplet ending with a 255 causes the accumulated pixel data to display (a show command). ...
mit
Python
c1ad95ee4680836fc359ee636a2252925a41b3a9
fix raw_id_fields on admin. closes #33
RDXT/django-knowledge,legrostdg/django-knowledge,zapier/django-knowledge,RDXT/django-knowledge,CantemoInternal/django-knowledge,legrostdg/django-knowledge,zapier/django-knowledge,inovasolutions/django-knowledge,CantemoInternal/django-knowledge,legrostdg/django-knowledge,RDXT/django-knowledge,inovasolutions/django-knowl...
knowledge/admin.py
knowledge/admin.py
from django.contrib import admin from knowledge.models import Question, Response, Category class CategoryAdmin(admin.ModelAdmin): list_display = [f.name for f in Category._meta.fields] prepopulated_fields = {'slug': ('title', )} admin.site.register(Category, CategoryAdmin) class QuestionAdmin(admin.ModelAd...
from django.contrib import admin from knowledge.models import Question, Response, Category class CategoryAdmin(admin.ModelAdmin): list_display = [f.name for f in Category._meta.fields] prepopulated_fields = {'slug': ('title', )} admin.site.register(Category, CategoryAdmin) class QuestionAdmin(admin.ModelAd...
isc
Python
4c052b2429d7b48768f51cef0627e7a1772909b3
Fix import
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
dbaas/workflow/steps/tests/test_base_step.py
dbaas/workflow/steps/tests/test_base_step.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging from django.test import TestCase from ..util.base import BaseStep LOG = logging.getLogger(__name__) class BaseStepTestCase(TestCase): def setUp(self): self.base_step = BaseStep() def test_has_do_method(s...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging from django.test import TestCase from ..base import BaseStep LOG = logging.getLogger(__name__) class BaseStepTestCase(TestCase): def setUp(self): self.base_step = BaseStep() def test_has_do_method(self):...
bsd-3-clause
Python
b70e34d399b171b3d8e0731206dde54f8d029379
Add uuid to import
goller/casstest
casstest/casstest.py
casstest/casstest.py
# -*- coding: utf-8 -*- import os import uuid from cassandra.io.libevreactor import LibevConnection from cassandra.cluster import Cluster seed = os.environ.get('SEED', '127.0.0.1') port = int(os.environ.get('PORT', '9042')) keyspace = os.environ.get('KEYSPACE', 'test') def test_read(session, user_id, age): read...
# -*- coding: utf-8 -*- import os from cassandra.io.libevreactor import LibevConnection from cassandra.cluster import Cluster seed = os.environ.get('SEED', '127.0.0.1') port = int(os.environ.get('PORT', '9042')) keyspace = os.environ.get('KEYSPACE', 'test') def test_read(session, user_id, age): read_query = 'SE...
bsd-3-clause
Python
85680ed5792456a109583830bcbfbc30ef3b62c4
Complete 'About Lambdas' koans
JesusMtnez/devexperto-challenge,JesusMtnez/devexperto-challenge
jesusmtnez/python/koans/koans/about_lambdas.py
jesusmtnez/python/koans/koans/about_lambdas.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based slightly on the lambdas section of AboutBlocks in the Ruby Koans # from runner.koan import * class AboutLambdas(Koan): def test_lambdas_can_be_assigned_to_variables_and_called_explicitly(self): add_one = lambda n: n + 1 self.assertEqual(11, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based slightly on the lambdas section of AboutBlocks in the Ruby Koans # from runner.koan import * class AboutLambdas(Koan): def test_lambdas_can_be_assigned_to_variables_and_called_explicitly(self): add_one = lambda n: n + 1 self.assertEqual(__, ...
mit
Python
d9719a20d4ee433aaab27a648888966d1ce0163b
Implement inversion counting with global variable
timpel/stanford-algs,timpel/stanford-algs
count-inversions/count_inversions.py
count-inversions/count_inversions.py
from random import randint import sys count = 0 def sort_and_count(arr): n = len(arr) if n == 1: return arr else: first_half = arr[:n/2] second_half = arr[n/2:] return merge_and_count_split(sort_and_count(first_half), sort_and_count(second_half)) def merge_and_count_split(arr1, arr2): i, j = 0, 0 res...
from random import randint import sys def sort_and_count(arr): n = len(arr) if n == 1: return arr else: first_half = arr[:n/2] second_half = arr[n/2:] return merge_and_count_split(sort_and_count(first_half), sort_and_count(second_half)) def merge_and_count_split(arr1, arr2): i, j = 0, 0 result = [] ...
mit
Python
17dceb0d66ac72547c6de6153d79d9bcd5dd9926
put _id and properties in the right places
NCI-GDC/gdcdatamodel,NCI-GDC/gdcdatamodel
gdcdatamodel/mappings/mappings.py
gdcdatamodel/mappings/mappings.py
from gdcdatamodel import node_avsc_json from mapped_entities import ( file_tree, file_traversal, participant_tree, participant_traversal, annotation_tree, annotation_traversal, ONE_TO_MANY, ONE_TO_ONE, annotation_tree ) def _get_es_type(_type): if 'long' in _type or 'int' in _type: return ...
from gdcdatamodel import node_avsc_json from mapped_entities import ( file_tree, file_traversal, participant_tree, participant_traversal, annotation_tree, annotation_traversal, ONE_TO_MANY, ONE_TO_ONE, annotation_tree ) def _get_es_type(_type): if 'long' in _type or 'int' in _type: return ...
apache-2.0
Python
36b2ca696bf6955d54ade1f917a1caea59b2d2d1
update version to 0.7.4
Widukind/dlstats,Widukind/dlstats
dlstats/version.py
dlstats/version.py
VERSION = (0, 7, 4) def version_str(): if len(VERSION) == 3: return "%s.%s.%s" % VERSION elif len(VERSION) == 4: return "%s.%s.%s-%s" % VERSION else: raise IndexError("Incorrect format for the VERSION tuple")
VERSION = (0, 7, 3) def version_str(): if len(VERSION) == 3: return "%s.%s.%s" % VERSION elif len(VERSION) == 4: return "%s.%s.%s-%s" % VERSION else: raise IndexError("Incorrect format for the VERSION tuple")
agpl-3.0
Python
bca4bb08fbfffe27214803429ad63f7800f36428
Update demo.py to show different stock codes
7forz/numpy_pandas_tushare_learning
demo.py
demo.py
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6), p_CCI=14): """ Example stock: str, '000001', date: str, '2017-08-18', ...
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6), p_CCI=14): """ Example stock: str, '000001', date: str, '2017-08-18', ...
agpl-3.0
Python
04713d6aa951b444098cddead17de35421135c99
adjust BNF conf + banner remover (#372)
medialab/hyphe,medialab/hyphe,medialab/hyphe,medialab/hyphe
hyphe_backend/lib/webarchives.py
hyphe_backend/lib/webarchives.py
import re ARCHIVES_OPTIONS = { "": { "label": "Disabled", "description": "crawl the live web, not any kind of web archive" }, "archive.org": { "label": "Web.Archive.org", "description": "crawl worldwide web archives maintained by Archive.org", "url_prefix": "https://...
import re ARCHIVES_OPTIONS = { "": { "label": "Disabled", "description": "crawl the live web, not any kind of web archive" }, "archive.org": { "label": "Web.Archive.org", "description": "crawl worldwide web archives maintained by Archive.org", "url_prefix": "https://...
agpl-3.0
Python
d99aebe4ded6f8b8663ca32a191c6c39e58b1517
bump version
cenkalti/kuyruk,cenkalti/kuyruk
kuyruk/__init__.py
kuyruk/__init__.py
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.14.5' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.14.4' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
mit
Python
8650f7380976671553db28e11ac145ac3b4b9d20
Update production.py
watchdogpolska/poradnia,watchdogpolska/poradnia,rwakulszowa/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,rwakulszowa/poradnia,rwakulszowa/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,watchdogpolska/poradnia.siecobywatelska.pl,rwakulszowa/poradnia
poradnia/config/production.py
poradnia/config/production.py
# -*- coding: utf-8 -*- ''' Production Configurations ''' from .common import * # noqa # SECRET KEY SECRET_KEY = env.str('DJANGO_SECRET_KEY') # END SECRET KEY # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ...
# -*- coding: utf-8 -*- ''' Production Configurations ''' from .common import * # noqa # SECRET KEY SECRET_KEY = env.str('DJANGO_SECRET_KEY') # END SECRET KEY # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ...
mit
Python
a73451272d832ac22e6afcff0bf3fbe416328b65
use correct file?
ppliu1979/libinjection,fengjian/libinjection,fengjian/libinjection,ppliu1979/libinjection,fengjian/libinjection,fengjian/libinjection,dijkstracula/libinjection,dijkstracula/libinjection,ppliu1979/libinjection,fengjian/libinjection,ppliu1979/libinjection,ppliu1979/libinjection,dijkstracula/libinjection,dijkstracula/libi...
cicada/publishers.py
cicada/publishers.py
import logging import os import stat import subprocess class PublishArtifact(object): """ Publish console ouput artifct is relative to workspace directory href/linktext is made for future linking """ def __init__(self, artifact, destination, href, linktext): self.artifact = artifact ...
import logging import os import stat import subprocess class PublishArtifact(object): """ Publish console ouput artifct is relative to workspace directory href/linktext is made for future linking """ def __init__(self, artifact, destination, href, linktext): self.artifact = artifact ...
bsd-3-clause
Python
eaba29ee7ea2a02eef180531e7efaf4c3cfebf31
Check for subscript like DD1
mph-/lcapy
lcapy/latex.py
lcapy/latex.py
import re sub_super_pattern = re.compile(r"([_\^]){([a-zA-Z]+)([0-9]*)}") class Latex(object): words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg', 'mean', 'peak', 'pp', 'min', 'max', 'src', 'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol') def __init__(self, string): ...
import re sub_super_pattern = re.compile(r"([_\^]){([\w]+)}") class Latex(object): words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg', 'mean', 'peak', 'pp', 'min', 'max', 'src', 'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol') def __init__(self, string): self.str ...
lgpl-2.1
Python
9cc013cc0fbff030be386ed3af5f6a826b97ca5f
make the module hook more robust
iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack
lib/spack/spack/hooks/module_file_generation.py
lib/spack/spack/hooks/module_file_generation.py
# Copyright 2013-2020 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) import spack.config import spack.modules import spack.modules.common import llnl.util.tty as tty def _for_each_enabled(s...
# Copyright 2013-2020 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) import spack.modules import spack.modules.common import llnl.util.tty as tty try: enabled = spack.config.get('modules...
lgpl-2.1
Python
7f77f822dcf05152634cda771cce934320d23ca1
use image data
pdebuyl-lab/RMPCDMD,laurensdeprez/RMPCDMD,pdebuyl-lab/RMPCDMD,laurensdeprez/RMPCDMD,pdebuyl/RMPCDMD,pdebuyl/RMPCDMD
experiments/01-single-dimer/plot_velocity.py
experiments/01-single-dimer/plot_velocity.py
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser() parser.add_argument('file', type=str, help='H5MD datafile') parser.add_argument('--directed', action='store_true') args = parser.parse_args() import numpy as np import h5py import matplotlib.pyplot as plt with h5py.File(args.file, 'r') as f: ...
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser() parser.add_argument('file', type=str, help='H5MD datafile') parser.add_argument('--directed', action='store_true') args = parser.parse_args() import numpy as np import h5py import matplotlib.pyplot as plt with h5py.File(args.file, 'r') as f: ...
bsd-3-clause
Python
02ae6cadac686c9c601bcad42c6b95b8811c3cfb
Add --ip and --port flag to example.
eronde/vim_suggest,eronde/vim_suggest,eronde/py_word_suggest,eronde/py_word_suggest
examples/commandline.py
examples/commandline.py
"""commandline. Usage: commandline.py lookup --lang=<lang> --word=<preword> [--ip=<redis-ip>] [--port=<redis-port>] commandline.py -h | --help Options: -h --help Show this screen. --lang=<lang> Language of suggested word. --word=<preword> Pre-word of suggested word. --ip=<rediis-i...
"""commandline. Usage: commandline.py lookup --lang=<lang> --word=<preword> commandline.py -h | --help Options: -h --help Show this screen. --lang=<lang> Language of suggested word. --word=<preword> Pre-word of suggested word. """ import redis import py_word_suggest # from config import REDIS_IP fro...
mit
Python
ca1fa126611f958ccd893f034df74e8821f41771
update prototype
sachinio/redalert,sachinio/redalert,sachinio/redalert,sachinio/redalert,sachinio/redalert,sachinio/redalert,sachinio/redalert
hardware/prototype/read_serial.py
hardware/prototype/read_serial.py
__author__ = 'sachinpatney' import serial import time import binascii ser = serial.Serial('/dev/ttyUSB0', baudrate=9600, timeout=1.0) s = b'' def do(cmd): if cmd == 'play': print('Playing music ...') while True: bytesToRead = ser.inWaiting() if bytesToRead > 0: s += ser.rea...
__author__ = 'sachinpatney' import serial import time import binascii ser = serial.Serial('/dev/ttyUSB0', baudrate=9600, timeout=1.0) s = b'' def do(cmd): if cmd == 'play': print('Playing music ...') while True: bytesToRead = ser.inWaiting() if bytesToRead > 0: s += ser.rea...
mit
Python
2846b996783b896f69ec0870569c7e442ddcc652
fix imports, arguments
vlukes/sfepy,sfepy/sfepy,sfepy/sfepy,olivierverdier/sfepy,RexFuzzle/sfepy,vlukes/sfepy,BubuLK/sfepy,olivierverdier/sfepy,RexFuzzle/sfepy,sfepy/sfepy,BubuLK/sfepy,vlukes/sfepy,rc/sfepy,rc/sfepy,RexFuzzle/sfepy,lokik/sfepy,RexFuzzle/sfepy,rc/sfepy,lokik/sfepy,olivierverdier/sfepy,lokik/sfepy,lokik/sfepy,BubuLK/sfepy
sfepy/terms/terms_fibres.py
sfepy/terms/terms_fibres.py
from sfepy.terms.terms import * from sfepy.terms.terms_base import VectorVector from sfepy.terms.terms_hyperelastic_tl import HyperElasticTLBase from sfepy.homogenization.utils import iter_sym class FibresActiveTLTerm(VectorVector, HyperElasticTLBase): r""":description: Hyperelastic active fibres term. Effective s...
from sfepy.terms.terms import * from sfepy.terms.terms_hyperelastic_tl import HyperElasticTLBase from sfepy.homogenization.utils import iter_sym class FibresActiveTLTerm(HyperElasticTLBase): r""":description: Hyperelastic active fibres term. Effective stress $S_{ij} = A f_{\rm max} \exp{-(\frac{\epsilon - \var...
bsd-3-clause
Python
207dd3b5f59ecc66c896cc0f3ad90e283fca5145
refactor the registration process
fretboardfreak/netify
src/app.py
src/app.py
"""The netify application object.""" # Copyright 2015 Curtis Sand # # 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 app...
"""The netify application object.""" # Copyright 2015 Curtis Sand # # 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 app...
apache-2.0
Python
12720a225210afe73f301c2112f0a7ddcdc41bcb
Fix CSR loading in ACME example client script.
goofwear/letsencrypt,jsha/letsencrypt,kevinlondon/letsencrypt,DavidGarciaCat/letsencrypt,ahojjati/letsencrypt,jmaurice/letsencrypt,rugk/letsencrypt,rugk/letsencrypt,thanatos/lets-encrypt-preview,DavidGarciaCat/letsencrypt,thanatos/lets-encrypt-preview,beermix/letsencrypt,ghyde/letsencrypt,Jonadabe/letsencrypt,TheBoegl/...
examples/acme_client.py
examples/acme_client.py
"""Example script showing how to use acme client API.""" import logging import os import pkg_resources from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa import OpenSSL from acme import client from acme import messages from acme import jose logging.bas...
"""Example script showing how to use acme client API.""" import logging import os import pkg_resources from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa import OpenSSL from acme import client from acme import messages from acme import jose logging.bas...
apache-2.0
Python