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 |
|---|---|---|---|---|---|---|---|---|
1c186e4fdd0ee965538060953295e88f91af39c0 | fix newline segment | saghul/shline | segments/newline.py | segments/newline.py | def add_newline_segment():
powerline.append('\\n', 0, 0)
add_newline_segment()
| def add_newline_segment():
powerline.append('\n', 0, 0)
add_newline_segment()
| mit | Python |
736fdfaba4737fab7540e81e362d532f054f99ed | Update Twitch.py | MikeJewski/ArduinoDeck,MikeJewski/ArduinoDeck,MikeJewski/ArduinoDeck | src/Twitch.py | src/Twitch.py | import re
import socket
import time
def SendMessage(msg,check):
ChannelName = ""
TwitchChatKey = ""
with open("Setup.txt","r") as data:
values = data.readlines()
for i in range(0,len(values)):
exec(values[i] )
HOST = "irc.chat.t... | import re
import socket
import time
def SendMessage(msg,check):
ChannelName = ""
TwitchChatKey = ""
with open("Setup.txt","r") as data:
values = data.readlines()
for i in range(0,len(values)):
exec(values[i] )
HOST = "irc.chat.t... | mit | Python |
d8d941abd23807630b9f8af997e9d19c131c72f2 | Use three-level versioning | welshjf/bitnomon,welshjf/bitnomon | bitnomon/__init__.py | bitnomon/__init__.py | # Copyright 2015 Jacob Welsh
#
# This file is part of Bitnomon; see the README for license information.
"""Monitoring GUI for a Bitcoin Core node"""
__version__ = '0.1.0'
# Whether to bundle dependencies (pyqtgraph) inside the package
BUNDLE = True
if BUNDLE:
import sys, os
sys.path.insert(0, os.path.join(o... | # Copyright 2015 Jacob Welsh
#
# This file is part of Bitnomon; see the README for license information.
"""Monitoring GUI for a Bitcoin Core node"""
__version__ = '0.1'
# Whether to bundle dependencies (pyqtgraph) inside the package
BUNDLE = True
if BUNDLE:
import sys, os
sys.path.insert(0, os.path.join(os.... | apache-2.0 | Python |
d56e337f9badf6e07ab0d9cdcc6cd55820b8abf1 | remove debug code | smartfile/client-python | smartfile/errors.py | smartfile/errors.py | import six
class APIError(Exception):
"SmartFile API base Exception."
pass
class RequestError(APIError):
""" Exception for issues regarding a request. """
def __init__(self, exc, *args, **kwargs):
self.exc = exc
self.detail = str(exc)
super(RequestError, self).__init__(*args,... | import six
class APIError(Exception):
"SmartFile API base Exception."
pass
class RequestError(APIError):
""" Exception for issues regarding a request. """
def __init__(self, exc, *args, **kwargs):
self.exc = exc
self.detail = str(exc)
super(RequestError, self).__init__(*args,... | mit | Python |
05f5b56a0a44a28f908aeab675f8a83e937ace60 | put code under if main statement | georgetown-analytics/dc-crimebusters,georgetown-analytics/dc-crimebusters | tests/Visualizing_Neightborhood_Data.py | tests/Visualizing_Neightborhood_Data.py | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 26 14:29:29 2015
@author: awoiz_000
Exploring spatial data
"""
import pandas as pd
from pandas.tools.plotting import scatter_matrix
import pysal
import numpy as np
import sys
def get_data_as_frame(filepath, columns):
open_dbf = pysal.open(filepath)
X = []
... | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 26 14:29:29 2015
@author: awoiz_000
Exploring spatial data
"""
import pandas as pd
from pandas.tools.plotting import scatter_matrix
import pysal
import numpy as np
import sys
def get_data_as_frame(filepath, columns):
open_dbf = pysal.open(filepath)
X = []
... | mit | Python |
e9c02fe9cd6a34e06b3342ef8af0c10e68ee1f79 | allow list-pool to accept 1-2 pool arguments | motivator/clusto,JTCunning/clusto,clusto/clusto,motivator/clusto,clusto/clusto,JTCunning/clusto,sloppyfocus/clusto,thekad/clusto,sloppyfocus/clusto,thekad/clusto | src/clusto/commands/list_pool.py | src/clusto/commands/list_pool.py | #!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
import argparse
import sys
import clusto
from clusto import drivers
from clusto import script_helper
class ListPool(script_helper.Script):
... | #!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
import argparse
import sys
import clusto
from clusto import drivers
from clusto import script_helper
class ListPool(script_helper.Script):
... | bsd-3-clause | Python |
7bd360d3f3293ca52102cedcab8d02dca4814c4d | Remove debugging statements | fedora-infra/kitchen,fedora-infra/kitchen | tests/subprocessdata/sigchild_ignore.py | tests/subprocessdata/sigchild_ignore.py | import os
import signal, sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from kitchen.pycompat27.subprocess import _subprocess as subprocess
# On Linux this causes os.waitpid to fail with OSError as the OS has already
# reaped our child process. The wait() passing the OSError on to the ca... | import os
import signal, sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
log = open('/var/tmp/subprocess', 'w')
log.write(os.path.join(os.path.dirname(__file__), '..', '..'))
log.close()
from kitchen.pycompat27.subprocess import _subprocess as subprocess
# On Linux this causes os.waitpid t... | lgpl-2.1 | Python |
949ad6594b759ebd91da142187cbb6f675117eea | Add newline | Gregory-Howard/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,raphael0202/spaCy,raphael0202/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,aikra... | spacy/ja/tag_map.py | spacy/ja/tag_map.py | # encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
"ADV": {POS: ADV},
"NOUN": {POS: NOUN},
"ADP": {POS: ADP},
"PRON": {POS: PRON},
"SCONJ": {POS: SCONJ},
"PROPN": {POS: PROPN},
"DET": {POS: DET},
"SYM": {POS: ... | # encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
"ADV": {POS: ADV},
"NOUN": {POS: NOUN},
"ADP": {POS: ADP},
"PRON": {POS: PRON},
"SCONJ": {POS: SCONJ},
"PROPN": {POS: PROPN},
"DET": {POS: DET},
"SYM": {POS: ... | mit | Python |
1c35bf9c4831babcdaabd9feb291a757ad298657 | Remove type annotation from `VERSION` as setuptools can't handle it | homeworkprod/dbb-ranking-parser | src/dbbrankingparser/__init__.py | src/dbbrankingparser/__init__.py | """
DBB Ranking Parser
~~~~~~~~~~~~~~~~~~
Extract league rankings from the DBB (Deutscher Basketball Bund e.V.)
website.
The resulting data is structured as a list of dictionaries.
Please note that rankings are usually only available for the current
season, but not those of the past.
:Copyright: 2006-2021 Jochen Ku... | """
DBB Ranking Parser
~~~~~~~~~~~~~~~~~~
Extract league rankings from the DBB (Deutscher Basketball Bund e.V.)
website.
The resulting data is structured as a list of dictionaries.
Please note that rankings are usually only available for the current
season, but not those of the past.
:Copyright: 2006-2021 Jochen Ku... | mit | Python |
839d493d2bc6dd29223cf415f83a7173ac936029 | Remove unused code | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website | src/epiweb/apps/banner/models.py | src/epiweb/apps/banner/models.py | from django.db import models
from django.db.models.signals import pre_save
class Category(models.Model):
name = models.SlugField()
description = models.CharField(max_length=250, blank=True)
def __unicode__(self):
return self.name
class Meta:
verbose_name_plural = "categories"
class I... | from django.db import models
from django.db.models.signals import pre_save
class Category(models.Model):
name = models.SlugField()
description = models.CharField(max_length=250, blank=True)
def __unicode__(self):
return self.name
class Meta:
verbose_name_plural = "categories"
class I... | agpl-3.0 | Python |
1d3ec589bbb2bee05749fb8a3ea82b406ddb9652 | adjust to css's patterns | pitomba/spriter | spriter/__init__.py | spriter/__init__.py | import datetime
VERSION = "0.0.6"
RELEASE_DATE = datetime.datetime(2013, 7, 5)
| import datetime
VERSION = "0.0.5"
RELEASE_DATE = datetime.datetime(2013, 7, 5)
| apache-2.0 | Python |
340f54c9e0d1e9d3ea5bc57f661dea8d3f99a826 | remove shot-git | rr-/dotfiles,rr-/dotfiles,rr-/dotfiles | cfg/xorg/__main__.py | cfg/xorg/__main__.py | from libdotfiles import HOME_DIR, PKG_DIR, packages, util
packages.try_install("xorg") # the server itself
packages.try_install("xclip") # for clip to work
packages.try_install("xorg-xinit") # for startx
packages.try_install("xorg-xsetroot") # to fix the mouse cursor
packages.try_install("xorg-xrandr") # to query... | from libdotfiles import HOME_DIR, PKG_DIR, packages, util
packages.try_install("xorg") # the server itself
packages.try_install("xclip") # for clip to work
packages.try_install("xorg-xinit") # for startx
packages.try_install("xorg-xsetroot") # to fix the mouse cursor
packages.try_install("xorg-xrandr") # to query... | mit | Python |
06ae1e9d9a11a9dcb77d1160e582e4842cbdfc06 | add cancel button | manducku/awesomepose,manducku/awesomepose,manducku/awesomepose,manducku/awesomepose | awesomepose/posts/forms/post.py | awesomepose/posts/forms/post.py | from django import forms
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, Fieldset, Button
from crispy_forms.bootstrap import (
PrependedText, PrependedAppendedText, FormActions)
from po... | from django import forms
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, Fieldset
from crispy_forms.bootstrap import (
PrependedText, PrependedAppendedText, FormActions)
from posts.mode... | mit | Python |
306611ad0c6a939068b2b2616ef33d4d01e82a75 | Change send_mail method to take emails list instead of users | patrick91/pycon,patrick91/pycon | backend/notifications/emails.py | backend/notifications/emails.py | from base64 import urlsafe_b64encode
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
def send_request_password_reset_mail(user, token):
b64_uid = urlsafe_b64encode(byte... | from base64 import urlsafe_b64encode
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
def send_request_password_reset_mail(user, token):
b64_uid = urlsafe_b64encode(byte... | mit | Python |
a982a43a5b95e2ec4b2dfb86d0c7664fa862c214 | add minor control during initial redis connection | ugurengin/redis-slave-check | check_redis_slave.py | check_redis_slave.py | #!/usr/bin/python
# Redis Slave Connectivity Check
# Ugur Engin
# 12 August, 2016
from optparse import OptionParser
import os, sys, redis, json
parser = OptionParser()
parser.add_option("-H", dest="host", type='string',
help="Slave redis host address")
parser.add_option("-P", dest="port", type='int... | #!/usr/bin/python
# Redis Slave Connectivity Check
# Ugur Engin
# 12 August, 2016
from optparse import OptionParser
import os, sys, redis, json
parser = OptionParser()
parser.add_option("-H", dest="host", type='string',
help="Slave redis host address")
parser.add_option("-P", dest="port", type='int... | mit | Python |
84b077ba27ef278281b0a9ff19cd00ff4ade7bda | Add allow_untrusted to default aptitude install | ella/citools,ella/citools | citools/buildbots.py | citools/buildbots.py | from buildbot.steps import shell
__all__ = (
"DatabaseBackupRestore", "CriticalTest", "DatabaseBackupRestore",
"AptitudeInstall", "DatabaseMigrate", "GitSetVersion", "BuildDebianPackage",
)
class CriticalShellCommand(shell.ShellCommand):
warnOnFailure = 1
flunkOnFailure = 1
haltOnFailure = 1
clas... | from buildbot.steps import shell
__all__ = (
"DatabaseBackupRestore", "CriticalTest", "DatabaseBackupRestore",
"AptitudeInstall", "DatabaseMigrate", "GitSetVersion", "BuildDebianPackage",
)
class CriticalShellCommand(shell.ShellCommand):
warnOnFailure = 1
flunkOnFailure = 1
haltOnFailure = 1
clas... | bsd-3-clause | Python |
79924999561d28d3af5a70b28f0bb247ef50cdc2 | add signal.lsim benchmark | pnedunuri/scipy,pschella/scipy,vanpact/scipy,rgommers/scipy,chatcannon/scipy,nmayorov/scipy,sauliusl/scipy,Eric89GXL/scipy,raoulbq/scipy,larsmans/scipy,njwilson23/scipy,pschella/scipy,bkendzior/scipy,endolith/scipy,richardotis/scipy,njwilson23/scipy,Srisai85/scipy,woodscn/scipy,Kamp9/scipy,richardotis/scipy,zxsted/scip... | benchmarks/benchmarks/signal.py | benchmarks/benchmarks/signal.py | from __future__ import division, absolute_import, print_function
from itertools import product
import numpy as np
try:
from scipy.signal import convolve2d, correlate2d, lti, lsim
except ImportError:
pass
from .common import Benchmark
class Convolve2D(Benchmark):
def setup(self):
np.random.seed... | from __future__ import division, absolute_import, print_function
from itertools import product
import numpy as np
try:
from scipy.signal import convolve2d, correlate2d
except ImportError:
pass
from .common import Benchmark
class Convolve2D(Benchmark):
def setup(self):
np.random.seed(1234)
... | bsd-3-clause | Python |
588bd5590e99ae7c28073275c1b4c4b1b8c82b69 | Clean manage.py | Data2Semantics/linkitup,Data2Semantics/linkitup,Data2Semantics/linkitup | src/manage.py | src/manage.py | #!/usr/bin/env python
import os
from app import app, db
from app.models import User
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split... | #!/usr/bin/env python
import os
from app import app, db
from app.models import User
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split... | mit | Python |
4434455a031f697c1847f9a81e5e00a5f5799684 | fix injection import | xavileon/midonet-sandbox,xavileon/midonet-sandbox,xavileon/midonet-sandbox,midonet/midonet-sandbox,midonet/midonet-sandbox,midonet/midonet-sandbox | src/midonet_sandbox/logic/cli.py | src/midonet_sandbox/logic/cli.py | # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# @author: Antonio Sagliocco <antonio@midokura.com>, Midokura
import logging
import keyword
from docopt import docopt
import sys
from midonet_sandbox.logic.injection import get_injector
from midonet_sandbox.assets.assets import BASE_ASSETS_PATH
from midonet_s... | # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# @author: Antonio Sagliocco <antonio@midokura.com>, Midokura
import logging
import keyword
from docopt import docopt
import sys
from injection import get_injector
from midonet_sandbox.assets.assets import BASE_ASSETS_PATH
from midonet_sandbox.logic.dispatche... | apache-2.0 | Python |
5c016ea684946f7f761262756baf933dbcaf5c09 | make adjustment | Zumium/boxes | boxes/handlers/list_allboxes.py | boxes/handlers/list_allboxes.py | from boxes import handlerBase
class ListHandler(handlerBase.BaseHandler):
def __init__(self):
super().__init__()
def handle(self):
import subprocess
#check number of arguments
if self.argumentNum != 0:
print('usage: boxes list')
return
#list unarchived boxes
print('Boxes:')
print(' ',end='')
... | from boxes import handlerBase
class ListHandler(handlerBase.BaseHandler):
def __init__(self):
super().__init__()
def handle(self):
import subprocess
#check number of arguments
if self.argumentNum != 0:
print('usage: boxes list')
return
#list unarchived boxes
print('Boxes:')
subprocess.call(['bo... | apache-2.0 | Python |
8581ad47a3915b601e9f43668fdc23b5fcd21e5c | initialize Monitor, just don't log it | bubbleboy14/cantools,bubbleboy14/cantools,bubbleboy14/cantools,bubbleboy14/cantools | cantools/scripts/pubsub/bots.py | cantools/scripts/pubsub/bots.py | import event, json, psutil
from cantools import config
from cantools.util import log
from actor import Actor
class BotMeta(type):
def __new__(cls, name, bases, attrs):
bc = type.__new__(cls, name, bases, attrs)
if name is not "Bot":
name is not "Monitor" and log("Initializing Bot Class: %s"%(name,), important=... | import event, json, psutil
from cantools import config
from cantools.util import log
from actor import Actor
class BotMeta(type):
def __new__(cls, name, bases, attrs):
bc = type.__new__(cls, name, bases, attrs)
if name not in ["Bot", "Monitor"]:
log("Initializing Bot Class: %s"%(name,), important=True)
conf... | mit | Python |
b3ae8ed9c17ed9371a80d14d97062136da225a92 | Revert year range end back to 2015 (2016 is not over) | datascopeanalytics/chicago-new-business,datascopeanalytics/chicago-new-business | src/chicago_flow.py | src/chicago_flow.py | #!/usr/bin/env python
import csv
import sys
import figs
def load_counts(filename):
counts = {}
with open(filename) as stream:
stream.readline()
reader = csv.reader(stream)
for row in reader:
year, count = map(int, row)
counts[year] = count
return counts
# ... | #!/usr/bin/env python
import csv
import sys
import figs
def load_counts(filename):
counts = {}
with open(filename) as stream:
stream.readline()
reader = csv.reader(stream)
for row in reader:
year, count = map(int, row)
counts[year] = count
return counts
# ... | unlicense | Python |
6df89fe8dc7f078d1a16c45e4f8e5f99e8ed4a09 | Verify database in create multisig address | martindale/orisi,orisi/orisi,martindale/orisi,orisi/orisi | src/client/tests.py | src/client/tests.py | from client import OracleClient
from client_db import ClientDb, MultisigRedeemDb
from test_data import ADDRESSES
from shared.bitcoind_client.bitcoinclient import BitcoinClient
from collections import Counter
from decimal import getcontext
from xmlrpclib import ProtocolError
import json
import os
import unittest
TEM... | from client import OracleClient
from client_db import ClientDb
from test_data import ADDRESSES
from shared.bitcoind_client.bitcoinclient import BitcoinClient
from collections import Counter
from decimal import getcontext
from xmlrpclib import ProtocolError
import os
import unittest
TEMP_CLIENT_DB_FILE = 'client_tes... | mit | Python |
24906f1ef1104223ac41b3fee1eaa3a8a2d5247b | Remove usused import | calpaterson/recall,calpaterson/recall,calpaterson/recall | src/refresh_debugging_fixture.py | src/refresh_debugging_fixture.py | #!/usr/bin/env python
import os
import convenience
settings = convenience.settings
def main():
os.environ["RECALL_DEBUG_MODE"] = "1"
convenience.load_settings()
convenience.wipe_mongodb()
convenience.wipe_elastic_search()
convenience.create_test_user(fixture_user=True)
db = convenience.get_d... | #!/usr/bin/env python
import os
import requests
import convenience
settings = convenience.settings
def main():
os.environ["RECALL_DEBUG_MODE"] = "1"
convenience.load_settings()
convenience.wipe_mongodb()
convenience.wipe_elastic_search()
convenience.create_test_user(fixture_user=True)
db = ... | agpl-3.0 | Python |
bd6a7f48215aefcb5fc8aa8e9c4e53127313f77c | update API usage | AlienVault-Engineering/service-manager | src/unittest/python/vcs_tests.py | src/unittest/python/vcs_tests.py | import os
from service_buddy.service import loader
from service_buddy.vcs.Bitbucket import BitbucketVCSProvider
from service_buddy.vcs.vcs import VCS, vcs_provider_map
from testcase_parent import ParentTestCase
DIRNAME = os.path.dirname(os.path.abspath(__file__))
class VCSTestCase(ParentTestCase):
def tearDown(... | import os
from service_buddy.service import loader
from service_buddy.vcs.Bitbucket import BitbucketVCSProvider
from service_buddy.vcs.vcs import VCS
from testcase_parent import ParentTestCase
DIRNAME = os.path.dirname(os.path.abspath(__file__))
class VCSTestCase(ParentTestCase):
def tearDown(self):
pas... | apache-2.0 | Python |
b4d3fbb0535074f2153b2b9bad53fdf654ddedd1 | Clean up the Bellman benchmarking code. | borg-project/borg | src/python/borg/tools/bench_bellman.py | src/python/borg/tools/bench_bellman.py | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from borg.tools.bench_bellman import main
raise SystemExit(main())
def main():
"""
Benchmark the Bellman plan computation code.
"""
from borg.portfolio.bellman import compute_bellman_plan
from bo... | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from borg.tools.bench_bellman import main
raise SystemExit(main())
def main():
"""
Benchmark the Bellman plan computation code.
"""
# need a place to dump profiling results
from tempfile import NamedTempor... | mit | Python |
bf2d457ae8173a1372bb0175bc8a08063c8e8e85 | Improve usefulness of server links disconnect messages if a server didn't start registering yet | Heufneutje/txircd | txircd/modules/extra/snotice_links.py | txircd/modules/extra/snotice_links.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implementer
from typing import Callable, List, Tuple
@implementer(IPlugin, IModuleData)
class SnoLinks(ModuleData):
name = "ServerNoticeLinks"
def actions(self) -> List[Tuple[str, int, Callable... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implementer
from typing import Callable, List, Tuple
@implementer(IPlugin, IModuleData)
class SnoLinks(ModuleData):
name = "ServerNoticeLinks"
def actions(self) -> List[Tuple[str, int, Callable... | bsd-3-clause | Python |
52555f8a1632ecf7ef70b291f759bc6848974553 | Move api to _api | yetizzz/zzz,yetizzz/zzz,slugin/slug.in,slugin/slug.in,yetizzz/zzz,slugin/slug.in | src/zzz/urls.py | src/zzz/urls.py | from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.conf import settings
urlpatterns = patterns('',
url(r'^$',
TemplateView.as_view(template_name='base.html'),
name='home'),
)
if settings.DEBUG:
urlpatterns += patterns('',
url(... | from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.conf import settings
urlpatterns = patterns('',
url(r'^$',
TemplateView.as_view(template_name='base.html'),
name='home'),
)
if settings.DEBUG:
urlpatterns += patterns('',
url(... | bsd-2-clause | Python |
e06c9b0f6cc2a415b2ed2b27996f9d3097ed6c00 | Replace XXX comments with explaination of what is going on, and change code to do 'the right thing'. While here, rename get_ner to get_feature, which is more descriptive...or is it? | rionda/dd-genomics,amwenger/dd-genomics,HazyResearch/dd-genomics,amwenger/dd-genomics,HazyResearch/dd-genomics,amwenger/dd-genomics,rionda/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics | code/dstruct/Word.py | code/dstruct/Word.py | #! /usr/bin/env python3
""" A Word class
Originally obtained from the 'pharm' repository, but modified.
"""
class Word(object):
insent_idx = None
word = None
pos = None
ner = None
lemma = None
dep_path = None
dep_parent = None
sent_id = None
box = None
def __init__(self, _s... | #! /usr/bin/env python3
""" A Word class
Originally obtained from the 'pharm' repository, but modified.
"""
class Word(object):
insent_idx = None
word = None
pos = None
ner = None
lemma = None
dep_path = None
dep_parent = None
sent_id = None
box = None
def __init__(self, _s... | apache-2.0 | Python |
e75436720a0dfb92c1807a83441eb32a2cc974ff | Update core to fix input error on python 3 | djds23/stacker-lang,djds23/stacker-lang | stacker/core.py | stacker/core.py | import argparse
import pprint
import sys
from builtins import input
from codecs import open
from os import path
import stacker
from stacker.lang import Stacker
from stacker.errors import StackerFileNotFound
def repl():
pp = pprint.PrettyPrinter(indent=4)
interpreter = Stacker()
def _exit(*args):
... | import argparse
import pprint
import sys
from codecs import open
from os import path
import stacker
from stacker.lang import Stacker
from stacker.errors import StackerFileNotFound
def repl():
pp = pprint.PrettyPrinter(indent=4)
interpreter = Stacker()
def _exit(*args):
sys.exit()
def _help... | mit | Python |
09416764a1b7aa197bacd44b10d33673c65ca8d9 | Document enum | UltrosBot/Ultros,UltrosBot/Ultros | system/protocols/capabilities.py | system/protocols/capabilities.py | # coding=utf-8
from enum import Enum, unique
__author__ = 'Sean'
__all__ = ["Capabilities"]
@unique
class Capabilities(Enum):
"""
An enum containing constants to declare what a protocol is capable of
You can use *protocol.get_capabilities()* or *protocol.has_capability(cap)*
to get all of a protocol... | # coding=utf-8
from enum import Enum, unique
__author__ = 'Sean'
__all__ = ["Capabilities"]
@unique
class Capabilities(Enum):
#: Messages can contain linebreaks
MULTILINE_MESSAGE = 0
#: Protocol uses channels
#: (rather than a single "channel" for the whole protocol)
MULTIPLE_CHANNELS = 1
... | artistic-2.0 | Python |
f79f4b044482c05cf1f2bf9c24c9b84e46968b19 | Add more logging to consumer fsm | pansapiens/mytardis,pansapiens/mytardis,steveandroulakis/mytardis,steveandroulakis/mytardis,pansapiens/mytardis,iiman/mytardis,iiman/mytardis,pansapiens/mytardis,steveandroulakis/mytardis,iiman/mytardis | tardis/apps/sync/consumer_fsm.py | tardis/apps/sync/consumer_fsm.py | import logging
from tardis.apps.sync.fields import State, FinalState, FSMField, \
map_return_to_transition, true_false_transition
from .transfer_service import TransferService, TransferClient
from .integrity import IntegrityCheck
from .signals import transfer_completed, transfer_failed
logger = logging.getLogg... | from tardis.apps.sync.fields import State, FinalState, FSMField, \
map_return_to_transition, true_false_transition
from .transfer_service import TransferService, TransferClient
from .integrity import IntegrityCheck
from .signals import transfer_completed, transfer_failed
class FailPermanent(FinalState):
d... | bsd-3-clause | Python |
c96395636b46bbb819bca1fcaa23afdc8d698ab5 | print colored diff on error | MarkLodato/vt100-parser,MarkLodato/vt100-parser | test/run_all.py | test/run_all.py | #!/usr/bin/python
"""
Run all of the t????-*.in tests in the current directory and compare with the
expected output.
"""
import sys, os
import glob
import difflib
from subprocess import Popen, PIPE
PROG = '../vt100.py'
IN_EXT = '.in'
FORMATS = ['text', 'html']
def slurp(filename):
with open(filename, 'rb') as f:... | #!/usr/bin/python
"""
Run all of the t????-*.in tests in the current directory and compare with the
expected output.
"""
import sys, os
import glob
from subprocess import Popen, PIPE
PROG = '../vt100.py'
IN_EXT = '.in'
FORMATS = ['text', 'html']
def slurp(filename):
with open(filename, 'rb') as f:
return... | mit | Python |
ec9d1e75d3640b3fa605dfcdcc5ea53d4c311a6f | raise max file size limit | hmoco/osf.io,cslzchen/osf.io,SSJohns/osf.io,abought/osf.io,aaxelb/osf.io,wearpants/osf.io,kwierman/osf.io,doublebits/osf.io,CenterForOpenScience/osf.io,leb2dg/osf.io,adlius/osf.io,emetsger/osf.io,alexschiller/osf.io,Johnetordoff/osf.io,KAsante95/osf.io,mluo613/osf.io,GageGaskins/osf.io,chrisseto/osf.io,felliott/osf.io,... | website/addons/osfstorage/__init__.py | website/addons/osfstorage/__init__.py | #!/usr/bin/env python
# encoding: utf-8
from . import routes, views, model
from . import listeners # noqa
MODELS = [model.OsfStorageNodeSettings]
NODE_SETTINGS_MODEL = model.OsfStorageNodeSettings
ROUTES = [
routes.api_routes
]
SHORT_NAME = 'osfstorage'
FULL_NAME = 'OSF Storage'
OWNERS = ['node']
ADDED_DEFAU... | #!/usr/bin/env python
# encoding: utf-8
from . import routes, views, model
from . import listeners # noqa
MODELS = [model.OsfStorageNodeSettings]
NODE_SETTINGS_MODEL = model.OsfStorageNodeSettings
ROUTES = [
routes.api_routes
]
SHORT_NAME = 'osfstorage'
FULL_NAME = 'OSF Storage'
OWNERS = ['node']
ADDED_DEFAU... | apache-2.0 | Python |
a5e1c8c17a1a150162d5935202e4243074dcf1ab | make redirects work | sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp | tcamp/urls.py | tcamp/urls.py | from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^logistics/$', RedirectView.as_view(url="/about/logistics/")),
url(r'^sessions/$', RedirectView.as_view(url="/schedu... | from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^treenav/', include('treenav.urls')),
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(ad... | bsd-3-clause | Python |
da4f981e6e1eb10a21963ce85221749cb7bf29f2 | Update this with the same option as single_fs.py | pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,vovojh/gem5,pombredanne/http-repo.gem5.org-g... | configs/test/test.py | configs/test/test.py | # Simple test script
#
# Alpha: "m5 test.py"
# MIPS: "m5 test.py -a Mips -c hello_mips"
import os, optparse, sys
import m5
from m5.objects import *
from FullO3Config import *
# parse command-line arguments
parser = optparse.OptionParser(option_list=m5.standardOptions)
parser.add_option("-c", "--cmd", default="hello"... | # Simple test script
#
# Alpha: "m5 test.py"
# MIPS: "m5 test.py -a Mips -c hello_mips"
import os, optparse, sys
import m5
from m5.objects import *
from FullO3Config import *
# parse command-line arguments
parser = optparse.OptionParser(option_list=m5.standardOptions)
parser.add_option("-c", "--cmd", default="hello"... | bsd-3-clause | Python |
773c3da6f2afe8be9b13a2262c760013e04da638 | Fix timeline module import | HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core | core/descriptives.py | core/descriptives.py | from __future__ import division, print_function
import datetime
from timeline import module_timeline
from collections import *
def describe( data ):
if len(data) == 0:
print( "Dataset empty." )
return
print( "Entries together", len(data) )
print( "Number of different authors", len( set(... | from __future__ import division, print_function
import datetime
import timeline
from collections import *
def describe( data ):
if len(data) == 0:
print( "Dataset empty." )
return
print( "Entries together", len(data) )
print( "Number of different authors", len( set( map( lambda d: d['cr... | mit | Python |
fbaae3249c2f4561b58014a4a1c13c196fb069a9 | Update setup.py | CannyLab/tsne-cuda,CannyLab/tsne-cuda,CannyLab/tsne-cuda,CannyLab/tsne-cuda,CannyLab/tsne-cuda | src/python/setup.py | src/python/setup.py | from distutils.core import setup
setup(
name='tsnecuda',
version='0.1.0',
author='Chan, David M., Huang, Forrest., Rao, Roshan.',
author_email='davidchan@berkeley.edu,forrest_huang@berkeley.edu,roshan_rao@berkeley.edu',
packages=['tsnecuda', 'tsnecuda.test'],
package_data={'tsnecuda': ['libtsne... | from distutils.core import setup
setup(
name='PyCTSNE',
version='0.1.0',
author='David M. Chan',
author_email='davidchan@berkeley.edu',
packages=['pyctsne', 'pyctsne.test'],
package_data={'pyctsne': ['libpyctsne.so']},
scripts=[],
url='',
license='LICENSE.txt',
description='CUDA... | bsd-3-clause | Python |
694966fc0e238f086b3af0e2d1594383d781925e | Use dxpy toolkit version as Python package version | dnanexus/dx-toolkit,dnanexus/dx-toolkit,andyshinn/dx-toolkit,andyshinn/dx-toolkit,andyshinn/dx-toolkit,johnwallace123/dx-toolkit,andyshinn/dx-toolkit,dnanexus/dx-toolkit,johnwallace123/dx-toolkit,dnanexus/dx-toolkit,olegnev/dx-toolkit,dnanexus/dx-toolkit,olegnev/dx-toolkit,johnwallace123/dx-toolkit,andyshinn/dx-toolkit... | src/python/setup.py | src/python/setup.py | #!/usr/bin/env python
import os, sys, glob
from setuptools import setup, find_packages
if sys.version_info < (2, 7):
raise Exception("dxpy requires Python >= 2.7")
from dxpy.toolkit_version import version
# Grab all the scripts from dxpy/scripts and install them without their .py extension.
# Replace underscore... | #!/usr/bin/env python
import os, sys, glob
from setuptools import setup, find_packages
if sys.version_info < (2, 7):
raise Exception("dxpy requires Python >= 2.7")
# Grab all the scripts from dxpy/scripts and install them without their .py extension.
# Replace underscores with dashes.
# See Readme.md for details... | apache-2.0 | Python |
00a01cabf9373e12398e22983251127014e07f97 | remove CA from default conf | telefonicaid/orchestrator,telefonicaid/orchestrator | src/settings/dev.py | src/settings/dev.py | """
(c) Copyright 2015 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... | """
(c) Copyright 2015 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... | agpl-3.0 | Python |
bd9f9b0d41921ff65188017b1239992e95f83dbf | remove unused imports | DIRECT-Energy-Storage/ELA,DIRECT-Energy-Storage/ELA | test_mapping.py | test_mapping.py | from ela import *
def test_geojson_to_df():
assert ela.geojson_to_df(states).polygon[0] == ela.geojson_to_df(states).polygon[3], "Geometry types are not similar for given locations in Alabama and Arizona"
return
def test_prediction_map():
assert len(vars(ela.prediction_map(states,'gen')))==len(vars(ela.pr... | import ela
<<<<<<< HEAD
from ela import *
import ela.mapping as mapping
import folium
import pandas as pd
import json
import numpy as np
import IPython.display
def test_geojson_to_df():
assert ela.geojson_to_df(states).polygon[0] == ela.geojson_to_df(states).polygon[3], "Geometry types are not similar for given l... | mit | Python |
6c964258cda1706db2ff8c6d7bd5f856c877f9ee | set rel version | w1z2g3/crossbar,w1z2g3/crossbar,w1z2g3/crossbar,NinjaMSP/crossbar,w1z2g3/crossbar,NinjaMSP/crossbar,NinjaMSP/crossbar,w1z2g3/crossbar,w1z2g3/crossbar,w1z2g3/crossbar | crossbar/__init__.py | crossbar/__init__.py | #####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... | #####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... | agpl-3.0 | Python |
543c58d57abb55101b2b81648e31262fe951610e | Use sys.exit() instead of exit() | ad1217/Cura,Curahelper/Cura,Curahelper/Cura,fxtentacle/Cura,ad1217/Cura,markwal/Cura,totalretribution/Cura,totalretribution/Cura,senttech/Cura,markwal/Cura,ynotstartups/Wanhao,bq/Ultimaker-Cura,hmflash/Cura,hmflash/Cura,fieldOfView/Cura,fxtentacle/Cura,bq/Ultimaker-Cura,senttech/Cura,fieldOfView/Cura,ynotstartups/Wanha... | cura/CrashHandler.py | cura/CrashHandler.py | import sys
import platform
import traceback
import webbrowser
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
def show(type, value, tb):
application = QCoreApplication.instance()
if not applicatio... | import sys
import platform
import traceback
import webbrowser
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
def show(type, value, tb):
application = QCoreApplication.instance()
if not applicatio... | agpl-3.0 | Python |
37eeecd3d4d1e6d2972565961b5c31731ae55ec7 | Test the an empty document results in a test failure. | bnkr/servequnit,bnkr/servequnit,bnkr/servequnit,bnkr/selenit,bnkr/selenit | tests/tester.py | tests/tester.py | import os
from unittest import TestCase
from servequnit.factory import ServerFactory
from servequnit.tester import QunitSeleniumTester, TestFailedError
class QunitSeleniumTesterTestCase(TestCase):
def _make_tester(self, server, suffix=None):
suffix = suffix or "oneshot/"
url = server.url + suffix
... | import os
from unittest import TestCase
from servequnit.factory import ServerFactory
from servequnit.tester import QunitSeleniumTester, TestFailedError
class QunitSeleniumTesterTestCase(TestCase):
def _make_tester(self, server, suffix=None):
suffix = suffix or "oneshot/"
url = server.url + suffix
... | mit | Python |
ac982754335654b003c455bd780cb14f618b08d6 | test vectors should not be transposed | juditacs/dsl,juditacs/dsl | dsl/representation/PCA.py | dsl/representation/PCA.py | from sklearn.decomposition import PCA
import numpy as np
class PcaEncoder(object):
def __init__(self, latentDimension):
self.latentDimension = latentDimension
self.model = PCA(n_components=self.latentDimension, whiten=True)
def train(self, data):
self.data = data
self.model.f... | from sklearn.decomposition import PCA
import numpy as np
class PcaEncoder(object):
def __init__(self, latentDimension):
self.latentDimension = latentDimension
self.model = PCA(n_components=self.latentDimension, whiten=True)
def train(self, data):
self.data = data
self.model.f... | mit | Python |
6a8215845e3cea4b6fc0f178f560243861674b6c | Load queryset dynamically instead upon server start | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | dthm4kaiako/dtta/views.py | dthm4kaiako/dtta/views.py | """Views for DTTA application."""
from django.views import generic
from django.utils.timezone import now
from utils.mixins import RedirectToCosmeticURLMixin
from dtta.models import (
Page,
NewsArticle,
RelatedLink,
)
class HomeView(generic.base.TemplateView):
"""View for DTTA homepage."""
templa... | """Views for DTTA application."""
from django.views import generic
from django.utils.timezone import now
from utils.mixins import RedirectToCosmeticURLMixin
from dtta.models import (
Page,
NewsArticle,
RelatedLink,
)
class HomeView(generic.base.TemplateView):
"""View for DTTA homepage."""
templa... | mit | Python |
af1605b7f0343aa2959039d80db35b899275221c | Update main.py | caiyunapp/qa-badge,caiyunapp/qa-badge | src/webhook/main.py | src/webhook/main.py | # -*- coding: utf-8 -*-
import os
from flask import Flask
application = Flask(__name__)
route = application.route
application.debug = True
@route('/qps/caiyun-backend-wrapper-new')
def index():
cmd = "cd caiyun-backend-wrapper-new; source $HOME/bin/develop; $PRJ_HOME/bin/pref-test"
os.system("ssh caiyun@inn... | # -*- coding: utf-8 -*-
import os
from flask import Flask
application = Flask(__name__)
route = application.route
application.debug = True
@route('/qps/caiyun-backend-wrapper-new')
def index():
cmd = "cd caiyun-backend-wrapper-new"
cmd = "%s; source develop; bin/pref-test" % cmd
os.system("ssh caiyun@in... | mit | Python |
c15722533da7db5e00c315bb4057d7184c377161 | Remove unused import | SambitAcharya/coala,aptrishu/coala,sagark123/coala,svsn2117/coala,arush0311/coala,impmihai/coala,sudheesh001/coala,SambitAcharya/coala,refeed/coala,dagdaggo/coala,sils1297/coala,lonewolf07/coala,karansingh1559/coala,karansingh1559/coala,incorrectusername/coala,jayvdb/coala,Asnelchristian/coala,Nosferatul/coala,scottbel... | coalib/bearlib/abstractions/SectionCreatable.py | coalib/bearlib/abstractions/SectionCreatable.py | from coalib.settings.FunctionMetadata import FunctionMetadata
class SectionCreatable:
"""
A SectionCreatable is an object that is creatable out of a section object. Thus this is the class for many helper
objects provided by the bearlib.
If you want to use an object that inherits from this class the f... | from coalib.settings.FunctionMetadata import FunctionMetadata
from coalib.settings.Section import Section
class SectionCreatable:
"""
A SectionCreatable is an object that is creatable out of a section object. Thus this is the class for many helper
objects provided by the bearlib.
If you want to use a... | agpl-3.0 | Python |
a5dfa4caaa2ff28fc486ddb7c54155aed99e6f52 | Fix error (typo) in test/basic.py | iconpin/sputnik-python | test/basic.py | test/basic.py | import unittest
import requests
import sputnik
class BasicTest(unittest.TestCase):
def setUp(self):
pass
def test_number_of_results(self):
requests_res = requests.get(
'http://ws.spotify.com/search/1'
'/track.json?q=nine+inch+nails+broken'
).js... | import unittest
import requests
import sputnik
class BasicTest(unittest.TestCase):
def setUp(self):
pass
def test_number_of_results(self):
requests_result = requests.get(
'http://ws.spotify.com/search/1'
'/track.json?q=nine+inch+nails+broken'
)... | mit | Python |
b6dd53bb4f2e96964a0c74e1e10a1cf0c46a5c99 | stop tests fix | DrimTim32/py_proj_transport | tests/cross_version/test_stop.py | tests/cross_version/test_stop.py | import pytest
from core.simulation.passenger_group import PassengersGroup
from utils.helpers import get_full_class_name
import sys
if sys.version_info[0] >= 3:
import unittest.mock as mock
else:
import mock
from mock import PropertyMock, MagicMock
from core.simulation.stop import Stop
def test_create():
... | import pytest
from core.simulation.passenger_group import PassengersGroup
from utils.helpers import get_full_class_name
import sys
if sys.version_info[0] >= 3:
import unittest.mock as mock
else:
import mock
from mock import PropertyMock
from core.simulation.stop import Stop
def test_create():
s = Stop("n... | mit | Python |
4027cccb929308528666e1232eeebfc1988e0ab1 | Use generator for IAM template names | gogoair/foremast,gogoair/foremast | tests/iam/test_iam_valid_json.py | tests/iam/test_iam_valid_json.py | """Test IAM Policy templates are valid JSON."""
import jinja2
from foremast.iam.construct_policy import render_policy_template
from foremast.utils.templates import LOCAL_TEMPLATES
def iam_templates():
"""Generate list of IAM templates."""
jinjaenv = jinja2.Environment(loader=jinja2.FileSystemLoader([LOCAL_TE... | """Test IAM Policy templates are valid JSON."""
import jinja2
from foremast.iam.construct_policy import render_policy_template
from foremast.utils.templates import LOCAL_TEMPLATES
def test_all_iam_templates():
"""Verify all IAM templates render as proper JSON."""
jinjaenv = jinja2.Environment(loader=jinja2.F... | apache-2.0 | Python |
00b566ee36a5e826a8f5f6da6d0575ffe03bb4f5 | Refactor tests | tonyseek/sqlalchemy-utils,marrybird/sqlalchemy-utils,cheungpat/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,tonyseek/sqlalchemy-utils,rmoorman/sqlalchemy-utils,spoqa/sqlalchemy-utils,JackWink/sqlalchemy-utils | tests/test_translation_hybrid.py | tests/test_translation_hybrid.py | import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy_utils import TranslationHybrid
from tests import TestCase
class TestTranslationHybrid(TestCase):
dns = 'postgres://postgres@localhost/sqlalchemy_utils_test'
def create_models(self):
class City(self.Base):
... | import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy_utils import TranslationHybrid
from tests import TestCase
class TestTranslationHybrid(TestCase):
dns = 'postgres://postgres@localhost/sqlalchemy_utils_test'
def create_models(self):
class City(self.Base):
... | bsd-3-clause | Python |
e3739ed1e0dea0fc4558b4b3bc0b75b7c90c2408 | Return None from cache if not found | trygveaa/python-tunigo | tunigo/cache.py | tunigo/cache.py | from __future__ import unicode_literals
import time
class Cache(object):
def __init__(self, cache_time):
self._cache = {}
self._cache_time = cache_time
def __repr__(self):
return 'Cache(cache_time={})'.format(self._cache_time)
def _cache_valid(self, key):
return (key in... | from __future__ import unicode_literals
import time
class Cache(object):
def __init__(self, cache_time):
self._cache = {}
self._cache_time = cache_time
def __repr__(self):
return 'Cache(cache_time={})'.format(self._cache_time)
def _cache_valid(self, key):
return (key in... | apache-2.0 | Python |
279a8bc81fcd9e8a5d38cb43d7d3609601645766 | Update Eigen to: https://gitlab.com/libeigen/eigen/-/commit/954879183b1e008d7f0fefb97e48a925c4e3fb16 | tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,paolodedios/tensorflow,sarvex/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,karllessard/tensorflow,t... | third_party/eigen3/workspace.bzl | third_party/eigen3/workspace.bzl | """Provides the repository macro to import Eigen."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports Eigen."""
# Attention: tools parse and update these lines.
EIGEN_COMMIT = "954879183b1e008d7f0fefb97e48a925c4e3fb16"
EIGEN_SHA256 = "f3e8d419c39f651f50a86fd7ca2153a60e290d9288... | """Provides the repository macro to import Eigen."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports Eigen."""
# Attention: tools parse and update these lines.
EIGEN_COMMIT = "3d9051ea84a5089b277c88dac456b3b1576bfa7f"
EIGEN_SHA256 = "1e473b94966cd3084c6df5b4fe0612ea681ac0ae66... | apache-2.0 | Python |
34fb02d09573e712caf3a68fd02afee933663827 | Add Pipeline (SAX+L2) example | rtavenar/tslearn | tslearn/docs/examples/plot_neighbors.py | tslearn/docs/examples/plot_neighbors.py | # -*- coding: utf-8 -*-
"""
Nearest neighbors
=================
This example illustrates the use of nearest neighbor methods for database search and classification tasks.
"""
# Author: Romain Tavenard
# License: BSD 3 clause
from __future__ import print_function
import numpy
from sklearn.metrics import accuracy_scor... | # -*- coding: utf-8 -*-
"""
Nearest neighbors
=================
This example illustrates the use of nearest neighbor methods for database search and classification tasks.
"""
# Author: Romain Tavenard
# License: BSD 3 clause
from __future__ import print_function
import numpy
from sklearn.metrics import accuracy_scor... | bsd-2-clause | Python |
dfb4714430b6ce91f143e491b6f679d5cfbd5d60 | fix for missing parameter | tndatacommons/tndata_backend,izzyalonso/tndata_backend,izzyalonso/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend | tndata_backend/goals/managers.py | tndata_backend/goals/managers.py | from django.db import models
class TriggerManager(models.Manager):
"""A simple manager for the Trigger model. This class adds a few convenience
methods to the regular api:
* custom() -- the set of Triggers that are associated with a user
* default() -- the set of default Triggers (not associated with... | from django.db import models
class TriggerManager(models.Manager):
"""A simple manager for the Trigger model. This class adds a few convenience
methods to the regular api:
* custom() -- the set of Triggers that are associated with a user
* default() -- the set of default Triggers (not associated with... | mit | Python |
e1f244db53ad2cdb68ff64663ee12dc29ca4b505 | change imports for new module structure (#1300) | spodkowinski/cassandra-dtest,iamaleksey/cassandra-dtest,pauloricardomg/cassandra-dtest,snazy/cassandra-dtest,pauloricardomg/cassandra-dtest,aweisberg/cassandra-dtest,iamaleksey/cassandra-dtest,krummas/cassandra-dtest,bdeggleston/cassandra-dtest,stef1927/cassandra-dtest,pcmanus/cassandra-dtest,stef1927/cassandra-dtest,b... | upgrade_tests/bootstrap_upgrade_test.py | upgrade_tests/bootstrap_upgrade_test.py | from bootstrap_test import BaseBootstrapTest
from tools.decorators import since, no_vnodes
class TestBootstrapUpgrade(BaseBootstrapTest):
__test__ = True
"""
@jira_ticket CASSANDRA-11841
Test that bootstrap works with a mixed version cluster
In particular, we want to test that keep-alive is not s... | from bootstrap_test import BaseBootstrapTest
from tools import since, no_vnodes
class TestBootstrapUpgrade(BaseBootstrapTest):
__test__ = True
"""
@jira_ticket CASSANDRA-11841
Test that bootstrap works with a mixed version cluster
In particular, we want to test that keep-alive is not sent
to ... | apache-2.0 | Python |
c1cf02cbea8ade829eb30eaa83e5b282bd31b32a | fix tests | taizilongxu/shadowsocks,bartley-le/shadowsocks,Ricardo666666/shadowsocks,chaonet/shadowsocks,030io/shadowsocks,lecason/shadowsocks,zhujiangang/shadowsocks,Mucid/shadowsocks,hanguofeng/shadowsocks,danny200309/shadowsocks,liberize/shadowsocks,bradparks/shadowsocks,Xiaolang0/shadowsocks,nickyfoto/shadowsocks,BMan-L/shadow... | tests/test.py | tests/test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import signal
import select
import time
from subprocess import Popen, PIPE
sys.path.insert(0, './')
if 'salsa20' in sys.argv[-1]:
from shadowsocks import encrypt_salsa20
encrypt_salsa20.test()
print 'encryption test passed'
p1 = Popen(['pyth... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import signal
import select
import time
from subprocess import Popen, PIPE
sys.path.insert(0, '../')
if 'salsa20' in sys.argv[-1]:
from shadowsocks import encrypt_salsa20
encrypt_salsa20.test()
print 'encryption test passed'
p1 = Popen(['pyt... | apache-2.0 | Python |
8f0caecc4accf8258e2cae664181680973e1add6 | Fix to remove DeprecationWarning message from test log | hftools/hftools | hftools/dataset/tests/test_helper.py | hftools/dataset/tests/test_helper.py | # -*- coding: ISO-8859-1 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------------... | # -*- coding: ISO-8859-1 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------------... | bsd-3-clause | Python |
9846197f976b827b809da934693aaf301793a7b5 | Make gunicorn restart/reload on spa source code change and actually use those changes. | btubbs/spa,dmonroy/spa,btubbs/spa,michalwasilewski/spa,dmonroy/spa,dmonroy/spa,michalwasilewski/spa,btubbs/spa | spa/utils.py | spa/utils.py | import multiprocessing
import os
import sys
from gunicorn.app.base import Application as GunicornApplication
from werkzeug._compat import PY2
def import_class(path):
try:
module, dot, klass = path.rpartition('.')
imported = __import__(module, globals(), locals(), [klass, ], -1)
return get... | import multiprocessing
import os
import sys
from gunicorn.app.base import Application as GunicornApplication
from werkzeug._compat import PY2
def import_class(path):
try:
module, dot, klass = path.rpartition('.')
imported = __import__(module, globals(), locals(), [klass, ], -1)
return get... | bsd-3-clause | Python |
9d5ed2fed16058a7b5a427ec512efa49449bd7de | Fix Shear Force | yajnab/gantry_girder_design | gantry.py | gantry.py | #
##Gantry Girder Designer
##Author-Yajnavalkya Bandyopadhyay
##email-yajnab@gmail.com
#
print("Gantry Girder Designer")
print("Author- Yajnavalkya Bandyopadhyay")
print("email- yajnab@gmail.com")
import numpy as np
#Constants
FOS = 1.5 #Factor of Safety
W_Crane = 200#Weight of the Crane
W_Crab = 40#Weight of the Cr... | #
##Gantry Girder Designer
##Author-Yajnavalkya Bandyopadhyay
##email-yajnab@gmail.com
#
print("Gantry Girder Designer")
print("Author- Yajnavalkya Bandyopadhyay")
print("email- yajnab@gmail.com")
import numpy as np
#Constants
FOS = 1.5 #Factor of Safety
W_Crane = 200#Weight of the Crane
W_Crab = 40#Weight of the Cr... | mit | Python |
f5983348940e3acf937c7ddfded73f08d767c5a1 | Add vltstd to include path | jamesbowman/swapforth,zuloloxi/swapforth,uho/swapforth,uho/swapforth,zuloloxi/swapforth,GuzTech/swapforth,jamesbowman/swapforth,jamesbowman/swapforth,GuzTech/swapforth,uho/swapforth,RGD2/swapforth,zuloloxi/swapforth,RGD2/swapforth,GuzTech/swapforth,zuloloxi/swapforth,GuzTech/swapforth,uho/swapforth,RGD2/swapforth,james... | j1a/verilator/setup.py | j1a/verilator/setup.py | from distutils.core import setup
from distutils.extension import Extension
from os import system
setup(name='vsimj1a',
ext_modules=[
Extension('vsimj1a',
['vsim.cpp'],
depends=["obj_dir/Vv3__ALL.a"],
extra_objects=["obj_dir/verilated.o", "obj_dir/Vj1a__ALL.a"],
... | from distutils.core import setup
from distutils.extension import Extension
from os import system
setup(name='vsimj1a',
ext_modules=[
Extension('vsimj1a',
['vsim.cpp'],
depends=["obj_dir/Vv3__ALL.a"],
extra_objects=["obj_dir/verilated.o", "obj_dir/Vj1a__ALL.a"],
... | bsd-3-clause | Python |
a8e91b655a03ea4b8bb58c52d892f7a369bb556c | clean unused imports | simodalla/django-custom-email-user,simodalla/django-custom-email-user | custom_email_user/managers.py | custom_email_user/managers.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import BaseUserManager
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.utils import timezone
from django.utils.translation import ugettext as... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import BaseUserManager
from django.core.exceptions import ValidationError
from django.core.mail import mail_admins
from django.core.validators import validate_email
from django.template import loader, Conte... | bsd-3-clause | Python |
153682bd6cb6968544cecee77f440a587c66ed41 | Change OFPP_CONTROLLER to OF1.2-compliant value | raphaelvrosa/RouteFlow,c3m3gyanesh/RouteFlow-OpenConfig,routeflow/RouteFlow,srijanmishra/RouteFlow,arazmj/RouteFlow,CPqD/RouteFlow,c3m3gyanesh/RouteFlow-OpenConfig,srijanmishra/RouteFlow,ralph-mikera/RouteFlow-1,CPqD/RouteFlow,raphaelvrosa/RouteFlow,raphaelvrosa/RouteFlow,ralph-mikera/RouteFlow-1,ralph-mikera/RouteFlow... | rflib/defs.py | rflib/defs.py | MONGO_ADDRESS = "192.169.1.1:27017"
MONGO_DB_NAME = "db"
RFCLIENT_RFSERVER_CHANNEL = "rfclient<->rfserver"
RFSERVER_RFPROXY_CHANNEL = "rfserver<->rfproxy"
RFTABLE_NAME = "rftable"
RFCONFIG_NAME = "rfconfig"
RFSERVER_ID = "rfserver"
RFPROXY_ID = "rfproxy"
DEFAULT_RFCLIENT_INTERFACE = "eth0"
RFVS_PREFIX = 0x72667673... | MONGO_ADDRESS = "192.169.1.1:27017"
MONGO_DB_NAME = "db"
RFCLIENT_RFSERVER_CHANNEL = "rfclient<->rfserver"
RFSERVER_RFPROXY_CHANNEL = "rfserver<->rfproxy"
RFTABLE_NAME = "rftable"
RFCONFIG_NAME = "rfconfig"
RFSERVER_ID = "rfserver"
RFPROXY_ID = "rfproxy"
DEFAULT_RFCLIENT_INTERFACE = "eth0"
RFVS_PREFIX = 0x72667673... | apache-2.0 | Python |
0f7732d3ceb67ecd445bb4fe2fee1edf4ce8a2f4 | Tweak raw text parameter name | silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock | rock/utils.py | rock/utils.py | from __future__ import unicode_literals
import os
try:
from io import StringIO
except ImportError: # pragma: no cover
from StringIO import StringIO
from rock.exceptions import ConfigError
ROCK_SHELL = (os.environ.get('ROCK_SHELL') or '/bin/bash -c').split()
ROCK_SHELL.insert(1, os.path.basename(ROCK_SHELL[0]... | from __future__ import unicode_literals
import os
try:
from io import StringIO
except ImportError: # pragma: no cover
from StringIO import StringIO
from rock.exceptions import ConfigError
ROCK_SHELL = (os.environ.get('ROCK_SHELL') or '/bin/bash -c').split()
ROCK_SHELL.insert(1, os.path.basename(ROCK_SHELL[0]... | mit | Python |
8b719b8232290ed962f7237b4a75f7f0390b4f7d | Fix Python 3 compatibility for R inspect package | Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client | binstar_client/inspect_package/r.py | binstar_client/inspect_package/r.py | import tarfile
import email.parser
from os import path
# Python 3 requires BytesParser which doesn't exist in Python 2
Parser = getattr(email.parser, 'BytesParser', email.parser.Parser)
def parse_package_list(package_spec):
if not package_spec:
return []
return [
spec.strip()
for spec... | import tarfile
from email.parser import Parser
from os import path
def parse_package_list(package_spec):
if not package_spec:
return []
return [
spec.strip()
for spec in package_spec.split(',')
]
def inspect_r_package(filename, fileobj, *args, **kwargs):
tf = tarfile.open(fil... | bsd-3-clause | Python |
93929ca9b8e5b287af3852accb45de56c9614ced | update migration revision | xlqian/navitia,xlqian/navitia,pbougue/navitia,pbougue/navitia,Tisseo/navitia,Tisseo/navitia,CanalTP/navitia,CanalTP/navitia,xlqian/navitia,kinnou02/navitia,xlqian/navitia,xlqian/navitia,Tisseo/navitia,CanalTP/navitia,CanalTP/navitia,pbougue/navitia,kinnou02/navitia,kinnou02/navitia,CanalTP/navitia,Tisseo/navitia,Tisseo... | source/tyr/migrations/versions/204aae05372a_add_max_duration_direct_path_by_mode.py | source/tyr/migrations/versions/204aae05372a_add_max_duration_direct_path_by_mode.py | """max_{mode}_direct_path_duration
these parameters are nullable. When null, there is no limit
Revision ID: 204aae05372a
Revises: 1c8334cd1997
Create Date: 2019-03-25 15:49:29.025453
"""
# revision identifiers, used by Alembic.
revision = '204aae05372a'
down_revision = '1c8334cd1997'
from alembic import op
import s... | """max_{mode}_direct_path_duration
these parameters are nullable. When null, there is no limit
Revision ID: 204aae05372a
Revises: 16d8bca1453b
Create Date: 2019-03-25 15:49:29.025453
"""
# revision identifiers, used by Alembic.
revision = '204aae05372a'
down_revision = '16d8bca1453b'
from alembic import op
import s... | agpl-3.0 | Python |
e10f4bdca95b0a49bb9f26cb2e532566936a62c8 | Add __all__ variable to __init__.py, since we don't want to include the old Locust and HttpLocust classes (which are now just helper classes that raises DeprecationWarning) in the public API (e.g. for IDE/editor completion). | mbeacom/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,locustio/locust | locust/__init__.py | locust/__init__.py | # Apply Gevent monkey patching of stdlib
from gevent import monkey as _monkey
_monkey.patch_all()
from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, tag, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_... | # Apply Gevent monkey patching of stdlib
from gevent import monkey as _monkey
_monkey.patch_all()
from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, tag, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_... | mit | Python |
bf0944c8dfd36d4ecc2e23ffa25a3f53f109b99f | Fix linting errors | HTTPArchive/beta.httparchive.org,HTTPArchive/beta.httparchive.org,HTTPArchive/beta.httparchive.org | timestamps.py | timestamps.py | import json
import datetime
import logging
timestamps_json = {}
def update_config():
global timestamps_json
with open('config/last_updated.json', 'r') as config_file:
timestamps_json = json.load(config_file)
return
def get_timestamps_config():
global timestamps_json
return timestamps_js... | import json
import datetime
timestamps_json = {}
def update_config():
global timestamps_json
with open('config/last_updated.json', 'r') as config_file:
timestamps_json = json.load(config_file)
return
def get_timestamps_config():
global timestamps_json
return timestamps_json
def get_fil... | apache-2.0 | Python |
a0cf098c47932ff45fa5674aa6b59606493da0c2 | validate that decision tree xml have valid endpoints with matching rx | Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner,Ecotrust/forestplanner | lot/trees/admin.py | lot/trees/admin.py | from trees.models import *
from django.contrib import admin
from django import forms
admin.site.register(Strata)
admin.site.register(Stand)
admin.site.register(Scenario)
admin.site.register(ForestProperty)
admin.site.register(ScenarioStand)
admin.site.register(Rx)
admin.site.register(MyRx)
admin.site.register(SpatialC... | from trees.models import *
from django.contrib import admin
from django import forms
admin.site.register(Strata)
admin.site.register(Stand)
admin.site.register(Scenario)
admin.site.register(ForestProperty)
admin.site.register(ScenarioStand)
admin.site.register(Rx)
admin.site.register(MyRx)
admin.site.register(SpatialC... | bsd-3-clause | Python |
c7b684ebf85e2a80e0acdd44ea91171bc1aa6388 | Make date imports more flexible | datasciencebr/serenata-de-amor,datasciencebr/jarbas,marcusrehm/serenata-de-amor,datasciencebr/jarbas,datasciencebr/jarbas,marcusrehm/serenata-de-amor,datasciencebr/jarbas,marcusrehm/serenata-de-amor,datasciencebr/serenata-de-amor,marcusrehm/serenata-de-amor | jarbas/chamber_of_deputies/fields.py | jarbas/chamber_of_deputies/fields.py | from rows import fields
class IntegerField(fields.IntegerField):
@classmethod
def deserialize(cls, value, *args, **kwargs):
try: # Rows cannot convert values such as '2011.0' to integer
value = int(float(value))
except:
pass
return super(IntegerField, cls).des... | from datetime import date
from rows import fields
class IntegerField(fields.IntegerField):
@classmethod
def deserialize(cls, value, *args, **kwargs):
try: # Rows cannot convert values such as '2011.0' to integer
value = int(float(value))
except:
pass
return s... | mit | Python |
1a1632983002a8b5cdf9d4ec9c9263db25b9d8fa | Add documentation | CruiseDevice/coala,abhiroyg/coala,tltuan/coala,djkonro/coala,AbdealiJK/coala,NalinG/coala,RJ722/coala,saurabhiiit/coala,CruiseDevice/coala,tushar-rishav/coala,dagdaggo/coala,Tanmay28/coala,aptrishu/coala,RJ722/coala,tltuan/coala,damngamerz/coala,sophiavanvalkenburg/coala,NalinG/coala,Uran198/coala,Asnelchristian/coala,... | coalib/output/NullInteractor.py | coalib/output/NullInteractor.py | from coalib.output.Interactor import Interactor
class NullInteractor(Interactor):
"""
This interactor can be used for headless setups, it requires no interaction
from the user.
"""
def print_result(self, result, file_dict):
pass
def print_results(self, result_list, file_dict):
... | from coalib.output.Interactor import Interactor
class NullInteractor(Interactor):
def print_result(self, result, file_dict):
pass
def print_results(self, result_list, file_dict):
pass
def did_nothing(self):
pass
def begin_section(self, section):
pass
def acquire... | agpl-3.0 | Python |
107c79fe9a2171ada3090abdf692f6f6ef523b29 | Update msync developer example to latest plist Python API | Tatsh/libimobiledevice,patweb/libimobiledevice,patweb/libimobiledevice,Tatsh/libimobiledevice,libimobiledevice/libimobiledevice,Tatsh/libimobiledevice,patweb/libimobiledevice,kalev/libimobiledevice,upbit/libimobiledevice,upbit/libimobiledevice,libimobiledevice-win32/libimobiledevice,libimobiledevice-win32/libimobiledev... | dev/msync.py | dev/msync.py | #! /usr/bin/env python
from iphone import *
from plist import *
# get msync client
def GetMobileSyncClient() :
phone = iPhone()
if not phone.init_device() :
print "Couldn't find device, is it connected ?\n"
return None
lckd = phone.get_lockdown_client()
if not lckd :
print "Fai... | #! /usr/bin/env python
from libiphone.iPhone import *
# get msync client
def GetMobileSyncClient() :
phone = iPhone()
if not phone.init_device() :
print "Couldn't find device, is it connected ?\n"
return None
lckd = phone.get_lockdown_client()
if not lckd :
print "Failed to sta... | lgpl-2.1 | Python |
df768d2417e40fc213e6ed7c70a2533e03a16b25 | make test work, sort of | Crashfreak/maproulette,Crashfreak/maproulette,osmlab/maproulette,Crashfreak/maproulette,osmlab/maproulette,Crashfreak/maproulette,mvexel/maproulette,mvexel/maproulette,mvexel/maproulette,mvexel/maproulette,osmlab/maproulette,osmlab/maproulette | test/test.py | test/test.py | import os
from maproulette import app
from maproulette.models import db
import unittest
import tempfile
class MapRouletteTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
app.config['TESTING'] = True
self.app = app.test_client()
... | import os
import maproulette
import unittest
import tempfile
class MapRouletteTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, maproulette.app.config['DATABASE'] = tempfile.mkstemp()
maproulette.app.config['TESTING'] = True
self.app = maproulette.app.test_client()
maproul... | apache-2.0 | Python |
4767a5c94bd6cf3e864854f23220196a8a9b4b34 | test returned data by process() | ioO/nommer | tests_cli.py | tests_cli.py | import unittest
from unittest.mock import patch
import nommer_cli
class NommerCliTestCase(unittest.TestCase):
"""
Test class for cli interface
"""
def test_process(self):
self.assertEqual(nommer_cli.process('hello,world'), ['ho', 'we'])
if __name__ == '__main__':
unittest.main()
| import unittest
class NommerCliTestCase(unittest.TestCase):
"""
Test class for cli interface
"""
def test_success(self):
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()
| unlicense | Python |
158e11dc1c11e606621a729b3b220cecf5ca700a | Set noqa to silence flake8. | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx | awx/api/management/commands/uses_mongo.py | awx/api/management/commands/uses_mongo.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved
import sys
from django.core.management.base import BaseCommand
from awx.main.task_engine import TaskSerializer
class Command(BaseCommand):
"""Return a exit status of 0 if MongoDB should be active, and an
exit status of 1 otherwise.
This script i... | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved
import sys
from django.core.management.base import BaseCommand
from awx.main.task_engine import TaskSerializer
class Command(BaseCommand):
"""Return a exit status of 0 if MongoDB should be active, and an
exit status of 1 otherwise.
This script i... | apache-2.0 | Python |
a2fdb32593c959822819371176457a1f186dee8c | Fix handling of queued track | martinp/jarvis2,martinp/jarvis2,mpolden/jarvis2,martinp/jarvis2,mpolden/jarvis2,mpolden/jarvis2 | jarvis/jobs/sonos.py | jarvis/jobs/sonos.py | # -*- coding: utf-8 -*-
from jobs import AbstractJob
from soco import SoCo
class Sonos(AbstractJob):
def __init__(self, conf):
self.interval = conf['interval']
self.display_album_art = conf.get('display_album_art', True)
self._device = SoCo(conf['ip'])
self._timeout = conf.get('t... | # -*- coding: utf-8 -*-
from jobs import AbstractJob
from soco import SoCo
class Sonos(AbstractJob):
def __init__(self, conf):
self.interval = conf['interval']
self.display_album_art = conf.get('display_album_art', True)
self._device = SoCo(conf['ip'])
self._timeout = conf.get('t... | mit | Python |
f9cea5a2a42dc51562557587ffe570ec26fa6012 | return empty title if no response | ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks | bookmarks/views/helper_endpoints.py | bookmarks/views/helper_endpoints.py | """Helper endpoints that should requested internally."""
import re
from urllib.parse import urlparse
from flask import request, abort, Blueprint
from flask_login import login_required
from bs4 import BeautifulSoup
import requests
helper_endpoints = Blueprint('helper_endpoints', __name__)
@helper_endpoints.route(... | """Helper endpoints that should requested internally."""
import re
from urllib.parse import urlparse
from flask import request, abort, Blueprint
from flask_login import login_required
from bs4 import BeautifulSoup
import requests
helper_endpoints = Blueprint('helper_endpoints', __name__)
@helper_endpoints.route(... | mit | Python |
3913b7e3e4839df57b085cfc30eb94e0704a7a7d | fix of hashes test | cislaa/prophy,aurzenligl/prophy,aurzenligl/prophy,cislaa/prophy,cislaa/prophy | jinja/test_writer.py | jinja/test_writer.py | import os
import sys
import writer
import data_holder
import hashlib
linux_hashes = {
"test_of_PythonSerializer" : "11e1ffc3519be57eba208d6f740c7dd2",
"test_of_PythonSerializer_enum" : "e907ddf819d3a2558596ffb392eb626f",
"test_of_PythonSerializer_import" : "42b158e97a9e205de2178d6befaeed35"
}
windows_hashes = {
"tes... | import os
import writer
import data_holder
import hashlib
def test_of_WriterFabric_default_writer():
assert type(writer.WriterFabric.get_writer("test.txt")) is writer.WriterTxt
def test_of_PythonSerializer():
ih = data_holder.IncludeHolder()
th = data_holder.TypeDefHolder()
for x in range(20, 400, ... | mit | Python |
d5bd380dac33066c279bad775c27e15819f03694 | bump version along with the change | venmo/nose-detecthttp | detecthttp/_version.py | detecthttp/_version.py | __version__ = "1.2.1"
| __version__ = "1.2.0"
| mit | Python |
c7ebca2079206c56774af73de8de76a4274ae238 | Remove generate generate_thumbnail code | chengdujin/newsman,chengdujin/newsman,chengdujin/newsman | newsman/data_processor/thumbnail.py | newsman/data_processor/thumbnail.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
thumbnail used to make thumbnails
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul., 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('..')
from config.settings import logger
from cStringIO import StringIO
import Imag... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
thumbnail used to make thumbnails
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul., 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('..')
from config.settings import logger
from cStringIO import StringIO
import Imag... | agpl-3.0 | Python |
7f79e575b9a2b5dc15ed304e2c1cb123ab39b91b | Add NFD_NFC to unicode normalization comparison. | coblo/isccbench | iscc_bench/metaid/shortnorm.py | iscc_bench/metaid/shortnorm.py | # -*- coding: utf-8 -*-
import unicodedata
def shortest_normalization_form():
"""
Find unicode normalization that generates shortest utf8 encoded text.
Result NFKC
"""
s = 'Iñtërnâtiônàlizætiøn☃ and string escaping are ticky   things'
nfc = unicodedata.normalize('NFC', s)
nfd = unico... | # -*- coding: utf-8 -*-
import unicodedata
def shortest_normalization_form():
"""
Find unicode normalization that generates shortest utf8 encoded text.
Result NFKC
"""
s = 'Iñtërnâtiônàlizætiøn☃ and string escaping are ticky   things'
nfc = unicodedata.normalize('NFC', s)
nfd = unico... | bsd-2-clause | Python |
3bb608f1192687596248e15b6f0a5bfd51eeb05c | Fix typo (#47) | PUNCH-Cyber/stoq-plugins-public,PUNCH-Cyber/stoq-plugins-public | trid/setup.py | trid/setup.py | from setuptools import setup, find_packages
setup(
name="trid",
version="2.0.2",
author="Marcus LaFerrera (@mlaferrera)",
url="https://github.com/PUNCH-Cyber/stoq-plugins-public",
license="Apache License 2.0",
description="Identify file types from their TrID signature",
packages=find_packag... | from setuptools import setup, find_packages
setup(
name="trid",
version="2.0.2",
author="Marcus LaFerrera (@mlaferrera)",
url="https://github.com/PUNCH-Cyber/stoq-plugins-public",
license="Apache License 2.0",
description="Identify file types from their TrID signatur",
packages=find_package... | apache-2.0 | Python |
45e27d11e6f9b19b129429d2d5f483ac58fb359e | Fix Glance Indexing after Notification | openstack/searchlight,openstack/searchlight,openstack/searchlight | searchlight/elasticsearch/plugins/glance/images_notification_handler.py | searchlight/elasticsearch/plugins/glance/images_notification_handler.py | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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 (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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 |
19b58defe397a01d3abf0f13985839894add81fc | make password prompt optional if it's supplied to the backup function | sephii/fabliip,sephii/fabliip,liip/fabliip,liip/fabliip | fabliip/database/pgsql.py | fabliip/database/pgsql.py | from getpass import getpass
from fabric import api
def dump(backup_path, database_name, user='postgres', host=None,
password=None):
"""
Backs up the given database to the given file as a PostgreSQL archive. If
host is set to None, a local connection will be used, so you'll need to be
able to... | from getpass import getpass
from fabric import api
def dump(backup_path, database_name, user='postgres', host=None):
"""
Backs up the given database to the given file as a PostgreSQL archive. If
host is set to None, a local connection will be used, so you'll need to be
able to sudo to the given user.... | mit | Python |
89d18ded147d0d713ba6387473c4aeaf41a7620c | Update version.py | ssteo/moviepy,Zulko/moviepy,kerstin/moviepy | moviepy/version.py | moviepy/version.py | __version__ = "0.2.3.1"
| __version__ = "0.2.3"
| mit | Python |
851cf48aa674c3453df332852aabf118e63b3fff | change log target | rshorey/moxie,paultag/moxie,mileswwatkins/moxie,loandy/moxie,loandy/moxie,paultag/moxie,mileswwatkins/moxie,paultag/moxie,mileswwatkins/moxie,rshorey/moxie,loandy/moxie,rshorey/moxie | moxie/cores/log.py | moxie/cores/log.py | # Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify... | # Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify... | mit | Python |
2ec5e08d367517ff96afbcc0de61169d0776a857 | fix issue #11 | znc-sistemas/django-municipios,znc-sistemas/django-municipios,znc-sistemas/django-municipios,luzfcb/django-municipios,luzfcb/django-municipios | municipios/urls.py | municipios/urls.py | try:
from django.conf.urls.defaults import patterns, include, url
except:
from django.conf.urls import patterns, include, url
urlpatterns = patterns('municipios.views',
url(r'^$', 'base_url_js', name='municipios-base-url'),
url(r'^base_url.js$', 'base_url_js', name='municipios-base-url-js'),
url(r'^a... | from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('municipios.views',
url(r'^$', 'base_url_js', name='municipios-base-url'),
url(r'^base_url.js$', 'base_url_js', name='municipios-base-url-js'),
url(r'^ajax/municipios/(?P<uf>\w\w)/$', 'municipios_ajax', name='municipios-ajax'), ... | mit | Python |
b9ee8be4ecb19144649d8248543307bee2a8c17c | add default disqus config to rux | guyskk/rux,hit9/rux,hit9/rux,guyskk/rux | rux/config.py | rux/config.py | # coding=utf8
"""
rux.config
~~~~~~~~~~
Configuration manager, rux's configuration is in toml.
"""
from os.path import exists
from . import charset
from .exceptions import ConfigSyntaxError
from .utils import join
import toml
class Config(object):
filename = 'config.toml'
filepath = join('.'... | # coding=utf8
"""
rux.config
~~~~~~~~~~
Configuration manager, rux's configuration is in toml.
"""
from os.path import exists
from . import charset
from .exceptions import ConfigSyntaxError
from .utils import join
import toml
class Config(object):
filename = 'config.toml'
filepath = join('.'... | bsd-2-clause | Python |
459e81ea6c66e56a27b671125e1df6532b0c63c0 | Use DOI format to simplify links. | jakirkham/nanshe,nanshe-org/nanshe,jakirkham/nanshe,DudLab/nanshe,DudLab/nanshe,nanshe-org/nanshe | nanshe/__init__.py | nanshe/__init__.py | """
The ```nanshe``` package is an image processing package that contains a variety
of different techniques, which are used primarily to assemble the ADINA
algorithm proposed by Diego, et al.
( doi:`10.1109/ISBI.2013.6556660`_ ) to extract active neurons from
an image sequence. This algorithm uses online dictionary lea... | """
The ```nanshe``` package is an image processing package that contains a variety
of different techniques, which are used primarily to assemble the ADINA
algorithm proposed by Diego, et al.
( http://dx.doi.org/10.1109/ISBI.2013.6556660 ) to extract active neurons from
an image sequence. This algorithm uses online dic... | bsd-3-clause | Python |
1cc01f4ed38b13cc37e7a9958d64c58cecf17608 | Solve function | rodriggs/pipeline | data_transfer_object/__init__.py | data_transfer_object/__init__.py | # Answer
s0 = 'azzf'
def palindrome_string(s):
mid,left = divmod(len(s0), 2) # (3,0)
s1 = bytearray(s0)
while s1[:mid] != s1[-mid:][::-1]:
for i in range(mid):
a,b = s1[i], s1[-i-1]
if a > b:
s1[-i-1] = a
elif a < b:
s1[-i-1] = a
... | while b[-i] == 122:
b[-i] = 97
if b[-i-1] != 122:
b[-i-1] += 1
else:
i += 1
| mit | Python |
a8f1434680d674bd41a5a138e5998d00d3e70182 | Fix minor parser bug | ALSchwalm/SyntaxAwareSearch | sas/parser.py | sas/parser.py | from rply import ParserGenerator
def parser_from_lexer(lexer, mapping):
pg = ParserGenerator(
[rule.name for rule in lexer.rules],
cache_id="cache",
# NOTE: This is pretty arbitrary at the moment
precedence=[
('right', ['NOT']),
('left', ['PARENT', 'CHILD',... | from rply import ParserGenerator
def parser_from_lexer(lexer, mapping):
pg = ParserGenerator(
[rule.name for rule in lexer.rules],
cache_id="cache",
# NOTE: This is pretty arbitrary at the moment
precedence=[
('right', ['NOT']),
('left', ['PARENT', 'CHILD',... | mit | Python |
0b49467c88088f36c1f9f2755d3288e5cfd68567 | Fix global argument in a vs. an | amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint | proselint/checks/garner/a_vs_an.py | proselint/checks/garner/a_vs_an.py | # -*- coding: utf-8 -*-
"""MAU100: Misuse of 'a' vs. 'an'.
---
layout: post
error_code: MAU101
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: a vs. an
date: 2014-06-10 12:31:19
categories: writing
---
The first line is always wrong.
"""
import re
from proselint.to... | # -*- coding: utf-8 -*-
"""MAU100: Misuse of 'a' vs. 'an'.
---
layout: post
error_code: MAU101
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: a vs. an
date: 2014-06-10 12:31:19
categories: writing
---
The first line is always wrong.
"""
import re
from proselint.to... | bsd-3-clause | Python |
bab9e148580c2d70662275aeb58064df0aa01956 | Add missing head docstring | geo-fluid-dynamics/phaseflow-fenics | phaseflow/backward_difference_formulas.py | phaseflow/backward_difference_formulas.py | """ **backward_difference_formulas.py** implements some BDF's for time discretization.
"""
import fenics
def apply_backward_euler(Delta_t, u):
""" Apply the backward Euler (fully implicit, first order) time discretization method. """
u_t = (u[0] - u[1])/Delta_t
return u_t
def apply_bdf2(Del... | import fenics
def apply_backward_euler(Delta_t, u):
""" Apply the backward Euler (fully implicit, first order) time discretization method. """
u_t = (u[0] - u[1])/Delta_t
return u_t
def apply_bdf2(Delta_t, u):
""" Apply the Gear/BDF2 (fully implicit, second order) backward difference fo... | mit | Python |
2495177cad5b65acd275fe8e8aece7064793f6f7 | check state | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | soil/views.py | soil/views.py | import uuid
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseServerError
import logging
from django.shortcuts import render_to_response, render
from django... | import uuid
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseServerError
import logging
from django.shortcuts import render_to_response, render
from django... | bsd-3-clause | Python |
e9a2abbc23560c1abf5a0a6b36efe9914bfebed4 | Update csv_reader.py | kandidat-highlights/model,kandidat-highlights/model | src/csv_reader.py | src/csv_reader.py | # MIT License
#
# Copyright (c) 2017 Jonatan Almén, Alexander Håkansson, Jesper Jaxing, Gmal
# Tchaefa, Maxim Goretskyy, Axel Olivecrona
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software with... | # MIT License
#
# Copyright (c) 2017 Jonatan Almén, Alexander Håkansson, Jesper Jaxing, Gmal
# Tchaefa, Maxim Goretskyy, Axel Olivecrona
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software with... | mit | Python |
30f9b35ec34432e6cb0a2437ccb96d04beec95b9 | Update version number to 0.7.2. Review URL: https://codereview.appspot.com/5683055 | XiaonuoGantan/pywebsocket,XiaonuoGantan/pywebsocket | src/setup.py | src/setup.py | #!/usr/bin/env python
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | #!/usr/bin/env python
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | bsd-3-clause | Python |
9289212c2292cebdecbf5f6516e1285fa7945719 | Change api dependencies | segalaj/hammr,usharesoft/hammr,emuus/hammr,emuus/hammr,MaxTakahashi/hammr,MaxTakahashi/hammr,usharesoft/hammr,segalaj/hammr | src/setup.py | src/setup.py | from setuptools import setup,find_packages
from hammr.utils.constants import *
import os
import sys
# Declare your packages' dependencies here, for eg:
requires=['uforge_python_sdk>=3.5.1, <3.6',
'httplib2==0.9',
'cmd2==0.6.7',
'texttable... | from setuptools import setup,find_packages
from hammr.utils.constants import *
import os
import sys
# Declare your packages' dependencies here, for eg:
requires=['uforge_python_sdk>=3.5.1',
'httplib2==0.9',
'cmd2==0.6.7',
'texttable==0.8.... | apache-2.0 | Python |
1a87da6eaeaaeeae165651d3096dfea3cdba6b0d | improve error handling | eehlers/reposit,eehlers/reposit,eehlers/reposit,eehlers/reposit,eehlers/reposit,eehlers/reposit | dev_tools/diff_code.py | dev_tools/diff_code.py |
# This script takes a snapshot of all of the source code files
# that are autogenerated by the reposit SWIG module.
import os
import sys
import glob
import shutil
ROOT_DIR = 'C:/Users/erik/Documents/repos/reposit/quantlib'
#ROOT_DIR = '/media/windows/linux/repos/reposit/quantlib'
SUB_DIRS = (
'QuantLibAddin2/ql... |
# This script takes a snapshot of all of the source code files
# that are autogenerated by the reposit SWIG module.
import os
import sys
import glob
import shutil
#ROOT_DIR = 'C:/Users/erik/Documents/repos/reposit/quantlib'
ROOT_DIR = '/media/windows/linux/repos/reposit/quantlib'
SUB_DIRS = (
'QuantLibAddin2/ql... | bsd-3-clause | Python |
ab079e05cb0a242235c1f506cb710279bf233ba0 | Fix order on opps menu | YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps | opps/channels/context_processors.py | opps/channels/context_processors.py | # -*- coding: utf-8 -*-
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import get_current_site
from .models import Channel
def channel_context(request):
""" Channel context processors
"""
site = get_current_site(request)
opps_menu = Channel.objects... | # -*- coding: utf-8 -*-
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import get_current_site
from .models import Channel
def channel_context(request):
""" Channel context processors
"""
site = get_current_site(request)
opps_menu = Channel.objects... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.