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 |
|---|---|---|---|---|---|---|---|---|
65daed91fab511220c4d2b04ab2a4d0e8e15f943 | test one | Preffer/teain,Preffer/teain,Preffer/teain | tee/views.py | tee/views.py | # Create your views here.
from django.shortcuts import render
def index(request):
hello = 'helloaaaa'
return render(request, 'index.html', {'var': hello}) | # Create your views here.
from django.shortcuts import reder_to_response
def index(req):
hello = 'helloaaaa'
return render_to_response('index.html', {'var':hello}) | apache-2.0 | Python |
b99be7440c3bed3be9f82c362e618e340a91b180 | use better IDW for p01d_12z gridding | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/iemre/grid_p01d_12z_pre1997.py | scripts/iemre/grid_p01d_12z_pre1997.py | """Make a gridded analysis of p01d_12z based on obs."""
import sys
import datetime
import numpy as np
from metpy.units import units as mpunits
from metpy.units import masked_array
from metpy.gridding.interpolation import inverse_distance
from pandas.io.sql import read_sql
from pyiem.iemre import get_daily_ncname, dail... | """Make a gridded analysis of p01d_12z based on obs."""
import sys
import datetime
import numpy as np
from metpy.units import units as mpunits
from scipy.interpolate import NearestNDInterpolator
from pandas.io.sql import read_sql
from pyiem.iemre import get_daily_ncname, daily_offset
from pyiem.util import ncopen, get... | mit | Python |
922e59c86c14d897c289084bb225dce934f2264b | Fix for job_script changes. | ssorgatem/pulsar,natefoo/pulsar,jmchilton/pulsar,jmchilton/lwr,jmchilton/pulsar,jmchilton/lwr,natefoo/pulsar,ssorgatem/pulsar,galaxyproject/pulsar,galaxyproject/pulsar | lwr/managers/util/job_script/__init__.py | lwr/managers/util/job_script/__init__.py | from string import Template
from pkg_resources import resource_string
DEFAULT_JOB_FILE_TEMPLATE = Template(
resource_string(__name__, 'DEFAULT_JOB_FILE_TEMPLATE.sh')
)
SLOTS_STATEMENT_CLUSTER_DEFAULT = \
resource_string(__name__, 'CLUSTER_SLOTS_STATEMENT.sh')
SLOTS_STATEMENT_SINGLE = """
GALAXY_SLOTS="1"
"""... | from string import Template
from pkg_resources import resource_string
DEFAULT_JOB_FILE_TEMPLATE = Template(
resource_string(__name__, 'DEFAULT_JOB_FILE_TEMPLATE.sh')
)
SLOTS_STATEMENT_CLUSTER_DEFAULT = \
resource_string(__name__, 'CLUSTER_SLOTS_STATEMENT.sh')
SLOTS_STATEMENT_SINGLE = """
GALAXY_SLOTS="1"
"""... | apache-2.0 | Python |
f5bfcf5796c10ea10274dec2a7bb69b25a902610 | Reduce line length | macmanes-lab/GeosmithiaComparativeGenomics,macmanes-lab/GeosmithiaComparativeGenomics,macmanes-lab/GeosmithiaComparativeGenomics | scripts4PAML/macse4cdsOrthofiles_TA.py | scripts4PAML/macse4cdsOrthofiles_TA.py | #!/usr/bin/python3
# A program for aligning CDSs of a orthogroup.
# USAGE: ./macse4cdsOrthofiles_TA.py
# Author: Taruna Aggarwal
# Affiliation: University of New Hampshire, Durham, NH, USA
# Date: 01/27/2016
# Purpose is
import sys
import os
import subprocess
import argparse
from multiprocessing import pool
def runM... | #!/usr/bin/python3
# A program for aligning CDSs of a orthogroup.
# USAGE: ./macse4cdsOrthofiles_TA.py
# Author: Taruna Aggarwal
# Affiliation: University of New Hampshire, Durham, NH, USA
# Date: 01/27/2016
# Purpose is
import sys
import os
import subprocess
import argparse
from multiprocessing import pool
def runM... | cc0-1.0 | Python |
d3312e9c909e505fd9803a06df9c814339a6e939 | Correct import. | willrogers/pml,willrogers/pml | test/test_machine.py | test/test_machine.py | import pml
import pytest
import os
import re
from math import floor
@pytest.fixture
def lattice():
basepath = os.path.dirname(__file__)
filename = os.path.join(basepath, 'data/VMX/')
lattice = pml.load_csv.load(filename)
return lattice
def test_load_bpms(lattice):
bpms = lattice.get_elements('BP... | import pml.load
import pytest
import os
import re
from math import floor
@pytest.fixture
def lattice():
basepath = os.path.dirname(__file__)
filename = os.path.join(basepath, 'data/VMX/')
lattice = pml.load_csv.load(filename)
return lattice
def test_load_bpms(lattice):
bpms = lattice.get_element... | apache-2.0 | Python |
ba3282d4df890daa054be808dfbf503404b77c3c | Use field.to_python to do django type conversions on the field before checking if dirty. | romgar/django-dirtyfields,smn/django-dirtyfields,jdotjdot/django-dirtyfields | src/dirtyfields/dirtyfields.py | src/dirtyfields/dirtyfields.py | # Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django
from django.db.models.signals import post_save
class DirtyFieldsMixin(object):
def __init__(self, *args, **kwargs):
super(DirtyFieldsMixin, self).__init__(*args, **kwargs)
post_save.connect(reset_state, sender=self.__cl... | # Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django
from django.db.models.signals import post_save
class DirtyFieldsMixin(object):
def __init__(self, *args, **kwargs):
super(DirtyFieldsMixin, self).__init__(*args, **kwargs)
post_save.connect(reset_state, sender=self.__cl... | bsd-3-clause | Python |
f9c9bc4c138b57b4723b439263b1cc26d056990d | add CouponManager | rsalmaso/django-fluo-coupons,byteweaver/django-coupons,byteweaver/django-coupons,rsalmaso/django-fluo-coupons | coupons/models.py | coupons/models.py | import random
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from settings import COUPON_TYPES, CODE_LENGTH, CODE_CHARS
class CouponManager(models.Manager):
def create_coupon(self, type, value,... | import random
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from settings import COUPON_TYPES, CODE_LENGTH, CODE_CHARS
class Coupon(models.Model):
value = models.IntegerField(_("Value"), help_text=_("Arbitrary coupon value"))
... | bsd-3-clause | Python |
33bd5d8b02c144edb48a1b5e1f03cd34b78481ac | Update db.py | fkmclane/MCP,fkmclane/MCP,fkmclane/MCP,fkmclane/MCP | mcp/db.py | mcp/db.py | import json
import os
name = 'db.py'
version = '0.1'
class HeadersError(Exception):
pass
class HeadersMismatchError(Exception):
pass
class Database(object):
def __init__(self, filename, headers=None, mkdir=True):
self.filename = filename
self.headers = headers
self.entries = {}
class Entry(object):
d... | import json
import os
name = 'db.py'
version = '0.1'
class HeadersError(Exception):
pass
class HeadersMismatchError(Exception):
pass
class Database(object):
def __init__(self, filename, headers=None, mkdir=True):
self.filename = filename
self.headers = headers
self.entries = {}
class Entry(object):
d... | mit | Python |
ccc667bb7c4fc014bf1d9c8f8bb90d419b979dcf | Set content-type to json on everything | UngaForskareStockholm/medlem2 | medlem.py | medlem.py | #! /usr/bin/env python2.7
import cherrypy
import controller.authentication
import controller.user
class Medlem(object):
def __init__(self):
cherrypy.tools.content_type_json = cherrypy.Tool("before_finalize", self.content_type_json)
cherrypy.config.update({"tools.content_type_json.on": True})
cherrypy.config.u... | #! /usr/bin/env python2.7
import cherrypy
import controller.authentication
import controller.user
class Medlem(object):
def __init__(self):
self.authentication = controller.authentication.Authentication()
self.user = controller.user.User()
| bsd-3-clause | Python |
d6912d7453bd128aafb9ee8634782b26427a42a4 | Return sth in every case | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | src/dashboard/src/main/templatetags/active.py | src/dashboard/src/main/templatetags/active.py | from django.template import Library
import math
register = Library()
@register.simple_tag
def active(request, pattern):
if request.path.startswith(pattern) and pattern != '/':
return 'active'
elif request.path == pattern == '/':
return 'active'
else:
return ''
| from django.template import Library
import math
register = Library()
@register.simple_tag
def active(request, pattern):
if request.path.startswith(pattern) and pattern != '/':
return 'active'
elif request.path == pattern == '/':
return 'active'
| agpl-3.0 | Python |
1492357374f0c38ae76278ed8ca97d177f60ab73 | Remove all the old code | tarkatronic/django-excel-response | excel_response/__init__.py | excel_response/__init__.py | from __future__ import absolute_import
from .response import ExcelResponse
__all__ = ['ExcelResponse']
| # import datetime
#
# from django.db.models.query import QuerySet, ValuesQuerySet
# from django.http import HttpResponse
#
# class ExcelResponse(HttpResponse):
#
# def __init__(self, data, output_name='excel_data', headers=None,
# force_csv=False, encoding='utf8'):
#
# # Make sure we've got... | apache-2.0 | Python |
726d892d727e023faa504a4f96014fa34ac835e1 | create locale dir | fujicoin/electrum-fjc,pooler/electrum-ltc,romanz/electrum,molecular/electrum,argentumproject/electrum-arg,digitalbitbox/electrum,dashpay/electrum-dash,spesmilo/electrum,procrasti/electrum,imrehg/electrum,cryptapus/electrum-myr,dabura667/electrum,neocogent/electrum,pknight007/electrum-vtc,dabura667/electrum,FairCoinTeam... | mki18n.py | mki18n.py | #!/usr/bin/python
import urllib2, os
url = "https://en.bitcoin.it/wiki/Electrum/Translation?action=raw"
f = urllib2.urlopen(url)
lines = f.readlines()
dicts = {}
message = None
for line in lines:
l = line.strip()
if not l: continue
if l[0] != '*': continue
if l[0:2] == '**':
lang, translation ... | #!/usr/bin/python
import urllib2, os
url = "https://en.bitcoin.it/wiki/Electrum/Translation?action=raw"
f = urllib2.urlopen(url)
lines = f.readlines()
dicts = {}
message = None
for line in lines:
l = line.strip()
if not l: continue
if l[0] != '*': continue
if l[0:2] == '**':
lang, translation ... | mit | Python |
af41c6a71af8429afe0bc745d090ff1d4a1c5646 | add a few more lines of functional mint testing | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | test/webtest-skip.py | test/webtest-skip.py | #!/usr/bin/python2.4
#
# Copyright (c) 2005 rpath, Inc.
#
# All Rights Reserved
#
import testsuite
testsuite.setup()
import rephelp
class MintTest(rephelp.WebRepositoryHelper):
def testLogin(self):
page = self.assertCode('/register', code = 200)
page.postForm(0, self.postAssertCode,
... | #!/usr/bin/python2.4
#
# Copyright (c) 2005 rpath, Inc.
#
# All Rights Reserved
#
import testsuite
testsuite.setup()
import rephelp
class MintTest(rephelp.WebRepositoryHelper):
def testLogin(self):
page = self.assertContent('/login', 'Please log in to use the the rpath Linux Mint custom distribution serve... | apache-2.0 | Python |
247f23727b9e4a0c39d0b3cd176ff996053c7326 | bump version to 13.1.dev | ArvinPan/pyzmq,yyt030/pyzmq,Mustard-Systems-Ltd/pyzmq,dash-dash/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,swn1/pyzmq,Mustard-Systems-Ltd/pyzmq,swn1/pyzmq,yyt030/pyzmq,caidongyun/pyzmq,caidongyun/pyzmq,caidongyun/pyzmq,Mustard-Systems-Ltd/pyzmq,dash-dash/pyzmq,ArvinPan/pyzmq | zmq/sugar/version.py | zmq/sugar/version.py | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | bsd-3-clause | Python |
955c20ad73e66687140d6f6cee2d53a332811d6e | bump version to rc | swn1/pyzmq,dash-dash/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,Mustard-Systems-Ltd/pyzmq,Mustard-Systems-Ltd/pyzmq,ArvinPan/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,caidongyun/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,yyt030/pyzmq,caidongyun/pyzmq | zmq/sugar/version.py | zmq/sugar/version.py | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | bsd-3-clause | Python |
4651cc2127eef2d0a2745af4e1b35e464ac052dd | fix some settings for tests | ConsumerAffairs/django-affect | test_app/settings.py | test_app/settings.py | DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
}
}
USE_TZ = False
SITE_ID = 1
SECRET_KEY = '1%m#fx+rht9h%ojl+-3()xxg#^&$*8-k8bmq3p8$olgx7iz*5g'
ROOT_URLCONF = 'test_app.urls'
STATIC_URL = '/static/'
INSTALLED_APPS = (
... | DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
}
}
USE_TZ = False
SITE_ID = 1
SECRET_KEY = '1%m#fx+rht9h%ojl+-3()xxg#^&$*8-k8bmq3p8$olgx7iz*5g'
ROOT_URLCONF = 'test_app.urls'
STATIC_URL = '/static/'
INSTALLED_APPS = (
... | bsd-3-clause | Python |
472223165494d43c10aef2d02dd25215e6dfd2e8 | Update __init__.py | gregoil/rotest | src/rotest/__init__.py | src/rotest/__init__.py | """Rotest testing framework, based on Python unit-test and Django."""
# pylint: disable=unused-import
from __future__ import absolute_import
from unittest import skip, SkipTest, skipIf as skip_if
import django
import colorama
from .common import config
if not hasattr(django, 'apps'): # noqa
django.setup()
# En... | """Rotest testing framework, based on Python unit-test and Django."""
# pylint: disable=unused-import
from __future__ import absolute_import
from unittest import skip, SkipTest, skipIf as skip_if
import colorama
from .common import config
# Enable color printing on screen.
colorama.init()
| mit | Python |
4494fc43ce90da6d529e7d45460a59bad7a2d044 | reorder settings | peap/alexa-astro,peap/alexa-astro | app/settings.py | app/settings.py | import os
AMAZON_APPLICATION_ID = 'amzn1.echo-sdk-ams.app.6f2cd304-8d03-45ae-8135-18e6d3486035'
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASE_FILE = os.path.join(BASE_DIR, 'db.sqlite')
SKILL_INVOCATION_NAME = 'Pluto'
SKILL_NAME = 'Pluto the Astronomer'
SKILL_VERSION = '0.1.1'
| import os
AMAZON_APPLICATION_ID = 'amzn1.echo-sdk-ams.app.6f2cd304-8d03-45ae-8135-18e6d3486035'
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASE_FILE = os.path.join(BASE_DIR, 'db.sqlite')
SKILL_VERSION = '0.1.1'
SKILL_INVOCATION_NAME = 'Pluto'
SKILL_NAME = 'Pluto the Astronomer'
| mit | Python |
344329d836b289e19d783783a790e207e04707c4 | Fix RemovedInDjango41Warning | ezhome/django-webpack-loader,ezhome/django-webpack-loader,ezhome/django-webpack-loader | webpack_loader/__init__.py | webpack_loader/__init__.py | __author__ = 'Owais Lone'
__version__ = '1.1.0'
if django.VERSION < (3, 2): # pragma: no cover
default_app_config = 'webpack_loader.apps.WebpackLoaderConfig'
| __author__ = 'Owais Lone'
__version__ = '1.1.0'
default_app_config = 'webpack_loader.apps.WebpackLoaderConfig'
| mit | Python |
48f5234d4b19cc230d185374c422d008ba5aca3b | Add missed import | ezhome/django-webpack-loader,ezhome/django-webpack-loader,ezhome/django-webpack-loader | webpack_loader/__init__.py | webpack_loader/__init__.py | __author__ = 'Owais Lone'
__version__ = '1.1.0'
import django
if django.VERSION < (3, 2): # pragma: no cover
default_app_config = 'webpack_loader.apps.WebpackLoaderConfig'
| __author__ = 'Owais Lone'
__version__ = '1.1.0'
if django.VERSION < (3, 2): # pragma: no cover
default_app_config = 'webpack_loader.apps.WebpackLoaderConfig'
| mit | Python |
aaaaaf0e8971fde5ae404d704aa2931f8c20ca11 | Add helpful comment explaining "{{{}}}{}[@{}='{}']" | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | falcom/api/marc/mapping.py | falcom/api/marc/mapping.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import xml.etree.ElementTree as ET
class MARCMapping:
xmlns = "http://www.loc.gov/MARC21/slim"
def __init__ (self, xml_str):
... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import xml.etree.ElementTree as ET
class MARCMapping:
xmlns = "http://www.loc.gov/MARC21/slim"
def __init__ (self, xml_str):
... | bsd-3-clause | Python |
176e7c849f78fdd3895c0f45a15b90fc52b57a00 | update rename_file.py | MingwangLin/automatic-colorization-of-sketch | stroke_extraction/rename_file.py | stroke_extraction/rename_file.py | import os
import string
import random
import argparse
def remove_mac_DSstore():
cmd_line = 'sudo find /home/lin/Downloads -name ".DS_Store" -depth -exec rm {} \;'
os.system(cmd_line)
def string_generator(length):
chars = string.ascii_lowercase + string.digits
# chars = string.digits
return ''.jo... | import os
import string
import random
import argparse
def remove_mac_DSstore():
cmd_line = 'sudo find /home/lin/Downloads -name ".DS_Store" -depth -exec rm {} \;'
os.system(cmd_line)
def string_generator(length):
chars = string.ascii_lowercase + string.digits
# chars = string.digits
return ''.jo... | apache-2.0 | Python |
8d5b0682c3262fa210c3ed5e50c91259f1f2550c | Set default ordering for blog post tags | plumdog/myhome,plumdog/myhome,plumdog/myhome,plumdog/myhome | myhome/blog/models.py | myhome/blog/models.py | from django.db import models
class BlogPostTag(models.Model):
name = models.CharField(max_length=255)
class Meta:
ordering = ['name']
def __str__(self):
return self.name
class BlogPost(models.Model):
datetime = models.DateTimeField()
title = models.CharField(max_length=255)
... | from django.db import models
class BlogPostTag(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class BlogPost(models.Model):
datetime = models.DateTimeField()
title = models.CharField(max_length=255)
content = models.TextField()
live = model... | mit | Python |
0c3d85aecbb6daa7339130699701aaa8ede677a2 | add url search for ResourceSubmission and ResourceVerification | trawick/edurepo,trawick/edurepo,trawick/edurepo,trawick/edurepo | src/edurepo/resources/admin.py | src/edurepo/resources/admin.py | from django.contrib import admin
from django.db.models import F
from resources.models import Resource, ResourceSubmission, ResourceVerification
class ResourceAdmin(admin.ModelAdmin):
search_fields = ('url',)
admin.site.register(Resource, ResourceAdmin)
class ResourceSubmissionAdmin(admin.ModelAdmin):
sear... | from django.contrib import admin
from django.db.models import F
from resources.models import Resource, ResourceSubmission, ResourceVerification
class ResourceAdmin(admin.ModelAdmin):
search_fields = ('url',)
admin.site.register(Resource, ResourceAdmin)
admin.site.register(ResourceSubmission)
class Unreachable... | apache-2.0 | Python |
9b54d374b462b9c8885809fc7b2ffdbfbbbbadea | Remove api import | laslabs/vertical-medical,ShaheenHossain/eagle-medical,ShaheenHossain/eagle-medical,laslabs/vertical-medical | medical_family/models/medical_patient.py | medical_family/models/medical_patient.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dave Lasley <dave@laslabs.com>
# Copyright: 2015 LasLabs, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dave Lasley <dave@laslabs.com>
# Copyright: 2015 LasLabs, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | agpl-3.0 | Python |
223d2c23187fbcd5241dc7781b8a790c7ee5beea | Enable TestCallStdStringFunction for GCC. | llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb | test/expression_command/call-function/TestCallStdStringFunction.py | test/expression_command/call-function/TestCallStdStringFunction.py | """
Test calling std::String member functions.
"""
import unittest2
import lldb
import lldbutil
from lldbtest import *
class ExprCommandCallFunctionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the li... | """
Test calling std::String member functions.
"""
import unittest2
import lldb
import lldbutil
from lldbtest import *
class ExprCommandCallFunctionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the li... | apache-2.0 | Python |
b02b643a35ff017a398bd6d1b181b3ad9244fee5 | add warning for test skipped by travis | sdpython/code_beatrix,sdpython/code_beatrix,sdpython/code_beatrix,sdpython/code_beatrix | _unittests/ut_jsscripts/test_copy_tools.py | _unittests/ut_jsscripts/test_copy_tools.py | """
@brief test log(time=0s)
"""
import sys
import os
import unittest
import re
import warnings
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if... | """
@brief test log(time=0s)
"""
import sys
import os
import unittest
import re
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys... | mit | Python |
f7bff3ef5a24852c3b8465e903870fbc0d9eff22 | Improve decorator so that logging is done with properly named logger in accordance to module and function name. | fraricci/pymatgen,dongsenfo/pymatgen,davidwaroquiers/pymatgen,czhengsci/pymatgen,gpetretto/pymatgen,johnson1228/pymatgen,xhqu1981/pymatgen,aykol/pymatgen,blondegeek/pymatgen,Bismarrck/pymatgen,nisse3000/pymatgen,johnson1228/pymatgen,xhqu1981/pymatgen,gpetretto/pymatgen,davidwaroquiers/pymatgen,blondegeek/pymatgen,Bisma... | pymatgen/util/decorators.py | pymatgen/util/decorators.py | #!/usr/bin/env python
'''
This module contains useful decorators for a variety of functions.
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 31, 20... | #!/usr/bin/env python
'''
This module contains useful decorators for a variety of functions.
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 31, 20... | mit | Python |
865aa1832296b793b7edef53c326c5c377e30e19 | Rewrite the entire client program | mystor/Elephant-Jaguar,mystor/Elephant-Jaguar | client/client.py | client/client.py | """-ELEPHANTS == JAGUARS-"""
import hashlib
import time
import requests
import os
import json
SERVER = "http://localhost:8000"
CACHE = {}
def pulse(path):
"""
Perform a single pulse, synchronising data between the client and the
server. As long as there aren't concurrent modifications, everything
sh... | """--"""
import requests
import os
import json
from datetime import datetime
####
from dateutil.tz import tzutc
UTC = tzutc()
def serialize_date(dt):
"""
Serialize a date/time value into an ISO8601 text representation
adjusted (if needed) to UTC timezone.
For instance:
>>> serialize_date(datet... | apache-2.0 | Python |
9dc31b7a995ceff016f6562096b361d57c1414c2 | Add create_delete_result fixture | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool | tests/fixtures/db.py | tests/fixtures/db.py | import pytest
import pymongo
import motor.motor_asyncio
class MockDeleteResult:
def __init__(self, deleted_count):
self.deleted_count = deleted_count
@pytest.fixture
def test_db():
client = pymongo.MongoClient()
yield client["test"]
client.drop_database("test")
@pytest.fixture
def test_mo... | import pytest
import pymongo
import motor.motor_asyncio
@pytest.fixture
def test_db():
client = pymongo.MongoClient()
yield client["test"]
client.drop_database("test")
@pytest.fixture
def test_motor(test_db, loop):
client = motor.motor_asyncio.AsyncIOMotorClient(io_loop=loop)
yield client["test"... | mit | Python |
d1df2bd85983d33d07a31c0ad35fce9aedcf2329 | Update main.py | picklecai/OMOOC2py,picklecai/OMOOC2py | _src/om2py0w/0wex1/main.py | _src/om2py0w/0wex1/main.py | # _*_ coding:utf-8 _*_
from os.path import exists
import time
# 打印之前所有的内容
if exists("tempfile.txt"):
print '''
历史记录:
-------------------------------------------'''
txt = open("tempfile.txt")
notelist = txt.readlines()
txt.close()
for i in notelist:
print(i)
print "------------------------------... | # _*_ coding:utf-8 _*_
from os.path import exists
import time
# 打印之前所有的内容
if exists("tempfile.txt"):
print '''
记事本现在的内容是:
-------------------------------------------'''
txt = open("tempfile.txt")
notelist = txt.readlines()
txt.close()
for i in notelist:
print(i)
print "-------------------------... | mit | Python |
96cf5be538ca6df3c1da819e18933d35df8b51e8 | add APNG support (part 2) | h2non/filetype.py | filetype/types/__init__.py | filetype/types/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from . import archive
from . import audio
from . import application
from . import font
from . import image
from . import video
from .base import Type # noqa
# Supported image types
IMAGE = (
image.Dwg(),
image.Xcf(),
image.Jpeg(),
image.... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from . import archive
from . import audio
from . import application
from . import font
from . import image
from . import video
from .base import Type # noqa
# Supported image types
IMAGE = (
image.Dwg(),
image.Xcf(),
image.Jpeg(),
image.... | mit | Python |
2459239188b4a6f9e46363ef84fc9dc252793774 | Modify the condition for selection of longest patterns | nkmrtty/trie-search | trie_search/record_trie.py | trie_search/record_trie.py | from marisa_trie import RecordTrie
from .trie import TrieSearch
class RecordTrieSearch(RecordTrie, TrieSearch):
def __init__(self, record_format, records=None, filepath=None):
super(RecordTrieSearch, self).__init__(record_format, records)
if filepath:
self.load(filepath)
def searc... | from marisa_trie import RecordTrie
from .trie import TrieSearch
class RecordTrieSearch(RecordTrie, TrieSearch):
def __init__(self, record_format, records=None, filepath=None):
super(RecordTrieSearch, self).__init__(record_format, records)
if filepath:
self.load(filepath)
def searc... | mit | Python |
168855fb62744d0b134abd6d9803c6d17605c8d0 | Install nfs-client for mounting nfs shares | felixsch/mkcrowbar | src/mkcrowbar/commands/install.py | src/mkcrowbar/commands/install.py | from mkcrowbar import zypper, base
from mkcrowbar.pretty import say, fatal
class Install(base.App):
DESCRIPTION = 'Install crowbar on this maschine'
def exec(self):
say('Install basic requirements for running crowbar...')
self.install_packages()
def install_packages(self):
with s... | from mkcrowbar import zypper, base
from mkcrowbar.pretty import say, fatal
class Install(base.App):
DESCRIPTION = 'Install crowbar on this maschine'
def exec(self):
say('Install basic requirements for running crowbar...')
self.install_packages()
def install_packages(self):
with s... | apache-2.0 | Python |
15fc1754b0c6498f5fe2fc7dd93d0dd9d4f496ba | Fix database settings | maykinmedia/django-timeline-logger,maykinmedia/django-timeline-logger | tests/settings_pg.py | tests/settings_pg.py | import os
from .settings import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'timeline_logger',
'USER': os.getenv('PGUSER', 'postgres'),
'PASSWORD': os.getenv('PGPASSWORD', ''),
'HOST': os.getenv('PGHOST', ''),
'PORT': os.... | from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'timeline_logger',
'USERNAME': 'postgres',
'PASSWORD': '',
}
}
| mit | Python |
698a173f61c7c62692d94080ce179ae17584f00d | Remove silly | Motoko11/MotoBot | motobot/core_plugins/channel_override.py | motobot/core_plugins/channel_override.py | from motobot import command, IRCLevel, Priority, Notice
@command('channel', level=IRCLevel.master, priority=Priority.max)
def channel_command(bot, context, message, args):
""" Override the channel to make a command act as if it were in another channel. """
try:
channel = args[1]
message = '!' ... | from motobot import command, IRCLevel, Priority, Notice
@command('channel', level=IRCLevel.master, priority=Priority.max)
def channel_command(bot, context, message, args):
""" Override the channel to make a command act as if it were in another channel. """
print('BOOBS!')
try:
channel = args[1]
... | mit | Python |
dcd91c0f514eb1ee27bb5f4406ab863b0644fd22 | Use dict.get method for FieldMappings methods | pantheon-systems/etl-framework | etl_framework/transformer_mixins/FieldMappingsMixin.py | etl_framework/transformer_mixins/FieldMappingsMixin.py | """parses configuration and returns useful things"""
#pylint: disable=relative-import
from etl_framework.utilities.DataTable import DataRow
class FieldMappingsMixin(object):
"""stuff"""
def map_fields(self, row):
"""stuff"""
mapped_row = DataRow()
for traverse_path, mapped_field_name... | """parses configuration and returns useful things"""
#pylint: disable=relative-import
from etl_framework.utilities.DataTable import DataRow
class FieldMappingsMixin(object):
"""stuff"""
def map_fields(self, row):
"""stuff"""
mapped_row = DataRow()
for traverse_path, mapped_field_name... | mit | Python |
09c9f25f9b8537f2b6330020df5bd08db1777758 | Update ReplaceNetworkAclAssociation | nagyistoce/euca2ools,vasiliykochergin/euca2ools,nagyistoce/euca2ools,gholms/euca2ools,jhajek/euca2ools,vasiliykochergin/euca2ools,gholms/euca2ools,jhajek/euca2ools | euca2ools/commands/ec2/replacenetworkaclassociation.py | euca2ools/commands/ec2/replacenetworkaclassociation.py | # Copyright 2013-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions ... | # Copyright 2009-2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions ... | bsd-2-clause | Python |
ce96831efd6aa71fc7e9b05bf2bcdb66c326634a | bump version | tsuru/tsuru-autoscale-dashboard,tsuru/tsuru-autoscale-dashboard | tsuru_autoscale/version.py | tsuru_autoscale/version.py | __version__ = "0.4.4"
| __version__ = "0.4.3"
| bsd-3-clause | Python |
caf1cce23853955bf0a04fc4e255f23b730dca97 | Update the argument normalization test | dask-image/dask-ndfourier | tests/test__utils.py | tests/test__utils.py | # -*- coding: utf-8 -*-
import pytest
import numpy as np
import dask.array as da
import dask.array.utils as dau
import dask_ndfourier._utils
@pytest.mark.parametrize(
"a, s, n, axis", [
(da.ones((3, 4), chunks=(3, 4)), da.ones((2,), chunks=(2,)), -1, -1),
]
)
def test_norm_args(a, s, n, axis):
... | # -*- coding: utf-8 -*-
import pytest
import numpy as np
import dask.array as da
import dask.array.utils as dau
import dask_ndfourier._utils
@pytest.mark.parametrize(
"a, s, n, axis", [
(da.ones((3, 4), chunks=(3, 4)), da.ones((2,), chunks=(2,)), -1, -1),
]
)
def test_norm_args(a, s, n, axis):
... | bsd-3-clause | Python |
256050c324cde5ae21b71b961db096c39f61e094 | use new url format | adaptive-learning/matmat-web,adaptive-learning/matmat-web,adaptive-learning/matmat-web,adaptive-learning/matmat-web | matmat/urls.py | matmat/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
import matmat.views
admin.autodiscover()
urlpatterns = [
url(r'^user/', include('proso_user.urls')),
url(r'^models/', include('proso_models.urls')),
url(r'^common/', include('proso_common.urls')),
url(r'^concepts/', ... | from django.conf.urls import patterns, include, url
from django.contrib import admin
import matmat.views
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^user/', include('proso_user.urls')),
url(r'^models/', include('proso_models.urls')),
url(r'^common/', include('proso_common.urls')),
url... | mit | Python |
9be0320fd3e8624bbeba2dfa1db6daf90a2176df | テスト : タグ件数アクション テスト漏れ | ayziao/niascape,ayziao/niascape,ayziao/niascape,ayziao/niascape | tests/test_action.py | tests/test_action.py | import unittest
from unittest import mock
from niascape import action
from niascape.entity import basedata
class TestAction(unittest.TestCase):
def test_top(self):
ret = action.top({})
self.assertEqual('top', ret)
@mock.patch('niascape.action.basedata')
def test_daycount(self, moc):
self.assertTrue(hasattr... | import unittest
from unittest import mock
from niascape import action
from niascape.entity import basedata
class TestAction(unittest.TestCase):
def test_top(self):
ret = action.top({})
self.assertEqual('top', ret)
@mock.patch('niascape.action.basedata')
def test_daycount(self, moc):
self.assertTrue(hasattr... | mit | Python |
d4e661493ff9388208c538e59a43ba808766ae48 | fix asset test for py2 | laktak/extrakto,laktak/extrakto | tests/test_assets.py | tests/test_assets.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import subprocess
import os
import sys
class TestAssets(unittest.TestCase):
def test_all(self):
script_dir = os.path.dirname(os.path.realpath(__file__))
tests = ['text1', 'text2', 'unicode']
for test in tests:
if (s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import subprocess
import os
class TestAssets(unittest.TestCase):
def test_all(self):
script_dir = os.path.dirname(os.path.realpath(__file__))
tests = ['text1', 'text2', 'unicode']
for test in tests:
subprocess.run("... | mit | Python |
147cb7aa63dd470bb718eaa195437a888daa5914 | Add some type hints to utils.pathscrub module | crawln45/Flexget,malkavi/Flexget,ianstalk/Flexget,Flexget/Flexget,crawln45/Flexget,malkavi/Flexget,ianstalk/Flexget,Flexget/Flexget,Flexget/Flexget,crawln45/Flexget,ianstalk/Flexget,crawln45/Flexget,malkavi/Flexget,Flexget/Flexget,malkavi/Flexget | flexget/utils/pathscrub.py | flexget/utils/pathscrub.py | import ntpath
import re
import sys
from typing import Optional
os_mode = None # Can be 'windows', 'mac', 'linux' or None. None will auto-detect os.
# Replacement order is important, don't use dicts to store
platform_replaces = {
'windows': [
['[:*?"<>| ]+', ' '], # Turn illegal characters into a space
... | import ntpath
import re
import sys
os_mode = None # Can be 'windows', 'mac', 'linux' or None. None will auto-detect os.
# Replacement order is important, don't use dicts to store
platform_replaces = {
'windows': [
['[:*?"<>| ]+', ' '], # Turn illegal characters into a space
[r'[\.\s]+([/\\]|$)', ... | mit | Python |
b999e55759c2e4e6aa8eb9e647c22a90c1e5243d | put things to parameters | lightning-huang/pybackup | backupconfig.py | backupconfig.py | destfolder=u"h:\\baiduyundownload"
hashfile=u"h:\\baidyunindex.tsv"
srcfolder=u"F:\\BaiduYunDownload"
maxdays=60
picked_size=1024000
codec_name="gb18030"
file_ignore_suffix="baiduyun.downloading"
indexfile=hashfile
| destfolder=u"h:\\baiduyundownload"
hashfile=u"h:\\baidyunindex.tsv"
srcfolder=u"F:\\BaiduYunDownload"
maxdays=60
indexfile=hashfile | apache-2.0 | Python |
ff022041b31b2d38fdeb8ab50257441c15bfb855 | Add unit tests for VATINField | fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,fghaas/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,hastexo/django-oscar-vat_moss | tests/test_fields.py | tests/test_fields.py | import unittest
from decimal import Decimal as D
from oscar_vat_moss.fields import * # noqa
from django.core.exceptions import ValidationError
class VATINValidatorTest(unittest.TestCase):
VALID_VATINS = (
# VATIN # Company name
('ATU66688202', 'hastexo Professional Services GmbH'),
... | import unittest
from decimal import Decimal as D
from oscar_vat_moss.fields import * # noqa
from django.core.exceptions import ValidationError
class VATINValidatorTest(unittest.TestCase):
VALID_VATINS = (
# VATIN # Company name
('ATU66688202', 'hastexo Professional Services GmbH'),
... | bsd-3-clause | Python |
23fbdabb97689a355abaac7310d3b1e887f921b8 | Convert exceptions in a type-safe manner to string before string cats | thatsIch/sublime-rainmeter | tests/test_logger.py | tests/test_logger.py | """This module is about testing the logger."""
import sys
from unittest import TestCase
LOGGER = sys.modules["Rainmeter.logger"]
class TestFunctions(TestCase):
"""Test class wrapper using unittest."""
# pylint: disable=W0703; This is acceptable since we are testing it not failing
def test_info(self):... | """This module is about testing the logger."""
import sys
from unittest import TestCase
LOGGER = sys.modules["Rainmeter.logger"]
class TestFunctions(TestCase):
"""Test class wrapper using unittest."""
# pylint: disable=W0703; This is acceptable since we are testing it not failing
def test_info(self):... | mit | Python |
15f3b389628c6d89701a5da48703182a709b161c | cover matrix.py | pikepdf/pikepdf,pikepdf/pikepdf,pikepdf/pikepdf | tests/test_matrix.py | tests/test_matrix.py | from math import isclose
import pytest
import pikepdf
from pikepdf.models import PdfMatrix
def test_init_6():
m = PdfMatrix(1, 0, 0, 1, 0, 0)
m2 = m.scaled(2, 2)
m2t = m2.translated(2, 3)
assert (
repr(m2t)
== 'pikepdf.Matrix(((2.0, 0.0, 0.0), (0.0, 2.0, 0.0), (2.0, 3.0, 1.0)))'
... | import pytest
import pikepdf
from pikepdf.models import PdfMatrix
def test_init_6():
m = PdfMatrix(1, 0, 0, 1, 0, 0)
m2 = m.scaled(2, 2)
m2t = m2.translated(2, 3)
assert (
repr(m2t)
== 'pikepdf.Matrix(((2.0, 0.0, 0.0), (0.0, 2.0, 0.0), (2.0, 3.0, 1.0)))'
)
def test_invalid_init(... | mpl-2.0 | Python |
d41854ba8e9daac4f31c4140b7b7f52dc4b24fb7 | Add a test case for serilzation of underscored Enum values | Taketrung/betfair.py,jmcarp/betfair.py,skozilla/betfair.py | tests/test_models.py | tests/test_models.py | # -*- coding: utf-8 -*-
import pytest
from enum import Enum
from schematics.types import StringType
from betfair.meta.types import EnumType
from betfair.meta.types import ModelType
from betfair.meta.models import BetfairModel
def test_field_inflection():
class FakeModel(BetfairModel):
underscore_separa... | # -*- coding: utf-8 -*-
import pytest
from enum import Enum
from schematics.types import StringType
from betfair.meta.types import EnumType
from betfair.meta.types import ModelType
from betfair.meta.models import BetfairModel
def test_field_inflection():
class FakeModel(BetfairModel):
underscore_separa... | mit | Python |
8498b36bf76ede718c90d430ec312260d48e9ec2 | use new naming conventions | jcharum/pycurl,m13253/pycurl-python3,m13253/pycurl-python3,ninemoreminutes/pycurl,ninemoreminutes/pycurl,jcharum/pycurl,ninemoreminutes/pycurl,jcharum/pycurl,m13253/pycurl-python3,ninemoreminutes/pycurl | tests/test_multi5.py | tests/test_multi5.py | # $Id: test_multi5.py,v 1.3 2002/08/14 10:26:51 kjetilja Exp $
import sys, select, time
import pycurl
c1 = pycurl.Curl()
c2 = pycurl.Curl()
c3 = pycurl.Curl()
c1.setopt(c1.URL, 'http://www.python.org')
c2.setopt(c2.URL, 'http://curl.haxx.se')
c3.setopt(c3.URL, 'http://slashdot.org')
c1.body = file("doc1", "w")
c2.bod... | # $Id: test_multi5.py,v 1.2 2002/08/14 09:20:10 kjetilja Exp $
import sys, select, time
import pycurl
c1 = pycurl.init()
c2 = pycurl.init()
c3 = pycurl.init()
c1.setopt(pycurl.URL, 'http://www.python.org')
c2.setopt(pycurl.URL, 'http://curl.haxx.se')
c3.setopt(pycurl.URL, 'http://slashdot.org')
c1.body = file("doc1",... | lgpl-2.1 | Python |
6446af2cd11bdc5069fdc8ab47a0881089e7cbab | Add a parametrized sample test. Make xfast faster. | SectorLabs/pytest-benchmark,thedrow/pytest-benchmark,aldanor/pytest-benchmark,ionelmc/pytest-benchmark | tests/test_normal.py | tests/test_normal.py | """
Just to make sure the plugin doesn't choke on doctests::
>>> print('Yay, doctests!')
Yay, doctests!
"""
import time
from functools import partial
import pytest
def test_fast(benchmark):
@benchmark
def result():
return time.sleep(0.000001)
assert result is None
def test_slow(benchm... | """
Just to make sure the plugin doesn't choke on doctests::
>>> print('Yay, doctests!')
Yay, doctests!
"""
import time
from functools import partial
import pytest
def test_fast(benchmark):
@benchmark
def result():
return time.sleep(0.000001)
assert result is None
def test_slow(benchm... | bsd-2-clause | Python |
e8260617470cbfa40648e1b99a448314cfcb4a58 | Test the number of calls json.dump is being called | cguardia/cookiecutter,venumech/cookiecutter,stevepiercy/cookiecutter,luzfcb/cookiecutter,michaeljoseph/cookiecutter,moi65/cookiecutter,willingc/cookiecutter,Springerle/cookiecutter,luzfcb/cookiecutter,stevepiercy/cookiecutter,terryjbates/cookiecutter,ramiroluz/cookiecutter,agconti/cookiecutter,audreyr/cookiecutter,pjbu... | tests/test_replay.py | tests/test_replay.py | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import json
import os
import pytest
from cookiecutter import replay
from cookiecutter.config import get_user_config
@pytest.fixture
def replay_dir():
return os.path.expanduser('~/.cookiecutter_replay/')
def test_get_user_config(mocker, replay_dir):
... | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import json
import os
import pytest
from cookiecutter import replay
from cookiecutter.config import get_user_config
@pytest.fixture
def replay_dir():
return os.path.expanduser('~/.cookiecutter_replay/')
def test_get_user_config(mocker, replay_dir):
... | bsd-3-clause | Python |
feb08b5294cf47e8bf555ba5b0db2a3ee05f38a9 | mark test_write_data[exr-action-delete.json] as skip, not xfail | dr-leo/pandaSDMX | tests/test_writer.py | tests/test_writer.py | """Tests for pandasdmx/writer.py."""
# TODO test all possible values of Writer.write() arguments
# - asframe
# - attribute
# - fromfreq
# - parsetime
# …for each type of input argument.
import pandas as pd
import pytest
from pytest import raises
import pandasdmx
from pandasdmx.writer import Writer
from . import asse... | """Tests for pandasdmx/writer/data2pandas.py."""
# TODO test all possible values of Writer.write() arguments
# - asframe
# - attribute
# - fromfreq
# - parsetime
# …for each type of input argument.
import pandas as pd
import pytest
from pytest import raises
import pandasdmx
from pandasdmx.writer import Writer
from .... | apache-2.0 | Python |
9e263129e449180d8297ae82f6d54f56a7bcc9ee | fix video import | ocefpaf/folium,QuLogic/folium,ocefpaf/folium,QuLogic/folium,python-visualization/folium,QuLogic/folium,python-visualization/folium | folium/plugins/__init__.py | folium/plugins/__init__.py | # -*- coding: utf-8 -*-
"""
Folium plugins
--------------
Wrap some of the most populat leaflet external plugins.
"""
from __future__ import (absolute_import, division, print_function)
from folium.plugins.boat_marker import BoatMarker
from folium.plugins.fast_marker_cluster import FastMarkerCluster
from folium.plu... | # -*- coding: utf-8 -*-
"""
Folium plugins
--------------
Wrap some of the most populat leaflet external plugins.
"""
from __future__ import (absolute_import, division, print_function)
from folium.plugins.boat_marker import BoatMarker
from folium.plugins.fast_marker_cluster import FastMarkerCluster
from folium.plu... | mit | Python |
ae58629213d2c89fc4e9f091b428c7275aa87d67 | test for 7b9c5714644d109524cddb8e403c3ea119ad7650 | evildmp/arkestra-publications,evildmp/arkestra-publications,evildmp/arkestra-publications | publications/tests.py | publications/tests.py | # coding=utf-8
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.encoding import force_unicode
import unittest
from cms.models.placeholdermodel import Placeholder
from cms.api import add_plugin
from publications.models import Researcher, PublicationsPlugin... | # coding=utf-8
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.encoding import force_unicode
import unittest
from publications.models import Researcher
from contacts_and_people.models import Person
class ResearcherTests(unittest.TestCase):
def test_... | bsd-2-clause | Python |
6dd4eb21f6598bbaad329645a3965ad9d47c41db | Add test runner task stub | elegion/djangodash2012,elegion/djangodash2012 | fortuitus/frunner/tasks.py | fortuitus/frunner/tasks.py | from celery import task
@task()
def add(x, y):
""" Test task. """
return x + y
@task()
def run_tests(test_id):
"""
A task that actually runs the API testing.
First it copies the test data to the run history tables, then runs the
tests.
"""
# TODO
pass
| from celery import task
@task()
def add(x, y):
""" Test task. """
return x + y
| mit | Python |
a4c497ee9563e634ca41405daa0cf54075d4432f | update tests to v1.1.0 (#1266) | exercism/xpython,exercism/python,behrtam/xpython,exercism/xpython,jmluy/xpython,jmluy/xpython,exercism/python,N-Parsons/exercism-python,smalley/python,N-Parsons/exercism-python,smalley/python,behrtam/xpython | exercises/reverse-string/reverse_string_test.py | exercises/reverse-string/reverse_string_test.py | import unittest
from reverse_string import reverse
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
class ReverseStringTests(unittest.TestCase):
def test_empty_string(self):
self.assertEqual(reverse(''), '')
def test_a_word(self):
self.assertEqual(reverse(... | import unittest
from reverse_string import reverse
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.1
class ReverseStringTests(unittest.TestCase):
def test_empty_string(self):
self.assertEqual(reverse(''), '')
def test_a_word(self):
self.assertEqual(reverse(... | mit | Python |
f8c307790b2a0de5ef106416d39bf54ba7bdd3f8 | Add test data version | jmluy/xpython,N-Parsons/exercism-python,pheanex/xpython,pheanex/xpython,exercism/python,mweb/python,exercism/xpython,behrtam/xpython,exercism/xpython,mweb/python,smalley/python,smalley/python,behrtam/xpython,exercism/python,N-Parsons/exercism-python,jmluy/xpython | exercises/roman-numerals/roman_numerals_test.py | exercises/roman-numerals/roman_numerals_test.py | import unittest
import roman_numerals
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
class RomanTest(unittest.TestCase):
numerals = {
1: 'I',
2: 'II',
3: 'III',
4: 'IV',
5: 'V',
6: 'VI',
9: 'IX',
27: 'XXVII',
48:... | import unittest
import roman_numerals
class RomanTest(unittest.TestCase):
numerals = {
1: 'I',
2: 'II',
3: 'III',
4: 'IV',
5: 'V',
6: 'VI',
9: 'IX',
27: 'XXVII',
48: 'XLVIII',
59: 'LIX',
93: 'XCIII',
141: 'CXLI',
... | mit | Python |
3f2f4c064db5a8567b2726ee563bb540e059753c | Test circle ci | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | api/run.py | api/run.py | from database.base import db_session
from flask import Flask
from flask_cors import CORS
from flask_graphql import GraphQLView
from schema import schema
import api_utils
import logging
import sys
log = logging.getLogger(__name__)
logging.basicConfig(
# filename='data_quality.log',
stream=sys.stdout,
level=... | from database.base import db_session
from flask import Flask
from flask_cors import CORS
from flask_graphql import GraphQLView
from schema import schema
import api_utils
import logging
import sys
log = logging.getLogger(__name__)
logging.basicConfig(
# filename='data_quality.log',
stream=sys.stdout,
level=... | apache-2.0 | Python |
74b5f414fabb2421e1d94333ab30e161d7ab77a7 | Fix django import outside __init__ | Nomadblue/django-nomad-country-blogs | nomadblog/__init__.py | nomadblog/__init__.py | VERSION = (0, 9, 1)
__version__ = '.'.join(map(str, VERSION))
def get_post_model():
"""
Returns the Post model that is active in this project.
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_model
POST_MODEL = ge... | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
VERSION = (0, 9, 0)
__version__ = '.'.join(map(str, VERSION))
def get_post_model():
"""
Returns the Post model that is active in this project.
"""
from django.db.models import get_model
POST_MODEL = getattr(s... | bsd-3-clause | Python |
05609ca6fbe994c0f175baae721c09d026c799e4 | clear state before running tests, wait for ssh | ibuildthecloud/os,rancherio/os,1yvT0s/os,SvenDowideit/os,datawolf/os,maxfierke/rancher-os,duguhaotian/os,OnePaaS/os,luxas/os,gizmotronic/os,duguhaotian/os,arnononline/os,OnePaaS/os,1yvT0s/os,rancherio/os,imikushin/os,fentas/os,gpndata/os,hairyhenderson/rancheros,hairyhenderson/rancheros,juliengk/os,fentas/os,gpndata/os... | tests/integration/rancherostest/test_system.py | tests/integration/rancherostest/test_system.py | import pytest
import subprocess
import time
@pytest.fixture(scope="module")
def qemu(request):
subprocess.check_call('rm ./state/*', shell=True)
print('\nrm ./state/*')
print('\nStarting QEMU')
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=T... | import pytest
import subprocess
import time
@pytest.fixture(scope="module")
def qemu(request):
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
def fin():
print('\nTerminating QEMU')
p.stdout.close()
p.terminate()
re... | apache-2.0 | Python |
77fb14a396dfbfcefba3ab7f823d306ccacdd337 | add def unicode in class Trophies | kaduuuken/achievementsystem,kaduuuken/achievementsystem | achievements/models.py | achievements/models.py | from django.db import models
from django.contrib.auth.models import User
from filebrowser.fields import FileBrowseField
from django.utils.translation import ugettext_lazy as _
import validate
class Category(models.Model):
name = models.CharField(_("Name"), max_length=255)
parent_category = models.ForeignKey('s... | from django.db import models
from django.contrib.auth.models import User
from filebrowser.fields import FileBrowseField
from django.utils.translation import ugettext_lazy as _
import validate
class Category(models.Model):
name = models.CharField(_("Name"), max_length=255)
parent_category = models.ForeignKey('s... | bsd-2-clause | Python |
d2cbfe2aa33022c3682952459b4af7ee78315ad5 | Fix `BrewVersion` fact default. | Fizzadar/pyinfra,Fizzadar/pyinfra | pyinfra/facts/brew.py | pyinfra/facts/brew.py | import re
from pyinfra import logger
from pyinfra.api import FactBase
from .util.packaging import parse_packages
BREW_REGEX = r'^([^\s]+)\s([0-9\._+a-z\-]+)'
def new_cask_cli(version):
'''
Returns true if brew is version 2.6.0 or later and thus has the new CLI for casks.
i.e. we need to use bre... | import re
from pyinfra import logger
from pyinfra.api import FactBase
from .util.packaging import parse_packages
BREW_REGEX = r'^([^\s]+)\s([0-9\._+a-z\-]+)'
def new_cask_cli(version):
'''
Returns true if brew is version 2.6.0 or later and thus has the new CLI for casks.
i.e. we need to use bre... | mit | Python |
dba1b8142b2c01cc5cfea3743a4b7705d4c44d0a | Fix import error. | efiring/numpy-work,illume/numpy3k,teoliphant/numpy-refactor,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,Ademan/NumPy-GSoC,illume/numpy3k,Ademan/NumPy-GSoC,chadnetzer/numpy-gau... | numpy/linalg/setup.py | numpy/linalg/setup.py |
import sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info
config = Configuration('linalg',parent_package,top_path)
config.add_data_dir('tests')
# Configure lapack_lite
lapack_info = get_... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info
config = Configuration('linalg',parent_package,top_path)
config.add_data_dir('tests')
# Configure lapack_lite
lapack_info = get_info('lapack... | bsd-3-clause | Python |
f0f12a3e289c96e84d9bfb8a103c0b221b52656d | fix typo in env var | thedrow/samsa,benauthor/pykafka,yungchin/pykafka,thedrow/samsa,wikimedia/operations-debs-python-pykafka,benauthor/pykafka,yungchin/pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,wikimedia/operations-debs-python-pykafka,thedrow/samsa | pykafka/test/utils.py | pykafka/test/utils.py | import os
from pykafka.test.kafka_instance import KafkaInstance, KafkaConnection
def get_cluster():
"""Gets a Kafka cluster for testing, using one already running is possible.
An already-running cluster is determined by environment variables:
BROKERS, ZOOKEEPER, KAFKA_BIN. This is used primarily to spe... | import os
from pykafka.test.kafka_instance import KafkaInstance, KafkaConnection
def get_cluster():
"""Gets a Kafka cluster for testing, using one already running is possible.
An already-running cluster is determined by environment variables:
BROKERS, ZOOKEEPER, KAFKA_BIN. This is used primarily to spe... | apache-2.0 | Python |
dd8320e5eabcb8f850b35a9406e3616c48e10dee | Remove debug print. | vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah,vickenty/ookoobah | ookoobah/menu_mode.py | ookoobah/menu_mode.py | from __future__ import division
import sys
import os
import pyglet
from pyglet.gl import *
from pyglet.window import key
import mode
import gui
class MenuMode(mode.Mode):
name = "menu_mode"
def connect(self, controller):
super(MenuMode, self).connect(controller)
self.init_opengl()
self... | from __future__ import division
import sys
import os
import pyglet
from pyglet.gl import *
from pyglet.window import key
import mode
import gui
class MenuMode(mode.Mode):
name = "menu_mode"
def connect(self, controller):
super(MenuMode, self).connect(controller)
self.init_opengl()
self... | mit | Python |
87416d5dc283e7486cea4d47c6a63181964cdbbb | Fix a test. | ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver | backend/tests/api/v0/test_uniprot.py | backend/tests/api/v0/test_uniprot.py | import json
def test_get_uniprot_pfams(db, client, uniprot_reg_full_mt2_human):
headers = [("Accept", "application/json"), ("Content-Type", "application/json")]
res = client.get("/api/v0/uniprots/mt2_human/pfams", headers=headers)
assert res.status_code == 200
data = json.loads(res.get_data(as_text=Tr... | import json
def test_get_uniprot_pfams(db, client, uniprot_reg_full_mt2_human):
headers = [("Accept", "application/json"), ("Content-Type", "application/json")]
res = client.get("/api/v0/uniprots/mt2_human/pfams", headers=headers)
assert res.status_code == 200
data = json.loads(res.get_data(as_text=Tr... | agpl-3.0 | Python |
de41af52f2a0e89215cde9ee57996b93d4cf0f78 | Add a prefix | appknox/vendor,appknox/vendor,appknox/vendor | ak_vendor/constants.py | ak_vendor/constants.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: constants.py
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2016-11-07
"""
from os.path import dirname, abspath
RISK_ENUM_UNKNOWN = -1
RISK_ENUM_PASSED = 0
RISK_ENUM_LO... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: constants.py
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2016-11-07
"""
from os.path import dirname, abspath
RISK_ENUM_UNKNOWN = -1
RISK_ENUM_PASSED = 0
RISK_ENUM_LO... | mit | Python |
41863fd6b6324af5128323f0a1a238974667b08d | use language from request to get connection alias when possible | aldryn/aldryn-search,nephila/aldryn-search,nephila/aldryn-search,aldryn/aldryn-search,aldryn/aldryn-search,nephila/aldryn-search | aldryn_search/views.py | aldryn_search/views.py | # -*- coding: utf-8 -*-
from django.utils.translation import get_language_from_request
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from haystack.forms import ModelSearchForm
from haystack.query import EmptySearchQuerySet, SearchQuerySet
from aldryn_common.paginator import... | # -*- coding: utf-8 -*-
from django.utils.translation import get_language_from_request
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from haystack.forms import ModelSearchForm
from haystack.query import EmptySearchQuerySet
from aldryn_common.paginator import DiggPaginator
... | bsd-3-clause | Python |
ca770f32614ef888c95df06e927f4d72534c4c0d | Fix selecting channel/guild in ratelimit | TitanEmbeds/Titan,TitanEmbeds/Titan,TitanEmbeds/Titan | titanembeds/utils.py | titanembeds/utils.py | from titanembeds.database import db, Guilds
from titanembeds.discordrest import DiscordREST
from flask import request, session
from flask.ext.cache import Cache
from flask_limiter import Limiter
from config import config
import random
import string
discord_api = DiscordREST(config['bot-token'])
cache = Cache()
def ge... | from titanembeds.database import db, Guilds
from titanembeds.discordrest import DiscordREST
from flask import request, session
from flask.ext.cache import Cache
from flask_limiter import Limiter
from config import config
import random
import string
discord_api = DiscordREST(config['bot-token'])
cache = Cache()
def ge... | agpl-3.0 | Python |
0a517d99330c4691e076bf1023901a85a63c75a6 | Fix import issue in visi | TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary | tmt/visi/__init__.py | tmt/visi/__init__.py | from os.path import join, dirname, realpath
from tmt.util import load_config
from tmt.visi.util import check_visi_config
__version__ = '0.1.0'
logo = '''
_ _
__ _(_)__(_) visi (%(version)s)
\ V / (_-< | Convert Visitron's .stk files to .png images
\_/|_/__/_| https://github.com/HackerMD/TissueMAP... | from os.path import join, dirname, realpath
from tmt.util import load_config
from visi.util import check_visi_config
__version__ = '0.1.0'
logo = '''
_ _
__ _(_)__(_) visi (%(version)s)
\ V / (_-< | Convert Visitron's .stk files to .png images
\_/|_/__/_| https://github.com/HackerMD/TissueMAPSToo... | agpl-3.0 | Python |
894218842081acd18e8af6f3394e3373f0a14f9b | Add context information to astrobin_apps_users_list templatetag | astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin | astrobin_apps_users/templatetags/astrobin_apps_users_tags.py | astrobin_apps_users/templatetags/astrobin_apps_users_tags.py | # Django
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.template import Library, Node
# AstroBin apps
from astrobin.models import Image
# Third party apps
from toggleproperties.models import ToggleProperty
register ... | # Django
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.template import Library, Node
# AstroBin apps
from astrobin.models import Image
# Third party apps
from toggleproperties.models import ToggleProperty
register ... | agpl-3.0 | Python |
c1e1e2428bfa1705001e673bd838e2908d3ca7bc | add identifier, uuid | jamesabel/osnap,jamesabel/osnap | osnap/make_pkgproj.py | osnap/make_pkgproj.py | import logging
import os
import sys
import site
import uuid
import osnap.const
import osnap.util
from jinja2 import Template
LOGGER = logging.getLogger()
def make_pkgproj(application_name, reverse_dns_identifier, pkgproj_path):
# find Packages project file
template_file = 'template.pkgproj'
locations... | import logging
import os
import sys
import site
import osnap.const
import osnap.util
from jinja2 import Template
LOGGER = logging.getLogger()
def make_prkproj(application_name, pkgproj_path):
# find Packages project file
template_file = 'template.pkgproj'
locations = set()
for d in site.getsitepac... | mit | Python |
512ca99144da537da61e7437d17782e5a95addb9 | Tweak for when SQS message is missing the eTag from a bucket notification. | gnott/elife-bot,gnott/elife-bot,jhroot/elife-bot,jhroot/elife-bot,gnott/elife-bot,jhroot/elife-bot | S3utility/s3_sqs_message.py | S3utility/s3_sqs_message.py | from boto.sqs.message import Message
import json
from s3_notification_info import S3NotificationInfo
class S3SQSMessage(Message):
def __init__(self, queue=None, body='', xml_attrs=None):
Message.__init__(self, queue, body)
self.payload = None
self.notification_type = 'S3Info'
def even... | from boto.sqs.message import Message
import json
from s3_notification_info import S3NotificationInfo
class S3SQSMessage(Message):
def __init__(self, queue=None, body='', xml_attrs=None):
Message.__init__(self, queue, body)
self.payload = None
self.notification_type = 'S3Info'
def even... | mit | Python |
95313f030c34f36f7b3ec5eb04d74ff39a21a66a | Fix formatting issue (#924) | kubeflow/testing,kubeflow/testing,kubeflow/testing,kubeflow/testing,kubeflow/testing | aws/IaC/CDK/test-infra/config/static_config/ECR_Resources.py | aws/IaC/CDK/test-infra/config/static_config/ECR_Resources.py | """
This file defines ECR resource static configuration parameters for CDK Constructs
"""
ECR_Private_Registry_List = {
# Pattern
# "cdk-id": "registry-name"
# Katib images.
# Katib main components.
"katib-controller": "katib/v1beta1/katib-controller",
"katib-db-manager": "katib/v1beta1/katib-... | """
This file defines ECR resource static configuration parameters for CDK Constructs
"""
ECR_Private_Registry_List = {
# Pattern
# "cdk-id": "registry-name"
# Example:
# "katib/v1beta1/katib-ui": "cdk-poc/katib/v1beta1/katib-ui",
# "kfserving/agent": "cdk-poc/kfserving/agent",
# "pytorch-oper... | apache-2.0 | Python |
e558c80d816282614bcd8fdd000d575a6d9f3d6b | fix class inheritance | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/crm_sms/models/crm_lead.py | addons/crm_sms/models/crm_lead.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class CrmLead(models.Model):
_inherit = 'crm.lead'
def _sms_get_number_fields(self):
""" This method returns the fields to use to find the number to use to
send an SMS o... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class CrmLead(models.AbstractModel):
_inherit = 'crm.lead'
def _sms_get_number_fields(self):
""" This method returns the fields to use to find the number to use to
send ... | agpl-3.0 | Python |
621d2b331fe23b728ca3f1a983801529d0694734 | Add placeholder test for decode_command_line_args | kislyuk/eight | test/test.py | test/test.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import print_function, unicode_literals
import os, sys, unittest, collections, copy, re, io
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import eight
from eight import *
class TestEight(unittest.TestCase):
def test_basic... | #!/usr/bin/env python
# coding: utf-8
from __future__ import print_function, unicode_literals
import os, sys, unittest, collections, copy, re, io
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import eight
from eight import *
class TestEight(unittest.TestCase):
def test_basic... | apache-2.0 | Python |
15159cbed5703063fed31788ef8f4ded88107249 | Make sure the slug is not recreated on every save. | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | us_ignite/common/fields.py | us_ignite/common/fields.py | import shortuuid
from django.db import models
from django.utils.encoding import force_unicode
class AutoUUIDField(models.SlugField):
"""Generates an automatic short UUID field."""
description = "An automatic short UUID field."
def __init__(self, *args, **kwargs):
kwargs.setdefault('blank', True)... | import shortuuid
from django.db import models
from django.utils.encoding import force_unicode
class AutoUUIDField(models.SlugField):
"""Generates an automatic short UUID field."""
description = "An automatic short UUID field."
def __init__(self, *args, **kwargs):
kwargs.setdefault('blank', True)... | bsd-3-clause | Python |
f782bab2af59d64acf1153bb8cc19aa30f24b636 | Bump version | cool-RR/PySnooper,cool-RR/PySnooper | pysnooper/__init__.py | pysnooper/__init__.py | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | mit | Python |
e3790d9c2188949991295580f4f06d6f228ad082 | rename peer_type to type | luckydonald/pytg | pytg/fix_msg_array.py | pytg/fix_msg_array.py | # -*- coding: utf-8 -*-
__author__ = 'luckydonald'
import logging
logger = logging.getLogger(__name__)
from luckydonaldUtils.encoding import to_unicode as u
ENCR_CHAT_PREFIX = "!_user@"
TGL_PEER_CHAT = u("chat")
TGL_PEER_USER = u("user")
TGL_PEER_ENCR_CHAT = u("encr_chat")
TGL_PEER_GEO_CHAT = u("geo_chat") #todo: do... | # -*- coding: utf-8 -*-
__author__ = 'luckydonald'
import logging
logger = logging.getLogger(__name__)
from luckydonaldUtils.encoding import to_unicode as u
ENCR_CHAT_PREFIX = "!_user@"
TGL_PEER_CHAT = u("chat")
TGL_PEER_USER = u("user")
TGL_PEER_ENCR_CHAT = u("encr_chat")
TGL_PEER_GEO_CHAT = u("geo_chat") #todo: do... | mit | Python |
443edcfdb94012988a7b2fbfa39e187b88e451b9 | handle zookeeper exceptions and increase verbosity of output | mesoscloud/haproxy | 1.5.14/ubuntu/14.04/init.py | 1.5.14/ubuntu/14.04/init.py | #!/usr/bin/python -u
"""HAProxy"""
import datetime
import logging
import os
import subprocess
import sys
import time
import kazoo.client
def pid():
with open('/tmp/haproxy.pid') as f:
return int(f.read().rstrip())
def main():
logging.basicConfig()
mtime = 0
zk = None
while True:
... | #!/usr/bin/python -u
"""HAProxy"""
import logging
import os
import subprocess
import sys
import time
import kazoo.client
def main():
logging.basicConfig()
zk = kazoo.client.KazooClient(hosts=os.getenv('ZK', '127.0.0.1:2181'), read_only=True)
zk.start()
mtime = 0
while True:
data, stat... | mit | Python |
c88e2a837e1536c90a585f2a5724d2940cc1c343 | fix import | chainer/chainercv,yuyu2172/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv | chainercv/utils/iterator/__init__.py | chainercv/utils/iterator/__init__.py | from chainercv.utils.iterator.apply_prediction_to_iterator import apply_prediction_to_iterator # NOQA
from chainercv.utils.iterator.progress_hook import ProgressHook # NOQA
from chainercv.utils.iterator.unzip import unzip # NOQA
| from chainercv.utils.iterator.apply_prediction_to_iterator import apply_prediction_to_iterator # NOQA
from chainercv.utils.iterator.ProgressHook import ProgressHook # NOQA
from chainercv.utils.iterator.unzip import unzip # NOQA
| mit | Python |
b5898695507623b6f219a5dd0d28d6cf46ef9aec | Fix shared library build on windows (breakage caused by r122082). | yitian134/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,ropik/chromium,yitian134/chromium,ropik/chromium,ropik/chromium,gavinp/chrom... | chrome/common/extensions/api/api.gyp | chrome/common/extensions/api/api.gyp | # Copyright (c) 2012 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': 'api',
'type': 'static_library',
'sources': [
'<@(json_schema_files)',
],
'in... | # Copyright (c) 2012 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': 'api',
'type': 'static_library',
'sources': [
'<@(json_schema_files)',
],
'in... | bsd-3-clause | Python |
a2ca940e529b7f6c9f46d9d1c1621eb0c15f6a1d | Add a note about the bug of packbits of previous NumPy versions | chainer/chainer,ktnyt/chainer,cupy/cupy,okuta/chainer,keisuke-umezawa/chainer,chainer/chainer,cupy/cupy,ktnyt/chainer,ronekko/chainer,rezoo/chainer,okuta/chainer,keisuke-umezawa/chainer,hvy/chainer,hvy/chainer,hvy/chainer,cupy/cupy,kiyukuta/chainer,wkentaro/chainer,jnishi/chainer,chainer/chainer,niboshi/chainer,wkentar... | tests/cupy_tests/binary_tests/test_packing.py | tests/cupy_tests/binary_tests/test_packing.py | import numpy
import unittest
from cupy import testing
@testing.gpu
class TestPacking(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.with_requires('numpy>=1.10')
@testing.for_int_dtypes()
@testing.numpy_cupy_array_equal()
def check_packbits(self, data, xp, dtype):
# Note nu... | import numpy
import unittest
from cupy import testing
@testing.gpu
class TestPacking(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.with_requires('numpy>=1.10')
@testing.for_int_dtypes()
@testing.numpy_cupy_array_equal()
def check_packbits(self, data, xp, dtype):
# Note nu... | mit | Python |
fc22aefccfad63e79b41f44934c63eccf92f88f4 | Document the control tokens. | mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware | gateware/hdmi_in/common.py | gateware/hdmi_in/common.py | control_tokens = [
# Control tokens are designed to have a large number (7) of transitions to
# help the receiver synchronize its clock with the transmitter clock.
# Control tokens are encoded using the values in the table below.
# 9........0 C1 C0
0b1101010100, # 0 0
0b0010101011, # ... | control_tokens = [0b1101010100, 0b0010101011, 0b0101010100, 0b1010101011]
channel_layout = [("d", 8), ("c", 2), ("de", 1)]
| bsd-2-clause | Python |
2f99c43ce1a7336f926b5ae2613004820e4a2060 | remove iptables init because it is called in a loop for every request | ffrgb/ffrn-gw-splash,Freifunk-Rhein-Neckar/ffrn-gw-splash,ffrgb/ffrn-gw-splash,ffrgb/ffrn-gw-splash,Freifunk-Rhein-Neckar/ffrn-gw-splash | backend.py | backend.py | from flask import Flask, request, jsonify, render_template, abort
import subprocess
import re
import db as database
from iptables import IPTables
from helper import Helper
app = Flask(__name__)
# create objects needed here
ipt = IPTables()
helper = Helper()
db = database.DB()
@app.route('/', methods=['GET', 'POST'],... | from flask import Flask, request, jsonify, render_template, abort
import subprocess
import re
import db as database
from iptables import IPTables
from helper import Helper
app = Flask(__name__)
# create objects needed here
ipt = IPTables()
helper = Helper()
db = database.DB()
@app.route('/', methods=['GET', 'POST'],... | mit | Python |
02358217031fa38826f1f27302e4b6eb370862c0 | Correct reverse migration. | harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o | web/main/migrations/0030_auto_20200108_1606.py | web/main/migrations/0030_auto_20200108_1606.py | # Generated by Django 2.2.9 on 2020-01-08 16:06
from django.db import migrations
def admin_status_in_user_field(apps, schema_editor):
User = apps.get_model('main', 'User')
superadmins = User.objects.filter(roles__name='superadmin')
superadmins.update(is_staff=True, is_superuser=True)
def admin_status_via... | # Generated by Django 2.2.9 on 2020-01-08 16:06
from django.db import migrations
def admin_status_in_user_field(apps, schema_editor):
User = apps.get_model('main', 'User')
superadmins = User.objects.filter(roles__name='superadmin')
superadmins.update(is_staff=True, is_superuser=True)
def revert_admin(app... | agpl-3.0 | Python |
8fef99429fd9b267a24902680552bca153afab3f | Add dict debugger function | aleasoluciones/docker-image-cleaner,aebm/docker-image-cleaner | chacha.py | chacha.py | #!/usr/bin/env python
import argparse
import atexit
import logging
DEFAULT_DOCKER_BASE_URL = 'unix://var/run/docker.sock'
HELP_DOCKER_BASE_URL = ('Refers to the protocol+hostname+port where the '
'Docker server is hosted. Defaults to %s') % DEFAULT_DOCKER_BASE_URL
DEFAULT_DOCKER_API_VERSION = 'auto'
HELP_DOCKER_... | #!/usr/bin/env python
import argparse
import atexit
import logging
DEFAULT_DOCKER_BASE_URL = 'unix://var/run/docker.sock'
HELP_DOCKER_BASE_URL = ('Refers to the protocol+hostname+port where the '
'Docker server is hosted. Defaults to %s') % DEFAULT_DOCKER_BASE_URL
DEFAULT_DOCKER_API_VERSION = 'auto'
HELP_DOCKER_... | mit | Python |
2cbbcd24ebb65ebd4877b0c172304861b31514eb | simplify setup | vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa | python/vespa/setup.py | python/vespa/setup.py | import os
import setuptools
def get_target_version():
build_nr = os.environ.get("GITHUB_RUN_NUMBER", "0+dev")
version = "0.1"
return "{}.{}".format(version, build_nr)
min_python = "3.6"
setuptools.setup(
name="pyvespa",
version=get_target_version(),
description="Python API for vespa.ai",
... | import os
from pkg_resources import parse_version
from configparser import ConfigParser
import setuptools
assert parse_version(setuptools.__version__) >= parse_version("36.2")
# note: all settings are in settings.ini; edit there, not here
config = ConfigParser(delimiters=["="])
config.read("settings.ini")
cfg = confi... | apache-2.0 | Python |
ce64b680b7ee69d70488e150b914199fbbda6895 | Store the generated files in DATABASE | sayan2207/Otaku-senpai | generate-clean-database.py | generate-clean-database.py | from zipfile import ZipFile
import pandas as pd
import os
ZIP_FILE = "anime-recommendations-database"
DATA_FILE = "anime.csv"
NEW_DATA_FILE = "anime_cleaned.csv"
DIR = "DATABASE"
def clean_by_id(df):
ids = df.iloc[:,0]
drops=[]
for i in range(len(ids)):
if not str(ids[i]).isdigit():
... | from zipfile import ZipFile
import pandas as pd
import os
ZIP_FILE = "anime-recommendations-database"
DATA_FILE = "anime.csv"
NEW_DATA_FILE = "anime_cleaned.csv"
def clean_by_id(df):
ids = df.iloc[:,0]
drops=[]
for i in range(len(ids)):
if not str(ids[i]).isdigit():
drops.append(i... | mit | Python |
afb20498a06c7d3f7cf8b3ab80150dabea20087b | Fix import for cron | saurabhshri/sample-platform,saurabhshri/sample-platform,satyammittal/sample-platform,canihavesomecoffee/sample-platform,canihavesomecoffee/sample-platform,satyammittal/sample-platform,satyammittal/sample-platform,canihavesomecoffee/sample-platform,saurabhshri/sample-platform,canihavesomecoffee/sample-platform,saurabhsh... | mod_ci/cron.py | mod_ci/cron.py | #!/usr/bin/python
import sys
from os import path
# Need to append server root path to ensure we can import the necessary files.
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
def cron():
from mod_ci.controllers import start_platform
from run import config, log
from database import cr... | #!/usr/bin/python
import sys
from os import path
# Need to append server root path to ensure we can import the necessary files.
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
def cron():
from mod_ci.controllers import start_all_platforms
from run import config, log
from database impo... | isc | Python |
d2fe00f1692a2601f0f2d1025537783f77400760 | print out filesize | yuan3y/dropbox-clone-MID | client.py | client.py | import requests
import os, time
from os.path import isfile, join, getsize
'''
[ f for f in os.listdir('./') if isfile(join('./',f)) ]
'''
print(os.listdir("./"))
filenames_list = os.listdir("./")
filter(os.path.isfile, os.listdir( os.curdir ))
# filter(os.path.isfile, filenames_list)
for filename in filenames_list:
... | import requests
import os, time
from os.path import isfile, join
'''
[ f for f in os.listdir('./') if isfile(join('./',f)) ]
'''
print(os.listdir("./"))
filenames_list = os.listdir("./")
filter(os.path.isfile, os.listdir( os.curdir ))
# filter(os.path.isfile, filenames_list)
for filename in filenames_list:
# wit... | mit | Python |
d91aaae50a65852bcc4f70cb751be7913e50860b | Add arrow bindings | The-Compiler/dotfiles,The-Compiler/dotfiles,The-Compiler/dotfiles | qutebrowser/config.py | qutebrowser/config.py | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | mit | Python |
795cb989099a940a1bd065f8212f5fe650c2bf18 | Move MessageContainer.on_send inside its .to_bytes | LonamiWebs/Telethon,andr-04/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,expectocode/Telethon,LonamiWebs/Telethon | telethon/tl/message_container.py | telethon/tl/message_container.py | from . import TLObject, GzipPacked
from ..extensions import BinaryWriter
class MessageContainer(TLObject):
constructor_id = 0x73f1f8dc
# TODO Currently it's a bit of a hack, since the container actually holds
# messages (message id, sequence number, request body), not requests.
# Probably create a pr... | from . import TLObject, GzipPacked
from ..extensions import BinaryWriter
class MessageContainer(TLObject):
constructor_id = 0x73f1f8dc
# TODO Currently it's a bit of a hack, since the container actually holds
# messages (message id, sequence number, request body), not requests.
# Probably create a pr... | mit | Python |
848840142ed1ea745afd0603358fd23a5606c306 | fix plink frq parser | knmkr/dbsnp-pg-min,knmkr/dbsnp-pg-min,knmkr/dbsnp-pg,knmkr/dbsnp-pg-min,knmkr/dbsnp-pg-min,knmkr/dbsnp-pg,knmkr/dbsnp-pg | contrib/freq/script/plinkfrq2pg_array.py | contrib/freq/script/plinkfrq2pg_array.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import sys
from decimal import *
for line in sys.stdin:
# Convert from .frq to .csv
#
# [.frq]
# CHR SNP A1 A2 MAF NCHROBS
# 1 rs140337953 G T 0.1101 572
# 1 rs199681827 CTGT C ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import sys
from decimal import *
for line in sys.stdin:
# Convert from .frq to .csv
#
# [.frq]
# CHR SNP A1 A2 MAF NCHROBS
# 12 rs671 A G 0.2168 572
#
# [.csv]
# {A,G} {... | unknown | Python |
190649523fcecdad3c69752b3bb0ce1cc39f2233 | Fix stdout open mode | pndurette/gTTS,XueWei/gTTS,XueWei/gTTS | bin/gtts-cli.py | bin/gtts-cli.py | #! /usr/bin/python
from __future__ import print_function
from gtts import gTTS
from gtts import __version__
import sys
import argparse
import os
def languages():
"""Sorted pretty printed string of supported languages"""
return ", ".join(sorted("{}: '{}'".format(gTTS.LANGUAGES[k], k) for k in gTTS.LANGUAGES))
... | #! /usr/bin/python
from __future__ import print_function
from gtts import gTTS
from gtts import __version__
import sys
import argparse
def languages():
"""Sorted pretty printed string of supported languages"""
return ", ".join(sorted("{}: '{}'".format(gTTS.LANGUAGES[k], k) for k in gTTS.LANGUAGES))
# Args
de... | mit | Python |
566ae40b7f546e3773933217506f917845c8b468 | Return more fields in subtraction find API response | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool | virtool/subtractions/db.py | virtool/subtractions/db.py | import virtool.utils
PROJECTION = [
"_id",
"count",
"file",
"ready",
"job",
"nickname",
"user"
]
async def get_linked_samples(db, subtraction_id):
cursor = db.samples.find({"subtraction.id": subtraction_id}, ["name"])
return [virtool.utils.base_processor(d) async for d in cursor]
| import virtool.utils
PROJECTION = [
"_id",
"file",
"ready",
"job"
]
async def get_linked_samples(db, subtraction_id):
cursor = db.samples.find({"subtraction.id": subtraction_id}, ["name"])
return [virtool.utils.base_processor(d) async for d in cursor]
| mit | Python |
571b04e2d688f311c3a4aa38c588aaad1cd478bd | Update __init__.py | selvakarthik21/newspaper,selvakarthik21/newspaper | newspaperdemo/__init__.py | newspaperdemo/__init__.py | from flask import Flask, request, render_template, redirect, url_for,jsonify
from newspaper import Article
from xml.etree import ElementTree
app = Flask(__name__)
# Debug logging
import logging
import sys
# Defaults to stdout
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
try:
log.inf... | from flask import Flask, request, render_template, redirect, url_for,jsonify
from newspaper import Article
from xml.etree import ElementTree
app = Flask(__name__)
# Debug logging
import logging
import sys
# Defaults to stdout
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
try:
log.inf... | mit | Python |
294f8520ab85e8a3e889b163e97e23a1906efb6d | Fix django default appconfig deprecation warning (#141) | fabiocaccamo/django-admin-interface,fabiocaccamo/django-admin-interface,fabiocaccamo/django-admin-interface | admin_interface/__init__.py | admin_interface/__init__.py | import django
if django.VERSION < (3, 2):
default_app_config = 'admin_interface.apps.AdminInterfaceConfig'
| # -*- coding: utf-8 -*-
default_app_config = 'admin_interface.apps.AdminInterfaceConfig'
| mit | Python |
961f21972b8ca270b278210441a97f53a4c103ca | use tuple for DEFAULT_THROTTLE_CLASSES travis | sloria/osf.io,felliott/osf.io,adlius/osf.io,erinspace/osf.io,hmoco/osf.io,chennan47/osf.io,hmoco/osf.io,HalcyonChimera/osf.io,sloria/osf.io,icereval/osf.io,Nesiehr/osf.io,laurenrevere/osf.io,acshi/osf.io,chrisseto/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,Nesiehr/osf.io,mattclark/osf.io,cwisecarver/osf.io,cslzchen... | api/base/settings/local-travis.py | api/base/settings/local-travis.py | VARNISH_SERVERS = ['http://127.0.0.1:8080']
ENABLE_VARNISH = True
ENABLE_ESI = False
REST_FRAMEWORK = {
'PAGE_SIZE': 10,
# Order is important here because of a bug in rest_framework_swagger. For now,
# rest_framework.renderers.JSONRenderer needs to be first, at least until
# https://github.com/marcgibb... | VARNISH_SERVERS = ['http://127.0.0.1:8080']
ENABLE_VARNISH = True
ENABLE_ESI = False
REST_FRAMEWORK = {
'PAGE_SIZE': 10,
# Order is important here because of a bug in rest_framework_swagger. For now,
# rest_framework.renderers.JSONRenderer needs to be first, at least until
# https://github.com/marcgibb... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.