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 |
|---|---|---|---|---|---|---|---|---|
45444c93a3186b4db6c6a05785756d05d496a351 | Copy the helpers before everything else | hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder | lib/hawaiibuildbot/archlinux/__init__.py | lib/hawaiibuildbot/archlinux/__init__.py | #
# This file is part of Hawaii.
#
# Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (... | #
# This file is part of Hawaii.
#
# Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (... | agpl-3.0 | Python |
275d64b678eaaf193866eced0720838f4817b1f1 | modify orm.py | XiaoChengOMG/Practice | www/orm.py | www/orm.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = ""
'''
'''
import asyncio,logging
logging.basicConfig(level=logging.INFO)
import aiomysql
def log(sql,args=()):
logging.info('SQL: %s' % sql)
async def create_pool(loop,**kw):
logging.info('create database connection pool...')
global _pool
... | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = ""
'''
'''
import asyncio,logging
import aiomysql
def log(sql,args=()):
logging.info('SQL: %s' % sql)
async def create_pool(loop,**kw):
logging.info('create database connection pool...')
global _pool
_pool = await aiomysql.create_pool(
... | apache-2.0 | Python |
2835ec88db32664ce8fc7b6876a36546063da526 | Allow dynamic translation in AngularJS | tiramiseb/awesomeshop,tiramiseb/awesomeshop,tiramiseb/awesomeshop,tiramiseb/awesomeshop | awesomeshop/views.py | awesomeshop/views.py | # -*- coding: utf8 -*-
# Copyright 2015 Sébastien Maccagnoni-Munch
#
# This file is part of AwesomeShop.
#
# AwesomeShop is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License,... | # -*- coding: utf8 -*-
# Copyright 2015 Sébastien Maccagnoni-Munch
#
# This file is part of AwesomeShop.
#
# AwesomeShop is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License,... | agpl-3.0 | Python |
0d1a862cb2745fa15d74a970159f99b6a04ad7d9 | Add MXs. | Juniper/contrail-fabric-utils,Juniper/contrail-fabric-utils | fabfile/testbeds/testbed_a6s30.py | fabfile/testbeds/testbed_a6s30.py | from fabric.api import env
os_username = 'admin'
os_password = 'contrail123'
os_tenant_name = 'demo'
host1 = 'root@10.84.13.30'
ext_routers = [('mx1', '10.84.11.253'), ('mx2', '10.84.11.252')]
router_asn = 64512
public_vn_rtgt = 10000
host_build = 'nsheth@10.84.5.31'
env.roledefs = {
'all': [host1],
... | from fabric.api import env
os_username = 'admin'
os_password = 'contrail123'
os_tenant_name = 'demo'
host1 = 'root@10.84.13.30'
ext_routers = []
router_asn = 64512
public_vn_rtgt = 10000
host_build = 'nsheth@10.84.5.31'
env.roledefs = {
'all': [host1],
'cfgm': [host1],
'openstack': [host1],
... | apache-2.0 | Python |
0a5908495afcd9dba729a07d7166f71530d62dee | remove erroneous assert statement | benedictpaten/cactus,benedictpaten/cactus,benedictpaten/cactus,benedictpaten/cactus,benedictpaten/cactus | progressive/multiCactusProject.py | progressive/multiCactusProject.py | #!/usr/bin/env python
#Copyright (C) 2011 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
""" Basic interface to the multi cactus project xml file.
"""
import unittest
import os
import xml.etree.ElementTree as ET
from xml.dom import minidom
import sys
import random
import math
import copy
import... | #!/usr/bin/env python
#Copyright (C) 2011 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
""" Basic interface to the multi cactus project xml file.
"""
import unittest
import os
import xml.etree.ElementTree as ET
from xml.dom import minidom
import sys
import random
import math
import copy
import... | mit | Python |
f92eac982dee9d4ea97e36cfda0f1fa19213b9f4 | Improve Project Euler problem 092 solution 1 (#5703) | TheAlgorithms/Python | project_euler/problem_092/sol1.py | project_euler/problem_092/sol1.py | """
Project Euler Problem 092: https://projecteuler.net/problem=92
Square digit chains
A number chain is created by continuously adding the square of the digits in
a number to form a new number until it has been seen before.
For example,
44 → 32 → 13 → 10 → 1 → 1
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
Therefor... | """
Project Euler Problem 092: https://projecteuler.net/problem=92
Square digit chains
A number chain is created by continuously adding the square of the digits in
a number to form a new number until it has been seen before.
For example,
44 → 32 → 13 → 10 → 1 → 1
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
Therefor... | mit | Python |
1bc4507234d87b1ed246501165fa1d8138bf5ca6 | Fix for pypy compatibility: must super's __init__ | jessemyers/cheddar,jessemyers/cheddar | cheddar/exceptions.py | cheddar/exceptions.py | """
Shared exception.
"""
class BadRequestError(Exception):
pass
class ConflictError(Exception):
pass
class NotFoundError(Exception):
def __init__(self, status_code=None):
super(NotFoundError, self).__init__()
self.status_code = status_code
| """
Shared exception.
"""
class BadRequestError(Exception):
pass
class ConflictError(Exception):
pass
class NotFoundError(Exception):
def __init__(self, status_code=None):
self.status_code = status_code
| apache-2.0 | Python |
ac9cd5ff007ee131e97f70c49c763f79f06ebf5a | Include the entire existing environment for integration tests subprocesses | CleanCut/green,CleanCut/green | green/test/test_integration.py | green/test/test_integration.py | import copy
import multiprocessing
import os
from pathlib import PurePath
import subprocess
import sys
import tempfile
from textwrap import dedent
import unittest
try:
from unittest.mock import MagicMock
except:
from mock import MagicMock
from green import cmdline
class TestFinalizer(unittest.TestCase):
... | import multiprocessing
import os
from pathlib import PurePath
import subprocess
import sys
import tempfile
from textwrap import dedent
import unittest
try:
from unittest.mock import MagicMock
except:
from mock import MagicMock
from green import cmdline
class TestFinalizer(unittest.TestCase):
def setUp(s... | mit | Python |
b91974d3e830d97cdb0808dadf8ff5d22b506bdf | Add toString() | lewangbtcc/anti-XSS,lewangbtcc/anti-XSS | lib/var/countpage.py | lib/var/countpage.py | #!/usr/bin/env python
'''
Copyright (c) 2016 anti-XSS developers
'''
class CountPage(object):
number = 0
def __init__(self, number=0):
self.number = number
pass
def setNumber(self, number):
self.number = number
pass
def getNumber(self):
return self.number
... | #!/usr/bin/env python
'''
Copyright (c) 2016 anti-XSS developers
'''
class CountPage(object):
number = 0
def __init__(self, number=0):
self.number = number
def setNumber(self, number):
self.number = number
def getNumber(self):
return self.number
def incNumber(self):
... | mit | Python |
46ba8967de7b6f6c714749dd7ff2771f447b9258 | fix field allowance | joeyuan19/flaming-bear,joeyuan19/flaming-bear,joeyuan19/flaming-bear,joeyuan19/flaming-bear | PersonalSite/content/models.py | PersonalSite/content/models.py | from django.db import models
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length=128,blank=True,null=True,default="")
body = models.TextField(blank=True,null=True,default="")
preview = models.ImageField(upload_to="img/project_previews/",blank=True,null=True,def... | from django.db import models
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length=128,blank=True,null=True,default="")
body = models.TextField(blank=True,null=True,default="")
preview = models.ImageField(upload_to="img/project_previews/",blank=True,null=True,def... | apache-2.0 | Python |
c1abb8ea05c68de7072a34c2f40f1e8c303be0fe | Bump version to 1.0 | asfin/electrum,imrehg/electrum,imrehg/electrum,procrasti/electrum,fireduck64/electrum,spesmilo/electrum,cryptapus/electrum,vialectrum/vialectrum,dabura667/electrum,cryptapus/electrum,digitalbitbox/electrum,neocogent/electrum,argentumproject/electrum-arg,procrasti/electrum,wakiyamap/electrum-mona,pooler/electrum-ltc,cry... | lib/version.py | lib/version.py | ELECTRUM_VERSION = "1.0"
SEED_VERSION = 4 # bump this everytime the seed generation is modified
TRANSLATION_ID = 28344 # version of the wiki page
| ELECTRUM_VERSION = "0.61"
SEED_VERSION = 4 # bump this everytime the seed generation is modified
TRANSLATION_ID = 28344 # version of the wiki page
| mit | Python |
ddd8c4d3f913a1f87b68496cca8e1deb10a8ee8e | remove obsolete replacements from synth.py (#37) | googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node | packages/google-cloud-recommender/synth.py | packages/google-cloud-recommender/synth.py | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
71b5883a6693361facf705f2dc840cdd9ff4c225 | format dates more like BibTeX | chbrown/pybtex,andreas-h/pybtex,chbrown/pybtex,andreas-h/pybtex | pybtex/styles/formatting/plain.py | pybtex/styles/formatting/plain.py | # Copyright 2006 Andrey Golovizin
#
# This file is part of pybtex.
#
# pybtex is free software; you can redistribute it and/or modify
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# pybtex i... | # Copyright 2006 Andrey Golovizin
#
# This file is part of pybtex.
#
# pybtex is free software; you can redistribute it and/or modify
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# pybtex i... | mit | Python |
016fa58761c1ea42657409bb3f4d6260671d8ea1 | Update note_util.py so that it reads the new note offsets | albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com | app/note_util.py | app/note_util.py | import datetime
import os
import dotenv
from getenv import env
import markdown2
import pytz
root_path = os.path.dirname(os.path.realpath(__file__)) + '/../'
dotenv.read_dotenv(os.path.join(root_path, '.env'))
# See https://github.com/trentm/python-markdown2/wiki/Extras
MARKDOWN_EXTRAS = [
'code-friendly',
'f... | import datetime
import os
import dotenv
from getenv import env
import markdown2
import pytz
root_path = os.path.dirname(os.path.realpath(__file__)) + '/../'
dotenv.read_dotenv(os.path.join(root_path, '.env'))
# See https://github.com/trentm/python-markdown2/wiki/Extras
MARKDOWN_EXTRAS = [
'code-friendly',
'f... | mit | Python |
117c84bba009aeff166900f5eb70aa640e05beb2 | Modify to use casefold | thombashi/typepy | typepy/converter/_bool.py | typepy/converter/_bool.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from .._common import strip_ansi_escape
from .._const import DefaultValue, ParamKey
from ..error import TypeConversionError
from ._interface import AbstractValueConverter
class BoolConverter(AbstractValueConverter):
def force_convert(self):
... | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from .._common import strip_ansi_escape
from .._const import DefaultValue, ParamKey
from ..error import TypeConversionError
from ._interface import AbstractValueConverter
class BoolConverter(AbstractValueConverter):
def force_convert(self):
... | mit | Python |
40777e44e2403d633ecaa4d45b6985be3a5bc907 | add version 1.1 (#5461) | skosukhin/spack,matthiasdiener/spack,tmerrick1/spack,matthiasdiener/spack,EmreAtes/spack,TheTimmy/spack,mfherbst/spack,krafczyk/spack,skosukhin/spack,mfherbst/spack,TheTimmy/spack,skosukhin/spack,iulian787/spack,lgarren/spack,LLNL/spack,skosukhin/spack,skosukhin/spack,krafczyk/spack,mfherbst/spack,LLNL/spack,TheTimmy/s... | var/spack/repos/builtin/packages/parsplice/package.py | var/spack/repos/builtin/packages/parsplice/package.py | ##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | ##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | lgpl-2.1 | Python |
a47ab9c6b216e4926a5cc4564a7db24379354fb4 | Add extra version of py-psutil (#15063) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-psutil/package.py | var/spack/repos/builtin/packages/py-psutil/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPsutil(PythonPackage):
"""psutil is a cross-platform library for retrieving information ... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPsutil(PythonPackage):
"""psutil is a cross-platform library for retrieving information ... | lgpl-2.1 | Python |
299ed52e872a2242610cc553ac90764275b05272 | Update test_glove2word2vec.py | manasRK/gensim,manasRK/gensim,manasRK/gensim | gensim/test/test_glove2word2vec.py | gensim/test/test_glove2word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Test for gensim.scripts.glove2word2vec.py."""
import unittest
import os
import sys
import gensim
from gensim.utils import check_out... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Test for gensim.scripts.glove2word2vec.py."""
import unittest
import os
import sys
import gensim
from gensim.utils import check_out... | lgpl-2.1 | Python |
df1e33283485b76c61185a98b5b2c909431c2ae5 | Remove white space between print and () | stackforge/python-monascaclient,sapcc/python-monascaclient,sapcc/python-monascaclient,openstack/python-monascaclient,openstack/python-monascaclient,stackforge/python-monascaclient | client_api_example.py | client_api_example.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 |
3f877871a9f439be8d0839bfee965dc6462b7b3b | fix class method declaration | mikebranstein/IoT,mikebranstein/IoT | raspberry-pi/led-switch-toggle.py | raspberry-pi/led-switch-toggle.py | import RPi.GPIO as GPIO
import time
# tell GPIO to use the Pi's board numbering for pins
GPIO.setmode(GPIO.BOARD)
# simple class that toggles the output value of the outputPin (HIGH/LOW)
# by pressing the switch on switchInputPin
#
# to use, instantiate and call the toggle() method in your loop
class SwitchToggler:
... | import RPi.GPIO as GPIO
import time
# tell GPIO to use the Pi's board numbering for pins
GPIO.setmode(GPIO.BOARD)
# simple class that toggles the output value of the outputPin (HIGH/LOW)
# by pressing the switch on switchInputPin
#
# to use, instantiate and call the toggle() method in your loop
class SwitchToggler:
... | mit | Python |
e40c6076da9f31207b81589082acaca962078107 | Fix #2971 | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/crypter/FshareVnFolder.py | module/plugins/crypter/FshareVnFolder.py | # -*- coding: utf-8 -*-
import re
from ..internal.Crypter import Crypter
from ..internal.misc import replace_patterns
class FshareVnFolder(Crypter):
__name__ = "FshareVnFolder"
__type__ = "crypter"
__version__ = "0.09"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?fshare\.vn/folder/... | # -*- coding: utf-8 -*-
from ..internal.SimpleCrypter import SimpleCrypter
class FshareVnFolder(SimpleCrypter):
__name__ = "FshareVnFolder"
__type__ = "crypter"
__version__ = "0.08"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?fshare\.vn/folder/.+'
__config__ = [("activated", "b... | agpl-3.0 | Python |
c9ad789262f2e75010d0f6690d793a2f7c36f352 | Add locked and lock_suggested properties to OfficialDocument | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/apps/official_documents/models.py | ynr/apps/official_documents/models.py | from __future__ import unicode_literals
import os
from django.db import models
from django.utils.translation import ugettext_lazy as _
from popolo.models import Post
from elections.models import Election
from django_extensions.db.models import TimeStampedModel
from compat import python_2_unicode_compatible
DOCUME... | from __future__ import unicode_literals
import os
from django.db import models
from django.utils.translation import ugettext_lazy as _
from popolo.models import Post
from elections.models import Election
from django_extensions.db.models import TimeStampedModel
from compat import python_2_unicode_compatible
DOCUME... | agpl-3.0 | Python |
e863c1b380911d39ebc309fa584dd3c847bc5312 | add beta in fabfile | uhuramedia/cookiecutter-django,uhuramedia/cookiecutter-django | {{cookiecutter.repo_name}}/fabfile.py | {{cookiecutter.repo_name}}/fabfile.py | from fabric.api import env, run, local
def live():
"""Connects to the server."""
env.hosts = ['bankenverband.de']
env.user = 'freshmilk'
env.cwd = '/var/www/{{cookiecutter.project_name}}'
env.connect_to = '{0}@{1}:{2}'.format(env.user, env.hosts[0], env.cwd)
def beta():
"""Connects... | from fabric.api import env, run, local
def live():
"""Connects to the server."""
env.hosts = ['bankenverband.de']
env.user = 'freshmilk'
env.cwd = '/var/www/{{cookiecutter.project_name}}'
env.connect_to = '{0}@{1}:{2}'.format(env.user, env.hosts[0], env.cwd)
def gitpull(tag=None):
... | bsd-3-clause | Python |
ede0103939fa25cf04524dfc4d3d1a1430aead82 | Update affected content loader tests. | Plexxi/st2,tonybaloney/st2,Itxaka/st2,alfasin/st2,grengojbo/st2,armab/st2,nzlosh/st2,grengojbo/st2,armab/st2,peak6/st2,dennybaa/st2,punalpatel/st2,emedvedev/st2,nzlosh/st2,emedvedev/st2,dennybaa/st2,pinterb/st2,Itxaka/st2,lakshmi-kannan/st2,pixelrebel/st2,peak6/st2,nzlosh/st2,tonybaloney/st2,jtopjian/st2,peak6/st2,puna... | st2common/tests/unit/test_content_loader.py | st2common/tests/unit/test_content_loader.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 |
0f729d07c6501fe5cb1904ec72264694a5e9023c | Fix some bugs in djbuildhere | hint/django-hint-tools,hint/django-hint-tools | scripts/djbuildhere.py | scripts/djbuildhere.py | #!/usr/bin/env python
"""
Build
"""
import glob
import os
import shutil
import sys
try:
import djtools
# this is for testing purposes
except ImportError:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import djtools
# would be good not to overwrite old _djtools_common.py... | #!/usr/bin/env python
"""
Build
"""
import glob
import os
import shutil
import sys
import djtools
# would be good not to overwrite old _djtools_common.py
if len(sys.argv > 1):
destdir = sys.argv[1]
else:
destdir = os.getcwd()
for file in glob(djtools.get_skel_dir() + '/*'):
shutil.copy(file, destdir) | bsd-2-clause | Python |
923ca5a7083d9833e74a6c5e312c54ff9c2b3209 | add docstrings for logger.py | jeremy-miller/life-python | life/logger.py | life/logger.py | """This module creates a logger for formatted console logging."""
import logging
from sys import stdout
class LoggerClass(object):
"""This class creates a logger for formatted console logging."""
@staticmethod
def create_logger(log_level=logging.INFO):
"""This function creates a logger for formatted consol... | import logging
from sys import stdout
class LoggerClass(object):
@staticmethod
def create_logger(log_level=logging.INFO):
logger = logging.getLogger('')
logger.setLevel(log_level)
log_formatter = logging.Formatter("%(asctime)s %(message)s", datefmt='[%d/%b/%Y %H:%M:%S]')
console_handler = logging.... | mit | Python |
f585e7f61a35811cbc85cc39a30ecc6b827ccec0 | Add first and last name to userInfo REST endpoint; Addresses #884 | RENCI/xDCIShare,FescueFungiShare/hydroshare,RENCI/xDCIShare,RENCI/xDCIShare,FescueFungiShare/hydroshare,ResearchSoftwareInstitute/MyHPOM,FescueFungiShare/hydroshare,FescueFungiShare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,FescueFungiShare/hydroshare,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstit... | hs_core/views/user_rest_api.py | hs_core/views/user_rest_api.py | from rest_framework.views import APIView
from rest_framework.response import Response
class UserInfo(APIView):
def get(self, request):
user_info = {"username": request.user.username}
if request.user.email:
user_info['email'] = request.user.email
if request.user.first_name:
... | from rest_framework.views import APIView
from rest_framework.response import Response
class UserInfo(APIView):
def get(self, request):
user_info = {"username": request.user.username}
if request.user.email:
user_info['email'] = request.user.email
return Response(user_info)
| bsd-3-clause | Python |
d3e4973b8b52ccf1ff78f3780c002e5449622c66 | change the length of str to 80 in parse_head.py | shifvb/DarkChina | http_proxy/tools/parse_head.py | http_proxy/tools/parse_head.py | # The MIT License (MIT)
#
# Copyright shifvb 2015-2016
#
# 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, m... | # The MIT License (MIT)
#
# Copyright shifvb 2015-2016
#
# 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, m... | mit | Python |
eecf1445d3c14ea3a0b6074eb23b3a18da9715d6 | add comment | aurzenligl/prophy,cislaa/prophy,cislaa/prophy,cislaa/prophy,aurzenligl/prophy | jinja/reader.py | jinja/reader.py | import os
from xml.dom import minidom
#To jest reader to konkretnych xmlwoych plików a nie genertyczny reader
class Reader(object):
files = []
def __init__(self, xml_dir_path): # czy oby na pewno ma on czytać pliki w momencie konstrukcji? Potem te dane sa w ramie przez cały czas życia tego obiektu a nie tyl... | import os
from xml.dom import minidom
class Reader(object):
files = []
def __init__(self, xml_dir_path):
self.tree_files = {}
self.xml_dir = xml_dir_path
self.__set_files_to_parse()
self.__open_files()
def __open_files(self):
for x in self.files:
self.t... | mit | Python |
fb1a991d5840e261462a5378cfc02e43c0606ad8 | Add try-catch block to Hausa stemming | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | mediacloud/mediawords/languages/ha/__init__.py | mediacloud/mediawords/languages/ha/__init__.py | import hausastemmer
from typing import List
from mediawords.languages import McLanguageException, SpaceSeparatedWordsMixIn, StopWordsFromFileMixIn
from mediawords.languages.en import EnglishLanguage
from mediawords.util.perl import decode_object_from_bytes_if_needed
from mediawords.util.log import create_logger
log =... | import hausastemmer
from typing import List
from mediawords.languages import McLanguageException, SpaceSeparatedWordsMixIn, StopWordsFromFileMixIn
from mediawords.languages.en import EnglishLanguage
from mediawords.util.perl import decode_object_from_bytes_if_needed
from mediawords.util.log import create_logger
log =... | agpl-3.0 | Python |
ec108184fec40e200f52b106c88a773f727cec8e | Introduce localizable raise conditions to the iLO power on script Signed-off-by:Javier.Alvarez-Valle@citrix.com | koushikcgit/xcp-networkd,simonjbeaumont/xcp-rrdd,djs55/squeezed,johnelse/xcp-rrdd,sharady/xcp-networkd,robhoes/squeezed,johnelse/xcp-rrdd,djs55/xcp-networkd,koushikcgit/xcp-rrdd,djs55/xcp-rrdd,koushikcgit/xcp-rrdd,djs55/xcp-networkd,sharady/xcp-networkd,djs55/xcp-rrdd,koushikcgit/xcp-networkd,simonjbeaumont/xcp-rrdd,ko... | scripts/poweron/iLO.py | scripts/poweron/iLO.py | import sys,M2Crypto, XenAPI, XenAPIPlugin
class ILO_CONNECTION_ERROR(Exception):
"""Base Exception class for all transfer plugin errors."""
def __init__(self, *args):
Exception.__init__(self, *args)
class ILO_POWERON_FAILED(Exception):
"""Base Exception class for all transfer plugin er... | import sys,M2Crypto
def getXmlWithLogin(user, password):
inputFile=open("/etc/xapi.d/plugins/iLOPowerON.xml",'r')
try:
result= inputFile.read().replace('user',user).replace('password',password)
finally:
inputFile.close()
return result
def iLO(power_on_ip, user, password):
... | lgpl-2.1 | Python |
290a1f7a2c6860ec57bdb74b9c97207e93e611f0 | Add option to visualize data in reverse | alexlee-gk/visual_dynamics | visualize_data.py | visualize_data.py | from __future__ import division
import argparse
import cv2
import h5py
import util
def main():
parser = argparse.ArgumentParser()
parser.add_argument('hdf5_fname', type=str)
parser.add_argument('--vis_scale', '-r', type=int, default=10, metavar='R', help='rescale image by R for visualization')
parser.... | from __future__ import division
import argparse
import cv2
import h5py
import util
def main():
parser = argparse.ArgumentParser()
parser.add_argument('hdf5_fname', type=str)
parser.add_argument('--vis_scale', '-r', type=int, default=10, metavar='R', help='rescale image by R for visualization')
args =... | mit | Python |
e214cd39396489c35c36b9e06ba4edb0f426181d | Use a sleep of 0.01s longer than what we're testing for | eriol/circuits,treemo/circuits,eriol/circuits,treemo/circuits,treemo/circuits,nizox/circuits,eriol/circuits | tests/core/test_timers.py | tests/core/test_timers.py | # Module: test_timers
# Date: 10th February 2010
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Timers Tests"""
from time import sleep
from circuits import Event, Component, Timer
class Test(Event):
"""Test Event"""
class App(Component):
flag = False
def timer(self):
... | # Module: test_timers
# Date: 10th February 2010
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Timers Tests"""
from time import sleep
from circuits import Event, Component, Timer
class Test(Event):
"""Test Event"""
class App(Component):
flag = False
def timer(self):
... | mit | Python |
d62588af4e8ee547308d87e95a867581c28e8d03 | add example plist | jamesgk/ufo2ft,googlefonts/ufo2ft,jamesgk/ufo2fdk,googlei18n/ufo2ft,moyogo/ufo2ft | tests/featureWriters/featureWriters_test.py | tests/featureWriters/featureWriters_test.py | from __future__ import (
print_function,
absolute_import,
division,
unicode_literals,
)
from ufo2ft.featureWriters import (
BaseFeatureWriter,
FEATURE_WRITERS_KEY,
loadFeatureWriters,
loadFeatureWriterFromString,
)
try:
from plistlib import loads, FMT_XML
def readPlistFromStrin... | from __future__ import (
print_function,
absolute_import,
division,
unicode_literals,
)
from ufo2ft.featureWriters import (
BaseFeatureWriter,
FEATURE_WRITERS_KEY,
loadFeatureWriters,
loadFeatureWriterFromString,
)
import pytest
from ..testSupport import _TempModule
class FooBarWriter... | mit | Python |
bf6d6cdaf946af7ce8d1aa6831e7da9b47fef54f | Put import back on top | incuna/django-user-deletion | user_deletion/managers.py | user_deletion/managers.py | from dateutil.relativedelta import relativedelta
from django.apps import apps
from django.utils import timezone
class UserDeletionManagerMixin:
def users_to_notify(self):
"""Finds all users who have been inactive and not yet notified."""
user_deletion_config = apps.get_app_config('user_deletion')
... | from dateutil.relativedelta import relativedelta
from django.utils import timezone
class UserDeletionManagerMixin:
def users_to_notify(self):
"""Finds all users who have been inactive and not yet notified."""
from django.apps import apps
user_deletion_config = apps.get_app_config('user_de... | bsd-2-clause | Python |
8d0e16041a24f4526ac35aaad1c2f16e601236b1 | simplify import for ViewItem | TheImagingSource/tiscamera,TheImagingSource/tiscamera,TheImagingSource/tiscamera,TheImagingSource/tiscamera | tools/tcam-capture/tcam_capture/ViewItem.py | tools/tcam-capture/tcam_capture/ViewItem.py | # Copyright 2018 The Imaging Source Europe GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | # Copyright 2018 The Imaging Source Europe GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | apache-2.0 | Python |
3d8d6f906f8adcf60a8e91f2962f2756789581a7 | update test_mesh_expand.py for pytest | vlukes/sfepy,vlukes/sfepy,rc/sfepy,sfepy/sfepy,vlukes/sfepy,rc/sfepy,rc/sfepy,sfepy/sfepy,BubuLK/sfepy,BubuLK/sfepy,sfepy/sfepy,BubuLK/sfepy | tests/test_mesh_expand.py | tests/test_mesh_expand.py | def test_mesh_expand():
import numpy as nm
from sfepy.mesh.mesh_tools import expand2d
from sfepy.discrete.fem.mesh import Mesh
from sfepy import data_dir
mesh2d = Mesh.from_file(data_dir + '/meshes/2d/square_quad.mesh')
mesh3d_ref = Mesh.from_file(data_dir +\
'/m... | from __future__ import absolute_import
from sfepy.base.testing import TestCommon
class Test(TestCommon):
@staticmethod
def from_conf(conf, options):
test = Test(conf=conf, options=options)
return test
def test_mesh_expand(self):
import numpy as nm
from sfepy.mesh.mesh_tool... | bsd-3-clause | Python |
287389927050c6cc32cab0d572ad8c9931fe922e | Remove some optional middleware from the testsuite | matthiask/django-admin-ordering,matthiask/django-admin-ordering | tests/testapp/settings.py | tests/testapp/settings.py | import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contri... | import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contri... | bsd-3-clause | Python |
32ae4df3ace7c7f44ed9f7c55d144c43e55f2c4b | Fix build for third_party/qcms when SSE is diabled. | patrickm/chromium.src,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,chuan9/chromium-crosswalk,zcbenz/cefode-chromium,hgl888/chromium-crosswalk,ltilve/chromium,M4sse/chromium.src,krieger-od/nwjs_chromium.src,mogoweb/chromium-crosswalk,rogerwang/chromium,zcbenz/cefode-chromium,mohamed--abdel-maksoud/chromium.src,axingin... | third_party/qcms/qcms.gyp | third_party/qcms/qcms.gyp | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'qcms',
'product_name': 'qcms',
'type': '<(library)',
'sources': [
'qcms.h',
... | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'qcms',
'product_name': 'qcms',
'type': '<(library)',
'sources': [
'qcms.h',
... | bsd-3-clause | Python |
88e56a74e85f46290966cd881d2a84b08f9c975e | Fix children bug | adrianliaw/PyCuber | pycuber/ext/solvers/cfop/f2l.py | pycuber/ext/solvers/cfop/f2l.py | """
Module for solving Rubik's Cube F2L.
"""
from ....cube import *
from ....algorithm import *
from ....util import a_star_search
class F2LPairSolver(object):
"""
F2LPairSolver() => Solver for solving an F2L pair.
"""
def __init__(self, cube=None, pair=None):
self.cube = cube
self.pai... | """
Module for solving Rubik's Cube F2L.
"""
from ....cube import *
from ....algorithm import *
from ....util import a_star_search
class F2LPairSolver(object):
"""
F2LPairSolver() => Solver for solving an F2L pair.
"""
def __init__(self, cube=None, pair=None):
self.cube = cube
self.pai... | mit | Python |
6a767780253ef981e78b00bb9937e9aaa0f9d1b8 | Add sleep after nickserv identify | Motoko11/MotoBot | motobot/core_plugins/network_handlers.py | motobot/core_plugins/network_handlers.py | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, context, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, context, message):
""" Handles too fast for server message and waits 1 second. """
bot.id... | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, context, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, context, message):
""" Handles too fast for server message and waits 1 second. """
bot.id... | mit | Python |
68832a3638029713b59f8a462b96e797ce754c72 | Add docstrings to Singleton methods | shaunstanislaus/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,shaunstanislaus/pyexperiment,DeercoderResearch/pyexperiment,DeercoderResearch/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,DeercoderResearch/pyexperiment,kinverarity1/pyexperiment,kinverarity1/pyexperiment,DeercoderResearch/p... | pyexperiment/utils/Singleton.py | pyexperiment/utils/Singleton.py | """Implements a singleton base-class (as in tornado.ioloop.IOLoop.instance())
Written by Peter Duerr (inspired by tornado's implementation)
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import threading
class ... | """Implements a singleton base-class (as in tornado.ioloop.IOLoop.instance())
Written by Peter Duerr (inspired by tornado's implementation)
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import threading
class ... | mit | Python |
1a9122d59be0c351b14c174a60880c2e927e6168 | Fix failing host name test and add wildcard tests | fyookball/electrum,fyookball/electrum,fyookball/electrum | lib/tests/test_interface.py | lib/tests/test_interface.py | import unittest
from .. import interface
class TestInterface(unittest.TestCase):
def test_match_host_name(self):
self.assertTrue(interface._match_hostname('asd.fgh.com', 'asd.fgh.com'))
self.assertFalse(interface._match_hostname('asd.fgh.com', 'asd.zxc.com'))
self.assertTrue(interface._m... | import unittest
from .. import interface
class TestInterface(unittest.TestCase):
def test_match_host_name(self):
self.assertTrue(interface._match_hostname('asd.fgh.com', 'asd.fgh.com'))
self.assertFalse(interface._match_hostname('asd.fgh.com', 'asd.zxc.com'))
self.assertTrue(interface._m... | mit | Python |
d7d16f5c154b1c135e4eede78338022307bc720d | Fix bug in zhengzhou jiesuan parameter | happy6666/stockStrategies,happy6666/stockStrategies | options/script/zzjiesuan_parameter.py | options/script/zzjiesuan_parameter.py | #!/usr/bin/python
# coding: utf-8
import sys
import urllib2
import time
from datetime import datetime
from bs4 import BeautifulSoup
TODAY=datetime.today().strftime('%Y%m%d')
IMPORTANT='20101008'
def getDataOnDate(ts):
t=0;
alldata=[]
while True:
time.sleep(3)
try:
if ts>=IMPORTANT:
print 'http://www.czc... | #!/usr/bin/python
# coding: utf-8
import sys
import urllib2
import time
from datetime import datetime
from bs4 import BeautifulSoup
TODAY=datetime.today().strftime('%Y%m%d')
IMPORTANT='20101008'
def getDataOnDate(ts):
t=0;
alldata=[]
while True:
time.sleep(3)
try:
if ts>=IMPORTANT:
print 'http://www.czc... | apache-2.0 | Python |
832951d57a76d106db485c9a3469870713759ba5 | Fix ID of previous migration in comment | stackforge/blazar,ChameleonCloud/blazar,openstack/blazar,stackforge/blazar,openstack/blazar,ChameleonCloud/blazar | blazar/db/migration/alembic_migrations/versions/e069c014356d_add_floatingip.py | blazar/db/migration/alembic_migrations/versions/e069c014356d_add_floatingip.py | # Copyright 2019 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2019 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
c2d3c2c471dfb504626509a34256eb2d9898cfa2 | Fix to use get_serializer_class method instead of serializer_class | alanjds/drf-nested-routers | rest_framework_nested/viewsets.py | rest_framework_nested/viewsets.py | class NestedViewSetMixin(object):
def get_queryset(self):
"""
Filter the `QuerySet` based on its parents as defined in the
`serializer_class.parent_lookup_kwargs`.
"""
queryset = super(NestedViewSetMixin, self).get_queryset()
serializer_class = self.get_serializer_cla... | class NestedViewSetMixin(object):
def get_queryset(self):
"""
Filter the `QuerySet` based on its parents as defined in the
`serializer_class.parent_lookup_kwargs`.
"""
queryset = super(NestedViewSetMixin, self).get_queryset()
if hasattr(self.serializer_class, 'parent_... | apache-2.0 | Python |
c6790535ea1e49ec65c4926f997db746d9b0833b | use common board mode | wuan/klimalogger | klimalogger/sensor/sht1x_sensor.py | klimalogger/sensor/sht1x_sensor.py | # -*- coding: utf8 -*-
from injector import singleton, inject
try:
import configparser
except ImportError:
import configparser as configparser
from sht1x.Sht1x import Sht1x as SHT1x
@singleton
class Sensor:
name = "SHT1x"
@inject
def __init__(self, config_parser: configparser.ConfigParser):
... | # -*- coding: utf8 -*-
from injector import singleton, inject
try:
import configparser
except ImportError:
import configparser as configparser
from sht1x.Sht1x import Sht1x as SHT1x
@singleton
class Sensor:
name = "SHT1x"
@inject
def __init__(self, config_parser: configparser.ConfigParser):
... | apache-2.0 | Python |
3b7328dd7d9d235bf32b3cfb836b49e50b70be77 | Allow for non-ascii characters in password_hash | dailymuse/oz,dailymuse/oz,dailymuse/oz | oz/plugins/redis_sessions/__init__.py | oz/plugins/redis_sessions/__init__.py | from __future__ import absolute_import, division, print_function, with_statement, unicode_literals
import os
import binascii
import hashlib
import oz.app
from .middleware import *
from .options import *
from .tests import *
def random_hex(length):
"""Generates a random hex string"""
return binascii.hexlify(o... | from __future__ import absolute_import, division, print_function, with_statement, unicode_literals
import os
import binascii
import hashlib
import oz.app
from .middleware import *
from .options import *
from .tests import *
def random_hex(length):
"""Generates a random hex string"""
return binascii.hexlify(o... | bsd-3-clause | Python |
d514558e6f229abbd34392bf34235db8ebf1b0d9 | allow local users too | biviosoftware/salt-conf,radiasoft/salt-conf,biviosoftware/salt-conf,radiasoft/salt-conf | srv/salt/jupyterhub/jupyterhub_config.py | srv/salt/jupyterhub/jupyterhub_config.py | c.Authenticator.admin_users = {'{{ pillar.jupyterhub.admin_user }}',}
c.JupyterHub.confirm_no_ssl = True
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.cookie_secret_file = '{{ zz.guest_cookie }}'
c.JupyterHub.proxy_auth_token = '{{ pillar.jupyterhub.proxy_auth_token }}'
# Allow both local and GitHub users; Useful for bootst... | c.Authenticator.admin_users = {'{{ pillar.jupyterhub.admin_user }}',}
c.JupyterHub.confirm_no_ssl = True
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.cookie_secret_file = '{{ zz.guest_cookie }}'
c.JupyterHub.proxy_auth_token = '{{ pillar.jupyterhub.proxy_auth_token }}'
c.JupyterHub.authenticator_class = 'oauthenticator.Git... | apache-2.0 | Python |
e01c990aa095b28cd72be14917fec4e8e5253729 | support specifying custom runner file name | userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3 | atest/genrunner.py | atest/genrunner.py | #!/usr/bin/env python
"""Script to generate atest runners based on plain text data files.
Usage: %s testdata/path/data.txt [robot/path/runner.txt]
"""
from os.path import abspath, basename, dirname, exists, join, splitext
import os
import sys
if len(sys.argv) not in [2, 3] or not all(a.endswith('.txt') for a in sy... | #!/usr/bin/env python
"""Script to generate atest runners based on plain text data files.
Usage: %s path/to/data.txt
"""
from __future__ import with_statement
from os.path import abspath, basename, dirname, exists, join, splitext
import os
import sys
if len(sys.argv) != 2 or splitext(sys.argv[1])[1] != '.txt':
... | apache-2.0 | Python |
d4a4fd7fd5565276dabd7990721210bf9df6dd42 | fix busy cursor nesting | pbmanis/acq4,acq4/acq4,pbmanis/acq4,campagnola/acq4,acq4/acq4,campagnola/acq4,campagnola/acq4,pbmanis/acq4,meganbkratz/acq4,campagnola/acq4,acq4/acq4,meganbkratz/acq4,meganbkratz/acq4,pbmanis/acq4,meganbkratz/acq4,acq4/acq4 | pyqtgraph/widgets/BusyCursor.py | pyqtgraph/widgets/BusyCursor.py | from ..Qt import QtGui, QtCore
__all__ = ['BusyCursor']
class BusyCursor(object):
"""Class for displaying a busy mouse cursor during long operations.
Usage::
with pyqtgraph.BusyCursor():
doLongOperation()
May be nested.
"""
active = []
def __enter__(self):
QtGui.... | from ..Qt import QtGui, QtCore
__all__ = ['BusyCursor']
class BusyCursor(object):
"""Class for displaying a busy mouse cursor during long operations.
Usage::
with pyqtgraph.BusyCursor():
doLongOperation()
May be nested.
"""
active = []
def __enter__(self):
QtGui.... | mit | Python |
3c06788eef9ddfa8cc628c1d7c628073ec7fd50b | Set APK size limit to 5 MB. (#1523) | mozilla-mobile/focus-android,liuche/focus-android,liuche/focus-android,pocmo/focus-android,mozilla-mobile/focus-android,mastizada/focus-android,pocmo/focus-android,liuche/focus-android,ekager/focus-android,Benestar/focus-android,ekager/focus-android,pocmo/focus-android,Benestar/focus-android,mastizada/focus-android,eka... | tools/metrics/apk_size.py | tools/metrics/apk_size.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/.
# Check APK file size for limit
from os import path, listdir, stat
from sys import exit
SIZE_LIMIT = 5242880
PATH = pa... | # 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/.
# Check APK file size for limit
from os import path, listdir, stat
from sys import exit
SIZE_LIMIT = 4500000
PATH = pa... | mpl-2.0 | Python |
06e703290640ed6326bf70e172c25be92799591f | Exclude extmod/vfs_fat_fileio.py test. | selste/micropython,chrisdearman/micropython,pfalcon/micropython,dmazzella/micropython,deshipu/micropython,TDAbboud/micropython,dxxb/micropython,SHA2017-badge/micropython-esp32,MrSurly/micropython,tralamazza/micropython,blazewicz/micropython,kerneltask/micropython,henriknelson/micropython,trezor/micropython,Timmenem/mic... | tools/tinytest-codegen.py | tools/tinytest-codegen.py | #! /usr/bin/env python3
import os, sys
from glob import glob
from re import sub
def escape(s):
lookup = {
'\0': '\\0',
'\t': '\\t',
'\n': '\\n\"\n\"',
'\r': '\\r',
'\\': '\\\\',
'\"': '\\\"',
}
return "\"\"\n\"{}\"".format(''.join([lookup[x] if x in lookup else x for x in s]))
def chew_... | #! /usr/bin/env python3
import os, sys
from glob import glob
from re import sub
def escape(s):
lookup = {
'\0': '\\0',
'\t': '\\t',
'\n': '\\n\"\n\"',
'\r': '\\r',
'\\': '\\\\',
'\"': '\\\"',
}
return "\"\"\n\"{}\"".format(''.join([lookup[x] if x in lookup else x for x in s]))
def chew_... | mit | Python |
19c97e2d109a0ceaaf2a7ed38a16d621e9b7535d | Fix help print for modules. | S2R2/viper,cwtaylor/viper,kevthehermit/viper,Beercow/viper,MeteorAdminz/viper,cwtaylor/viper,kevthehermit/viper,Beercow/viper,MeteorAdminz/viper,S2R2/viper,Beercow/viper | viper/common/abstracts.py | viper/common/abstracts.py | # This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import argparse
import viper.common.out as out
class ArgumentErrorCallback(Exception):
def __init__(self, message, level=''):
self.message = message.strip() + '\n'
self.level ... | # This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import argparse
import viper.common.out as out
class ArgumentErrorCallback(Exception):
def __init__(self, message, level=''):
self.message = message.strip() + '\n'
self.level ... | bsd-3-clause | Python |
5516fdee86fe0ffcd34381985ebe798f9fbda1af | Fix incorrect check for `self.log` | h01ger/voctomix,h01ger/voctomix,voc/voctomix,voc/voctomix | voctogui/lib/uibuilder.py | voctogui/lib/uibuilder.py | import gi
import logging
from gi.repository import Gtk, Gst
class UiBuilder(object):
def __init__(self, uifile):
if not hasattr(self, 'log'):
self.log = logging.getLogger('UiBuilder')
self.uifile = uifile
self.builder = Gtk.Builder()
self.builder.add_from_file(self.u... | import gi
import logging
from gi.repository import Gtk, Gst
class UiBuilder(object):
def __init__(self, uifile):
if not self.log:
self.log = logging.getLogger('UiBuilder')
self.uifile = uifile
self.builder = Gtk.Builder()
self.builder.add_from_file(self.uifile)
... | mit | Python |
aaab0505fe1547a01a096d5612597f74f9534b29 | Send credentials only when they are provided | citrix-openstack-build/python-saharaclient,citrix-openstack-build/python-saharaclient,openstack/python-saharaclient,citrix-openstack-build/python-saharaclient | savannaclient/api/data_sources.py | savannaclient/api/data_sources.py | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 | Python |
b1eafae0b56abc652f884cec78a885669ab78986 | Update class name | jalama/drupdates | drupdates/tests/behavioral/test_multiple_working_directories_multiple_sites.py | drupdates/tests/behavioral/test_multiple_working_directories_multiple_sites.py | """ Test running Drupdates on multiple repos, multiple working Directories. """
"""
note: The second working directory will have it's own settings file.
"""
from drupdates.tests.behavioral.behavioral_utils import BehavioralUtils
from drupdates.tests import Setup
class TestMultipleWorkingDirectoriesOneCustomSettin... | """ Test running Drupdates on multiple repos, multiple working Directories. """
"""
note: The second working directory will have it's own settings file.
"""
from drupdates.tests.behavioral.behavioral_utils import BehavioralUtils
from drupdates.tests import Setup
class TestMultipleWorkingDirectoriesMultipleSites(o... | mit | Python |
780b25b724991ccfca20f649d0e4902cb94c4885 | Use static JSONEncoders (#7) | matrix-org/python-canonicaljson | canonicaljson.py | canonicaljson.py | # -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
#
# 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
#
#... | # -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket Ltd
#
# 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 l... | apache-2.0 | Python |
442f21bfde16f72d4480fa7fd9dea2eac741a857 | Include analysis detail view URL in message | ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai | src/analyses/views.py | src/analyses/views.py | from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, TemplateView
from .forms import AbstractAnalysisCreateForm
from .pipelines i... | from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, TemplateView
from .forms import AbstractAnalysisCreateForm
from .pipelines i... | mit | Python |
9283c745e510add1748c579020e87fa18459ee6f | Fix (hide) blacklist integrity error | tyler274/Recruitment-App,tyler274/Recruitment-App,tyler274/Recruitment-App | recruit_app/blacklist/models.py | recruit_app/blacklist/models.py | # -*- coding: utf-8 -*-
from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin
from flask import current_app
import requests
import datetime as dt
class BlacklistCharacter(SurrogatePK, TimeMixin, Model):
__tablename__ = 'blacklist_character'
# __searchable__ = [... | # -*- coding: utf-8 -*-
from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin
from flask import current_app
import requests
import datetime as dt
class BlacklistCharacter(SurrogatePK, TimeMixin, Model):
__tablename__ = 'blacklist_character'
# __searchable__ = [... | bsd-3-clause | Python |
6356cc557e392d3d28886e2d930aa7faa8bb0ac7 | switch to repr | tyler274/Recruitment-App,tyler274/Recruitment-App,tyler274/Recruitment-App | recruit_app/blacklist/models.py | recruit_app/blacklist/models.py | # -*- coding: utf-8 -*-
from recruit_app.extensions import bcrypt
from recruit_app.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
TimeMixin,
)
import flask_whooshalchemy as whooshalchemy
from sqlalchemy_searchable import make_searchable
from sqlalchemy_utils.... | # -*- coding: utf-8 -*-
from recruit_app.extensions import bcrypt
from recruit_app.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
TimeMixin,
)
import flask_whooshalchemy as whooshalchemy
from sqlalchemy_searchable import make_searchable
from sqlalchemy_utils.... | bsd-3-clause | Python |
d07530e309936f686c0d05eb9df257e5c89e16c7 | Update submission | davidgasquez/kaggle-airbnb | scripts/one_vs_rest_classifier.py | scripts/one_vs_rest_classifier.py | #!/usr/bin/env python
import pandas as pd
import numpy as np
import datetime
from sklearn.preprocessing import LabelEncoder
from sklearn.multiclass import OneVsRestClassifier
from xgboost.sklearn import XGBClassifier
def generate_submission(y_pred, test_users_ids, label_encoder):
ids = []
cts = []
for i ... | #!/usr/bin/env python
import pandas as pd
import numpy as np
import datetime
from sklearn.preprocessing import LabelEncoder
from sklearn.multiclass import OneVsRestClassifier
from xgboost.sklearn import XGBClassifier
def generate_submission(y_pred, test_users_ids, label_encoder):
ids = []
cts = []
for i ... | mit | Python |
2bc95d90db15160f9c4869c03f9dadb6cd8d56fa | Add another proxy server example string | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | seleniumbase/config/proxy_list.py | seleniumbase/config/proxy_list.py | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | mit | Python |
c0d3922b38a12e9de4bbca0935b7089e8156cf5c | Update three-words.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CheckiO/three-words.py | CheckiO/three-words.py | def checkio(words):
return '111' in ''.join('1' if w.isalpha() else '0' for w in words.split())
# alt
from re import findall, I
def checkio(words):
return bool(findall('([a-z]+ +){2,}[a-z]+', words, flags=I))
| def checkio(words):
return '111' in ''.join('1' if w.isalpha() else '0' for w in words.split())
| mit | Python |
a54ebe90f03406ab5c5587d9d63b01c5d9890863 | Update A.py | Pouf/CodingCompetition,Pouf/CodingCompetition | Google-Code-Jam/2016-1B/A.py | Google-Code-Jam/2016-1B/A.py | import os
import sys
script = __file__
script_path = os.path.dirname(script)
script_file = os.path.basename(script)[0]
files = [f for f in os.listdir(script_path) if script_file in f and '.in' in f]
if '{}-large'.format(script_file) in str(files):
size = 'large'
elif '{}-small'.format(script_file) in st... | import os
import sys
script = __file__
scriptPath = os.path.dirname(script)
scriptFile = os.path.basename(script)[0]
files = [f for f in os.listdir(scriptPath) if scriptFile in f and '.in' in f]
if '{}-large'.format(scriptFile) in str(files):
size = 'large'
elif '{}-small'.format(scriptFile) in str(files)... | mit | Python |
f825f2378f9546bb415282635955e31075a1405e | remove print statements | jdodds/feather | feather/dispatcher.py | feather/dispatcher.py | from collections import defaultdict
from multiprocessing import Queue
class Dispatcher(object):
"""Recieve messages from Plugins and send them to the Plugins that listen
for them.
"""
def __init__(self):
"""Create our set of listeners, communication Queue, and empty set of
plugins.
... | from collections import defaultdict
from multiprocessing import Queue
class Dispatcher(object):
"""Recieve messages from Plugins and send them to the Plugins that listen
for them.
"""
def __init__(self):
"""Create our set of listeners, communication Queue, and empty set of
plugins.
... | bsd-3-clause | Python |
e2af3ff1f28db11ee05e471a6f14f5a04244a69a | bump to next dev version | ocefpaf/ulmo,nathanhilbert/ulmo,cameronbracken/ulmo,nathanhilbert/ulmo,cameronbracken/ulmo,ocefpaf/ulmo | ulmo/version.py | ulmo/version.py | # set version number
__version__ = '0.7.2-dev'
| # set version number
__version__ = '0.7.1'
| bsd-3-clause | Python |
34256a3a7a5e56e6ebf74fa86861a176d6bf02cd | Update hsi_evaluate.py | JiJingYu/tensorflow-exercise | HSI_evaluate/hsi_evaluate.py | HSI_evaluate/hsi_evaluate.py | import numpy as np
from numpy.linalg import norm
from skimage.measure import compare_psnr, compare_ssim, compare_mse
def psnr(x_true, x_pred):
"""
:param x_true: 高光谱图像:格式:(H, W, C)
:param x_pred: 高光谱图像:格式:(H, W, C)
:return: 计算原始高光谱数据与重构高光谱数据的均方误差
References
----------
.. [1] https://en.wi... | import numpy as np
from numpy.linalg import norm
from skimage.measure import compare_psnr, compare_ssim, compare_mse
def psnr(x_true, x_pred):
"""
:param x_true:
:param x_pred:
:return:
References
----------
.. [1] https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
"""
n_ban... | apache-2.0 | Python |
12e68786488daf1a1d60681ed9800f9951cdd618 | Create handler object, add write functionality | SentientCNC/Sentient-CNC | store_data.py | store_data.py | from google.cloud import datastore
import datetime
class data_handler():
"""
Object designed to handle storage of incoming sensor data.
Args:
project_id: string
Project ID per Google Cloud's project ID (see Cloud Console)
sensor_node: string
Identifier for sensor gateway. This is u... | from google.cloud import datastore
import datetime
class data_writer():
def __init__(self, project_id='sentientcnc-1'):
self.project = datastore.Client(project_id)
pass
def create_client(project_id):
'''
Creates an authorized service object to make authenticated
requests to Google C... | apache-2.0 | Python |
1a15a08abd7c7b5313402be4574ca6811044fd75 | Fix HardwareDevice constructor to provide 'description' argument | Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server | launch_control/models/hw_device.py | launch_control/models/hw_device.py | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | agpl-3.0 | Python |
f20c62b663cb35cb60e26884000d47e8c9b712a3 | Include thread name in log output | netsec-ethz/scion,dmpiergiacomo/scion,netsec-ethz/scion,dmpiergiacomo/scion,klausman/scion,Oncilla/scion,dmpiergiacomo/scion,Oncilla/scion,Oncilla/scion,FR4NK-W/osourced-scion,FR4NK-W/osourced-scion,FR4NK-W/osourced-scion,dmpiergiacomo/scion,klausman/scion,klausman/scion,klausman/scion,Oncilla/scion,dmpiergiacomo/scion... | lib/log.py | lib/log.py | # Copyright 2015 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | # Copyright 2015 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | apache-2.0 | Python |
f4c66c87683587145f06fd332609152faa62ea00 | Fix filters config loading | dmrib/trackingtermites | trackingtermites/utils.py | trackingtermites/utils.py | """Utilitary shared functions."""
boolean_parameters = ['show_labels', 'highlight_collisions',
'show_bounding_box', 'show_frame_info',
'show_d_lines', 'show_trails']
tuple_parameters = ['video_source_size', 'arena_size']
integer_parameters = ['n_termites', 'box_size', 'sca... | """Utilitary shared functions."""
boolean_parameters = ['show_labels', 'highlight_collisions',
'show_bounding_box', 'show_frame_info',
'show_d_lines', 'show_trails']
tuple_parameters = ['video_source_size', 'arena_size']
integer_parameters = ['n_termites', 'box_size', 'sca... | mit | Python |
2b487bfe85d87dda6e7e89fd8f950d708db9fe52 | Revert Essentia from build test | Kaggle/docker-python,Kaggle/docker-python | test_build.py | test_build.py | # This script should run without errors whenever we update the
# kaggle/python container. It checks that all our most popular packages can
# be loaded and used without errors.
import numpy as np
print("Numpy imported ok")
print("Your lucky number is: " + str(np.random.randint(100)))
import pandas as pd
print("Pandas ... | # This script should run without errors whenever we update the
# kaggle/python container. It checks that all our most popular packages can
# be loaded and used without errors.
import numpy as np
print("Numpy imported ok")
print("Your lucky number is: " + str(np.random.randint(100)))
import pandas as pd
print("Pandas ... | apache-2.0 | Python |
b956f5d8c4c9329d4fae448358b5d3169939fcfb | Fix when packages not exist | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | shipyard/rules/java/java/build.py | shipyard/rules/java/java/build.py | """Set up Java runtime environment."""
from pathlib import Path
from foreman import define_parameter, rule
from garage import scripts
from templates import common
(define_parameter.path_typed('jre')
.with_doc('Path to JRE.')
.with_default(Path('/usr/local/lib/java/jre')))
(define_parameter.path_typed('package... | """Set up Java runtime environment."""
from pathlib import Path
from foreman import define_parameter, rule
from garage import scripts
from templates import common
(define_parameter.path_typed('jre')
.with_doc('Path to JRE.')
.with_default(Path('/usr/local/lib/java/jre')))
(define_parameter.path_typed('package... | mit | Python |
3983d7a205766526364c64158f10c0d931190d93 | Use update | davidfischer/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,safwanrahman/readthedocs.org,safwanrahman/readthedocs.org,safwanrahman/readthedocs.org | readthedocs/projects/migrations/0025_show-version-warning-existing-projects.py | readthedocs/projects/migrations/0025_show-version-warning-existing-projects.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-05-07 19:25
from __future__ import unicode_literals
from django.db import migrations
def show_version_warning_to_existing_projects(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Project.objects.all().update(show_version_warni... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-05-07 19:25
from __future__ import unicode_literals
from django.db import migrations
def show_version_warning_to_existing_projects(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
for project in Project.objects.all():
p... | mit | Python |
e4d818072e72492df6275c1ca43d06165c113a49 | Implement size method | funkybob/django-webdav-storage | webdav_storage/backend.py | webdav_storage/backend.py |
from django.conf import settings
from django.core.files.storage import Storage
import requests
from urlparse import urljoin
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
WEBDAV_ROOT = settings.WEBDAV_ROOT
WEBDAV_PULIC = getattr(settings, 'WEBDAV_PUBLIC', WEBDAV_ROOT)
... |
from django.conf import settings
from django.core.files.storage import Storage
import requests
from urlparse import urljoin
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
WEBDAV_ROOT = settings.WEBDAV_ROOT
WEBDAV_PULIC = getattr(settings, 'WEBDAV_PUBLIC', WEBDAV_ROOT)
... | bsd-2-clause | Python |
3c9504efecf0f5e14a3922e0f33f812851837bc7 | Add test to handle errors from extract_topics | NewAcropolis/api,NewAcropolis/api,NewAcropolis/api | tests/app/na_celery/test_upload_tasks.py | tests/app/na_celery/test_upload_tasks.py | from app.models import MAGAZINE
from app.na_celery.upload_tasks import upload_magazine
from tests.db import create_email
class WhenUploadingMagazinePdfs:
def it_uploads_a_magazine_pdf_and_sends_email(self, db_session, mocker, sample_magazine, sample_user):
mocker.patch('app.na_celery.upload_tasks.Storage... | from app.models import MAGAZINE
from app.na_celery.upload_tasks import upload_magazine
from tests.db import create_email
class WhenUploadingMagazinePdfs:
def it_uploads_a_magazine_pdf_and_sends_email(self, db_session, mocker, sample_magazine, sample_user):
mocker.patch('app.na_celery.upload_tasks.Storage... | mit | Python |
674a19c3d78829135a39dda34e468413bd72364b | Add description of work todo (so I don't forget). | agbrooks/ghetto-sonar | mlsmath/mls.py | mlsmath/mls.py | from polynomial import *
from modtwo import *
"""
mls defines make_mls, which creates a maximum length sequence from a given
degree.
The top of the file contains some parsing functions to read the generator
polynomial definitions.
"""
GENERATOR_FILE = "generators.text"
def _strip_after_pound(string):
"""
... | from polynomial import *
from modtwo import *
"""
mls defines make_mls, which creates a maximum length sequence from a given
degree.
The top of the file contains some parsing functions to read the generator
polynomial definitions.
"""
GENERATOR_FILE = "generators.text"
def _strip_after_pound(string):
"""
... | mit | Python |
9c668a12a021ed0e3698699cd36506f10a0fa486 | add coreview: user.json_list | abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core | abilian/web/coreviews/users.py | abilian/web/coreviews/users.py | # coding=utf-8
"""
"""
from __future__ import absolute_import
import hashlib
from sqlalchemy.sql.expression import or_, func
from flask import Blueprint, make_response, request, g, Response
from werkzeug.exceptions import NotFound
from abilian.core.models.subjects import User
from abilian.web import url_for
from abi... | # coding=utf-8
"""
"""
from __future__ import absolute_import
import hashlib
from flask import Blueprint, make_response, request, g, Response
from werkzeug.exceptions import NotFound
from abilian.core.models.subjects import User
bp = Blueprint('users', __name__, url_prefix='/users')
@bp.url_value_preprocessor
de... | lgpl-2.1 | Python |
f1fab0dbb25104213359c8da5aacb1bbed290a6b | Call match() instead of copying its body | nvbn/thefuck,SimenB/thefuck,Clpsplug/thefuck,scorphus/thefuck,SimenB/thefuck,nvbn/thefuck,scorphus/thefuck,Clpsplug/thefuck | thefuck/rules/git_flag_after_filename.py | thefuck/rules/git_flag_after_filename.py | import re
from thefuck.specific.git import git_support
error_pattern = "fatal: bad flag '(.*?)' used after filename"
@git_support
def match(command):
return re.search(error_pattern, command.output)
@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
# find the bad flag
... | import re
from thefuck.specific.git import git_support
error_pattern = "fatal: bad flag '(.*?)' used after filename"
@git_support
def match(command):
return re.search(error_pattern, command.output)
@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
# find the bad flag
... | mit | Python |
c9b5998372b99140b0c9032af0ba6590d68ad6d6 | Bump version to 0.10.3 | botify-labs/simpleflow,botify-labs/simpleflow | simpleflow/__init__.py | simpleflow/__init__.py | # -*- coding: utf-8 -*-
import logging.config
from .activity import Activity # NOQA
from .workflow import Workflow # NOQA
from . import settings
__version__ = '0.10.3'
__author__ = 'Greg Leclercq'
__license__ = "MIT"
logging.config.dictConfig(settings.base.load()['LOGGING'])
| # -*- coding: utf-8 -*-
import logging.config
from .activity import Activity # NOQA
from .workflow import Workflow # NOQA
from . import settings
__version__ = '0.10.2'
__author__ = 'Greg Leclercq'
__license__ = "MIT"
logging.config.dictConfig(settings.base.load()['LOGGING'])
| mit | Python |
e82c6f691a66efd6b7db3ef5db696e8d745b5d18 | reduce space | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | alphatwirl/roottree/inspect.py | alphatwirl/roottree/inspect.py | # Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
def is_ROOT_null_pointer(tobject):
try:
tobject.GetName()
return False
except ReferenceError:
return True
##__________________________________________________________________||
de... | # Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
def is_ROOT_null_pointer(tobject):
try:
tobject.GetName()
return False
except ReferenceError:
return True
##__________________________________________________________________||
de... | bsd-3-clause | Python |
77c15b91325e43c7c28d83c8b97130b31facd2ea | Update post and add put method for User api endpoint. | rivalrockets/benchmarks.rivalrockets.com,rivalrockets/rivalrockets-api | app/api_1_0/resources/users.py | app/api_1_0/resources/users.py | from flask import g
from flask_restful import Resource, reqparse, fields, marshal_with
from .authentication import auth
from .machines import machine_fields
from ... import db
from ...models import User, Machine
# flask_restful fields usage:
# note that the 'Url' field type takes the 'endpoint' for the arg
user_field... | from flask_restful import Resource, reqparse, fields, marshal_with
from ... import db
from ...models import User
# flask_restful fields usage:
# note that the 'Url' field type takes the 'endpoint' for the arg
user_fields = {
'username': fields.String,
'uri': fields.Url('.user', absolute=True)
}
# List of us... | mit | Python |
e02c4a9b39a11af0dad6312abcd20855744d5344 | update Ashford import script for parl.2017-06-08 (closes #946) | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_ashford.py | polling_stations/apps/data_collection/management/commands/import_ashford.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000105'
addresses_name = 'parl.2017-06-08/Version 1/Ashford Democracy_Club__08June2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/Ashford Democracy_Clu... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000105'
addresses_name = 'Ashford_Democracy_Club__04May2017.CSV'
stations_name = 'Ashford_Democracy_Club__04May2017.CSV'
elections = [
'local.ke... | bsd-3-clause | Python |
5f70996680418c4c5b35ecf88a1bf3bb3b718c1f | Bump max API to 2. #485 #486 | mfeit-internet2/pscheduler-dev,perfsonar/pscheduler,mfeit-internet2/pscheduler-dev,perfsonar/pscheduler,perfsonar/pscheduler,perfsonar/pscheduler | pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/admin.py | pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/admin.py | #
# Administrative Information
#
import datetime
import pscheduler
import pytz
import socket
import tzlocal
from pschedulerapiserver import application
from .access import *
from .args import arg_integer
from .dbcursor import dbcursor_query
from .response import *
from .util import *
from .log import log
@applicati... | #
# Administrative Information
#
import datetime
import pscheduler
import pytz
import socket
import tzlocal
from pschedulerapiserver import application
from .access import *
from .args import arg_integer
from .dbcursor import dbcursor_query
from .response import *
from .util import *
from .log import log
@applicati... | apache-2.0 | Python |
a412c1c9ec32fc75e69981f2420c77ebf04bd9be | Make benchmark callable from profile / cProfile module | googlei18n/cu2qu,googlefonts/cu2qu,googlefonts/fonttools,fonttools/fonttools | Lib/cu2qu/benchmark.py | Lib/cu2qu/benchmark.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
778393cfd2d186f9fe771218da9e42ad1eda109b | support for sharding builds | kim42083/webm.libvpx,jdm/libvpx,mbebenita/aom,felipebetancur/libvpx,shacklettbp/aom,VTCSecureLLC/libvpx,abwiz0086/webm.libvpx,ittiamvpx/libvpx,ittiamvpx/libvpx-1,gshORTON/webm.libvpx,turbulenz/libvpx,webmproject/libvpx,matanbs/webm.libvpx,liqianggao/libvpx,luctrudeau/aom,shareefalis/libvpx,jdm/libvpx,felipebetancur/lib... | all_builds.py | all_builds.py | #!/usr/bin/python
import getopt
import subprocess
import sys
LONG_OPTIONS = ["shard=", "shards="]
BASE_COMMAND = "./configure --enable-internal-stats --enable-experimental"
def RunCommand(command):
run = subprocess.Popen(command, shell=True)
output = run.communicate()
if run.returncode:
print "Non-zero ret... | #!/usr/bin/python
import subprocess
import sys
def RunCommand(command):
run = subprocess.Popen(command, shell=True)
output = run.communicate()
if run.returncode:
print "Non-zero return code: " + str(run.returncode) + " => exiting!"
sys.exit(1)
def list_of_experiments():
experiments = []
configure_f... | bsd-2-clause | Python |
8976837f144bcc46ce3b0ae1f2a0ba3a75604d18 | Fix __init__.py | kowito/bluesnap-python,justyoyo/bluesnap-python,kowito/bluesnap-python,justyoyo/bluesnap-python | bluesnap/__init__.py | bluesnap/__init__.py | from __future__ import absolute_import
__all__ = ['constants', 'client', 'exceptions', 'models', 'resources', 'version']
from . import constants, client, exceptions, models, resources, version
| from __future__ import absolute_import
| mit | Python |
8fff587b9fd7e2cd0ca4d45e869345cbfb248045 | Add encryption properties to Workspace | 7digital/troposphere,dmm92/troposphere,horacio3/troposphere,ikben/troposphere,alonsodomin/troposphere,pas256/troposphere,cloudtools/troposphere,dmm92/troposphere,ikben/troposphere,Yipit/troposphere,cloudtools/troposphere,johnctitus/troposphere,amosshapira/troposphere,johnctitus/troposphere,pas256/troposphere,alonsodomi... | troposphere/workspaces.py | troposphere/workspaces.py | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject
from .validators import boolean
class Workspace(AWSObject):
resource_type = "AWS::WorkSpaces::Workspace"
props = {
'BundleId': (basestring, True),
'DirectoryI... | # Copyright (c) 2015, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject
class Workspace(AWSObject):
resource_type = "AWS::WorkSpaces::Workspace"
props = {
'BundleId': (basestring, True),
'DirectoryId': (basestring, True),
... | bsd-2-clause | Python |
b4e106271f96b083644b27d313ad80c240fcb0a5 | Add agency chain to Booking | gadventures/gapipy | gapipy/resources/booking/booking.py | gapipy/resources/booking/booking.py | # Python 2 and 3
from __future__ import unicode_literals
from gapipy.resources.checkin import Checkin
from ..base import Resource
from .agency_chain import AgencyChain
from .document import Invoice, Document
from .override import Override
from .service import Service
from .transaction import Payment, Refund
class B... | # Python 2 and 3
from __future__ import unicode_literals
from gapipy.resources.checkin import Checkin
from ..base import Resource
from .transaction import Payment, Refund
from .document import Invoice, Document
from .override import Override
from .service import Service
class Booking(Resource):
_resource_name =... | mit | Python |
893f5c5b33c833a5b497caa69f72af2285f5b81c | Bump version | dimagi/loveseat | loveseat/__init__.py | loveseat/__init__.py | __author__ = 'Dimagi'
__version__ = '0.0.6'
__licence__ = 'MIT'
| __author__ = 'Dimagi'
__version__ = '0.0.5'
__licence__ = 'MIT'
| mit | Python |
e01426579813507880d7a415b3f9f11cd3dceb2c | Add error to possible results | ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec | benchexec/tools/infer.py | benchexec/tools/infer.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
from collections.abc import Mapping
import benchexec.resul... | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
from collections.abc import Mapping
import benchexec.resul... | apache-2.0 | Python |
4702b1d3ee912676f4bd8ca0032f368573c81210 | add sorting to benchmark | numerai/submission-criteria,numerai/submission-criteria | benchmark_originality.py | benchmark_originality.py | import time
import statistics
import os
import numpy as np
import randomstate as rnd
from multiprocessing import Pool
from originality import original
N_RUNS = 50
def gen_submission(predictions=45000, users=1000):
# numpy's RandomSeed don't play well with multiprocessing; randomstate is a drop-in replacement
... | import time
import statistics
import os
import randomstate as rnd
from multiprocessing import Pool
from originality import original
N_RUNS = 50
def gen_submission(predictions=45000, users=1000):
# numpy's RandomSeed don't play well with multiprocessing; randomstate is a drop-in replacement
return rnd.normal... | apache-2.0 | Python |
57db503feed5321cfa6635c86629d3f0c9fc276d | Fix python 3 support | alexmojaki/flower,getupcloud/flower,ChinaQuants/flower,pj/flower,asmodehn/flower,tellapart/flower,pj/flower,asmodehn/flower,pygeek/flower,pygeek/flower,allengaller/flower,pj/flower,Lingling7/flower,marrybird/flower,getupcloud/flower,raphaelmerx/flower,lucius-feng/flower,asmodehn/flower,barseghyanartur/flower,barseghyan... | flower/views/tasks.py | flower/views/tasks.py | from __future__ import absolute_import
import copy
try:
from itertools import imap
except ImportError:
imap = map
import celery
from tornado import web
from ..views import BaseHandler
from ..utils.tasks import iter_tasks, get_task_by_id
class TaskView(BaseHandler):
@web.authenticated
def get(self,... | from __future__ import absolute_import
import copy
from itertools import imap
import celery
from tornado import web
from ..views import BaseHandler
from ..utils.tasks import iter_tasks, get_task_by_id
class TaskView(BaseHandler):
@web.authenticated
def get(self, task_id):
task = get_task_by_id(sel... | bsd-3-clause | Python |
2767e954c160682aed5e0dd46b7430ac0825a2a7 | Clean geometry of access level before returning | OpenChemistry/mongochemserver | girder/molecules/server/geometry.py | girder/molecules/server/geometry.py | from girder.api.describe import Description, autoDescribeRoute
from girder.api import access
from girder.api.rest import Resource
from girder.api.rest import RestException
from girder.api.rest import getCurrentUser
from girder.constants import AccessType
from girder.constants import TokenScope
from .models.geometry i... | from girder.api.describe import Description, autoDescribeRoute
from girder.api import access
from girder.api.rest import Resource
from girder.api.rest import RestException
from girder.api.rest import getCurrentUser
from girder.constants import AccessType
from girder.constants import TokenScope
from .models.geometry i... | bsd-3-clause | Python |
81a905e4626cbcaf887813fddea686f9ae61ce6f | Fix version number | adamchainz/freezegun,spulec/freezegun,Sun77789/freezegun,Affirm/freezegun | freezegun/__init__.py | freezegun/__init__.py | # -*- coding: utf-8 -*-
"""
freezegun
~~~~~~~~
:copyright: (c) 2012 by Steve Pulec.
"""
__title__ = 'freezegun'
__version__ = '0.1.17'
__author__ = 'Steve Pulec'
__license__ = 'Apache License 2.0'
__copyright__ = 'Copyright 2012 Steve Pulec'
from .api import freeze_time
__all__ = ["freeze_time"]
| # -*- coding: utf-8 -*-
"""
freezegun
~~~~~~~~
:copyright: (c) 2012 by Steve Pulec.
"""
__title__ = 'freezegun'
__version__ = '0.1.16'
__author__ = 'Steve Pulec'
__license__ = 'Apache License 2.0'
__copyright__ = 'Copyright 2012 Steve Pulec'
from .api import freeze_time
__all__ = ["freeze_time"]
| apache-2.0 | Python |
b9b1374f6c4076cb2444f45333c203124668f970 | Add test to improve coverage | jni/skan | skan/test/test_draw.py | skan/test/test_draw.py | """
Basic testing of the draw module. This just ensures the functions don't crash.
Testing plotting is hard. ;)
"""
import os
import numpy as np
from skimage import io, morphology
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
import pytest
from skan import pre, draw, csr
rundir = os.path.abspat... | """
Basic testing of the draw module. This just ensures the functions don't crash.
Testing plotting is hard. ;)
"""
import os
from skimage import io, morphology
import pytest
from skan import pre, draw, csr
rundir = os.path.abspath(os.path.dirname(__file__))
datadir = os.path.join(rundir, 'data')
@pytest.fixture
de... | bsd-3-clause | Python |
04398c4f91e5ceae83d4efec46f918949129867e | add timer | poweredbygrow/backup_gitlab.com | backup_gitlab.py | backup_gitlab.py | #!/usr/bin/env python3
import os
import requests
import shutil
import subprocess
import sys
import time
import conf
def clean(dir_to_clean):
if os.path.isdir(dir_to_clean):
shutil.rmtree(dir_to_clean)
def run(cmd):
print("running", ' '.join(cmd))
subprocess.check_call(cmd)
def get_projects()... | #!/usr/bin/env python3
import os
import requests
import shutil
import subprocess
import sys
import conf
def clean(dir_to_clean):
if os.path.isdir(dir_to_clean):
shutil.rmtree(dir_to_clean)
def run(cmd):
print("running", ' '.join(cmd))
subprocess.check_call(cmd)
def get_projects():
params... | apache-2.0 | Python |
9a60a053ae59b255817839be75b7f3481839ce3e | Update cron | Soaring-Outliers/news_graph,Soaring-Outliers/news_graph,Soaring-Outliers/news_graph,Soaring-Outliers/news_graph | graph/management/commands/filldb.py | graph/management/commands/filldb.py | from django.core.management.base import BaseCommand, CommandError
from graph.models import Website
class Command(BaseCommand):
help = 'Fill database by retrieving articles and concepts'
def handle(self, *args, **options):
for website in Website.objects.all():
print(website.name)
... | from django.core.management.base import BaseCommand, CommandError
from graph.models import Website
class Command(BaseCommand):
help = 'Fill database by retrieving articles and concepts'
def handle(self, *args, **options):
for website in Website.objects.all():
website.download_rss_articles() | mit | Python |
ed1172479388c302356af093f6dd855cab61f914 | Update hipchat.py | ViaSat/graphite-beacon,gcochard/graphite-beacon,ViaSat/graphite-beacon,ViaSat/graphite-beacon,gcochard/graphite-beacon,gcochard/graphite-beacon | graphite_beacon/handlers/hipchat.py | graphite_beacon/handlers/hipchat.py | import json
from tornado import gen, httpclient as hc
from . import AbstractHandler, LOGGER
class HipChatHandler(AbstractHandler):
name = 'hipchat'
# Default options
defaults = {
'url': 'https://api.hipchat.com',
'room': None,
'key': None,
}
colors = {
'critical... | import json
from tornado import gen, httpclient as hc
from . import AbstractHandler, LOGGER
class HipChatHandler(AbstractHandler):
name = 'hipchat'
# Default options
defaults = {
'url': 'https://api.hipchat.com',
'room': None,
'key': None,
}
colors = {
'critical... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.