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 |
|---|---|---|---|---|---|---|---|---|
e692728608e625fa4e0ae44af3f88154f6e421ee | Revise doc string. | bowen0701/algorithms_data_structures | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get nth number of Fibonacci series by recursion.
Both of tim... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get nth number of Fibonacci series by recursion."""
if n <= 1... | bsd-2-clause | Python |
122ba6d8c6cc28e3b9c1d7abd942d51409cd70cf | Add package details | joshainglis/pyley,joshainglis/pyley,ziyasal/pyley,ziyasal/pyley | pyley/__init__.py | pyley/__init__.py | """
pyley Python client for an open-source graph database Cayley
:copyright: (c) 2014 by Ziya SARIKAYA @ziyasal.
:license: MIT, see LICENSE for more details.
"""
__title__ = 'pyley'
__version__ = '0.1.0'
__build__ = 0x00001
__author__ = 'Ziya SARIKAYA @ziyasal'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014 Ziy... | __version__ = '0.1.0'
VERSION = tuple(map(int, __version__.split('.'))) | mit | Python |
6d4d507049c582ca01448510d873bf8ab6b30656 | fix project_name | Railslide/subvenv,Railslide/subvenv | virtualenvwrapper/subvenv.py | virtualenvwrapper/subvenv.py | import json
import logging
import os
log = logging.getLogger(__name__)
def post_mkproject(args):
project_name = os.path.basename(os.getenv('VIRTUAL_ENV'))
project_venv = os.path.join(os.getenv('WORKON_HOME'), project_name)
project_path_file = os.path.join(project_venv, '.project')
project_interprete... | import json
import logging
import os
log = logging.getLogger(__name__)
def post_mkproject(args):
project_name = os.path.split(os.getenv('PWD'))[1]
project_venv = os.path.join(os.getenv('WORKON_HOME'), project_name)
project_path_file = os.path.join(project_venv, '.project')
project_interpreter = os.p... | mit | Python |
5a3033aeb63ee9302cba8919814f798ab41bd79c | Add /dashboards to list of paths | alexanderlz/redash,alexanderlz/redash,stefanseifert/redash,vishesh92/redash,M32Media/redash,useabode/redash,crowdworks/redash,moritz9/redash,denisov-vlad/redash,amino-data/redash,stefanseifert/redash,getredash/redash,vishesh92/redash,moritz9/redash,moritz9/redash,chriszs/redash,getredash/redash,rockwotj/redash,moritz9/... | redash/handlers/static.py | redash/handlers/static.py | import os
from flask import current_app, safe_join, send_file
from flask_login import login_required
from redash import settings
from redash.handlers import routes
from redash.handlers.base import org_scoped_rule
from werkzeug.exceptions import NotFound
@routes.route('/<path:filename>')
def send_static(filename):
... | import os
from flask import current_app, safe_join, send_file
from flask_login import login_required
from redash import settings
from redash.handlers import routes
from redash.handlers.base import org_scoped_rule
from werkzeug.exceptions import NotFound
@routes.route('/<path:filename>')
def send_static(filename):
... | bsd-2-clause | Python |
e9fe93d5e178a0e1f63b8bcfc7a004ecf813e16c | Fix extension table removing migration | lonnen/socorro,lonnen/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro | alembic/versions/0193b4725f32_bug_1132858_remove_extensions.py | alembic/versions/0193b4725f32_bug_1132858_remove_extensions.py | """bug 1132858 remove extensions table
Revision ID: 0193b4725f32
Revises: bb8cdbb8a6bd
Create Date: 2018-01-31 14:21:41.032179
"""
# revision identifiers, used by Alembic.
revision = '0193b4725f32'
down_revision = 'bb8cdbb8a6bd'
from alembic import op
from socorro.lib import citexttype, jsontype, buildtype
from soc... | """bug 1132858 remove extensions table
Revision ID: 0193b4725f32
Revises: bb8cdbb8a6bd
Create Date: 2018-01-31 14:21:41.032179
"""
# revision identifiers, used by Alembic.
revision = '0193b4725f32'
down_revision = 'bb8cdbb8a6bd'
from alembic import op
from socorro.lib import citexttype, jsontype, buildtype
from soc... | mpl-2.0 | Python |
f5a67ab54324e0eb1779ee863d0f2a458bd6f0a3 | Bump module version to 10.0.1.0.0 | akretion/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_sale/__manifest__.py | l10n_br_sale/__manifest__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2009 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization Sale',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website': 'http://... | # -*- coding: utf-8 -*-
# Copyright (C) 2009 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization Sale',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website': 'http://... | agpl-3.0 | Python |
cea7e61a22eb0e996c8171b2daec4de562b495ac | Add TODO to replace encoding stuff with urllib.quote where possible | isagalaev/sm-openid,necaris/python3-openid,moreati/python3-openid,moreati/python3-openid,misli/python3-openid,moreati/python3-openid,misli/python3-openid,necaris/python3-openid,misli/python3-openid | openid/codecutil.py | openid/codecutil.py | import codecs
try:
chr(0x10000)
except ValueError:
# narrow python build
UCSCHAR = [
(0xA0, 0xD7FF),
(0xF900, 0xFDCF),
(0xFDF0, 0xFFEF),
]
IPRIVATE = [
(0xE000, 0xF8FF),
]
else:
UCSCHAR = [
(0xA0, 0xD7FF),
(0xF900, 0xFDCF),
(0... | import codecs
try:
chr(0x10000)
except ValueError:
# narrow python build
UCSCHAR = [
(0xA0, 0xD7FF),
(0xF900, 0xFDCF),
(0xFDF0, 0xFFEF),
]
IPRIVATE = [
(0xE000, 0xF8FF),
]
else:
UCSCHAR = [
(0xA0, 0xD7FF),
(0xF900, 0xFDCF),
(0... | apache-2.0 | Python |
b434c09b38dbed349d0965e60b736eaab23fa218 | Move import in to apps.ready() | onespacemedia/cms-faqs,onespacemedia/cms-faqs | apps/faqs/apps.py | apps/faqs/apps.py | from django.apps import AppConfig
from watson import search as watson
class FaqsConfig(AppConfig):
name = '{{ project_name }}.apps.faqs'
verbose_name = 'FAQ'
verbose_name_plural = 'FAQs'
def ready(self):
from cms.models import PageBaseSearchAdapter
Faq = self.get_model('Faq')
... | from cms.models import PageBaseSearchAdapter
from django.apps import AppConfig
from watson import search as watson
class FaqsConfig(AppConfig):
name = '{{ project_name }}.apps.faqs'
verbose_name = 'FAQ'
verbose_name_plural = 'FAQs'
def ready(self):
Faq = self.get_model('Faq')
watson.r... | mit | Python |
4c76a99e1d72820a367d2195fbd3edc1b0af30fd | Add options to Tag model fields. [skip ci] | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | organizer/models.py | organizer/models.py | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(
max_length=31, unique=True)
slug = models.SlugField(
max_length=31,
unique=True,
help_text='A label for URL config... | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
class Startup(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
... | bsd-2-clause | Python |
3de2dc88d6ae25200e4c339cf732c665d1c9826a | fix lint | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/domain/management/commands/update_dimagi_created_self_started_projects.py | corehq/apps/domain/management/commands/update_dimagi_created_self_started_projects.py | from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from corehq.apps.users.models import CouchUser
from corehq.apps.domain.models import Domain
class Command(BaseCommand):
help = "Sets all dimagi account created projects as non-self-started"
@staticmethod
def ... | from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from corehq.apps.users.models import CouchUser
from corehq.apps.domain.models import Domain
class Command(BaseCommand):
help = "Sets all dimagi account created projects as non-self-started"
@staticm... | bsd-3-clause | Python |
dbf7ab3ae20dd04bf6ead67ae4328a66d3733875 | Add comments | bowen0701/algorithms_data_structures | lc0040_combination_sum_ii.py | lc0040_combination_sum_ii.py | """Leetcode 40. Combination Sum II
Medium
URL: https://leetcode.com/problems/combination-sum-ii/
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in... | """Leetcode 40. Combination Sum II
Medium
URL: https://leetcode.com/problems/combination-sum-ii/
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in... | bsd-2-clause | Python |
1a1b8297c495346e42c32e14202c4655afbfd43e | Fix PyHeufyBot migration tool | DesertBot/DesertBot | migration/pyheufybot/util.py | migration/pyheufybot/util.py | from desertbot.config import Config
from desertbot.datastore import DataStore
import argparse, os, shelve
class PyHeufyBotUtil(object):
def __init__(self, section):
parser = argparse.ArgumentParser(description='PyHeufyBot shelve parsing tool.')
parser.add_argument('-s', '--storage', help='The stor... | from desertbot.config import Config
from desertbot.datastore import DataStore
import argparse, os, shelve
class PyHeufyBotUtil(object):
def __init__(self, section):
parser = argparse.ArgumentParser(description='PyHeufyBot shelve parsing tool.')
parser.add_argument('-s', '--storage', help='The stor... | mit | Python |
2a83bb654d625a1f5d879c00f138f77984c14ce5 | add simple test for bug issue #15 | codeforamerica/straymapper,codeforamerica/straymapper,codeforamerica/straymapper | animals/tests.py | animals/tests.py | from django.core.urlresolvers import reverse
from django.test import TestCase
class AnimalsViewsTestCase(TestCase):
def test_index(self):
resp = self.client.get(reverse('animals_index'))
self.assertEqual(resp.status_code, 200)
self.assertTrue('form' in resp.context)
self.assertTrue... | from django.test import TestCase
class AnimalsViewsTestCase(TestCase):
def test_index(self):
resp = self.client.get('/animals/')
self.assertEqual(resp.status_code, 200)
self.assertTrue('form' in resp.context)
self.assertTrue('alist' in resp.context)
self.assertTrue('results... | bsd-3-clause | Python |
4fedb170469888a20324ca79176f761ca7c5ac1e | Remove rewrap_text from utils.py in favor of textwrap in standard lib | radicalbiscuit/garnish | garnish/utils.py | garnish/utils.py | import sys
def fill_template(temp, args, longname, filename, url):
"""
Takes a template string (temp) and replaces all template keywords with
information from commandline arguments.
"""
temp = temp.replace('OWNER_NAME', args.copyright_holder)
temp = temp.replace('COPYRIGHT_YEAR', args.year)
... | import sys
def fill_template(temp, args, longname, filename, url):
"""
Takes a template string (temp) and replaces all template keywords with
information from commandline arguments.
"""
temp = temp.replace('OWNER_NAME', args.copyright_holder)
temp = temp.replace('COPYRIGHT_YEAR', args.year)
... | mit | Python |
001206bb9f363b8574187d792a96ee596025ad78 | replace | with : as sep | tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj | database/inserter/insert_disease.py | database/inserter/insert_disease.py | # insert_disease.py
import os
import sys
import time
import json
import yaml
import MySQLdb
import pickle
import psycopg2
import postgresql_util as pg
from collections import defaultdict
from bs4 import BeautifulSoup
from urllib2 import urlopen
from datetime import datetime
def main(argv):
assert len(argv)>=7
... | # insert_disease.py
import os
import sys
import time
import json
import yaml
import MySQLdb
import pickle
import psycopg2
import postgresql_util as pg
from collections import defaultdict
from bs4 import BeautifulSoup
from urllib2 import urlopen
from datetime import datetime
def main(argv):
assert len(argv)>=7
... | mit | Python |
bcf9f5da40ad34276b8be1cbc2d8c9e2fd70e9ac | update the monitors benchmark | enthought/pikos,enthought/pikos,enthought/pikos | pikos/benchmark/monitors.py | pikos/benchmark/monitors.py | # -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Package: Pikos toolkit
# File: benchmark/monitors.py
# License: LICENSE.TXT
#
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved.
#---------------------------------------------------------------------... | # -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Package: Pikos toolkit
# File: benchmark/monitors.py
# License: LICENSE.TXT
#
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved.
#---------------------------------------------------------------------... | bsd-3-clause | Python |
6df173345c5ac0038a402a53f47a9f1095ecc31c | Add key field to table and autoincrement it. | prcutler/nflpool,prcutler/nflpool | create_player_picks_table.py | create_player_picks_table.py | import sqlite3
import json
# This file creates the table in the database to store each player's picks for every category in NFLPool.
conn = sqlite3.connect('nflpool.sqlite')
cur = conn.cursor()
# Do some setup
cur.executescript('''
DROP TABLE IF EXISTS picks;
CREATE TABLE picks (
firstname TEXT NOT NULL,
... | import sqlite3
import json
# This file creates the table in the database to store each player's picks for every category in NFLPool.
conn = sqlite3.connect('nflpool.sqlite')
cur = conn.cursor()
# Do some setup
cur.executescript('''
DROP TABLE IF EXISTS picks;
CREATE TABLE picks (
firstname TEXT NOT NULL,
... | mit | Python |
4d6bbdd538fa92a107a10344bc5c8f8f0ec86de9 | add self link | olneyhymn/westminster-daily,tdhopper/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,tdhopper/westminster-daily,olneyhymn/westminster-daily,tdhopper/westminster-daily | generate_feed.py | generate_feed.py | from feedgen.feed import FeedGenerator
import datetime as dt
import pytz
from premailer import transform
import markdown
from functools import lru_cache
from bs4 import BeautifulSoup
URL = "https://reformedconfessions.com/westminster-daily"
FILENAME = "feed.rss"
NUMBER_OF_DAYS = 30
@lru_cache()
def markdown_parser(m... | from feedgen.feed import FeedGenerator
import datetime as dt
import pytz
from premailer import transform
import markdown
from functools import lru_cache
from bs4 import BeautifulSoup
URL = "https://reformedconfessions.com/westminster-daily"
FILENAME = "feed.rss"
NUMBER_OF_DAYS = 30
@lru_cache()
def markdown_parser(m... | bsd-3-clause | Python |
e2fbf646b193284fc5d01684193b9c5aeb415efe | Fix due to merge conflicts | TalkAboutLocal/local-news-engine,TalkAboutLocal/local-news-engine,TalkAboutLocal/local-news-engine,TalkAboutLocal/local-news-engine | generate_html.py | generate_html.py | from jinja2 import Environment, FileSystemLoader
import datetime
import json
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
names_template = env.get_template('names.html')
area_template = env.get_template('areas.html')
with open("output/templates.js") as templatesjs:
templates = templat... | from jinja2 import Environment, FileSystemLoader
import datetime
import json
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
names_template = env.get_template('names.html')
area_template = env.get_template('areas.html')
with open("output/templates.js") as templatesjs:
templates = templat... | agpl-3.0 | Python |
df000e47d8d727f10e7f922b21814c025539b8ef | Add url_shortener.validation.NotABlacklistMatch class | piotr-rusin/url-shortener,piotr-rusin/url-shortener | url_shortener/validation.py | url_shortener/validation.py | # -*- coding: utf-8 -*-
from submodules.spam_lists_lib.spam_lists import (
GoogleSafeBrowsing, HpHosts, GeneralizedUrlTester, UrlTesterChain,
SPAMHAUS_DBL, SPAMHAUS_ZEN, SURBL_MULTI
)
from wtforms.validators import ValidationError
from . import app
google_safe_browsing = GoogleSafeBrowsing(
'url-shortene... | # -*- coding: utf-8 -*-
from submodules.spam_lists_lib.spam_lists import (
GoogleSafeBrowsing, HpHosts, GeneralizedUrlTester, UrlTesterChain,
SPAMHAUS_DBL, SPAMHAUS_ZEN, SURBL_MULTI
)
from . import app
google_safe_browsing = GoogleSafeBrowsing(
'url-shortener',
'0.9',
app.config['GOOGLE_SAFE_BROWS... | mit | Python |
0ec1c37beecfbbaa4a1e3b38d36c67359a388cf9 | remove unused imports | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | updatecmd.py | updatecmd.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import files
import sys
import versions
def doUpdate(repos, cfg, pkg, mainPackageName):
if cfg.root == "/":
print "using srs to update to your actual system is dumb."
sys.exit(0)
for (fileId, path, version) in pkg.fileList():
infoFile = repos.ge... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import package
import files
import shutil
import pwd
import grp
import files
import string
import sys
import versions
def doUpdate(repos, cfg, pkg, mainPackageName):
if cfg.root == "/":
print "using srs to update to your actual system is dumb."
import... | apache-2.0 | Python |
7b67d1753a678e1a24d400d4c733e82d224c11e5 | fix 19 10 tests | shtalinberg/django-el-pagination,shtalinberg/django-el-pagination,shtalinberg/django-el-pagination,shtalinberg/django-el-pagination | tests/settings.py | tests/settings.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""Settings file for the Django project used for tests."""
import os
DEBUG = True
DJANGO_LIVE_TEST_SERVER_ADDRESS = os.getenv('DJANGO_LIVE_TEST_SERVER_ADDRESS',
"localhost:8000-8010,8080,9200-9300")
# Disable 1.9 arguments '--parallel'
DJANGO_TEST... | """Settings file for the Django project used for tests."""
import os
DEBUG = True
DJANGO_LIVE_TEST_SERVER_ADDRESS = os.getenv('DJANGO_LIVE_TEST_SERVER_ADDRESS',
"localhost:8000-8010,8080,9200-9300")
# Disable 1.9 arguments '--parallel',
DJANGO_TEST_PROCESSES = os.getenv('DJANGO_TEST_PROCESSES', 1) # try exclud... | mit | Python |
8b9b77cc01cfca4dd477f4ba72b4476a6ed95758 | Bump to version 0.2. | signalfx/signalfx-python,signalfx/signalfx-python | signalfx/version.py | signalfx/version.py | # Copyright (C) 2015 SignalFx, Inc. All rights reserved.
name = 'signalfx'
version = '0.2'
| # Copyright (C) 2015 SignalFx, Inc. All rights reserved.
name = 'signalfx'
version = '0.1'
| apache-2.0 | Python |
1d34f417e13164a42470beaee09cc24dbbf8174e | revert back to 32bit python | sgibbes/zonal_stats_app | utilities/zstats_handler.py | utilities/zstats_handler.py | import subprocess
import arcpy
import os
def main_script(layer, raster, method):
# add to this if i'm running average area of zstats
final_aoi = layer.final_aoi
start_id = 0
end_id = int(arcpy.GetCount_management(final_aoi).getOutput(0))
print "Number of features: {}".format(end_id)
zstats... | import subprocess
import arcpy
import os
def main_script(layer, raster, method):
# add to this if i'm running average area of zstats
final_aoi = layer.final_aoi
start_id = 0
end_id = int(arcpy.GetCount_management(final_aoi).getOutput(0))
print "Number of features: {}".format(end_id)
zstats... | apache-2.0 | Python |
3977993b8bc8a846df1a5e5fe792d6f242009b03 | add gzip deflation to HtmlFetcher | AGoodId/python-goose,AGoodId/python-goose | goose/network.py | goose/network.py | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | apache-2.0 | Python |
266efa9d2e56fe3767111d5df9b8a554bec8a18a | fix attack | Groupe24/CodeInSpace | tools/run_game.py | tools/run_game.py | #!/usr/bin/env python
import os
import sys
os.chdir('../game')
sys.path.insert(0, '../game')
import coders_in_space
coders_in_space.play_game('board/test_board.cis', ('bot3','dumby'), screen_size=(190, 50), no_gui = False, no_splash = True, max_rounds_count = 10)
raw_input('Press Enter to continue...')
| #!/usr/bin/env python
import os
import sys
os.chdir('../game')
sys.path.insert(0, '../game')
import coders_in_space
coders_in_space.play_game('board/test_board.cis', ('dumbinspace','dumby'), screen_size=(190, 50), no_gui = False, no_splash = True, max_rounds_count = 10)
raw_input('Press Enter to continue... | mit | Python |
5d998a431ea5c531b78979e4ad69b1729369eab1 | Make all preview video 1080p | cgwire/zou | zou/app/utils/movie_utils.py | zou/app/utils/movie_utils.py | import os
from moviepy.editor import VideoFileClip
def save_file(tmp_folder, instance_id, file_to_save):
"""
Save given file in given path. This function should only be used for
temporary storage.
"""
extension = file_to_save.filename[-4:]
file_name = instance_id + extension.lower() + ".tmp"
... | import os
from moviepy.editor import VideoFileClip
def save_file(tmp_folder, instance_id, file_to_save):
"""
Save given file in given path. This function should only be used for
temporary storage.
"""
extension = file_to_save.filename[-4:]
file_name = instance_id + extension.lower() + ".tmp"
... | agpl-3.0 | Python |
5d3e8d7bcd553a1e60803cf7b72c6ed1eaa5ba0b | Optimize imports | joaolrpaulo/eletronic-voting-system,joaolrpaulo/eletronic-voting-system,joaolrpaulo/eletronic-voting-system | voting-server/app/errors.py | voting-server/app/errors.py | from app import app
from flask import jsonify
from werkzeug.exceptions import HTTPException
from werkzeug.exceptions import default_exceptions
def json_error(error):
response = jsonify(message = str(error))
response.status_code = error.code if isinstance(error, HTTPException) else 500
return response
for... | from app import app
from flask import jsonify
from werkzeug.exceptions import HTTPException, default_exceptions
def json_error(error):
response = jsonify(message = str(error))
print(str(error))
response.status_code = error.code if isinstance(error, HTTPException) else 500
return response
for code in ... | mit | Python |
3cb40d4dbc7a34050ed563778c215ca1e12e2d90 | Bump version to 0.4dev0 | jacebrowning/gdm,jacebrowning/gitman | gdm/__init__.py | gdm/__init__.py | """Package for GDM."""
import sys
__project__ = 'GDM'
__version__ = '0.4dev0'
CLI = 'gdm'
VERSION = __project__ + '-' + __version__
DESCRIPTION = 'A very basic language-agnostic "dependency manager" using Git.'
PYTHON_VERSION = 3, 3
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
e... | """Package for GDM."""
import sys
__project__ = 'GDM'
__version__ = '0.3'
CLI = 'gdm'
VERSION = __project__ + '-' + __version__
DESCRIPTION = 'A very basic language-agnostic "dependency manager" using Git.'
PYTHON_VERSION = 3, 3
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exit(... | mit | Python |
7b11ea6792b239fa9930f4fd5bfccef85e50103f | Include date | jml/edn-profiling | gen-much-edn.py | gen-much-edn.py | """Generate some edn records for profiling."""
import datetime
import decimal
import random
import sys
import edn
DICTIONARY_FILE = '/usr/share/dict/words'
def load_words(dictionary):
with open(dictionary, 'r') as dictionary_file:
return [x.strip() for x in dictionary_file.readlines()]
WORDS = load_w... | """Generate some edn records for profiling."""
import decimal
import random
import sys
import edn
DICTIONARY_FILE = '/usr/share/dict/words'
def load_words(dictionary):
with open(dictionary, 'r') as dictionary_file:
return [x.strip() for x in dictionary_file.readlines()]
WORDS = load_words(DICTIONARY_... | apache-2.0 | Python |
0ed9e159fa606c9dbdb90dfc64fcb357e9f9cedb | Fix wrong import in test | evernym/zeno,evernym/plenum | plenum/test/test_request.py | plenum/test/test_request.py | from plenum.common.request import Request
def test_request_all_identifiers_returns_empty_list_for_request_without_signatures():
req = Request()
assert req.all_identifiers == [] | from indy_common.types import Request
def test_request_all_identifiers_returns_empty_list_for_request_without_signatures():
req = Request()
assert req.all_identifiers == [] | apache-2.0 | Python |
219c773fcf4fb98201e90aab77a27e090799d2c1 | fix flock-related tests on linux/mac after r1646 | old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google | test/make_global_settings/basics/gyptest-make_global_settings.py | test/make_global_settings/basics/gyptest-make_global_settings.py | #!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies make_global_settings.
"""
import os
import sys
import TestGyp
test_format = ['ninja']
if sys.platform in ('linux2', 'darwin')... | #!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies make_global_settings.
"""
import os
import sys
import TestGyp
test_format = ['ninja']
if sys.platform in ('linux2', 'darwin')... | bsd-3-clause | Python |
da50e920ecfde15b90fe4380a7c31130112342a7 | fix failing unit test: IG error code reinterpreted as 401 | snarfed/oauth-dropins,snarfed/oauth-dropins,snarfed/oauth-dropins | handlers_test.py | handlers_test.py | """Unit tests for handlers.py.
"""
__author__ = ['Ryan Barrett <oauth-dropins@ryanb.org>']
import StringIO
import urllib2
import json
import apiclient.errors
import httplib2
from oauth2client.client import AccessTokenRefreshError
import requests
from webob import exc
import handlers
from webutil import util
from we... | """Unit tests for handlers.py.
"""
__author__ = ['Ryan Barrett <oauth-dropins@ryanb.org>']
import StringIO
import urllib2
import json
import apiclient.errors
import httplib2
from oauth2client.client import AccessTokenRefreshError
import requests
from webob import exc
import handlers
from webutil import util
from we... | unlicense | Python |
066526af8c7cff956c6a76c64e7f5fcf4ee2ed9b | remove comodel name | luc-demeyer/account-financial-reporting | account_financial_report_qweb/wizard/open_invoice_wizard.py | account_financial_report_qweb/wizard/open_invoice_wizard.py | # -*- coding: utf-8 -*-
# Author: Andrea andrea4ever Gallina
# Author: Francesco OpenCode Apruzzese
# Author: Ciro CiroBoxHub Urselli
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from openerp.exceptions import Warning as ... | # -*- coding: utf-8 -*-
# Author: Andrea andrea4ever Gallina
# Author: Francesco OpenCode Apruzzese
# Author: Ciro CiroBoxHub Urselli
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from openerp.exceptions import Warning as ... | agpl-3.0 | Python |
240ad133b9d80f324ae3613937f04b3c2737128d | bump version | AndrewWalker/glud | glud/version.py | glud/version.py | __version__ = '0.3.4-rc0'
| __version__ = '0.3.3'
| mit | Python |
1f6829d83fcf354e63b4e758a40c199aa466be92 | Change text to be more accurate | GeoSensorWebLab/arctic-biomap-server,GeoSensorWebLab/arctic-biomap-server,GeoSensorWebLab/arctic-biomap-server,johan--/arctic-biomap-server,johan--/arctic-biomap-server,johan--/arctic-biomap-server | backend/server.py | backend/server.py | #!/usr/bin/env python
import time
import os
import sys
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import json
import urllib
import os
import time
import sys
from service.frontend import LoginHandler
from service.frontend import UsersHandler
from service.frontend import Sightings... | #!/usr/bin/env python
import time
import os
import sys
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import json
import urllib
import os
import time
import sys
from service.frontend import LoginHandler
from service.frontend import UsersHandler
from service.frontend import Sightings... | mit | Python |
2d13103ff723e60edcabc2cd3121bc79fd7a4a1f | Check if ltihooks is present before trying to delete it | freedesktop-unofficial-mirror/gstreamer__gst-python,GStreamer/gst-python,lubosz/gst-python,freedesktop-unofficial-mirror/gstreamer__gst-python,pexip/gst-python,freedesktop-unofficial-mirror/gstreamer__gst-python,GStreamer/gst-python,freedesktop-unofficial-mirror/gstreamer-sdk__gst-python,lubosz/gst-python,freedesktop-u... | gst/__init__.py | gst/__init__.py | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# gst-python
# Copyright (C) 2002 David I. Lehn
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, o... | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# gst-python
# Copyright (C) 2002 David I. Lehn
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, o... | lgpl-2.1 | Python |
fdd4b3c4323499e067a794674a5f72e4764ea81f | Add column extraction for html tables to tools | mzunhammer/hracing | hracing/tools.py | hracing/tools.py | def flatten(l, ltypes=(list, tuple)):
""" Flattens nested lists l to yield a 1-d list"""
ltype = type(l)
l = list(l)
i = 0
while i < len(l):
while isinstance(l[i], ltypes):
if not l[i]:
l.pop(i)
i -= 1
break
else:
... | def flatten(l, ltypes=(list, tuple)):
ltype = type(l)
l = list(l)
i = 0
while i < len(l):
while isinstance(l[i], ltypes):
if not l[i]:
l.pop(i)
i -= 1
break
else:
l[i:i + 1] = l[i]
i += 1
return l... | mit | Python |
67e8b41d33360e2fb895e051005e36b95d4187ea | fix inheritance pattern of btax mock classes | OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain | webapp/apps/btax/compute.py | webapp/apps/btax/compute.py | import dropq
import os
from ..taxbrain.models import WorkerNodesCounter
import json
import requests
from requests.exceptions import Timeout, RequestException
from .helpers import arrange_totals_by_row
from ..taxbrain.compute import (DropqCompute,
MockCompute,
... | import dropq
import os
from ..taxbrain.models import WorkerNodesCounter
import json
import requests
from requests.exceptions import Timeout, RequestException
from .helpers import arrange_totals_by_row
from ..taxbrain.compute import (DropqCompute,
MockCompute,
... | mit | Python |
abe1872e51fa2beeb2fa7deee87ceb01753ef854 | Remove UTF-8 comment. | dscorbett/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,pygments/pygments,dscorbett/pygments,pygments/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,pygments/pygments,pygment... | pygments/styles/lilypond.py | pygments/styles/lilypond.py | """
pygments.styles.lilypond
~~~~~~~~~~~~~~~~~~~~~~~~
LilyPond-specific style.
:copyright: Copyright 2021-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Token
class LilypondStyle(Style):
"""
... | # -*- coding: utf-8 -*-
"""
pygments.styles.lilypond
~~~~~~~~~~~~~~~~~~~~~~~~
LilyPond-specific style.
:copyright: Copyright 2021-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Token
class LilypondSt... | bsd-2-clause | Python |
0d10b60f73703bf142ad826c897cf6bf7d58ffc3 | Return from Inbox edit view is now based on HTTP referer | Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen | website/views/inbox/edit.py | website/views/inbox/edit.py | ##
# Copyright (C) 2013-2015 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | ##
# Copyright (C) 2013-2015 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | agpl-3.0 | Python |
d2a6e24cb4703bad0c16bffc00936cc014d516af | bump version | danpoland/pyramid-restful-framework | pyramid_restful/__init__.py | pyramid_restful/__init__.py | from .settings import reload_api_settings
__version__ = '0.13.0'
VERSION = __version__
def includeme(config):
reload_api_settings(config.registry.settings)
| from .settings import reload_api_settings
__version__ = '0.12.0'
VERSION = __version__
def includeme(config):
reload_api_settings(config.registry.settings)
| bsd-2-clause | Python |
7a055e12b809110cdb07a642d12e11d909be1376 | Add convenience properties for discovery config items | leth/nose2,leth/nose2,ptthiem/nose2,little-dude/nose2,little-dude/nose2,ojengwa/nose2,ezigman/nose2,ptthiem/nose2,ezigman/nose2,ojengwa/nose2 | nose2/session.py | nose2/session.py | import argparse
from six.moves import configparser
from nose2 import config, events, util
class Session(object):
"""Configuration session.
Encapsulates all configuration for a given test run.
"""
def __init__(self):
self.argparse = argparse.ArgumentParser(prog='nose2')
self.config =... | import argparse
from six.moves import configparser
from nose2 import config, events, util
class Session(object):
"""Configuration session.
Encapsulates all configuration for a given test run.
"""
def __init__(self):
self.argparse = argparse.ArgumentParser(prog='nose2')
self.config =... | bsd-2-clause | Python |
19f2d58c40d56b6d4a30c1bc12ce24af7db9e992 | Fix names used in dft.old refft->rfft | efiring/numpy-work,teoliphant/numpy-refactor,efiring/numpy-work,illume/numpy3k,chadnetzer/numpy-gaurdro,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,jasonmccampbell/numpy-refactor-sprint,chadnetzer/numpy-gaurdro,chadnetzer/numpy-gaurdro,efiring/numpy-work,Ademan/NumPy-GSoC,illume/numpy3k,Ademan/NumPy-GSoC,i... | numpy/dft/old.py | numpy/dft/old.py |
__all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft', 'inverse_fft2d',
'inverse_fftnd', 'inverse_hermite_fft', 'inverse_real_fft', 'inverse_real_fft2d',
'inverse_real_fftnd', 'real_fft', 'real_fft2d', 'real_fftnd']
from fftpack import fft
from fftpack import fft2 as fft2d
from fftpac... |
__all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft', 'inverse_fft2d',
'inverse_fftnd', 'inverse_hermite_fft', 'inverse_real_fft', 'inverse_real_fft2d',
'inverse_real_fftnd', 'real_fft', 'real_fft2d', 'real_fftnd']
from fftpack import fft
from fftpack import fft2 as fft2d
from fftpac... | bsd-3-clause | Python |
536605ed5200e87bcac9c4544eadd2a4df373cdc | update font | shunliz/test,shunliz/test,shunliz/test,shunliz/test,shunliz/test,shunliz/test,shunliz/test,shunliz/test | python/pygame/game4/font.py | python/pygame/game4/font.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 记住上面这行是必须的,而且保存文件的编码要一致!
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
try:
screen = pygame.display.set_mode((640, 480), 0, 32)
except pygame.error, e:
print "Can't create the display :-("
print e
exit()
#scree... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 记住上面这行是必须的,而且保存文件的编码要一致!
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
font = pygame.font.SysFont("宋体", 40)
#上句在Linux可行,在我的Windows 7 64bit上不行,XP不知道行不行
#font = pygame.font.SysF... | apache-2.0 | Python |
737b84fa3a7789cb263cb58cab9dcb1858995982 | Add Tensor Flow | kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning | python/src/fft/FourierEx.py | python/src/fft/FourierEx.py | import numpy as np
import pylab as plt
from numpy import fft
import src.mylib.mlstm as mlstm
def bandpass_filter(x, freq, frequency_of_signal=0, band=0.1):
if (frequency_of_signal - band) < abs(freq) < (frequency_of_signal + band):
return x
else:
return 0
ds = mlstm.loadFXData('JPY=X', '../db/... | import numpy as np
import pylab as plt
from numpy import fft
import src.mylib.mlstm as mlstm
def bandpass_filter(x, freq, frequency_of_signal=0, band=0.1):
if (frequency_of_signal - band) < abs(freq) < (frequency_of_signal + band):
return x
else:
return 0
ds = mlstm.loadFXData('JPY=X', '../db/... | apache-2.0 | Python |
bd93afc0d0b8af145e302d3ff0ffcf7c5c7fc9b6 | Fix versions | mkukielka/oddt,mkukielka/oddt,oddt/oddt,oddt/oddt | oddt/__init__.py | oddt/__init__.py | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | bsd-3-clause | Python |
dc69135d94907049f0c6278e5f09f382ac8abfb2 | remove instead of pop in insert. | JustusW/BetterOrderedDict,therealfakemoot/collections2 | better_od/core.py | better_od/core.py | from collections import MutableMapping
class BetterOrderedDict(MutableMapping):
def __init__(self, **kwargs):
self._d = dict()
self._keys = []
def __len__(self):
return len(self._d)
def __iter__(self):
for key in self._keys:
yield key
def __setitem__(self... | from collections import MutableMapping
class BetterOrderedDict(MutableMapping):
def __init__(self, **kwargs):
self._d = dict()
self._keys = []
def __len__(self):
return len(self._d)
def __iter__(self):
for key in self._keys:
yield key
def __setitem__(self... | mit | Python |
8d79cdbc0016faf7e94d0b295842a182e11b8df3 | Update killed_and_injured_count_per_age_group_stacked_widget.py | hasadna/anyway,hasadna/anyway,hasadna/anyway,hasadna/anyway | anyway/widgets/suburban_widgets/killed_and_injured_count_per_age_group_stacked_widget.py | anyway/widgets/suburban_widgets/killed_and_injured_count_per_age_group_stacked_widget.py | from typing import Dict, List
from flask_babel import _
from anyway.backend_constants import InjurySeverity, BE_CONST as BE
from anyway.request_params import RequestParams
from anyway.widgets.suburban_widgets.killed_and_injured_count_per_age_group_widget_utils import (
KilledAndInjuredCountPerAgeGroupWidgetUtils,... | from typing import Dict, List
from flask_babel import _
from anyway.backend_constants import InjurySeverity, BE_CONST as BE
from anyway.request_params import RequestParams
from anyway.widgets.suburban_widgets.killed_and_injured_count_per_age_group_widget_utils import (
KilledAndInjuredCountPerAgeGroupWidgetUtils,... | mit | Python |
77cab93fc4ee7d1339a25a22d0b5b99acd3fcbe1 | Fix imports for python 3 | befelix/lyapunov-learning | safe_learning/__init__.py | safe_learning/__init__.py | from __future__ import absolute_import
from .utilities import *
from .safe_learning import *
| from utilities import *
from safe_learning import *
| mit | Python |
b493dd68e85cae43fe45b0d23d863e44c88390a9 | fix date format | ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website | core/functions.py | core/functions.py | import config
import importlib
import textwrap
def path_to_url(path = 'index', parameters = [], hash = ''):
if hash == '':
return "http://%s/%s" % (config.base_url, path)
else:
return "http://%s/%s#%s" % (config.base_url, path, hash)
# Gets URL for static resource
def static_to_url(path):
return path_to... | import config
import importlib
import textwrap
def path_to_url(path = 'index', parameters = [], hash = ''):
if hash == '':
return "http://%s/%s" % (config.base_url, path)
else:
return "http://%s/%s#%s" % (config.base_url, path, hash)
# Gets URL for static resource
def static_to_url(path):
return path_to... | apache-2.0 | Python |
a16fd23027b5d3f1378f5b9f75958d0f3ef2a124 | Bump version number to reflect dev status. | caktus/django-email-bandit,vericant/django-email-bandit,caktus/django-email-bandit | bandit/__init__.py | bandit/__init__.py | """
django-email-bandit is a Django email backend for hijacking email sending in a test environment.
"""
__version_info__ = {
'major': 1,
'minor': 0,
'micro': 0,
'releaselevel': 'dev',
}
def get_version():
"""
Return the formatted version information
"""
vers = ["%(major)i.%(minor)i"... | """
django-email-bandit is a Django email backend for hijacking email sending in a test environment.
"""
__version_info__ = {
'major': 0,
'minor': 2,
'micro': 0,
'releaselevel': 'final',
}
def get_version():
"""
Return the formatted version information
"""
vers = ["%(major)i.%(minor)... | bsd-3-clause | Python |
7dcba1ae4929820dd000bef1571257023a5b0ef0 | Update the stats to include the hostname | gmr/statelessd,gmr/statelessd | statelessd/stats.py | statelessd/stats.py | """
stats
"""
import logging
import resource
import time
from statelessd import base
LOGGER = logging.getLogger(__name__)
class Stats(base.RequestHandler):
"""Gather stats counters from RabbitMQ objects and return as JSON object"""
def initialize(self):
"""Initial the Request Handler making sure t... | """
stats
"""
import logging
import resource
import time
from statelessd import base
LOGGER = logging.getLogger(__name__)
class Stats(base.RequestHandler):
"""Gather stats counters from RabbitMQ objects and return as JSON object"""
def initialize(self):
"""Initial the Request Handler making sure t... | bsd-3-clause | Python |
fbbc75965487d3f1c2d4dbfb2dc6dc482566a636 | fix query mixin order | fkmclane/web.py | web/query.py | web/query.py | import re
import urllib.parse
import web
regex = '(?:\?([\w=&]*))?'
class QueryMixIn:
group = 0
def respond(self):
self.request.query = dict(urllib.parse.parse_qsl(self.groups[self.group], True))
return super().respond()
def new(base, handler):
class GenQueryHandler(QueryMixIn, hand... | import re
import urllib.parse
import web
regex = '\?([\w=&])'
class QueryMixIn:
group = 0
def respond(self):
self.request.query = dict(urllib.parse.parse_qsl(self.groups[self.group], True))
def new(base, handler):
class GenQueryHandler(handler, QueryMixIn):
pass
GenQueryHandler.... | mit | Python |
8daa2343ff164c0fa86dee316c0148c83fd4f2b9 | add explicit vim module import for neovim support | rafaqz/citation.vim | python/citation_vim/citation.py | python/citation_vim/citation.py | # -*- coding: utf-8 -*-
import os.path
import sys
import vim
class Citation(object):
@staticmethod
def connect():
"""
Returns source from builder,
printing any errors from python to the vim console.
"""
try:
set_script_path()
from citation_vim... | # -*- coding: utf-8 -*-
import os.path
import sys
class Citation(object):
@staticmethod
def connect():
"""
Returns source from builder,
printing any errors from python to the vim console.
"""
try:
set_script_path()
from citation_vim.builder im... | mit | Python |
e8db039771cb94987d15af726bfa4212d4f6e9e6 | print headers | hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples,hermantai/samples | python/sqlalchemy/basic/main.py | python/sqlalchemy/basic/main.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import models
def print_out(obj):
print("\n\n", ">>> ", obj, "\n\n", ... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import models
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
def print_out(obj):
print("\n\n", ">>> ", obj, "\n\n", sep="")
if __na... | apache-2.0 | Python |
4f170397acac08c6fd8a4573ead1f66d631ac8dc | Update dsub version to 0.3.2.dev0 | DataBiosphere/dsub,DataBiosphere/dsub | dsub/_dsub_version.py | dsub/_dsub_version.py | # Copyright 2017 Google Inc. 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 applicable law or a... | # Copyright 2017 Google Inc. 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 applicable law or a... | apache-2.0 | Python |
d9b47e8ab8ddc024704f01cc307aa3539ec4e22a | mark links to inexistant wikipages with a css class. | jerem/django-rcsfield | rcs/wiki/templatetags/wikify.py | rcs/wiki/templatetags/wikify.py | # from http://open.e-scribe.com/browser/python/django/apps/protowiki/templatetags/wikitags.py
# copyright Paul Bissex, MIT license
from django.template import Library
from django.conf import settings
from rcs.wiki.models import WikiPage
register = Library()
@register.filter
def wikify(value):
"""Makes WikiWords""... | # from http://open.e-scribe.com/browser/python/django/apps/protowiki/templatetags/wikitags.py
# copyright Paul Bissex, MIT license
from django.template import Library
from django.conf import settings
register = Library()
@register.filter
def wikify(value):
"""Makes WikiWords"""
import re
#wikifier = re.co... | bsd-3-clause | Python |
9bbf179008ef653ea1969a61d034f6392af14ec3 | send heartbeat while waiting result | cenkalti/kuyruk,cenkalti/kuyruk | kuyruk/result.py | kuyruk/result.py | import time
import json
import errno
import socket
import logging
from kuyruk.exceptions import ResultTimeout, RemoteException
logger = logging.getLogger(__name__)
class Result(object):
def __init__(self, channel):
self._channel = channel
def _process_message(self, message):
logger.debug("... | import time
import json
import errno
import socket
import logging
from kuyruk.exceptions import ResultTimeout, RemoteException
logger = logging.getLogger(__name__)
class Result(object):
def __init__(self, channel):
self._channel = channel
def _process_message(self, message):
logger.debug("... | mit | Python |
802667e1b64b68b80b81bee14990a98a10f4696d | Make sure that we generate a valid BSSID, thanks Estefania :) | Panagiotis-Kon/empower-runtime,Panagiotis-Kon/empower-runtime,Panagiotis-Kon/empower-runtime | empower/core/utils.py | empower/core/utils.py | #!/usr/bin/env python3
#
# Copyright (c) 2016 Roberto Riggio, Estefania Coronado
#
# 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 r... | #!/usr/bin/env python3
#
# Copyright (c) 2016 Roberto Riggio
#
# 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 applicabl... | apache-2.0 | Python |
f84e6ca8afad2700f2c38c1ab1f229c01331257b | Fix test_config.py | ahal/active-data-recipes,ahal/active-data-recipes | test/test_config.py | test/test_config.py | import os
from copy import deepcopy
from pathlib import Path
import pytest
from appdirs import user_config_dir
from tomlkit import dumps
from adr.configuration import (
Configuration,
merge_to,
)
here = Path(__file__).parent.resolve()
@pytest.fixture
def create_config(tmpdir):
def inner(data):
... | import os
from copy import deepcopy
from pathlib import Path
import pytest
from appdirs import user_config_dir
from tomlkit import dumps
from adr.configuration import (
Configuration,
merge_to,
)
here = Path(__file__).parent.resolve()
@pytest.fixture
def create_config(tmpdir):
def inner(data):
... | mpl-2.0 | Python |
b2c67e3733dacaaf2150913b8f3809c7f25814cf | Add function for file overwrite prompt | vividvilla/csvtotable | csvtotable/cli.py | csvtotable/cli.py | import os
import click
from csvtotable import convert
# Prompt for file overwrite
def prompt_overwrite(file_name):
# Skip if file doesn't exist
if not os.path.exists(file_name):
return
# Prompt for file overwrite if outfile already exists
fmt = "File ({}) already exists. Do you want to overw... | import os
import click
from csvtotable import convert
@click.command()
@click.argument("input_file", type=click.Path(exists=True))
@click.argument("output_file", type=click.Path())
@click.option("-c", "--caption", type=str, help="Table caption")
@click.option("-d", "--delimiter", type=str, default=",", help="CSV del... | mit | Python |
75a4d0ccff1af1aefa30efbb6fddc76f8e9db2fb | Add a quick interpolator. | ezekial4/atomic_neu,ezekial4/atomic_neu | xxdata_11.py | xxdata_11.py | import os
import _xxdata_11
parameters = {
'isdimd' : 200,
'iddimd' : 40,
'itdimd' : 50,
'ndptnl' : 4,
'ndptn' : 128,
'ndptnc' : 256,
'ndcnct' : 100
}
def read_scd(filename):
fd = open(filename, 'r')
fortran_filename = 'fort.%d' % fd.fileno()
os.symlink(filename, fortran_filen... | import os
import _xxdata_11
parameters = {
'isdimd' : 200,
'iddimd' : 40,
'itdimd' : 50,
'ndptnl' : 4,
'ndptn' : 128,
'ndptnc' : 256,
'ndcnct' : 100
}
def read_scd(filename):
fd = open(filename, 'r')
fortran_filename = 'fort.%d' % fd.fileno()
os.symlink(filename, fortran_filen... | mit | Python |
44faee89580ab301e82d6fc5dea290da8fc63741 | Use regex based search for links. | punchagan/parktain,punchagan/parktain,punchagan/parktain | parktain/main.py | parktain/main.py | #!/usr/bin/env python
# Standard library
from datetime import datetime
from os.path import abspath, dirname, join
import re
# 3rd party library
from gendo import Gendo
from sqlalchemy.orm import sessionmaker
# Local library
from parktain.models import Base, engine, Message
Session = sessionmaker(bind=engine)
sessio... | #!/usr/bin/env python
# Standard library
from datetime import datetime
from os.path import abspath, dirname, join
import re
from urllib.parse import urlparse
# 3rd party library
from gendo import Gendo
from sqlalchemy.orm import sessionmaker
# Local library
from parktain.models import Base, engine, Message
Session ... | bsd-3-clause | Python |
2654bab5f8e57224395ddfaa1b0917dd98d0ad10 | Apply isort | thombashi/pathvalidate | test/test_symbol.py | test/test_symbol.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import, unicode_literals
import itertools
import pytest
from pathvalidate import (
InvalidCharError, ascii_symbol_list, replace_symbol, unprintable_ascii_char_list,
validate_symbol)
fro... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import, unicode_literals
import itertools
import pytest
from pathvalidate import (
InvalidCharError, replace_symbol, unprintable_ascii_char_list, ascii_symbol_list, validate_symbol)
from ._... | mit | Python |
21edc71daaa7f681988528f797437210fff58a3a | set DRUID_IS_ACTIVE = False | dennisobrien/caravel-mysql-docker-example,dennisobrien/caravel-mysql-docker-example | caravel_config.py | caravel_config.py | """Minimal config to set SQLALCHEMY_DATABASE_URI from an environment variable.
"""
import logging
import os
# The SQLAlchemy connection string.
if os.environ.get('SQLALCHEMY_DATABASE_URI', None):
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
else:
logging.getLogger().warn('Falling back t... | """Minimal config to set SQLALCHEMY_DATABASE_URI from an environment variable.
"""
import logging
import os
# The SQLAlchemy connection string.
if os.environ.get('SQLALCHEMY_DATABASE_URI', None):
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
else:
logging.getLogger().warn('Falling back t... | mit | Python |
136b9777b49be0e70f0e3c82662595285421a306 | add mktoken command to generate tokens for users | rjw57/cubbie | cubbie/manager.py | cubbie/manager.py | """
Command-line manager utility for cubbie.
"""
import logging
from flask import current_app
from flask.ext.migrate import MigrateCommand, Migrate
from flask.ext.script import Manager, Command
from mixer.backend.flask import mixer
from cubbie.webapp import create_app
from cubbie.model import db
from cubbie.model im... | """
Command-line manager utility for cubbie.
"""
import logging
from flask import current_app
from flask.ext.migrate import MigrateCommand, Migrate
from flask.ext.script import Manager, Command
from mixer.backend.flask import mixer
from cubbie.webapp import create_app
from cubbie.model import db
from cubbie.model im... | mit | Python |
f13b891a539546dfa810119b2da8738e6e0d6aaa | Update tests | evansloan082/sports.py | tests/score_test.py | tests/score_test.py | import json
import unittest
import sports_py
from sports_py.models import Match
class TestScores(unittest.TestCase):
match_data = {
'league': 'NHL',
'home_team': 'Pittsburgh Penguins',
'away_team': 'Nashville Predators',
'match_score': '2-0',
'match_date': 'Sat, 19 Aug 201... | import json
import unittest
import sports_py
from sports_py.models import Match
class TestScores(unittest.TestCase):
match_data = {
'league': 'NHL',
'home_team': 'Pittsburgh Penguins',
'away_team': 'Nashville Predators',
'match_score': '2-0',
'match_date': 'Sat, 19 Aug 201... | mit | Python |
64d75f6eabd526d7dc47c5f3c980831ab59a604e | Expand test suite | zenhack/python-gtkclassbuilder | tests/test_build.py | tests/test_build.py | from gtkclassbuilder import from_string
from gi.repository import Gtk
input = """<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<child>
... | from gtkclassbuilder import from_string
from gi.repository import Gtk
input = """<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<child>
... | lgpl-2.1 | Python |
33e8538e1dad39be1f8bff3a1340f0ecb32f0648 | Add a test case for copying EXIF data | kontza/sigal,kontza/sigal,cbosdo/sigal,jdn06/sigal,t-animal/sigal,franek/sigal,kontza/sigal,xouillet/sigal,Ferada/sigal,cbosdo/sigal,saimn/sigal,jdn06/sigal,jasuarez/sigal,elaOnMars/sigal,saimn/sigal,xouillet/sigal,jasuarez/sigal,jasuarez/sigal,cbosdo/sigal,elaOnMars/sigal,t-animal/sigal,xouillet/sigal,jdn06/sigal,Fera... | tests/test_image.py | tests/test_image.py | # -*- coding:utf-8 -*-
import os
import pytest
from PIL import Image
from sigal import init_logging
from sigal.image import generate_image, generate_thumbnail, get_exif_tags
CURRENT_DIR = os.path.dirname(__file__)
TEST_IMAGE = 'exo20101028-b-full.jpg'
SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2',... | # -*- coding:utf-8 -*-
import os
import pytest
from PIL import Image
from sigal import init_logging
from sigal.image import generate_image, generate_thumbnail
CURRENT_DIR = os.path.dirname(__file__)
TEST_IMAGE = 'exo20101028-b-full.jpg'
SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', TEST_IMAGE)
... | mit | Python |
c71d578400fcd943db8115b9ef4eeef93adfaaa6 | Add more plotting tests | TheBB/badger | tests/test_plots.py | tests/test_plots.py | import csv
from pathlib import Path
import numpy as np
from badger import Case
DATADIR = Path(__file__).parent / 'data'
def read_csv(path: Path):
with open(path, 'r', newline='') as f:
reader = csv.reader(f)
headers = next(reader)
data = np.array([list(map(float, row)) for row in reade... | import csv
from pathlib import Path
import numpy as np
from badger import Case
DATADIR = Path(__file__).parent / 'data'
def read_csv(path: Path):
with open(path, 'r', newline='') as f:
reader = csv.reader(f)
headers = next(reader)
data = np.array([list(map(float, row)) for row in reade... | agpl-3.0 | Python |
5d32f809685b34b296d98c9a218019f341ce3eab | Add scene classification test | TUT-ARG/sed_eval | tests/test_scene.py | tests/test_scene.py | '''
Unit tests for scene classification
'''
import numpy
import nose.tools
import sed_eval
def test_direct_use():
reference = sed_eval.util.SceneList([
{
'scene_label': 'supermarket',
'file': 'supermarket09.wav'
},
{
'scene_label': 'tubestation',
... | '''
Unit tests for scene classification
'''
import numpy
import nose.tools
import sed_eval
| mit | Python |
29234853c58eee19455a0a2e69cb7afdf0432bcc | improve test_utils.py | aioworkers/aioworkers | tests/test_utils.py | tests/test_utils.py | import os
from unittest import mock
from aioworkers import utils
def test_urandom_seed():
utils.random_seed()
def test_random_seed():
def not_implemented_urandom(*args):
raise NotImplementedError
with mock.patch.object(os, "urandom", not_implemented_urandom):
utils.random_seed()
| from aioworkers import utils
def test_random_seed():
utils.random_seed()
| apache-2.0 | Python |
0fc647adfd60d1f926f1e12d3c18cc238564392b | bump version 0.0.9 >> 0.1.1 | abe-winter/pg13-py | pg13/__init__.py | pg13/__init__.py | import misc,diff,pg,syncschema
# don't import pgmock and stubredis -- they're only useful for test mode or nonstandard env (i.e. stubredis on windows)
# don't import redismodel by default -- it has an extra msgpack dependency
__version__ = '0.1.1'
| import misc,diff,pg,syncschema
# don't import pgmock and stubredis -- they're only useful for test mode or nonstandard env (i.e. stubredis on windows)
# don't import redismodel by default -- it has an extra msgpack dependency
__version__ = '0.0.9'
| mit | Python |
1ebd836c890bc55013f16ccd1443e6c6daab6b65 | create frist version and set number to 0.0.1 | byteweaver/django-tickets,Christophe31/django-tickets,byteweaver/django-tickets,Christophe31/django-tickets | tickets/__init__.py | tickets/__init__.py | __version__ = '0.0.1'
| __version__ = '0.0.0'
| bsd-3-clause | Python |
d746f7dae64bb75420d39b9e54b4df53b2f91cdd | Update script.py | TingPing/plugins,TingPing/plugins | HexChat/script.py | HexChat/script.py | import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: Valid commands are:\n \
INSTALL scr... | import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: Valid commands are:\n \
INSTALL scr... | mit | Python |
138c963d55bda492a523411fe24aa076f2910b37 | Update AFRL_demo.py | dm6718/RITSAR | examples/AFRL_demo.py | examples/AFRL_demo.py | ##############################################################################
# #
# This is a demonstration of the ritsar toolset using AFRL Gotcha data. #
# Algorithms can be switched in and out by commenting/uncommenting #
# t... | ##############################################################################
# #
# This is a demonstration of the ritsar toolset using AFRL Gotcha data. #
# Algorithms can be switched in and out by commenting/uncommenting #
# t... | mit | Python |
99e97a2e658591401e95898fb32b13a12503190e | fix test conflict with webservice in enterprise | frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe,frePPLe/frePPLe | contrib/django/freppledb/execute/tests/test_importexportfolder.py | contrib/django/freppledb/execute/tests/test_importexportfolder.py | #
# Copyright (C) 2007-2016 by frePPLe bvba
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This library is... | #
# Copyright (C) 2007-2016 by frePPLe bvba
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This library is... | agpl-3.0 | Python |
d3ff4084fcc8492398e87e2c7d5bb99132a133db | Add the tools/console (execute launch.py to run it) | v-legoff/pa-poc1 | launch.py | launch.py | # Copyright (c) 2012 LE GOFF Vincent
# 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 notice, this
# list of conditions and ... | # Copyright (c) 2012 LE GOFF Vincent
# 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 notice, this
# list of conditions and ... | bsd-3-clause | Python |
522084f5de4246b3b98293e9fa7320419a88d3a0 | Add --stdin-filename option support (fixes #40) | roadhump/SublimeLinter-eslint,joeybaker/SublimeLinter-textlint,AndBicScadMedia/SublimeLinter-eslint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2014 roadhump
#
# License: MIT
#
"""This module exports the ESLint plugin class."""
from SublimeLinter.lint import NodeLinter
class ESLint(NodeLinter):
"""Provides an interface to the... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2014 roadhump
#
# License: MIT
#
"""This module exports the ESLint plugin class."""
from SublimeLinter.lint import NodeLinter
class ESLint(NodeLinter):
"""Provides an interface to the... | mit | Python |
f5f77eedda3dc68c686796257bb53ddde82c6a78 | fix version parsing | maxgalbu/SublimeLinter-contrib-twiglint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by m.galbusera
# Copyright (c) 2014 m.galbusera
#
# License: MIT
#
"""This module exports the Twiglint plugin class."""
from SublimeLinter.lint import Linter
class Twiglint(Linter):
"""Provides an interface to t... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by m.galbusera
# Copyright (c) 2014 m.galbusera
#
# License: MIT
#
"""This module exports the Twiglint plugin class."""
from SublimeLinter.lint import Linter
class Twiglint(Linter):
"""Provides an interface to t... | mit | Python |
daff8c9c95cdd2f1f85162a1c1608a4da78b834d | use self.settings not self.get_view_settings | SublimeLinter/SublimeLinter-json | linter.py | linter.py | import json
import os.path
import re
import sublime
from SublimeLinter.lint import Linter
class JSON(Linter):
cmd = None
loose_regex = re.compile(r'^.+: (?P<message>.+) in \(data\):(?P<line>\d+):(?P<col>\d+)')
strict_regex = re.compile(r'^(?P<message>.+):\s*line (?P<line>\d+) column (?P<col>\d+)')
re... | import json
import os.path
import re
import sublime
from SublimeLinter.lint import Linter
class JSON(Linter):
cmd = None
loose_regex = re.compile(r'^.+: (?P<message>.+) in \(data\):(?P<line>\d+):(?P<col>\d+)')
strict_regex = re.compile(r'^(?P<message>.+):\s*line (?P<line>\d+) column (?P<col>\d+)')
re... | mit | Python |
cfab5f78fba799d62fb6952bcca1984b2175df37 | Remove commented out version attributes and redundant auxdir arg | jawshooah/SublimeLinter-contrib-scalastyle | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Josh Hagins
# Copyright (c) 2014 Josh Hagins
#
# License: MIT
#
"""This module exports the Scalastyle plugin class."""
from os import path
from SublimeLinter.lint import Linter, util
class Scalastyle(Linter):
... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Josh Hagins
# Copyright (c) 2014 Josh Hagins
#
# License: MIT
#
"""This module exports the Scalastyle plugin class."""
from os import path
from SublimeLinter.lint import Linter, util
class Scalastyle(Linter):
... | mit | Python |
fa98d97bca529d80dd6b5f29502a5618280a0a87 | Remove unused import | ReactiveX/RxPY,ReactiveX/RxPY | rx/concurrency/scheduleditem.py | rx/concurrency/scheduleditem.py | from typing import Any
from rx.core import Scheduler, typing
from rx.disposables import SingleAssignmentDisposable
def default_sub_comparer(x, y):
return 0 if x == y else 1 if x > y else -1
class ScheduledItem:
def __init__(self, scheduler: Scheduler, state: Any, action: typing.ScheduledAction, duetime: ty... | from typing import Any
from datetime import datetime
from rx.core import Scheduler, typing
from rx.disposables import SingleAssignmentDisposable
def default_sub_comparer(x, y):
return 0 if x == y else 1 if x > y else -1
class ScheduledItem:
def __init__(self, scheduler: Scheduler, state: Any, action: typin... | mit | Python |
8b612e6801eb43a19b50dbdc82437a90d0872132 | prepend _ to objects not for the user | jwkvam/plotlywrapper | plotlywrapper.py | plotlywrapper.py | from tempfile import NamedTemporaryFile
import plotly.offline as py
import plotly.graph_objs as go
from IPython import get_ipython
from ipykernel import zmqshell
def _detect_notebook():
"""
this isn't 100% correct but seems good enough
"""
kernel = get_ipython()
return isinstance(kernel, zmqshel... | from tempfile import NamedTemporaryFile
import plotly.offline as py
import plotly.graph_objs as go
from IPython import get_ipython
from ipykernel import zmqshell
def detect_notebook():
"""
this isn't 100% correct but seems good enough
"""
kernel = get_ipython()
return isinstance(kernel, zmqshell... | mit | Python |
06a8f5221e1b352151af576612dd0b52a5f7b7b7 | Make loader bypass missing data groups, add control blocks to set class parameters | soccermetrics/marcotti | loader.py | loader.py | from etl import get_local_handles, ingest_feeds
from etl.ecsv import CSV_ETL_CLASSES
from local import LocalConfig
from interface import Marcotti
if __name__ == "__main__":
settings = LocalConfig()
marcotti = Marcotti(settings)
with marcotti.create_session() as sess:
for group in ['Supplier', 'Ove... | from etl import get_local_handles, ingest_feeds
from etl.ecsv import CSV_ETL_CLASSES
from local import LocalConfig
from interface import Marcotti
if __name__ == "__main__":
settings = LocalConfig()
marcotti = Marcotti(settings)
with marcotti.create_session() as sess:
for group in ['Overview', 'Per... | mit | Python |
14cc5e93b347813f57cd0dfb99b735a384649bfa | remove facebook rss hack | rascul/botwot | plugins/feeds.py | plugins/feeds.py | """ feed Plugin (botwot plugins.feeds) """
# Copyright 2014 Ray Schulz <https://rascul.io>
#
# 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
#
# ... | """ feed Plugin (botwot plugins.feeds) """
# Copyright 2014 Ray Schulz <https://rascul.io>
#
# 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
#
# ... | apache-2.0 | Python |
4f6ed556cbbffd85c4698b30a3ae38ddf6849563 | change logger variablenames | enricoba/eems-box,enricoba/eems-box | logger.py | logger.py | from messagebus import Bus
import logging
# Message to Log:
# level: DEBUG, INFO, WARNING, ERROR, CRITICAL
# source: str() z.B. Display-Job, GSM-Job, Core-Job, ...
# msg: str()
# Define Functions for Logger
class Logger(object):
def __init__(self):
# Define Logger
log_format = '[*] %(asctime)s %(... | from messagebus import Bus
import logging
# VARIABLES
# STR
# con_str_01: log format
# con_str_02: log date format
# con_str_03: log file
# DICT
# con_dic_01: Log-level information
# Message to Log:
# level: DEBUG, INFO, WARNING, ERROR, CRITICAL
# source: str() z.B. Display-Job, GSM-Job, Core-Job, ...
# msg: str()
... | mit | Python |
81f9f1b6f1d8790d71b2d17ffc9d03ab3285781d | Fix json() from json | rcoh/modata,rcoh/modata,rcoh/modata,rcoh/modata | client/restlib.py | client/restlib.py | import requests
import hashlib
SERVER = "http://localhost:1234/"
def store(chunk, digest):
return requests.post(SERVER + "store", data={'key': digest, 'data': chunk}).json()
def store_auto(chunk):
return store(chunk, digest_for_chunk(chunk))
def findvalue(digest):
resp = requests.get(SERVER + "find-value... | import requests
import hashlib
SERVER = "http://localhost:1234/"
def store(chunk, digest):
return requests.post(SERVER + "store", data={'key': digest, 'data': chunk}).json
def store_auto(chunk):
return store(chunk, digest_for_chunk(chunk))
def findvalue(digest):
resp = requests.get(SERVER + "find-value/"... | mit | Python |
bf81ddba9e9516c08fa9c6b259013d17b9039ec2 | Call commands more explicitly | tobymccann/flask-base,hack4impact/asylum-connect-catalog,AsylumConnect/asylum-connect-catalog,hack4impact/asylum-connect-catalog,ColinHaley/Konsole,AsylumConnect/asylum-connect-catalog,hack4impact/asylum-connect-catalog,hack4impact/asylum-connect-catalog,AsylumConnect/asylum-connect-catalog,tobymccann/flask-base,ColinH... | manage.py | manage.py | #!/usr/bin/env python
import os
import subprocess
from app import create_app, db
from app.models import Role, User
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager, Shell
from redis import Redis
from rq import Connection, Queue, Worker
if os.path.exists('.env'):
print('Im... | #!/usr/bin/env python
import os
import subprocess
from app import create_app, db
from app.models import Role, User
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager, Shell
from redis import Redis
from rq import Connection, Queue, Worker
if os.path.exists('.env'):
print('Im... | mit | Python |
6c56a22dc353dcf09d2f6f87f8220a0c20921688 | allow all | if1live/importd-boilerplate,if1live/importd-boilerplate | manage.py | manage.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from importd import d
import os
import sys
def get_sentry_apps():
if 'SENTRY_DSN' in os.environ:
return ('raven.contrib.django.raven_compat',)
else:
return ()
if 'gunicorn' in sys.argv[0]:
DEBUG = False
else:
DEBUG = True
d(
DEBUG=DEBUG... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from importd import d
import os
import sys
def get_sentry_apps():
if 'SENTRY_DSN' in os.environ:
return ('raven.contrib.django.raven_compat',)
else:
return ()
if 'gunicorn' in sys.argv[0]:
DEBUG = False
else:
DEBUG = True
d(
DEBUG=DEBUG... | mit | Python |
9922f630a22df312ef4cacc80a998d2d71feebfb | Use python 3.6 new choices weights feature | tortxof/flask-password,tortxof/flask-password,tortxof/flask-password | markov.py | markov.py | import string
from collections import defaultdict
import random
def pairwise(iterable):
"""
Yield pairs of consecutive elements in iterable.
>>> list(pairwise('abcd'))
[('a', 'b'), ('b', 'c'), ('c', 'd')]
"""
iterator = iter(iterable)
try:
a = iterator.__next__()
except StopIte... | import string
from collections import defaultdict
import random
import itertools
import bisect
def pairwise(iterable):
"""
Yield pairs of consecutive elements in iterable.
>>> list(pairwise('abcd'))
[('a', 'b'), ('b', 'c'), ('c', 'd')]
"""
iterator = iter(iterable)
try:
a = iterato... | mit | Python |
a1294571b049bf0e81e997816ad038e4fb56aa40 | Allow specifying multiple times | kulawczukmarcin/mypox,adusia/pox,chenyuntc/pox,adusia/pox,jacobq/csci5221-viro-project,noxrepo/pox,carlye566/IoT-POX,denovogroup/pox,xAKLx/pox,pthien92/sdn,chenyuntc/pox,PrincetonUniversity/pox,noxrepo/pox,diogommartins/pox,chenyuntc/pox,PrincetonUniversity/pox,diogommartins/pox,adusia/pox,denovogroup/pox,xAKLx/pox,kul... | pox/log/level.py | pox/log/level.py | # Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distri... | # Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distri... | apache-2.0 | Python |
d05fdde673551c054c776bfc2d51fe0bc28ceda7 | refactor class to MetPyMapFeature | jrleeman/MetPy,ShawnMurd/MetPy,dopplershift/MetPy,Unidata/MetPy,jrleeman/MetPy,dopplershift/MetPy,ahaberlie/MetPy,Unidata/MetPy,ahaberlie/MetPy | metpy/plots/cartopy_utils.py | metpy/plots/cartopy_utils.py | # Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Cartopy specific mapping utilities."""
import cartopy.feature as cfeat
import cartopy.io.shapereader as shpreader
from ..cbook import get_test_data
class MetPyMapFeature(cfeat... | # Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Cartopy specific mapping utilities."""
import cartopy.feature as cfeat
import cartopy.io.shapereader as shpreader
from ..cbook import get_test_data
class USCountiesFeature(cfe... | bsd-3-clause | Python |
f428fe4bd0eaabd47f7e97724eb9e28702249c30 | Add settings | indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins | payment_manual/indico_payment_manual/plugin.py | payment_manual/indico_payment_manual/plugin.py | # This file is part of Indico.
# Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python |
4deaf02bd3e8e0d617559ad8035350f735866788 | Fix url | colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager | lib/aur/query.py | lib/aur/query.py | from urllib.request import urlopen
from contextlib import closing
import json
AUR_URL = 'https://aur.archlinux.org'
BASE_URL = AUR_URL + '/rpc/?v=5&'
INFO_URL = BASE_URL + 'type=info&'
class PackageNotFoundError(Exception):
pass
class AttrDict(dict):
"""
http://stackoverflow.com/questions/4984647/acces... | from urllib.request import urlopen
from contextlib import closing
import json
AUR_URL = 'https://aur.archlinux.org'
BASE_URL = AUR_URL + '/rpc/?v=5&'
INFO_URL = BASE_URL + 'type=info&'
class PackageNotFoundError(Exception):
pass
class AttrDict(dict):
"""
http://stackoverflow.com/questions/4984647/acces... | mit | Python |
52f2f2ec04bb99b83f02e5172ccd7a1180af9260 | Fix animated images test | missionpinball/mpf-mc,missionpinball/mpf-mc,missionpinball/mpf-mc | mpfmc/tests/test_AnimatedImages.py | mpfmc/tests/test_AnimatedImages.py | from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
class TestAnimatedImages(MpfMcTestCase):
def get_machine_path(self):
return 'tests/machine_files/animated_images'
def get_config_file(self):
return 'test_animated_images.yaml'
def test_animated_images_loading(self):
self.assert... | from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
class TestAnimatedImages(MpfMcTestCase):
def get_machine_path(self):
return 'tests/machine_files/animated_images'
def get_config_file(self):
return 'test_animated_images.yaml'
def test_animated_images_loading(self):
self.assert... | mit | Python |
f849acc0012ef08248a27f41af77bc57831b2829 | Fix invocation. | aequitas/python-rflink | rflink/__main__.py | rflink/__main__.py | """Command line interface for rflink library.
Usage:
rflink [-v] [--port=<port> [--baud=<baud>] | --host=<host> --port=<port>]
rflink (-h | --help)
rflink --version
Options:
-p --port=<port> Serial port to connect to [default: /dev/ttyACM0],
or TCP port in TCP mode.
--baud=<baud> ... | """Command line interface for rflink library.
Usage:
rflink [-v] [--port=<port> [--baud=<baud>] | --host=<host> --port=<port>]
rflink (-h | --help)
rflink --version
Options:
-p --port=<port> Serial port to connect to [default: /dev/ttyACM0],
or TCP port in TCP mode.
--baud=<baud> ... | mit | Python |
b1abe85e5c6a1ca78033d79e4729dc004bcfd8fd | reduce disk reqs of example task config | somic/paasta,Yelp/paasta,Yelp/paasta,somic/paasta | task_processing/executors/task_executor.py | task_processing/executors/task_executor.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
from collections import namedtuple
import six
TaskConfig = namedtuple(
'TaskConfig',
['image', 'cmd', 'cpus', 'mem', 'disk', 'volumes', 'ports', 'cap_add',
'ulimit', 'docker_parameters'],
)
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
from collections import namedtuple
import six
TaskConfig = namedtuple(
'TaskConfig',
['image', 'cmd', 'cpus', 'mem', 'disk', 'volumes', 'ports', 'cap_add',
'ulimit', 'docker_parameters'],
)
... | apache-2.0 | Python |
bbd37f93fe679f9df8b47fe04384ee68d943a89f | Remove unneeded bits from the recommonmark tests' Sphinx config. | erikrose/sphinx-js,erikrose/sphinx-js,erikrose/sphinx-js | tests/test_common_mark/source/docs/conf.py | tests/test_common_mark/source/docs/conf.py | from recommonmark.transform import AutoStructify
from recommonmark.parser import CommonMarkParser
extensions = [
'sphinx.ext.mathjax',
'sphinx_js'
]
source_suffix = ['.rst', '.md']
master_doc = 'index'
author = 'Jam Risser'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
source_parsers = {
'.md':... | #!/usr/bin/env python3
from recommonmark.transform import AutoStructify
from recommonmark.parser import CommonMarkParser
author = 'Jam Risser'
copyright = '2018, Jam Risser'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
extensions = [
'sphinx.ext.mathjax',
'sphinx_js'
]
html_static_path = ['_sta... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.