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 |
|---|---|---|---|---|---|---|---|---|
54321236d248a9dcbbdee81f061a87ffbaff1800 | add fontSize option | fritx/img2txt,hit9/img2txt,hit9/img2txt | img2txt.py | img2txt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: img2txt.py <imgfile> [--maxLen=<maxLen>] [--fontSize=<fontSize>] [--color]
"""
from docopt import docopt
dct = docopt(__doc__)
imgname = dct['<imgfile>']
maxLen = dct['--maxLen']
clr = dct['--color']
fontSize = dct['--fontSize']
try:
maxLen = float(ma... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: img2txt.py <imgfile> [--maxLen=<maxLen>] [--color]
"""
from docopt import docopt
dct = docopt(__doc__)
imgname = dct['<imgfile>']
maxLen = dct['--maxLen']
clr = dct['--color']
try:
maxLen = float(maxLen)
except:
maxLen = 100.0 # default maxlen: 1... | bsd-3-clause | Python |
7c796d52b222fcbfa101350776adfa8db89d2837 | Add get_dirs_in_path utility function. | StackStorm/st2,lakshmi-kannan/st2,pixelrebel/st2,dennybaa/st2,armab/st2,Itxaka/st2,alfasin/st2,lakshmi-kannan/st2,grengojbo/st2,pinterb/st2,StackStorm/st2,nzlosh/st2,peak6/st2,dennybaa/st2,nzlosh/st2,emedvedev/st2,tonybaloney/st2,lakshmi-kannan/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,punalpatel/st2,pixelrebel/st2,alfa... | st2debug/st2debug/utils/fs.py | st2debug/st2debug/utils/fs.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
441f64601e7a8431fdac48f32cb1990d0e5ac7d6 | add dictionaries support in configuration files | gbour/Mother,gbour/Mother | lib/mother/config.py | lib/mother/config.py | # -*- coding: utf8 -*-
__version__ = "$Revision$ $Date$"
__author__ = "Guillaume Bour <guillaume@bour.cc>"
__license__ = """
Copyright (C) 2010-2011, Guillaume Bour <guillaume@bour.cc>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License a... | # -*- coding: utf8 -*-
__version__ = "$Revision$ $Date$"
__author__ = "Guillaume Bour <guillaume@bour.cc>"
__license__ = """
Copyright (C) 2010-2011, Guillaume Bour <guillaume@bour.cc>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License a... | agpl-3.0 | Python |
ad0e438d757717ea4a758e7c66cef389e1b450fb | fix the test failure for image searcher dataloader. | tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples,tensorflow/examples | tensorflow_examples/lite/model_maker/core/data_util/image_searcher_dataloader_test.py | tensorflow_examples/lite/model_maker/core/data_util/image_searcher_dataloader_test.py | # Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
f76783ddb616c74e22feb003cb12952375cad658 | Fix for json encoding Decimal values | SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare... | corehq/apps/hqwebapp/encoders.py | corehq/apps/hqwebapp/encoders.py | import json
import datetime
from decimal import Decimal
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class DecimalEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, Decimal):
return str(obj)
return super(DecimalEncoder, ... | import json
import datetime
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class LazyEncoder(json.JSONEncoder):
"""Taken from https://github.com/tomchristie/django-rest-framework/issues/87
This makes sure that ugettext_lazy refrences in a dict are properly evaluate... | bsd-3-clause | Python |
2970a4435c59b51d44c4bc7322ad83a195dbd6fd | Update botdoc.py | jhonnyam123/hangoutsbot | hangupsbot/plugins/botdoc.py | hangupsbot/plugins/botdoc.py | import asyncio, re, logging, json, random
import hangups
import plugins
logger = logging.getLogger(__name__)
def _initialise(bot):
plugins.register_user_command(["botdoc"])
plugins.register_admin_command(["setbotdoc"])
@asyncio.coroutine
def botdoc(bot, event, *args):
"""Shows the bot related documentati... | import asyncio, re, logging, json, random
import hangups
import plugins
logger = logging.getLogger(__name__)
def _initialise(bot):
plugins.register_user_command(["botdoc"])
plugins.register_admin_command(["setbotdoc"])
@asyncio.coroutine
def botdoc(bot, event, *args):
"""Shows the bot related documentati... | agpl-3.0 | Python |
040dab6c8c684366c34a29168520f8fb3bd3c4e0 | Use Truncator to truncate the reaction text in __unicode__(). | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | apps/reactions/models.py | apps/reactions/models.py | from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django... | from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.conf import settings
from django_exten... | bsd-3-clause | Python |
a4085325f9af4f552484f6b4790f51e734d73dde | modify migration script | ResEnv/chain-api,ResEnv/chain-api,ResEnv/chain-api,ResEnv/chain-api | postgres_to_influx.py | postgres_to_influx.py | from chain.core.models import ScalarData
from django.utils import timezone
from datetime import timedelta, datetime
from chain.influx_client import InfluxClient, HTTP_STATUS_SUCCESSFUL_WRITE
from chain.core.resources import influx_client
import sys
# needs to be run from the manage.py shell context
def get_points(off... | from chain.core.models import ScalarData
from django.utils import timezone
from datetime import timedelta, datetime
from chain.influx_client import InfluxClient, HTTP_STATUS_SUCCESSFUL_WRITE
from chain.core.resources import influx_client
import sys
# needs to be run from the manage.py shell context
# start_time is UT... | mit | Python |
5564b86a226a0ec4f9a1b819929f49f830279f2a | Improve example tests | igordejanovic/parglare,igordejanovic/parglare | tests/func/test_examples.py | tests/func/test_examples.py | import pytest # noqa
import os
import sys
import glob
import importlib
from itertools import chain
skip_examples = [
'molecular_formulas',
'custom_table_caching',
'c/'
]
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
examples... | import pytest # noqa
import os
import sys
import glob
import importlib
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... | mit | Python |
02021bef513e062a26a8bbc8b81d0eccf54e9ae6 | Decrease test precision for keras_lstm_static_test. | google/iree,google/iree,iree-org/iree,iree-org/iree,iree-org/iree,google/iree,google/iree,google/iree,iree-org/iree,google/iree,iree-org/iree,google/iree,iree-org/iree,iree-org/iree | integrations/tensorflow/e2e/keras/keras_lstm_static_test.py | integrations/tensorflow/e2e/keras/keras_lstm_static_test.py | # Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
77bfbf148e43f95c45f051ed5fa5fd438961d56e | make consistent with the other show commands | stdweird/aquilon,stdweird/aquilon,guillaume-philippon/aquilon,stdweird/aquilon,guillaume-philippon/aquilon,quattor/aquilon,quattor/aquilon,quattor/aquilon,guillaume-philippon/aquilon | lib/python2.5/aquilon/server/commands/show_machine.py | lib/python2.5/aquilon/server/commands/show_machine.py | #!/ms/dist/python/PROJ/core/2.5.0/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Contains the logic for `aq show machine`."""
from aquilon.server.broker import (add_transaction, az_... | #!/ms/dist/python/PROJ/core/2.5.0/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# $Header$
# $Change$
# $DateTime$
# $Author$
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Contains the logic for `aq show machine`."""
from aqui... | apache-2.0 | Python |
1faf7266b7dc193c8f0a4cdda6290b5905844ef3 | prepare for next dev version (1.9.4) | arcivanov/unittest-xml-reporting,NightBlues/unittest-xml-reporting,haiyangd/unittest-xml-reporting,tkanemoto/unittest-xml-reporting | src/xmlrunner/version.py | src/xmlrunner/version.py |
__version__ = '1.9.4'
|
__version__ = '1.9.3'
| bsd-2-clause | Python |
991973e554758e7a9881453d7668925902e610b9 | Make unittest test runner work in older pythons | glenjamin/git-mnemonic | tests.py | tests.py | #!/usr/bin/env python
import unittest
import git_mnemonic as gm
class GitMnemonicTests(unittest.TestCase):
def test_encode(self):
self.assertTrue(gm.encode("master"))
def test_decode(self):
self.assertTrue(gm.decode("bis alo ama aha"))
def test_invertible(self):
once = gm.encode... | #!/usr/bin/env python
import unittest
import git_mnemonic as gm
class GitMnemonicTests(unittest.TestCase):
def test_encode(self):
self.assertTrue(gm.encode("master"))
def test_decode(self):
self.assertTrue(gm.decode("bis alo ama aha"))
def test_invertible(self):
once = gm.encode... | mit | Python |
a45f7e81689bb32bd40ba0f089b9c4de210330d8 | Add save_embedding script (#12) | bda2017-shallowermind/MusTGAN,bda2017-shallowermind/MusTGAN,bda2017-shallowermind/MusTGAN,bda2017-shallowermind/MusTGAN | magenta/magenta/models/nsynth/ours/save_embeddings.py | magenta/magenta/models/nsynth/ours/save_embeddings.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 ag... | # 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 ag... | apache-2.0 | Python |
807d3347f676e3767dc07f47182f0525291b897f | Remove bytes serialization | druids/django-chamber | chamber/utils/json.py | chamber/utils/json.py | from django.core.serializers.json import DjangoJSONEncoder
class ChamberJSONEncoder(DjangoJSONEncoder):
def default(self, val):
try:
return super().default(val)
except TypeError:
# https://github.com/python/cpython/blob/v3.8.3/Lib/json/encoder.py#L160-L180
retu... | from django.core.serializers.json import DjangoJSONEncoder
class ChamberJSONEncoder(DjangoJSONEncoder):
def default(self, val):
if isinstance(val, bytes):
return {
'__type__': bytes.__name__,
'__value__': [x for x in val],
}
else:
... | bsd-3-clause | Python |
bee3474611c9743a8db21ae68c7f7e883aa50956 | Update constants.py | haystack/eyebrowse-server,haystack/eyebrowse-server,haystack/eyebrowse-server,haystack/eyebrowse-server,haystack/eyebrowse-server | common/constants.py | common/constants.py | EMPTY_SEARCH_MSG = {
'home_stream': "Broaden your search filters or find friends to follow by <a href='/getting_started#startfollowing'>getting some suggestions</a> or <a href='/accounts/profile/sync_twitter'>connecting your Twitter account</a> to get more results.",
'self_profile_stream': "You don't have any ... | EMPTY_SEARCH_MSG = {
'home_stream': "Broaden your search filters or find friends to follow by <a href='/getting_started#startfollowing'>getting some suggestions</a> or <a href='/accounts/profile/sync_twitter'>connecting your Twitter account</a> to get more results.",
'self_profile_stream': "You don't have any ... | mit | Python |
8161c0343238234a296fe88a3b9e1ab2989554a1 | Update to hw0 parser. | cornell-cs5220-f15/management | hw0walk.py | hw0walk.py | #!/usr/bin/env python
"""
Walks over the HW0 submissions (in the Submissions folder)
and generates a YAML file from it.
"""
import os
import re
import math
import yaml
# Ordinary text attributes
attr = {
'name': '- First name',
'netid': '- Cornell netid',
'github': '- GitHub',
'status': '- Status',
... | #!/usr/bin/env python
"""
Walks over the HW0 submissions (in the Submissions folder)
and generates a YAML file from it.
"""
import os
import re
import math
import yaml
# Ordinary text attributes
attr = {
'name': '- First name',
'netid': '- Cornell netid',
'github': '- GitHub',
'status': '- Status',
... | mit | Python |
d29afc5a6d518f13058d7ee03541d65c2e185a70 | add several tests | lbatalha/pastething,lbatalha/pastething,lbatalha/pastething | tests.py | tests.py | import main
import config
import stats
import gc
import requests, subprocess
from random import getrandbits
from time import sleep
url = "http://localhost:5000/"
def test_plainresponse():
params = {'paste': 'test', 'raw': 'true'}
r = requests.post(url, data=params)
response = r.text.split(" | ")
r = requests.get... | import main
import config
import stats
import gc
import requests
from random import getrandbits
url = "http://localhost:5000/"
def test_plainresponse():
assert main.plain('test').headers['Content-Type'] == 'text/plain; charset=utf-8'
def test_postlimits():
#Missing paste body test
params = {'paste': '', 'burn': ... | mit | Python |
3e044b07e6bbd2fcd14a2c115979284cd4cc0cbf | fix pep8 issues | josuebrunel/yahoo-oauth | tests.py | tests.py | from __future__ import absolute_import
import pytest
import os
import logging
import myql
from myql.utils import pretty_json
from yahoo_oauth.utils import write_data, get_data
from yahoo_oauth import OAuth1, OAuth2
logging.basicConfig(
level=logging.DEBUG,
format="[%(asctime)s %(levelname)s] [%(name)s.%(mo... | from __future__ import absolute_import
import pytest
import os
import logging
import myql
from myql.utils import pretty_json
from yahoo_oauth.utils import write_data, get_data
from yahoo_oauth import OAuth1, OAuth2
logging.basicConfig(level=logging.DEBUG,format="[%(asctime)s %(levelname)s] [%(name)s.%(module)s.%(f... | mit | Python |
e2d254ba1c52f711d5a7327ec07b25aa8aef0019 | Add more player tests | allanburleson/python-adventure-game,disorientedperson/python-adventure-game | tests.py | tests.py | import unittest
import os
import pag
class TestPlayer(unittest.TestCase):
@classmethod
def setUpClass(self):
self.l = pag.classes.Location('Test')
self.l.description = 'Test description'
self.l2 = pag.classes.Location('Test 2', description='t2 description')
self.l.exits = ... | import unittest
import os
import pag
class TestPlayer(unittest.TestCase):
@classmethod
def setUpClass(self):
self.l = pag.classes.Location('Test')
self.l.description = 'Test description'
self.l2 = pag.classes.Location('Test 2', description='t2 description')
self.l.exits = ... | mit | Python |
8cc124db6e62898cd5421171f962811d4bc5fc72 | Fix shebang line | kevgathuku/top40,andela-kndungu/top40 | top40.py | top40.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import requests
import requests_cache
# Cache the API calls and expire after 12 hours
requests_cache.install_cache(expire_after=43200)
url = 'http://ben-major.co.uk/labs/top40/api/singles/'
@click.command()
@click.option('--count',
type=click.IntRange(1... | #/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import requests
import requests_cache
# Cache the API calls and expire after 12 hours
requests_cache.install_cache(expire_after=43200)
url = 'http://ben-major.co.uk/labs/top40/api/singles/'
@click.command()
@click.option('--count',
type=click.IntRange(1,... | mit | Python |
6321f2553358afe1bb40f9705bc8bbda4520c831 | Fix bare run of func tests | lawrencebenson/thefuck,levythu/thefuck,thinkerchan/thefuck,mcarton/thefuck,beni55/thefuck,PLNech/thefuck,vanita5/thefuck,vanita5/thefuck,barneyElDinosaurio/thefuck,PLNech/thefuck,hxddh/thefuck,mlk/thefuck,MJerty/thefuck,ostree/thefuck,thinkerchan/thefuck,manashmndl/thefuck,manashmndl/thefuck,BertieJim/thefuck,LawrenceH... | tests/functional/utils.py | tests/functional/utils.py | import pytest
import os
import subprocess
import shutil
from tempfile import mkdtemp
from pathlib import Path
import sys
import pexpect
from tests.utils import root
bare = os.environ.get('BARE')
enabled = os.environ.get('FUNCTIONAL')
def build_container(tag, dockerfile, copy_src=False):
tmpdir = mkdtemp()
t... | import pytest
import os
import subprocess
import shutil
from tempfile import mkdtemp
from pathlib import Path
import sys
import pexpect
from tests.utils import root
bare = os.environ.get('BARE')
enabled = os.environ.get('FUNCTIONAL')
def build_container(tag, dockerfile, copy_src=False):
tmpdir = mkdtemp()
t... | mit | Python |
73662f9eb77aa4897b1a11fa3049c691b2e636ad | Update classifier error message. | breznak/nupic,breznak/nupic,breznak/nupic | nupic/algorithms/cla_classifier_factory.py | nupic/algorithms/cla_classifier_factory.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python |
d0c59fede1f56ff83358ce57517deff7b9605622 | bump version | omergertel/chords | chords/__version__.py | chords/__version__.py | __version__ = '0.3'
| __version__ = '0.2'
| mit | Python |
44a77fd227c41e9ae939934efdb0184a03360641 | Fix Bug | muddyfish/PYKE,muddyfish/PYKE | node/bit_xor.py | node/bit_xor.py | #!/usr/bin/env python
from nodes import Node
class BitXOR(Node):
args = 2
results = 1
char = ".^"
def prepare(self, stack):
if len(stack) == 0:
self.add_arg(stack)
if isinstance(stack[0], Node.sequence):
self.args = 1
@Node.test_func([4... | #!/usr/bin/env python
from nodes import Node
class BitXOR(Node):
args = 2
results = 1
char = ".^"
def prepare(self, stack):
if len(stack) == 0:
self.add_arg(stack)
if isinstance(stack[0], Node.sequence):
self.args = 1
@Node.test_func([4... | mit | Python |
295c8340a39f48652f77d74f3f65bfcec19a5c34 | Bump to 0.11.1 | mitmproxy/mitmproxy,Kriechi/mitmproxy,cortesi/mitmproxy,zlorb/mitmproxy,mitmproxy/mitmproxy,gzzhanghao/mitmproxy,vhaupert/mitmproxy,ParthGanatra/mitmproxy,cortesi/mitmproxy,Kriechi/mitmproxy,ddworken/mitmproxy,fimad/mitmproxy,fimad/mitmproxy,gzzhanghao/mitmproxy,mosajjal/mitmproxy,zlorb/mitmproxy,ikoz/mitmproxy,xaxa89/... | libpathod/version.py | libpathod/version.py | IVERSION = (0, 11, 1)
VERSION = ".".join(str(i) for i in IVERSION)
MINORVERSION = ".".join(str(i) for i in IVERSION[:2])
NAME = "pathod"
NAMEVERSION = NAME + " " + VERSION
NEXT_MINORVERSION = list(IVERSION)
NEXT_MINORVERSION[1] += 1
NEXT_MINORVERSION = ".".join(str(i) for i in NEXT_MINORVERSION[:2])
| IVERSION = (0, 11)
VERSION = ".".join(str(i) for i in IVERSION)
MINORVERSION = ".".join(str(i) for i in IVERSION[:2])
NAME = "pathod"
NAMEVERSION = NAME + " " + VERSION
NEXT_MINORVERSION = list(IVERSION)
NEXT_MINORVERSION[1] += 1
NEXT_MINORVERSION = ".".join(str(i) for i in NEXT_MINORVERSION[:2]) | mit | Python |
5c259165b6ac1e7d5127d3fa110b076cccfcc43c | store file paths w/ /files/ prefix | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | trove.py | trove.py | import os.path
import versioned
import string
# this is a single version of a single package
class Package:
def addFile(self, path, version):
self.files["/files" + path] = version
def fileList(self):
l = []
# rip off the /files prefix
for (path, file) in self.files.items():
l.append((path[6:], file)... | import os.path
import versioned
import string
# this is a single version of a single package
class Package:
def addFile(self, path, version):
self.files[path] = version
def fileList(self):
l = []
for item in self.files.items():
l.append(item)
return l
def write(self, dataFile):
for (file, ver... | apache-2.0 | Python |
c1540d672865cb41fbbbe3e1271bb2c263f2312c | Allow arbitrary order of image and filename in IO | microscopium/microscopium,starcalibre/microscopium,jni/microscopium,Don86/microscopium,microscopium/microscopium,Don86/microscopium,jni/microscopium | husc/io.py | husc/io.py | import os
import numpy as np
import Image
def imwrite(ar, fn, bitdepth=None):
"""Write a np.ndarray 2D volume to a .png or .tif image
Parameters
----------
ar : numpy ndarray, shape (M, N)
The volume to be written to disk.
fn : string
The file name to which to write the volume.
... | import os
import numpy as np
import Image
def imwrite(ar, fn, bitdepth=None):
"""Write a np.ndarray 2D volume to a .png or .tif image
Parameters
----------
ar : numpy ndarray, shape (M, N)
The volume to be written to disk.
fn : string
The file name to which to write the volume.
... | bsd-3-clause | Python |
b09946de1ab841dd9ab2012c58e6408a467676cb | Rename variable f | openpassword/blimey,openpassword/blimey | openpassword/agile_keychain/data_source.py | openpassword/agile_keychain/data_source.py | import os
import json
from openpassword import abstract
AGILE_KEYCHAIN_BASE_FILES = ['1password.keys', 'contents.js', 'encryptionKeys.js']
class DataSource(abstract.DataSource):
def __init__(self, path):
self.base_path = path
self._default_folder = os.path.join(self.base_path, "data", "default")
... | import os
import json
from openpassword import abstract
AGILE_KEYCHAIN_BASE_FILES = ['1password.keys', 'contents.js', 'encryptionKeys.js']
class DataSource(abstract.DataSource):
def __init__(self, path):
self.base_path = path
self._default_folder = os.path.join(self.base_path, "data", "default")
... | mit | Python |
8294ff42ec298bb2fee6b775fb3c26b13c674f9b | modify segment room | jmloveyj/autoSweep | segment.py | segment.py | #!/usr/local/bin/python
#-*-coding:utf-8-*-
import numpy as np
import cv2
from matplotlib import pyplot as plt
currentWindowId = 0
def prepareWindow(img, title, ifGray = False):
global currentWindowId
currentWindowId = currentWindowId +1
plt.subplot(3,3,currentWindowId)
plt.title(title)
plt.xtick... | #!/usr/local/bin/python
#-*-coding:utf-8-*-
import numpy as np
import cv2
from matplotlib import pyplot as plt
currentWindowId = 0
def prepareWindow(img, title, ifGray = False):
global currentWindowId
currentWindowId = currentWindowId +1
plt.subplot(3,3,currentWindowId)
plt.title(title)
plt.xtick... | apache-2.0 | Python |
32902d537394a735f7a10c7db84bfc2ca7fb968e | Enable document cloning | jreese/nib | nib/document.py | nib/document.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os.path
import nib
from nib import yaml
class Document(dict):
def __init__(self, path=None, uri=None, group=None, content=None, short=None, **kwargs):
options = nib.instance().options
defaults = options['def... | from __future__ import absolute_import, division, print_function, unicode_literals
import os.path
import nib
from nib import yaml
class Document(dict):
def __init__(self, path=None, uri=None, group=None, content=None, short=None, **kwargs):
options = nib.instance().options
defaults = options['def... | mit | Python |
f7554a8f6c60cabe759d21c9b8e9e57a360dffff | Update twitchHandler.py | lgkern/PriestPy | src/twitchHandler.py | src/twitchHandler.py | from twitch import TwitchClient
class TwitchHandler:
async def validateStream(url, twitch_id):
client = TwitchClient(client_id=twitch_id)
channelName = url.split('/')[-1]
channels = client.search.channels(channelName)
if channels:
channel = channels[0]
... | from twitch import TwitchClient
class TwitchHandler:
async def validateStream(url, twitch_id):
client = TwitchClient(client_id=twitch_id)
channelName = url.split('/')[-1:]
channels = client.search.channels(channelName)
if channels:
channel = channels[0]
... | mit | Python |
2c0da1e6d6f1bfd020d53e5deb3ea755136ddc99 | access proper .git directory | mohrm/umklapp_site,mohrm/umklapp_site,mohrm/umklapp_site | umklapp/templatetags/git_revision.py | umklapp/templatetags/git_revision.py | import os
from django import template
from django.conf import settings
register = template.Library()
with open(os.path.join(settings.BASE_DIR, ".git", "refs", "heads", "master")) as fh:
GIT_REVISION = fh.read().decode("utf8") or "unknown"
@register.simple_tag
def git_revision():
return GIT_REVISION
| from django import template
register = template.Library()
with open(".git/refs/heads/master") as fh:
GIT_REVISION = fh.read().decode("utf8") or "unknown"
@register.simple_tag
def git_revision():
return GIT_REVISION
| mit | Python |
4972d5748a6170d1f6d2888fa8a2523684bc3eb7 | update trinity base url and names | felliott/scrapi,erinspace/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi,fabianvf/scrapi,ostwald/scrapi,felliott/scrapi,alexgarciac/scrapi,erinspace/scrapi,icereval/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi | scrapi/consumers/trinity/__init__.py | scrapi/consumers/trinity/__init__.py | """
Harvests metadata from the Digital Commons at Trinity University for the SHARE project
More infomation at https://github.com/CenterForOpenScience/SHARE/blob/master/providers/edu.trinity.md
Example API call: http://digitalcommons.trinity.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc&from=2014-09-29T00:00:00Z
... | """
Harvests metadata from the Digital Commons at Trinity University for the SHARE project
More infomation at https://github.com/CenterForOpenScience/SHARE/blob/master/providers/edu.trinity.md
Example API call: http://digitalcommons.trinity.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc&from=2014-09-29T00:00:00Z
... | apache-2.0 | Python |
18bbbdf1e09345dc2de74a1ff1b8453d781b013a | Update header comment | scanlime/little-eink-gif,scanlime/little-eink-gif,scanlime/little-eink-gif | imgprep.py | imgprep.py | #
# Quick utility to pre-process images (including animaged gifs)
# into a binary blob of compressed framebuffer data.
#
from glob import glob
from PIL import Image
import struct
import zlib
def deflate(data, level=9):
zData = zlib.compress(data, level)
# Strip off the zlib header, and return the raw DEFLATE data... | #
# Quick utility to pre-process images (including animaged gifs) into
# frames that are already in the proper format for the e-ink module
# and compressed using a simple LZ77 implementation.
#
from glob import glob
from PIL import Image
import struct
import zlib
def deflate(data, level=9):
zData = zlib.compress(da... | mit | Python |
cb08d25f49b8b4c5177c8afdd9a69330992ee854 | Add tests for a correct behaviour in cookiecutter.main for replay | christabor/cookiecutter,luzfcb/cookiecutter,hackebrot/cookiecutter,cguardia/cookiecutter,pjbull/cookiecutter,dajose/cookiecutter,michaeljoseph/cookiecutter,moi65/cookiecutter,terryjbates/cookiecutter,takeflight/cookiecutter,terryjbates/cookiecutter,luzfcb/cookiecutter,agconti/cookiecutter,cguardia/cookiecutter,christab... | tests/replay/test_replay.py | tests/replay/test_replay.py | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
assert replay.get_file_name('foo', 'bar') == 'foo/bar.json'
@pytest.fixture(... | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
assert replay.get_file_name('foo', 'bar') == 'foo/bar.json'
@pytest.fixture(... | bsd-3-clause | Python |
a1af33672bfb24e29644255587e9989072cd1c30 | Update test_publish.py | lwindg/sanji,imZack/sanji,Sanji-IO/sanji | tests/sanji/test_publish.py | tests/sanji/test_publish.py | # pylint: disable=no-name-in-module
import os
import sys
import json
import unittest
try:
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from sanji.publish import Publish
from connection_mockup import ConnectionMockup
except ImportError:
print "Please check the python PATH fo... | import os
import sys
import json
import unittest
try:
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from sanji.publish import Publish
from connection_mockup import ConnectionMockup
except ImportError:
print "Please check the python PATH for import test module. (%s)" \
... | mit | Python |
6c2852dd16f96a4bd58a7cba49781dc382913816 | Update color_button_1.py | satishgoda/learningqt,satishgoda/learningqt | basics/color/color_button_1.py | basics/color/color_button_1.py | class ColoredButton(QtGui.QPushButton):
def __init__(self, color, *args, **kwargs):
super(ColoredButton, self).__init__(*args, **kwargs)
self.color_ = color
colorName = self.color_.name()
self.setStyleSheet("""
QPushButton {background-color: %s; color: black; border: none;}
... | import random
class ColoredButton(QtGui.QPushButton):
def __init__(self, color, *args, **kwargs):
super(ColoredButton, self).__init__(*args, **kwargs)
self.color_ = color
self.setFixedWidth(16)
self.setFixedHeight(16)
self.setCheckable(True)
color... | mit | Python |
bf92f4de368976f7de1f270d497323ebbd96f789 | Add missing json import | mitre/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner | storage/mongo_storage.py | storage/mongo_storage.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the following
functions:
setup:... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the following
functions:
setup:... | mpl-2.0 | Python |
2591cd3ccb9b83777e9a6d80895cd13a8076cfa9 | Add get_task function to sqlite | awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,MITRECND/multiscanner,mitre/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,awest1339/multiscanner | storage/sqlite_driver.py | storage/sqlite_driver.py | #!/usr/bin/env python
import os
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base, ConcreteBase
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import IntegrityError
MS_WD = os.path.dirname(os.path.dirname(os.path.a... | #!/usr/bin/env python
import os
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base, ConcreteBase
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import IntegrityError
MS_WD = os.path.dirname(os.path.dirname(os.path.a... | mpl-2.0 | Python |
ecfde473b413e75f2589a431b44eb1fb2b87dfd2 | Clarify the time period that Hansard scoring is done over | patricmutwiri/pombola,mysociety/pombola,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,Hutspace/odekro,geoffkilpin/pombola,ken-muturi/pombola,patricmutwiri/pombola,ken-muturi/pombola,Hutspace/odekro,Hutspace/odekro,ken-muturi/pombola,hzj123/56th,Hutspace/odekro,hzj123/56th,ken-muturi/... | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | import datetime
from django.core.management.base import NoArgsCommand
from django.core.exceptions import ImproperlyConfigured
class Command(NoArgsCommand):
help = 'Create/update hansard scorecard entry for all mps'
args = ''
def handle_noargs(self, **options):
# Imports are here to avoid an impor... | import datetime
from django.core.management.base import NoArgsCommand
from django.core.exceptions import ImproperlyConfigured
class Command(NoArgsCommand):
help = 'Create/update hansard scorecard entry for all mps'
args = ''
def handle_noargs(self, **options):
# Imports are here to avoid an impor... | agpl-3.0 | Python |
9ffffbd7435813dddd3ec9aab02fe271b5382e2c | Use image too | olneyhymn/opc-history | tweet.py | tweet.py | import re
import datetime as dt
import twitter as tw
import json
def update_facebook(title, url):
import facebook
with open('facebook.txt', 'r') as f:
access_token = f.read().strip()
api = facebook.GraphAPI(access_token)
try:
api.put_wall_post("", attachment={"link": url, "name": titl... | import re
import datetime as dt
import twitter as tw
import json
def update_facebook(title, url):
import facebook
with open('facebook.txt', 'r') as f:
access_token = f.read().strip()
api = facebook.GraphAPI(access_token)
try:
api.put_wall_post("", attachment={"link": url, "name": titl... | unlicense | Python |
648d641311b4666676b385f23e099a30e55e0041 | make logging daemon log when it's shut down | PeterMosmans/letsencrypt,lmcro/letsencrypt,deserted/letsencrypt,brentdax/letsencrypt,rlustin/letsencrypt,piru/letsencrypt,VladimirTyrin/letsencrypt,jsha/letsencrypt,martindale/letsencrypt,jmhodges/letsencrypt,sapics/letsencrypt,beermix/letsencrypt,letsencrypt/letsencrypt,jtl999/certbot,BillKeenan/lets-encrypt-preview,B... | server-ca/logging-daemon.py | server-ca/logging-daemon.py | #!/usr/bin/env python
# This daemon runs on the CA side to handle logging.
import redis, signal, sys
r = redis.Redis()
ps = r.pubsub()
debug = "debug" in sys.argv
clean_shutdown = False
from daemon_common import signal_handler, log
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_... | #!/usr/bin/env python
# This daemon runs on the CA side to handle logging.
import redis, signal, sys
r = redis.Redis()
ps = r.pubsub()
debug = "debug" in sys.argv
clean_shutdown = False
from daemon_common import signal_handler, log
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_... | apache-2.0 | Python |
9a63da1be1c9283f43e96793d6ade83cce7d8fe3 | Fix initial data on form population | johngian/woodstock,ppapadeas/woodstock,ppapadeas/woodstock,mozilla/woodstock,mozilla/woodstock,ppapadeas/woodstock,johngian/woodstock,ppapadeas/woodstock,johngian/woodstock,mozilla/woodstock,mozilla/woodstock,johngian/woodstock | woodstock/voting/forms.py | woodstock/voting/forms.py | from django import forms
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.utils.safestring import mark_safe
from models import MozillianProfile, Vote
VOTE_CHOICES = ((0, 'Skip'),
(-1, 'No'),
(1, 'Probably'),
(2, 'De... | from django import forms
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.utils.safestring import mark_safe
from models import MozillianProfile, Vote
VOTE_CHOICES = ((0, 'Skip'),
(-1, 'No'),
(1, 'Probably'),
(2, 'De... | mpl-2.0 | Python |
bb134699b34eb53b53e1855612304e099e024fdf | Write a final data set with all data. | Axelrod-Python/axelrod-moran,Axelrod-Python/axelrod-moran | src/write_fitness.py | src/write_fitness.py | """
A script to write the relative fitness to file
"""
import pandas as pd
import theoretic
def read():
summary = pd.read_csv("../data/sims_summary.csv")
columns = [["player", "opponent", "N", "Noise", "$p_1$", "$p_{N/2}$",
"$r_1$", "$r_{N/2}$"],
["player", "opponent", "N", "Noi... | """
A script to write the relative fitness to file
"""
import pandas as pd
import theoretic
def read():
summary = pd.read_csv("../data/sims_summary.csv")
columns = [["player", "opponent", "N", "Noise", "$r_1$", "$r_{N/2}$"],
["player", "opponent", "N", "Noise", "$r_{N-1}$"]]
dfs = [[], []]
... | mit | Python |
2c4ba0509a3e47ccb61106896a44ea786ffe91a0 | Update artwork table display | rogerhil/flaviabernardes,rogerhil/flaviabernardes,rogerhil/flaviabernardes,rogerhil/flaviabernardes | flaviabernardes/flaviabernardes/artwork/admin.py | flaviabernardes/flaviabernardes/artwork/admin.py | from django.contrib import admin
from image_cropping import ImageCroppingMixin
from .models import Artwork, ArtworkType, Tag, TagArtwork
class TagInline(admin.TabularInline):
model = Artwork.tags.through
extra = 1 # how many rows to show
@admin.register(Artwork)
class ArtworkAdmin(ImageCroppingMixin, admin.... | from django.contrib import admin
from image_cropping import ImageCroppingMixin
from .models import Artwork, ArtworkType, Tag, TagArtwork
class TagInline(admin.TabularInline):
model = Artwork.tags.through
extra = 1 # how many rows to show
@admin.register(Artwork)
class ArtworkAdmin(ImageCroppingMixin, admin.... | apache-2.0 | Python |
9547988a1a9ef8faf22d9bfa881f4e542637fd46 | Establish connection only when needed | certik/mhd-hermes,certik/mhd-hermes | utils.py | utils.py | import xmlrpclib
import cPickle
import subprocess
from time import sleep
p = None
s = None
def start_plot_server():
global p
if p is None:
p = subprocess.Popen(["python", "plot_server.py"])
def stop_plot_server():
if p is not None:
p.terminate()
sleep(0.01)
p.kill()
def p... | import xmlrpclib
import cPickle
import subprocess
from time import sleep
p = None
s = None
def start_plot_server():
global p
if p is None:
p = subprocess.Popen(["python", "plot_server.py"])
def stop_plot_server():
if p is not None:
p.terminate()
sleep(0.01)
p.kill()
def p... | bsd-3-clause | Python |
27909291fd8044e47a31f5b1c6a2c5a3aaff36a1 | fix syntax | vb64/gae-openid | views.py | views.py | import logging
from django.shortcuts import render_to_response
def mainpage(request):
return render_to_response('main.html')
def success_handler(request, response, openid_url):
logging.warning("success_handler openid_url: %s" % openid_url)
| import logging
from django.shortcuts import render_to_response
def mainpage(request):
return render_to_response('main.html')
def success_handler(request, response, openid_url)
logging.warning("success_handler openid_url: %s" % openid_url)
| mit | Python |
70dfe8aca8189d254d6383b1e36c56c99505a953 | Enforce keyword-only args, alphabetize args. | voussoir/etiquette,voussoir/etiquette,voussoir/etiquette | frontends/etiquette_flask/etiquette_flask_dev.py | frontends/etiquette_flask/etiquette_flask_dev.py | '''
This file is the gevent launcher for local / development use.
Simply run it on the command line:
python etiquette_flask_dev.py [port]
'''
import gevent.monkey; gevent.monkey.patch_all()
import logging
handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
handler.set... | '''
This file is the gevent launcher for local / development use.
Simply run it on the command line:
python etiquette_flask_dev.py [port]
'''
import gevent.monkey; gevent.monkey.patch_all()
import logging
handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
handler.set... | bsd-3-clause | Python |
909188909d7c9691598307edab8853ce7c6e8aa0 | tag v.0.6.1 | tony/libtmux | libtmux/__about__.py | libtmux/__about__.py | __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.6.1'
__description__ = 'scripting library / orm for tmux'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016 Tony Narlock'
| __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.6.0'
__description__ = 'scripting library / orm for tmux'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016 Tony Narlock'
| bsd-3-clause | Python |
4c9d704df088b6897196df43f72ba1bf07bce3ce | fix #132: glob exception in some python platform | iambus/xunlei-lixian,davies/xunlei-lixian,wangjun/xunlei-lixian,sndnvaps/xunlei-lixian,xieyanhao/xunlei-lixian,wogong/xunlei-lixian,myself659/xunlei-lixian,ccagg/xunlei,windygu/xunlei-lixian,liujianpc/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,GeassDB/xunlei-lixian | lixian_cli_parser.py | lixian_cli_parser.py |
def expand_windows_command_line(args):
from glob import glob
expanded = []
for x in args:
try:
xx = glob(x)
except:
xx = None
if xx:
expanded += xx
else:
expanded.append(x)
return expanded
def expand_command_line(args):
import platform
return expand_windows_command_line(args) if platform.sys... |
def expand_windows_command_line(args):
from glob import glob
expanded = []
for x in args:
xx = glob(x)
if xx:
expanded += xx
else:
expanded.append(x)
return expanded
def expand_command_line(args):
import platform
return expand_windows_command_line(args) if platform.system() == 'Windows' else args
d... | mit | Python |
1690eff3f8bfb4c374859419b0af0c2fbda3014f | Bump version to 0.2.0 | lltk/lltk-restful | lltk-restful/base.py | lltk-restful/base.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.2.0'
import lltk.exceptions
from flask import Flask
from flask.ext.cache import Cache
from config import config
config['version'] = __version__
app = Flask(config['name'])
c... | #!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.1.0'
import lltk.exceptions
from flask import Flask
from flask.ext.cache import Cache
from config import config
config['version'] = __version__
app = Flask(config['name'])
c... | agpl-3.0 | Python |
737b07fe9c04cd749d5663393d2f915fb5a49e07 | Bump version | Arcensoth/cogbot | cogbot/__version__.py | cogbot/__version__.py | __version__ = '0.2.10-dev'
| __version__ = '0.2.9-dev'
| mit | Python |
49fe8786913336545022afc4a3e15bada12c1033 | Reorder letsencrypt properties | dhstack/gae-init,jakedotio/gae-init,gae-init/gae-init-docs,gae-init/gae-init-upload,jakedotio/gae-init,mdxs/gae-init-babel,lipis/meet-notes,lipis/github-stats,gmist/five-studio2,vanessa-bell/hd-kiosk-v2,lipis/gae-init,lipis/meet-notes,gae-init/gae-init-upload,lipis/gae-init,topless/gae-init,vanessa-bell/hd-kiosk-v2,gae... | main/model/config.py | main/model/config.py | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from api import fields
import config
import model
import util
class Config(model.Base, model.ConfigAuth):
analytics_id = ndb.StringProperty(default='', verbose_name='Tracking ID')
announcement_html = ndb.TextProperty(de... | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from api import fields
import config
import model
import util
class Config(model.Base, model.ConfigAuth):
analytics_id = ndb.StringProperty(default='', verbose_name='Tracking ID')
announcement_html = ndb.TextProperty(de... | mit | Python |
b33793cebd998fa4da757be04b79da25afd53874 | move special version in version string | fugu13/python-oauth2 | oauth2/_version.py | oauth2/_version.py | # This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "211-rsa"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil i... | # This is the version of this source code.
manual_verstr = "1.5-rsa"
auto_build_num = "211"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil i... | mit | Python |
aff5b78023de5518d3b220b4bf2dc34b3f5df65f | Use validation from VAT id for Finnish y-tunnus | holvi/python-stdnum,holvi/python-stdnum,holvi/python-stdnum | stdnum/fi/ytunnus.py | stdnum/fi/ytunnus.py | # ytunnus.py - functions for handling Finnish business identifiers (y-tunnus)
# coding: utf-8
#
# Copyright (C) 2015 Holvi Payment Services Oy
# Copyright (C) 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Licens... | # ytunnus.py - functions for handling Finnish business identifiers (y-tunnus)
# coding: utf-8
#
# Copyright (C) 2015 Holvi Payment Services Oy
# Copyright (C) 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Licens... | lgpl-2.1 | Python |
0b6a5b0e1d0e48ed54a5eb0ce40458dd943b5f8a | rename WS endpoint | morgante/deceptachat,morgante/deceptachat,morgante/deceptachat | index.py | index.py | """
Backend Chat server
"""
import redis
import os
import gevent
import json
from flask import Flask, render_template, request, redirect, url_for
from flask_sockets import Sockets
from chatterbox import Chatterbox
app = Flask(__name__)
app.debug = True
sockets = Sockets(app)
box = Chatterbox()
# Standard HTTP rout... | """
Backend Chat server
"""
import redis
import os
import gevent
import json
from flask import Flask, render_template, request, redirect, url_for
from flask_sockets import Sockets
from chatterbox import Chatterbox
app = Flask(__name__)
app.debug = True
sockets = Sockets(app)
box = Chatterbox()
# Standard HTTP rout... | mit | Python |
f3b9cc6392e4c271ae11417357ecdc196f1c3ae7 | Use the TBinaryProtocolAccelerated protocol instead of TBinaryProtocol to improve performance. | AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT... | python_scripts/extractor_python_readability_server.py | python_scripts/extractor_python_readability_server.py | #!/usr/bin/python
import sys
import os
import glob
#sys.path.append(os.path.join(os.path.dirname(__file__), "gen-py"))
sys.path.append(os.path.join(os.path.dirname(__file__),"gen-py/thrift_solr/"))
sys.path.append(os.path.dirname(__file__) )
from thrift.transport import TSocket
from thrift.transport import TTranspor... | #!/usr/bin/python
import sys
import os
import glob
#sys.path.append(os.path.join(os.path.dirname(__file__), "gen-py"))
sys.path.append(os.path.join(os.path.dirname(__file__),"gen-py/thrift_solr/"))
sys.path.append(os.path.dirname(__file__) )
from thrift.transport import TSocket
from thrift.server import TServer
#im... | agpl-3.0 | Python |
55968d6ac14f717b9a0b341ec24eaac302866c56 | Add type hints for linear for debugging | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/tensor/nn/linear.py | packages/syft/src/syft/core/tensor/nn/linear.py | from ..autodp.phi_tensor import PhiTensor
from ...adp.data_subject_list import DataSubjectList
from torch import Tensor
from torch import nn
def Linear(image: PhiTensor, in_features: int, out_features: int, bias=True) -> PhiTensor:
linear_layer = nn.Linear(in_features, out_features, bias=bias)
data = linear_... | from ..autodp.phi_tensor import PhiTensor
from ...adp.data_subject_list import DataSubjectList
from torch import Tensor
from torch import nn
def Linear(image: PhiTensor, in_features, out_features, bias=True):
linear_layer = nn.Linear(in_features, out_features, bias=True)
data = linear_layer(Tensor(image.chil... | apache-2.0 | Python |
c72190c6ef9a22d4732461ce61a416b4390c8c63 | Create test_bwa_aligner.py | Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq | tests/test_bwa_aligner.py | tests/test_bwa_aligner.py | #!/usr/bin/python
"""
.. Copyright 2017 EMBL-European Bioinformatics Institute
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
Unle... | #!/usr/bin/python
"""
.. Copyright 2017 EMBL-European Bioinformatics Institute
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
Unle... | apache-2.0 | Python |
42e7e52ad1630e2959d1e6084397599fff7518da | create blank unit test for new display method | IanDCarroll/xox | tests/test_cli_display.py | tests/test_cli_display.py | import unittest
from Scenery.cli_display import *
class Helper(object):
def get_methods(self, obj):
return [i for i in dir(obj) if callable(getattr(obj, i))]
class TerminalInterfaceTestCase(unittest.TestCase):
def setUp(self):
self.ui = TerminalInterface("fake_board_object")
self.he... | import unittest
from Scenery.cli_display import *
class Helper(object):
def get_methods(self, obj):
return [i for i in dir(obj) if callable(getattr(obj, i))]
class TerminalInterfaceTestCase(unittest.TestCase):
def setUp(self):
self.ui = TerminalInterface("fake_board_object")
self.he... | mit | Python |
3af76337dd86e5a12c0645b520bb1608ee7c9a31 | Test getByUniqueID Diary model | uzh/msregistry | tests/test_diary_model.py | tests/test_diary_model.py | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | agpl-3.0 | Python |
bc84ff8bfd1b0e745fb6401c06edc7478bbf90b9 | Remove double connection to mongodb | FactoryBoy/factory_boy | tests/test_mongoengine.py | tests/test_mongoengine.py | # -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
"""Tests for factory_boy/MongoEngine interactions."""
import os
import unittest
import mongoengine
import factory
from factory.mongoengine import MongoEngineFactory
class Address(mongoengine.EmbeddedDocument):
street = mongoengine.StringField()
clas... | # -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
"""Tests for factory_boy/MongoEngine interactions."""
import os
import unittest
import mongoengine
import factory
from factory.mongoengine import MongoEngineFactory
class Address(mongoengine.EmbeddedDocument):
street = mongoengine.StringField()
clas... | mit | Python |
6b0304cbf327fc6c29077d6f275ee9a5cb3526c3 | Improve tests (new equal func) | Cadene/pretrained-models.pytorch | tests/test_pm_imagenet.py | tests/test_pm_imagenet.py | import pytest
import torch
import torch.nn as nn
from torch.autograd import Variable
import pretrainedmodels as pm
import pretrainedmodels.utils as utils
pm_args = []
for model_name in pm.model_names:
for pretrained in pm.pretrained_settings[model_name]:
if pretrained in ['imagenet', 'imagenet+5k']:
... | import pytest
import torch
import torch.nn as nn
from torch.autograd import Variable
import pretrainedmodels as pm
import pretrainedmodels.utils as utils
pm_args = []
for model_name in pm.model_names:
for pretrained in pm.pretrained_settings[model_name]:
if pretrained in ['imagenet', 'imagenet+5k']:
... | bsd-3-clause | Python |
e4024b9224b5d5a472ac33dca9e9931921330fd1 | Fix tesseract unit test | Kaggle/docker-python,Kaggle/docker-python | tests/test_pytesseract.py | tests/test_pytesseract.py | import unittest
import io
import pytesseract
import numpy as np
from PIL import Image
from wand.image import Image as wandimage
class TestPytesseract(unittest.TestCase):
def test_tesseract(self):
# Open pdf with Wand
with wandimage(filename='/input/tests/data/test.pdf') as wand_image:
i... | import unittest
import io
import pytesseract
import numpy as np
from wand.image import Image as wandimage
class TestPytesseract(unittest.TestCase):
def test_tesseract(self):
# Open pdf with Wand
with wandimage(filename='/input/tests/data/test.pdf') as wand_image:
img_buffer = np.asarray... | apache-2.0 | Python |
58a6185ebe859868aaa318b7fcc2afa85853c829 | remove debug info left in script | andydavidson/pypeer,job/pypeer | bin/get_routes_from_session.py | bin/get_routes_from_session.py | import sys, argparse
from lxml import etree
sys.path.append('/home/andy/src/pypeer/lib')
from jnpr.junos import Device
from jnpr.junos.op.routes import RouteTable
from pypeer.ConfigDictionary import ConfigDictionary
config = ConfigDictionary()
username = config.username()
password = config.password()
parser = ar... | import sys, argparse
from lxml import etree
sys.path.append('/home/andy/src/pypeer/lib')
from jnpr.junos import Device
from jnpr.junos.op.routes import RouteTable
from pypeer.ConfigDictionary import ConfigDictionary
config = ConfigDictionary()
username = config.username()
password = config.password()
parser = ar... | mit | Python |
a6034ffa4d81bb57c5d86876ee72e0436426e6d2 | Update support for passing in filenames. | scottjab/imhotep_foodcritic | imhotep_foodcritic/plugin.py | imhotep_foodcritic/plugin.py | from imhotep.tools import Tool
from collections import defaultdict
import json
import os
import logging
log = logging.getLogger(__name__)
class FoodCritic(Tool):
def invoke(self,
dirname,
filenames=set(),
config_file=None):
retval = defaultdict(lambda: defaul... | from imhotep.tools import Tool
from collections import defaultdict
import json
import os
import logging
log = logging.getLogger(__name__)
class FoodCritic(Tool):
def invoke(self,
dirname,
filenames=set(),
config_file=None,
file_list=None):
retv... | mit | Python |
ff72f68aed13adb1a6ee65751bd7463af826d462 | update plugin name and configuration | Alir3z4/cmsplugin-filery,jasekz/cmsplugin-filery | cmsplugin_filery/cms_plugins.py | cmsplugin_filery/cms_plugins.py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from cmsplugin_filery.models import Filery
from cmsplugin_filery.admin import ImageInline
class FileryCMSPlugin(CMSPluginBase):
model = Filery
inlines = [ImageInline, ]
... | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from cmsplugin_filery.models import Filery
from cmsplugin_filery.admin import ImageInline
class CMSFileryPlugin(CMSPluginBase):
model = Filery
inlines = [ImageInline, ]
... | bsd-2-clause | Python |
01263d1e15470ec2cedfaf9f20d5e5d7ec41e484 | add comments | PallHaraldsson/pyjulia,JuliaPy/pyjulia,JuliaPy/pyjulia,JuliaLang/pyjulia | julia/__init__.py | julia/__init__.py | import sys
from .core import Julia
#initialize julia interpreter
julia = Julia()
#monkeypatch julia interpreter into module load path
sys.modules["julia"] = julia
| import sys
from .core import Julia
j = Julia()
sys.modules["julia"] = j
| mit | Python |
b7f0cbf91491deea57952d597e657d91b44f48cf | fix in production order patch | hanselke/erpnext-1,indictranstech/Das_Erpnext,rohitwaghchaure/digitales_erpnext,mbauskar/Das_Erpnext,rohitwaghchaure/erpnext-receipher,gangadhar-kadam/latestchurcherp,suyashphadtare/vestasi-update-erp,sagar30051991/ozsmart-erp,mahabuber/erpnext,indictranstech/focal-erpnext,shitolepriya/test-erp,indictranstech/tele-erpn... | patches/november_2012/production_order_patch.py | patches/november_2012/production_order_patch.py | def execute():
import webnotes
webnotes.reload_doc("manufacturing", "doctype", "production_order")
webnotes.reload_doc("stock", "doctype", "stock_entry")
webnotes.conn.sql("""update `tabStock Entry`
set use_multi_level_bom = if(consider_sa_items_as_raw_materials='Yes', 0, 1)""")
webnotes.conn.sql("""updat... | def execute():
import webnotes
webnotes.reload_doc("manufacturing", "doctype", "production_order")
webnotes.reload_doc("stock", "doctype", "stock_entry")
webnotes.conn.sql("""update `tabStock Entry`
set use_multi_level_bom = if(consider_sa_items_as_raw_materials='Yes', 0, 1)""")
webnotes.conn.sql("""updat... | agpl-3.0 | Python |
62759b7663b8c6bee1114128a232587e01e69dde | Manage tiddlywebwiki.instance:store_contents in a more straightforward fashion | tiddlyweb/tiddlywebwiki,tiddlyweb/tiddlywebwiki,tiddlyweb/tiddlywebwiki | tiddlywebwiki/instance.py | tiddlywebwiki/instance.py | """
The definition of the structure and contents of a
default TiddlyWikiWiki instance.
"""
from tiddlywebplugins.instancer.util import get_tiddler_locations
from tiddlywebplugins.console.instance import store_contents
instance_config = {
'system_plugins': ['tiddlywebwiki'],
'twanager_plugins': ['tiddlywebwi... | """
The definition of the structure and contents of a
default TiddlyWikiWiki instance.
"""
from tiddlywebplugins.console.instance import (store_contents as
console_store_contents)
instance_config = {
'system_plugins': ['tiddlywebwiki'],
'twanager_plugins': ['tiddlywebwiki']
}
store_contents = {
'sy... | bsd-3-clause | Python |
fb79d74c62be8d2116c2a3157d3010248f58bf9f | Work on keras mf; | sbremer/hybrid_rs | keras_mf_test.py | keras_mf_test.py | import numpy as np
from keras.layers import Embedding, Reshape, Input, Dense
from keras.layers.merge import Dot, Concatenate, Add
from keras.models import Model
from keras.callbacks import EarlyStopping
import keras
import pickle
from sklearn.metrics import mean_squared_error
from math import sqrt
from sklearn.model_s... | import numpy as np
from keras.layers import Embedding, Reshape, Merge, Dropout, Dense
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint
from keras.models import Sequential
import pickle
from sklearn.metrics import mean_squared_error
from math import sqrt
from sklearn.model_selection import KFold
# H... | apache-2.0 | Python |
c292060693f7d78b1975b289c257c333240d2e52 | Update test_plotting to use ContextTextCase. | RaoUmer/distarray,RaoUmer/distarray,enthought/distarray,enthought/distarray | distarray/tests/test_plotting.py | distarray/tests/test_plotting.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | bsd-3-clause | Python |
bb62a0753297e327c4759a4f2fabd5844024a5f3 | Fix order of the strings and add a comment to maintain this. | fyookball/electrum,fyookball/electrum,fyookball/electrum | android/app/src/main/python/electroncash_gui/android/strings.py | android/app/src/main/python/electroncash_gui/android/strings.py | # This file lists translatable strings used in the Android app which don't appear anywhere else
# in the Electron Cash repository. Some of them only differ in capitalization or punctuation:
# see https://medium.com/@jsaito/making-a-case-for-letter-case-19d09f653c98
# If you change anything here, you need to rebuild th... | # This file lists translatable strings used in the Android app which don't appear anywhere else
# in the Electron Cash repository. Some of them only differ in capitalization or punctuation:
# see https://medium.com/@jsaito/making-a-case-for-letter-case-19d09f653c98
# If you change anything here, you need to rebuild th... | mit | Python |
7509893db5888b62da22bfa27e17653cdb9dc052 | Fix bugs when moving languagebar. | ibus/ibus,fujiwarat/ibus,j717273419/ibus,luoxsbupt/ibus,fujiwarat/ibus,phuang/ibus,ueno/ibus,j717273419/ibus,ueno/ibus,j717273419/ibus,phuang/ibus,ueno/ibus,luoxsbupt/ibus,ibus/ibus-cros,Keruspe/ibus,phuang/ibus,Keruspe/ibus,ibus/ibus,ibus/ibus,luoxsbupt/ibus,ibus/ibus,phuang/ibus,Keruspe/ibus,fujiwarat/ibus,Keruspe/ib... | panel/handle.py | panel/handle.py | import gtk
import gtk.gdk as gdk
import gobject
class Handle (gtk.EventBox):
def __init__ (self):
gtk.EventBox.__init__ (self)
self.set_visible_window (False)
self.set_size_request (10, -1)
self.set_events (
gdk.EXPOSURE_MASK | \
gdk.BUTTON_PRESS_MASK | \
gdk.BUTTON_RELEASE_MASK | \
gdk.BUTTON1_MO... | import gtk
import gtk.gdk as gdk
import gobject
class Handle (gtk.EventBox):
def __init__ (self):
gtk.EventBox.__init__ (self)
self.set_visible_window (False)
self.set_size_request (10, -1)
self.set_events (
gdk.EXPOSURE_MASK | \
gdk.BUTTON_PRESS_MASK | \
gdk.BUTTON_RELEASE_MASK | \
gdk.BUTTON1_MO... | lgpl-2.1 | Python |
cb025682a2f0591758d0a1643f566eaa23c23156 | create tk9 | wangwei7175878/tutorials | tkinterTUT/tk9_menubar.py | tkinterTUT/tk9_menubar.py | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import tkinter as tk
window = tk.Tk()
window.title('my window')
window.geometry('200x200')
l = tk.Label... | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import tkinter as tk
window = tk.Tk()
window.title('my window')
window.geometry('200x200')
l = tk.Label... | mit | Python |
7672883fc7449cc4d8b285446f039ae1571629eb | Remove unused import from katana.scanner | eugene-eeo/katana | katana/scanner.py | katana/scanner.py | from re import Scanner
from collections import namedtuple
from katana.storage import Node
RExpr = namedtuple('RExpr', ['regex', 'callback'])
def rexpr(name, regex):
def callback(scanner, token):
return Node(name, token)
return RExpr(regex, callback)
def scan(rexprs, text):
nodes, rest = Scanne... | from re import Scanner
from collections import namedtuple
from katana.storage import Node, prepare
RExpr = namedtuple('RExpr', ['regex', 'callback'])
def rexpr(name, regex):
def callback(scanner, token):
return Node(name, token)
return RExpr(regex, callback)
def scan(rexprs, text):
nodes, rest... | mit | Python |
b7832fb4866c54011a17bbc593251b070e67263c | fix default config | fkmclane/paste,fkmclane/paste | paste/config.py | paste/config.py | # address to listen on
addr = ('', 8080)
# log locations
log = '/var/log/paste/paste.log'
httplog = '/var/log/paste/http.log'
# where service is located
service = 'https://paste.fooster.io'
# where store is located
store = 'store.fooster.io'
store_https = True
store_endpoint = '/'
# interval for storing pastes
inte... | # address to listen on
addr = ('', 8080)
# log locations
log = '/home/foster/tmp/var/log/paste/paste.log'
httplog = '/home/foster/tmp/var/log/paste/http.log'
# where service is located
service = 'https://paste.fooster.io'
# where store is located
store = 'store.fooster.io'
store_https = True
store_endpoint = '/'
# ... | mit | Python |
3ce1b928f36c314ab07c334843b2db96626f469e | Make this into a partial to get the protocol correctly. | SunDwarf/Kyoukai | kyokai/asphalt.py | kyokai/asphalt.py | """
Asphalt framework mixin for Kyokai.
"""
import logging
import asyncio
from functools import partial
from typing import Union
from asphalt.core import Component, resolve_reference, Context
from typeguard import check_argument_types
from kyokai.app import Kyokai
from kyokai.protocol import KyokaiProtocol
from kyok... | """
Asphalt framework mixin for Kyokai.
"""
import logging
import asyncio
from functools import partial
from typing import Union
from asphalt.core import Component, resolve_reference, Context
from typeguard import check_argument_types
from kyokai.app import Kyokai
from kyokai.protocol import KyokaiProtocol
from kyok... | mit | Python |
cd0ee4cd69378ca6d796ea4d8f10e62b68380a85 | Extend secrets tables | digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox | netbox/secrets/tables.py | netbox/secrets/tables.py | import django_tables2 as tables
from utilities.tables import BaseTable, ToggleColumn
from .models import SecretRole, Secret
SECRETROLE_ACTIONS = """
<a href="{% url 'secrets:secretrole_changelog' slug=record.slug %}" class="btn btn-default btn-xs" title="Change log">
<i class="fa fa-history"></i>
</a>
{% if perms... | import django_tables2 as tables
from utilities.tables import BaseTable, ToggleColumn
from .models import SecretRole, Secret
SECRETROLE_ACTIONS = """
<a href="{% url 'secrets:secretrole_changelog' slug=record.slug %}" class="btn btn-default btn-xs" title="Change log">
<i class="fa fa-history"></i>
</a>
{% if perms... | apache-2.0 | Python |
b126c103590005c0165771d6782ca4941a0af4bc | Use request.abort(404) instead of import HTTPNotFound | TangledWeb/tangled.site | tangled/site/resources/entry.py | tangled/site/resources/entry.py | from tangled.web import Resource, represent
from .. import model
class Entries(Resource):
@represent('text/html', template_name='entries.mako')
def GET(self):
session = self.request.db_session
entries = session.query(model.Entry).all()
return {
'entries': entries,
... | from webob.exc import HTTPNotFound
from tangled.web import Resource, represent
from .. import model
class Entries(Resource):
@represent('text/html', template_name='entries.mako')
def GET(self):
session = self.request.db_session
entries = session.query(model.Entry).all()
return {
... | mit | Python |
5239b96bb4cd3920ac920cd58657f1a2a77d2257 | update package name and version | Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro,Yelp/avro | lang/py/setup.py | lang/py/setup.py | #! /usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | #! /usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | apache-2.0 | Python |
b352c3e1f5e8812d29f2e8a1bca807bea5da8cc4 | Test for the hx launcher. | hangarunderground/hendrix,hendrix/hendrix,hangarunderground/hendrix,hendrix/hendrix,jMyles/hendrix,hendrix/hendrix,jMyles/hendrix,hangarunderground/hendrix,hangarunderground/hendrix,jMyles/hendrix | test/test_hx_launcher.py | test/test_hx_launcher.py | from hendrix.options import HendrixOptionParser
from hendrix.ux import main
def test_no_arguments_gives_help_text(mocker):
class MockFile(object):
@classmethod
def write(cls, whatever):
cls.things_written = whatever
class MockStdOut(object):
@classmethod
def write... | import pytest_twisted
from hendrix.ux import main
from hendrix.options import HendrixOptionParser
def test_no_arguments_gives_help_text(mocker):
class MockFile(object):
@classmethod
def write(cls, whatever):
cls.things_written = whatever
class MockStdOut(object):
@class... | mit | Python |
ad21c9255f6246944cd032ad50082c0aca46fcb3 | Call MPIOutput.file.Sync() in MPIOutput.file._write() to prevent log lines from intermittently being lost. | cerrno/neurokernel | neurokernel/tools/mpi.py | neurokernel/tools/mpi.py | #!/usr/bin/env python
"""
MPI utilities.
"""
from mpi4py import MPI
import twiggy
class MPIOutput(twiggy.outputs.Output):
"""
Output messages to a file via MPI I/O.
"""
def __init__(self, name, format, comm,
mode=MPI.MODE_CREATE | MPI.MODE_WRONLY,
close_atexit=True)... | #!/usr/bin/env python
"""
MPI utilities.
"""
from mpi4py import MPI
import twiggy
class MPIOutput(twiggy.outputs.Output):
"""
Output messages to a file via MPI I/O.
"""
def __init__(self, name, format, comm,
mode=MPI.MODE_CREATE | MPI.MODE_WRONLY,
close_atexit=True)... | bsd-3-clause | Python |
1f93c5748031e22b0a77eb237f40ebb4c003aed0 | Fix comments in constants | zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9,zacharylawrence/ENEE408I-Team-9 | pi/constants.py | pi/constants.py | # Speeds
FORWARD_SPEED_LEFT = 0.15
FORWARD_SPEED_RIGHT = 0.18
SPIN_SPEED_LEFT = 0.14
SPIN_SPEED_RIGHT = 0.14
SPIN_SPEED_LEFT_FAST = 0.15
SPIN_SPEED_RIGHT_FAST = 0.15
# Times
SPIN_TIME = 10 # In sec
WANDER_TIME = 30 # In sec
OPEN_CLAW_PAUSE = 2 # In sec
CLOSE_CLAW_PAUSE = 2 # In sec
# Thresholds
PING_CONE_THRESH... | FORWARD_SPEED_LEFT = 0.15
FORWARD_SPEED_RIGHT = 0.18
SPIN_SPEED_LEFT = 0.14
SPIN_SPEED_RIGHT = 0.14
SPIN_SPEED_LEFT_FAST = 0.15
SPIN_SPEED_RIGHT_FAST = 0.15
SPIN_TIME = 10 # In sec
WANDER_TIME = 30 # In sec
OPEN_CLAW_PAUSE = 2 # In sec
CLOSE_CLAW_PAUSE = 2 # In sec
PING_CONE_THRESHOLD = 5 # In cm
IR_TARGET_THR... | mit | Python |
76b7466d4dfbcf05ed23853a8cc7243af065b205 | Bump version to 0.3.0 | cool-RR/PySnooper,cool-RR/PySnooper | pysnooper/__init__.py | pysnooper/__init__.py | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | mit | Python |
400789a8d813b929285037ead1b058eb23e0f32a | Update URL routes | alexandermendes/pybossa-analyst,LibCrowds/libcrowds-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst | libcrowds_analyst/core.py | libcrowds_analyst/core.py | # -*- coding: utf8 -*-
"""Main module for libcrowds-analyst."""
import os
from flask import Flask, request
from flask_wtf.csrf import CsrfProtect
from flask.ext.z3950 import Z3950Manager
from libcrowds_analyst import default_settings
from libcrowds_analyst import view, auth
def create_app():
"""Application fact... | # -*- coding: utf8 -*-
"""Main module for libcrowds-analyst."""
import os
from flask import Flask, request
from flask_wtf.csrf import CsrfProtect
from flask.ext.z3950 import Z3950Manager
from libcrowds_analyst import default_settings
from libcrowds_analyst import view, auth
def create_app():
"""Application fact... | unknown | Python |
0252200f16efb06c1d44d8ae4140789be32b1dde | print page title instead | arve0/geogebra-wiki-translation-helper | pickleloader.py | pickleloader.py | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
File: pickleloader.py
Author: Arve Seljebu
Email: arve.seljebu@gmail.com
Github: arve0
Description: Loads data from pickle.
"""
import pickle
def main():
""" Runs upon script execution """
file_ = open('data/pages-en.pickle')
pages = pickle.load(file_)
... | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
File: pickleloader.py
Author: Arve Seljebu
Email: arve.seljebu@gmail.com
Github: arve0
Description: Loads data from pickle.
"""
import pickle
def main():
""" Runs upon script execution """
file_ = open('data/pages-en.pickle')
pages = pickle.load(file_)
... | mit | Python |
c0f4b86070829737033d3ec1a1a08af35ab85228 | allow polls to be added | praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme | polls/models.py | polls/models.py | from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from molo.core.models import HomePage, LanguagePage, ArticlePage
HomePage.subpage_types += ['polls.Question']
LanguagePage.subpage_types += ['polls.Question']
ArticlePage.subpage_types +=... | from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from molo.core.models import HomePage
HomePage.subpage_types += ['polls.Question']
class Question(Page):
parent_page_types = [
'core.LanguagePage', 'core.SectionPage', 'core... | bsd-2-clause | Python |
81374c322ab85c14326d1650b72b38f87f9f4d30 | Remove AttributeMixin | publica-io/django-publica-posts,publica-io/django-publica-posts | posts/models.py | posts/models.py | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.db import models
from entropy import base
from entropy.base import (
TitleMixin, SlugMixin, CreatedMixin, ModifiedMixin, EnabledMixin,
MetadataMixin
)
from templates.mixins import TemplateMixin
try:
from images.mixins import... | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.db import models
from entropy import base
from entropy.base import (
TitleMixin, SlugMixin, CreatedMixin, ModifiedMixin, EnabledMixin,
MetadataMixin, AttributeMixin
)
from templates.mixins import TemplateMixin
try:
from imag... | bsd-3-clause | Python |
2a4b02fe84542f3f44fa4e6913f86ed3a4771d43 | Change comment from a charfield to a textfield, and add a date_created field; which is not working correctly. | hfrequency/django-issue-tracker | issue_tracker/core/models.py | issue_tracker/core/models.py | from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
version = models.CharField(max_length=15, null=True)
release_date = models.DateField(null=True)
class Issue(models.Model):
pr... | from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
version = models.CharField(max_length=15, null=True)
release_date = models.DateField(null=True)
class Issue(models.Model):
pr... | mit | Python |
3461216d201bc9337b3137a99e799e6d8c5153be | add PING, easter egg | GLolol/PyLink | plugins/ctcp.py | plugins/ctcp.py | # ctcp.py: Handles basic CTCP requests.
import random
import datetime
from pylinkirc import utils
from pylinkirc.log import log
def handle_ctcpversion(irc, source, args):
"""
Handles CTCP version requests.
"""
irc.msg(source, '\x01VERSION %s\x01' % irc.version(), notice=True)
utils.add_cmd(handle_ctc... | # ctcp.py: Handles basic CTCP requests.
from pylinkirc import utils
from pylinkirc.log import log
def handle_ctcpversion(irc, source, args):
"""
Handles CTCP version requests.
"""
irc.msg(source, '\x01VERSION %s\x01' % irc.version(), notice=True)
utils.add_cmd(handle_ctcpversion, '\x01version')
utils.... | mpl-2.0 | Python |
071378de19df2129a7d6ac76cdeca41114c05736 | Add version to conductor migration_update message. | Triv90/Nova,CiscoSystems/nova,whitepages/nova,affo/nova,edulramirez/nova,dstroppa/openstack-smartos-nova-grizzly,varunarya10/nova_test_latest,JianyuWang/nova,qwefi/nova,dstroppa/openstack-smartos-nova-grizzly,aristanetworks/arista-ovs-nova,tealover/nova,rahulunair/nova,Yuriy-Leonov/nova,kimjaejoong/nova,devendermishraj... | nova/conductor/rpcapi.py | nova/conductor/rpcapi.py | # Copyright 2012 IBM Corp.
#
# 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 agree... | # Copyright 2012 IBM Corp.
#
# 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 agree... | apache-2.0 | Python |
54df6a68cd12f6f92dc4143580b8b92a49a8a133 | Prepare core.py for deletion. | helgee/plyades | plyades/core.py | plyades/core.py | import datetime
import numpy as np
class Epoch(datetime.datetime):
@property
def jd(self):
jd = (367.0 * self.year
- np.floor( (7 * (self.year + np.floor( (self.month + 9) / 12.0) ) ) * 0.25 )
+ np.floor( 275 * self.month / 9.0 )
+ self.day + 1721013.5
+ ( (self.second/60... | import datetime
import numpy as np
class Epoch(datetime.datetime):
@property
def jd(self):
jd = (367.0 * self.year
- np.floor( (7 * (self.year + np.floor( (self.month + 9) / 12.0) ) ) * 0.25 )
+ np.floor( 275 * self.month / 9.0 )
+ self.day + 1721013.5
+ ( (self.second/60... | mit | Python |
8f2f5f402e2978473b1bbab5be5310b1e83974cc | Use auto-reuse | songgc/tensormate | tensormate/graph/image_graph.py | tensormate/graph/image_graph.py | import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.contrib.framework import arg_scope
from tensormate.graph import TfGgraphBuilder
class ImageGraphBuilder(TfGgraphBuilder):
def __init__(self, scope=None, device=None, plain=False, data_format="NHWC",
data_format_ops=(l... | import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.contrib.framework import arg_scope
from tensormate.graph import TfGgraphBuilder
class ImageGraphBuilder(TfGgraphBuilder):
def __init__(self, scope=None, device=None, plain=False, data_format="NHWC",
data_format_ops=(l... | apache-2.0 | Python |
44c8d3ace818fa75fbd499c7fd317842b1323a18 | add read_history | mikofski/purereadline | purereadline.py | purereadline.py | # This module makes GNU readline available to Python. It has ideas
# contributed by Lee Busby, LLNL, and William Magro, Cornell Theory
# Center. The completer interface was inspired by Lele Gaifax. More
# recently, it was largely rewritten by Guido van Rossum.
from ctypes import *
import copy
# libreadline.so and ... | # This module makes GNU readline available to Python. It has ideas
# contributed by Lee Busby, LLNL, and William Magro, Cornell Theory
# Center. The completer interface was inspired by Lele Gaifax. More
# recently, it was largely rewritten by Guido van Rossum.
from ctypes import *
import copy
# libreadline.so and ... | bsd-2-clause | Python |
145dcaa19ef520fa1304a9d52f8f1a9ddee8d70f | change from config to configuration | erykoff/redmapper,erykoff/redmapper | redmapper/__init__.py | redmapper/__init__.py | from _version import __version__, __version_info__
version = __version__
import configuration
import runcat
import solver_nfw
import utilities
import redsequence
import chisq_dist
import background
import cluster
import galaxy
import mask
import zlambda
import cluster_runner
| from _version import __version__, __version_info__
version = __version__
import config
import runcat
import solver_nfw
import utilities
import redsequence
import chisq_dist
import background
import cluster
import galaxy
import mask
import zlambda
import cluster_runner
| apache-2.0 | Python |
8fbb5492c9d59b1b8a5fe9b45ae72cbef8fa5dd8 | fix url slash | chhantyal/referly,chhantyal/referly,chhantyal/referly | referly/apiv1/urls.py | referly/apiv1/urls.py | from django.conf.urls import patterns, include, url
from .views import (UserRetriveAPIView, ReferralListCreateAPIView,
ReferralRetriveUpdateDestroyAPIView)
from rest_framework.authtoken.views import obtain_auth_token
urlpatterns = patterns('',
# authentication
url(r'^toke... | from django.conf.urls import patterns, include, url
from .views import (UserRetriveAPIView, ReferralListCreateAPIView,
ReferralRetriveUpdateDestroyAPIView)
from rest_framework.authtoken.views import obtain_auth_token
urlpatterns = patterns('',
# authentication
url(r'^toke... | bsd-3-clause | Python |
7a0d0809465328a44c8c4728ab9947b73faa899f | Fix python/setup.py outside CMake | wez/watchman,facebook/watchman,nodakai/watchman,wez/watchman,nodakai/watchman,wez/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,wez/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,wez/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,nodakai/watchma... | python/setup.py | python/setup.py | #!/usr/bin/env python
# vim:ts=4:sw=4:et:
import os
# To support out-of-source builds, we distinguish between the build
# dir and the source dir. The watchman cmake file arranges to
# export the source and binary dirs when it invokes us. If they're
# not set then we assume that the build dir == source dir.
guessed... | #!/usr/bin/env python
# vim:ts=4:sw=4:et:
import os
# To support out-of-source builds, we distinguish between the build
# dir and the source dir. The watchman cmake file arranges to
# export the source and binary dirs when it invokes us. If they're
# not set then we assume that the build dir == source dir.
src_dir... | mit | Python |
8433478267592685f2316105fcd492995e3ebff5 | bump version to 0.2 | loomchild/burstlogging | python/setup.py | python/setup.py | #!/usr/bin/env python
import os
from setuptools import setup
setup(
name = "burstlogging",
version = "0.2",
author = "Jarek Lipski",
author_email = "pub@loomchild.net",
description = ("Burst logging library."),
license = "MIT",
keywords = "logging",
url = "https://github.com/loomchild/... | #!/usr/bin/env python
import os
from setuptools import setup
setup(
name = "burstlogging",
version = "0.1",
author = "Jarek Lipski",
author_email = "pub@loomchild.net",
description = ("Burst logging library."),
license = "MIT",
keywords = "logging",
url = "https://github.com/loomchild/... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.