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 |
|---|---|---|---|---|---|---|---|---|
411751a10ece8b84bb122422b8d58f22710731aa | Fix typo | wizeline/relayer | relayer/flask/logging_middleware.py | relayer/flask/logging_middleware.py | from datetime import datetime
class LoggingMiddleware(object):
def __init__(self, app, wsgi_app, context, logging_topic):
self.app = app
self.wsgi_app = wsgi_app
self.context = context
self.logging_topic = logging_topic
def __call__(self, environ, start_response):
with... | from datetime import datetime
class LoggingMiddleware(object):
def __init__(self, app, wsgi_app, context, logging_topic):
self.app = app
self.wsgi_app = wsgi_app
self.context = context
self.logging_topic = logging_topic
def __call__(self, environ, start_response):
with... | mit | Python |
911e961f189967554bc5a046f022bb1c394cc119 | Debug and test before finishing. p50-52 | n1cfury/ViolentPython | bruteKey.py | bruteKey.py | #!/usr/bin/env python
import pexpect, optparse, os
from threading import *
maxConnections = 5
connection_lock = BoundSemapohre(value=maxConnections)
Stop = False
Fails = 0
usage = "Example: bruteKey.py -H <target> -u <user name> -d <directory> "
def banner():
print "##### SSH Weak Key Exploit #######"
usage
prin... | #!/usr/bin/env python
import pexpect, optparse, os
from threading import *
maxConnections = 5
connection_lock = BoundSemapohre(value=maxConnections)
Stop = False
Fails = 0
usage = "Example: bruteKey.py -H <target> -u <user name> -d <directory> "
def banner():
print "##### SSH Weak Key Exploit #######"
usage
prin... | mit | Python |
f3578096219dbb82572063c8a6dbb75be4da07ac | Update P03_combinePDFs fixed reading encrypted files | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePDFs.py | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePDFs.py | #! python3
# combinePdfs.py - Combines all the PDFs in the current working directory into
# a single PDF.
import PyPDF4, os
# Get all the PDF filenames.
pdfFiles = []
for filename in os.listdir('.'):
if filename.endswith(".pdf"):
pdfFiles.append(filename)
pdfFiles.sort(key=str.lower)
pdfWriter = PyPDF4.P... | #! python3
# combinePdfs.py - Combines all the PDFs in the current working directory into
# a single PDF.
import PyPDF4, os
# Get all the PDF filenames.
pdfFiles = []
for filename in os.listdir('.'):
if filename.endswith(".pdf"):
pdfFiles.append(filename)
pdfFiles.sort(key=str.lower)
pdfWriter = PyPDF4.P... | mit | Python |
26ce46c14f3fc5d38253617822974c21b488dd95 | Set priority to 0, set viability to permanently null. Add test to ensure keyring can render itself. Ref #358. | jaraco/keyring | keyring/backends/chainer.py | keyring/backends/chainer.py | """
Implementation of a keyring backend chainer.
This is specifically not a viable backend, and must be
instantiated directly with a list of ordered backends.
"""
from __future__ import absolute_import
from ..backend import KeyringBackend
class ChainerBackend(KeyringBackend):
"""
>>> ChainerBackend(())
... | """
Implementation of a keyring backend chainer.
This is specifically not a viable backend, and must be
instantiated directly with a list of ordered backends.
"""
from __future__ import absolute_import
from ..backend import KeyringBackend
class ChainerBackend(KeyringBackend):
def __init__(self, backends):
... | mit | Python |
56598776ce6588445cf0d76b5faaea507d5d1405 | Update Labels for consistency | sigmavirus24/github3.py | github3/issues/label.py | github3/issues/label.py | # -*- coding: utf-8 -*-
"""Module containing the logic for labels."""
from __future__ import unicode_literals
from json import dumps
from ..decorators import requires_auth
from ..models import GitHubCore
class Label(GitHubCore):
"""A representation of a label object defined on a repository.
See also: http:/... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from json import dumps
from ..decorators import requires_auth
from ..models import GitHubCore
class Label(GitHubCore):
"""The :class:`Label <Label>` object. Succintly represents a label that
exists in a repository.
See also: http://develope... | bsd-3-clause | Python |
9626736dc94c85987472b7d7ad5951363883a5dc | Disable Facter plugin if yaml import fails | pombredanne/jsonstats,RHInception/jsonstats,RHInception/jsonstats,pombredanne/jsonstats | JsonStats/FetchStats/Plugins/Facter.py | JsonStats/FetchStats/Plugins/Facter.py | import datetime
from JsonStats.FetchStats import Fetcher
import os.path
class Facter(Fetcher):
"""
Facter plugin for `jsonstats`. Returns key-value pairs of general
system information provided by the `facter` command.
Load conditions:
* Plugin will load if the `facter` command is found
Opera... | import datetime
from JsonStats.FetchStats import Fetcher
import os.path
class Facter(Fetcher):
"""
Facter plugin for `jsonstats`. Returns key-value pairs of general
system information provided by the `facter` command.
Load conditions:
* Plugin will load if the `facter` command is found
Opera... | mit | Python |
764f785bfa34d99dc2633db78a0d80407e401993 | Implement a client instance | liberation/zuora-client | zuora/client.py | zuora/client.py | """
Client for Zuora SOAP API
"""
# TODO:
# - Handle debug
# - Handle error
# - Session policy
from suds.client import Client
from suds.sax.element import Element
from zuora.transport import HttpTransportWithKeepAlive
class ZuoraException(Exception):
"""
Base Zuora Exception.
"""
pass
class Zuor... | """
Client for Zuora SOAP API
"""
# TODO:
# - Handle debug
# - Handle error
# - Session policy
from suds.client import Client
from suds.sax.element import Element
class ZuoraException(Exception):
"""
Base Zuora Exception.
"""
pass
class Zuora(object):
"""
SOAP Client based on Suds
"""... | bsd-3-clause | Python |
88206513d4a04a99832ac8461a3209b2d1d7d2c8 | make test work | mkuiack/tkp,transientskp/tkp,mkuiack/tkp,bartscheers/tkp,bartscheers/tkp,transientskp/tkp | tests/test_quality/test_restoringbeam.py | tests/test_quality/test_restoringbeam.py | import os
import unittest2 as unittest
from tkp.quality.restoringbeam import beam_invalid
from tkp.testutil.decorators import requires_data
from tkp import accessors
from tkp.testutil.data import DATAPATH
fits_file = os.path.join(DATAPATH,
'quality/noise/bad/home-pcarrol-msss-3C196a-analysis-band6.corr.fits')
... | import os
import unittest2 as unittest
from tkp.quality.restoringbeam import beam_invalid
from tkp.testutil.decorators import requires_data
from tkp import accessors
from tkp.testutil.data import DATAPATH
fits_file = os.path.join(DATAPATH,
'quality/noise/bad/home-pcarrol-msss-3C196a-analysis-band6.corr.fits')
... | bsd-2-clause | Python |
716ffae543838af6de7b83723ac6048a9f8f390a | improve test list latest articles | eliostvs/django-kb,eliostvs/django-kb | knowledge/tests/tests_views.py | knowledge/tests/tests_views.py | from __future__ import unicode_literals
from model_mommy import mommy
from knowledge.base import choices
from knowledge.base.test import ViewTestCase
from knowledge.models import Article
class HomepageTestCase(ViewTestCase):
from knowledge.views import Homepage
view_class = Homepage
view_name = 'knowl... | from __future__ import unicode_literals
from model_mommy import mommy
from knowledge.base import choices
from knowledge.base.test import ViewTestCase
from knowledge.models import Article
class HomepageTestCase(ViewTestCase):
from knowledge.views import Homepage
view_class = Homepage
view_name = 'knowl... | bsd-3-clause | Python |
c69ac39ee650445533d31a4a476f6f3b14cb43ca | Update roles.py | mikelambson/tcid,mikelambson/tcid,mikelambson/tcid,mikelambson/tcid | site/models/roles.py | site/models/roles.py | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class Roles(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
name = DB.Column(DB.String(20);
district_id = DB.relationship(DB.Integer, DB.ForeignKey('district.id'));
created_by = DB.... | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class Roles(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
name = DB.Column(DB.String(20);
district_id = DB.relationship(DB.Integer, DB.ForeignKey('district.id'));
created_by = DB.... | bsd-3-clause | Python |
ea542282911cbc7b3cf594a20175fbddcbd75a89 | Use absolute import | mxreppy/restapi-logging-handler,narwhaljames/restapi-logging-handler | restapi_logging_handler/__init__.py | restapi_logging_handler/__init__.py | from __future__ import absolute_import
from restapi_logging_handler.loggly_handler import LogglyHandler
from restapi_logging_handler.restapi_logging_handler import RestApiHandler
| from loggly_handler import LogglyHandler
from restapi_logging_handler import RestApiHandler
| mit | Python |
128c54529da80d5f84a0bf8a9bca6e83ed14a342 | Delete unused import | thombashi/SimpleSQLite,thombashi/SimpleSQLite | simplesqlite/loader/html/formatter.py | simplesqlite/loader/html/formatter.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import bs4
import dataproperty
from ..constant import TableNameTemplate as tnt
from ..data import TableData
from ..formatter import TableFormatter
class HtmlTableFormatter(TableFormatter):
... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import bs4
import dataproperty
from ..constant import TableNameTemplate as tnt
from ..data import TableData
from ..error import InvalidDataError
from ..formatter import TableFormatter
class Htm... | mit | Python |
7f02d1f2b23bbf27e99d87ef23c491823875c3d1 | fix bin none subprocess.TimeoutExpired | le9i0nx/ansible-role-test | bin/virt.py | bin/virt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import yaml
import subprocess
import os
import sys
def proc(cmd,time = 120,sh = True ):
print("$".format(cmd))
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=sh)
outs, errs = p.communicate(timeout=time)
return outs,errs,p
ROO... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import yaml
import subprocess
import os
import sys
def proc(cmd,time = 120,sh = True ):
print("$".format(cmd))
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=sh)
try:
outs, errs = p.communicate(timeout=time)
except sub... | mit | Python |
45e9ddce96b4fdadca63a50bf2808c7f98520d99 | print query on error | isb-cgc/ISB-CGC-data-proc,isb-cgc/ISB-CGC-data-proc,isb-cgc/ISB-CGC-data-proc | data_upload/util/bq_wrapper.py | data_upload/util/bq_wrapper.py | '''
Created on Jan 22, 2017
Copyright 2017, Institute for Systems Biology.
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... | '''
Created on Jan 22, 2017
Copyright 2017, Institute for Systems Biology.
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... | apache-2.0 | Python |
d590307b0d59ac7163016197e3de0e8bced377d2 | Fix form typo | TwilioDevEd/account-verification-flask,TwilioDevEd/account-verification-flask,TwilioDevEd/account-verification-flask | account_verification_flask/forms/forms.py | account_verification_flask/forms/forms.py | from flask_wtf import Form
from wtforms import TextField, PasswordField, IntegerField
from wtforms.validators import DataRequired, Length, Email, EqualTo
class RegisterForm(Form):
name = TextField(
'Tell us your name',
validators = [DataRequired(message = "Name is required"), Length(min = 3,messag... | from flask_wtf import Form
from wtforms import TextField, PasswordField, IntegerField
from wtforms.validators import DataRequired, Length, Email, EqualTo
class RegisterForm(Form):
name = TextField(
'Tell us your name',
validators = [DataRequired(message = "Name is required"), Length(min = 3,messag... | mit | Python |
7998477a627a78b83f96894e72ec2f121c4b9606 | Update binding.gyp | jeremycx/node-LDAP,jeremycx/node-LDAP,jeremycx/node-LDAP,jeremycx/node-LDAP | binding.gyp | binding.gyp | {
"targets": [
{
'target_name': 'LDAP',
'sources': [
'src/LDAP.cc'
],
'include_dirs': [
'/usr/local/include'
],
'defines': [
'LDAP_DEPRECATED'
],
'cflags': [
'-Wall',
'-g'
],
'libraries': [
'-llber -ll... | {
"targets": [
{
'target_name': 'LDAP',
'sources': [
'src/LDAP.cc'
],
'include_dirs': [
'/usr/local/include'
],
'defines': [
'LDAP_DEPRECATED'
],
'cflags': [
'-Wall',
'-g'
],
'ldflags': [
'-L/usr/local... | mit | Python |
2a65b1715e469e11ed73faf7f3446f81c836c42e | Add fetch domain logic | kkstu/DNStack,kkstu/DNStack,kkstu/DNStack | handler/domain.py | handler/domain.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
# Domain Page
from BaseHandler import BaseHandler
from tornado.web import authenticated as Auth
from model.models import Domain, Groups, Record
class IndexHandler(BaseHandler):
@Auth
def get(self):
page = int(self.get_argument('page', 1)... | #!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
# Domain Page
from BaseHandler import BaseHandler
from tornado.web import authenticated as Auth
class IndexHandler(BaseHandler):
@Auth
def get(self):
self.render('domain/index.html')
class GroupHandler(BaseHandler):
@Auth
def g... | mit | Python |
c7412824c1e9edb7c386f111ce30b5d76952f861 | Remove 'reviews' from Context API return | Architizer/mendel,Architizer/mendel,Architizer/mendel,Architizer/mendel | mendel/serializers.py | mendel/serializers.py | from .models import Keyword, Category, Document, Context, Review, User
from rest_auth.models import TokenModel
from rest_framework import serializers
class KeywordSerializer(serializers.ModelSerializer):
class Meta:
model = Keyword
fields = ('id', 'name', 'definition')
def create(self, valid... | from .models import Keyword, Category, Document, Context, Review, User
from rest_auth.models import TokenModel
from rest_framework import serializers
class KeywordSerializer(serializers.ModelSerializer):
class Meta:
model = Keyword
fields = ('id', 'name', 'definition')
def create(self, valid... | agpl-3.0 | Python |
f471441bde9940e46badd0ec506c18e8587de004 | Optimize the rebuild admin | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | metaci/build/admin.py | metaci/build/admin.py | from django.contrib import admin
from metaci.build.models import Build
from metaci.build.models import BuildFlow
from metaci.build.models import FlowTask
from metaci.build.models import Rebuild
class BuildAdmin(admin.ModelAdmin):
list_display = (
'repo',
'plan',
'branch',
'commit',... | from django.contrib import admin
from metaci.build.models import Build
from metaci.build.models import BuildFlow
from metaci.build.models import FlowTask
from metaci.build.models import Rebuild
class BuildAdmin(admin.ModelAdmin):
list_display = (
'repo',
'plan',
'branch',
'commit',... | bsd-3-clause | Python |
206f76026504219ed52f2fcca1b6b64b78bdcf21 | Add some print statements | SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper | software/lightpowertool/csv_export.py | software/lightpowertool/csv_export.py | import csv
class CSVExport(object):
"""docstring for CSVExport"""
def __init__(self, filename):
super(CSVExport, self).__init__()
self._filename = filename
def export_data(self, data):
print("Beginning exportation of data...")
with open(self._filename, "w", newline='') as c... | import csv
class CSVExport(object):
"""docstring for CSVExport"""
def __init__(self, filename):
super(CSVExport, self).__init__()
self._filename = filename
def export_data(self, data):
with open(self._filename, "w", newline='') as csvfile:
csvwriter = csv.writer(csvfile... | agpl-3.0 | Python |
3121a02c6174a31b64974d57a3ec2d7df760a7ae | Ajoute une référence législative au taux d'incapacité | sgmap/openfisca-france,sgmap/openfisca-france | openfisca_france/model/caracteristiques_socio_demographiques/capacite_travail.py | openfisca_france/model/caracteristiques_socio_demographiques/capacite_travail.py | # -*- coding: utf-8 -*-
from openfisca_france.model.base import *
class taux_capacite_travail(Variable):
value_type = float
default_value = 1.0
entity = Individu
label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)"
defi... | # -*- coding: utf-8 -*-
from openfisca_france.model.base import *
class taux_capacite_travail(Variable):
value_type = float
default_value = 1.0
entity = Individu
label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)"
defi... | agpl-3.0 | Python |
a279cb4340c6da5ed64b39660cfcb5ef53d0bb74 | Fix test | cjellick/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,rancherio/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher | tests/core/test_node.py | tests/core/test_node.py | from common import auth_check
def test_node_fields(mc):
cclient = mc.client
fields = {
'nodeTaints': 'r',
'nodeLabels': 'r',
'nodeAnnotations': 'r',
'namespaceId': 'cr',
'conditions': 'r',
'allocatable': 'r',
'capacity': 'r',
'hostname': 'r',
... | from common import auth_check
def test_node_fields(mc):
cclient = mc.client
fields = {
'nodeTaints': 'r',
'nodeLabels': 'r',
'nodeAnnotations': 'r',
'namespaceId': 'cr',
'conditions': 'r',
'allocatable': 'r',
'capacity': 'r',
'hostname': 'r',
... | apache-2.0 | Python |
1bf3e893e45e0dc16e2e820f5f073a63600217c3 | Fix errors in PeriodicFilter | Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities | robotpy_ext/misc/periodic_filter.py | robotpy_ext/misc/periodic_filter.py | import logging
import time
class PeriodicFilter:
"""
Periodic Filter to help keep down clutter in the console.
Simply add this filter to your logger and the logger will
only print periodically.
The logger will always print logging levels of WARNING or higher
"""
def __ini... | import logging
import wpilib
class PeriodicFilter:
"""
Periodic Filter to help keep down clutter in the console.
Simply add this filter to your logger and the logger will
only print periodically.
The logger will always print logging levels of WARNING or higher
"""
def __i... | bsd-3-clause | Python |
881b5c56e89fb2fdb7d4af3a9ec5c5044a25b878 | declare dummy functions | gautamdivgi/eris,LCOO/eris | ansible/lib/modules/rally/library/test.py | ansible/lib/modules/rally/library/test.py | from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
module: rally
short_description: Executes rally commands
'''
def main():
fields = {
"scenario_file" : {"required": True, "type": "str"},
"scenario_args" : {"required" : False, "type": "str"},
}
commands = {'create_db', ... | from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
module: rally
short_description: Executes rally commands
'''
def main():
fields = {
"scenario_file" : {"required": True, "type": "str"},
"scenario_args" : {"required" : False, "type": "str"},
}
commands = {'create_db', ... | apache-2.0 | Python |
27330e69226f36b49f5d5eca5a67af29ee8d679b | Normalize the weasyl link. | Weasyl/conbadger | conbadge.py | conbadge.py | from fractions import Fraction
from cStringIO import StringIO
from PIL import Image, ImageDraw, ImageFont
import qrcode
import requests
museo = ImageFont.truetype('Museo500-Regular.otf', 424)
badge_back = Image.open('badge-back.png')
logo_stamp = Image.open('logo-stamp.png')
qr_size = 975, 975
qr_offset = 75, 75
na... | from fractions import Fraction
from cStringIO import StringIO
from PIL import Image, ImageDraw, ImageFont
import qrcode
import requests
museo = ImageFont.truetype('Museo500-Regular.otf', 424)
badge_back = Image.open('badge-back.png')
logo_stamp = Image.open('logo-stamp.png')
qr_size = 975, 975
qr_offset = 75, 75
na... | isc | Python |
90678692ec85ec90d454b1a3b255dae834bb24ba | trim space | klen/peewee_migrate | tests/mocks/postgres.py | tests/mocks/postgres.py | from psycopg2.extensions import connection, cursor
class MockConnection(connection):
def __init__(self, *args, **kwargs):
self._cursor = MockCursor()
def cursor(self, *args, **kwargs):
return self._cursor
class MockCursor(cursor):
def __init__(self, *args, **kwargs):
self.queries =... |
from psycopg2.extensions import connection, cursor
class MockConnection(connection):
def __init__(self, *args, **kwargs):
self._cursor = MockCursor()
def cursor(self, *args, **kwargs):
return self._cursor
class MockCursor(cursor):
def __init__(self, *args, **kwargs):
self.queries ... | bsd-3-clause | Python |
4c5ebbabcf54b1f23459da7ddf85adf5e5de22d8 | Update add-lore.py to serve legacy lorebot needs | christhompson/loredb | add-lore.py | add-lore.py | #!/usr/bin/env python3
import argparse
import datetime
from peewee import peewee
db = peewee.SqliteDatabase(None)
class BaseModel(peewee.Model):
class Meta:
database = db
class Lore(BaseModel):
time = peewee.DateTimeField(null=True, index=True)
author = peewee.CharField(null=True, index=True)
... | #!/usr/bin/env python3
import argparse
import datetime
from peewee import peewee
db = peewee.SqliteDatabase(None)
class BaseModel(peewee.Model):
class Meta:
database = db
class Lore(BaseModel):
time = peewee.DateTimeField(null=True, index=True)
author = peewee.CharField(null=True, index=True)
... | apache-2.0 | Python |
6ed282bb2da04790e6e399faad4d2ba8dfc214c4 | add v0.20210330 (#28111) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/ccls/package.py | var/spack/repos/builtin/packages/ccls/package.py | # Copyright 2013-2021 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 Ccls(CMakePackage):
"""C/C++ language server"""
homepage = "https://github.com/MaskRa... | # Copyright 2013-2021 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 Ccls(CMakePackage):
"""C/C++ language server"""
homepage = "https://github.com/MaskRa... | lgpl-2.1 | Python |
f230e69780823f4ceb48a68015cd5bd4af94cba0 | Add in some settings for email | pombredanne/discern,pombredanne/discern,pombredanne/discern,pombredanne/discern | ml_service_api/aws.py | ml_service_api/aws.py | """
Deployment settings file
"""
from settings import *
import json
DEBUG=False
TIME_BETWEEN_INDEX_REBUILDS = 60 * 30 # seconds
#Tastypie throttle settings
THROTTLE_AT = 100 #Throttle requests after this number in below timeframe
THROTTLE_TIMEFRAME= 60 * 60 #Timeframe in which to throttle N requests, seconds
THROTT... | """
Deployment settings file
"""
from settings import *
import json
DEBUG=False
TIME_BETWEEN_INDEX_REBUILDS = 60 * 30 # seconds
#Tastypie throttle settings
THROTTLE_AT = 100 #Throttle requests after this number in below timeframe
THROTTLE_TIMEFRAME= 60 * 60 #Timeframe in which to throttle N requests, seconds
THROTT... | agpl-3.0 | Python |
6ac28c1daa0173ae5baa66c9cb020e9c673973ff | Add info for lftp@4.8.1 (#5452) | EmreAtes/spack,tmerrick1/spack,lgarren/spack,EmreAtes/spack,lgarren/spack,iulian787/spack,krafczyk/spack,TheTimmy/spack,tmerrick1/spack,mfherbst/spack,TheTimmy/spack,krafczyk/spack,mfherbst/spack,TheTimmy/spack,TheTimmy/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,EmreAtes/spack,matthiasdiener/spack,skosukhin/sp... | var/spack/repos/builtin/packages/lftp/package.py | var/spack/repos/builtin/packages/lftp/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
e2be8a486c9d13f98d9f14ae7b0cddf8225cf1b3 | Add boolswitch test | mpsonntag/bulk-rename,mpsonntag/bulk-rename | test/test_apv_rename.py | test/test_apv_rename.py | """
Copyright (c) 2017, Michael Sonntag (sonntag@bio.lmu.de)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted under the terms of the BSD License. See
LICENSE file in the root of the project.
"""
import os
import shutil
import tempfile
import unittest... | """
Copyright (c) 2017, Michael Sonntag (sonntag@bio.lmu.de)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted under the terms of the BSD License. See
LICENSE file in the root of the project.
"""
import os
import shutil
import tempfile
import unittest... | bsd-3-clause | Python |
59faede78ad5d763c7c9fa1763e3e7cac67c1ca6 | Move Circle inside CxDeriv | rparini/cxroots,rparini/cxroots | cxroots/CxDerivative.py | cxroots/CxDerivative.py | from __future__ import division
import numpy as np
from numpy import inf, pi
import scipy.integrate
import math
def CxDeriv(f, contour=None):
"""
Compute derivaive of an analytic function using Cauchy's Integral Formula for Derivatives
"""
if contour is None:
from cxroots.Contours import Circle
C = lambda z0: ... | from __future__ import division
import numpy as np
from numpy import inf, pi
import scipy.integrate
import math
from cxroots.Contours import Circle, Rectangle
def CxDeriv(f, contour=None):
"""
Compute derivaive of an analytic function using Cauchy's Integral Formula for Derivatives
"""
if contour is None:
C = l... | bsd-3-clause | Python |
2df7947f02fd39e05bf18a89f904e273d17c63ca | add v0.9.29 (#23606) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/lmdb/package.py | var/spack/repos/builtin/packages/lmdb/package.py | # Copyright 2013-2021 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 Lmdb(MakefilePackage):
"""Symas LMDB is an extraordinarily fast, memory-efficient database... | # Copyright 2013-2021 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 Lmdb(MakefilePackage):
"""Symas LMDB is an extraordinarily fast, memory-efficient database... | lgpl-2.1 | Python |
7abc503d6aa492f2340ab0b98d1f66892180ba19 | Fix some test error | thislight/wood,thislight/wood | tests/test_blueprint.py | tests/test_blueprint.py | from wood import Wood
from wood.support import Blueprint
def make_example_blueprint():
b = Blueprint()
b.empty(r"/example","example")
return b
def test_blueprint_can_add_empty_handler():
b = make_example_blueprint()
assert b != None
def test_blueprint_can_add_handlers_to_wood():
w = Wood(... | from wood import Wood
from wood.support import Blueprint
def make_example_blueprint():
b = Blueprint()
b.empty(r"/example","example")
return b
def test_blueprint_can_add_empty_handler():
b = make_example_blueprint()
assert b != None
def test_blueprint_can_add_handlers_to_wood():
w = Wood(... | apache-2.0 | Python |
d5438347980b4ed3f4a798b8c1019b87691f28bd | Bump version | walkr/oi,danbob123/oi | oi/version.py | oi/version.py | VERSION = '0.2.1'
| VERSION = '0.2.0'
| mit | Python |
676440a464d695146361eb1bdb684e121bf41a42 | fix simple_date parsing | lucuma/solution,jpscaletti/solution | solution/__init__.py | solution/__init__.py | # coding=utf-8
"""
=============================
Solution
=============================
An amazing form solution
:copyright: `Juan-Pablo Scaletti <http://jpscaletti.com>`_.
:license: MIT, see LICENSE for more details.
"""
from .form import Form # noqa
from .formset import FormSet # noqa
fro... | # coding=utf-8
"""
=============================
Solution
=============================
An amazing form solution
:copyright: `Juan-Pablo Scaletti <http://jpscaletti.com>`_.
:license: MIT, see LICENSE for more details.
"""
from .form import Form # noqa
from .formset import FormSet # noqa
fro... | mit | Python |
f6c6ff376974f604b2b4a7b62ad28fd56a264c55 | Add empty testing scaffolding. | sloede/pyglab,sloede/pyglab | test/test_exceptions.py | test/test_exceptions.py | #!/usr/bin/env python3
import pyglab.exceptions as ex
import unittest as ut
class TestBadRequest(ut.TestCase):
def test_throw(self):
pass
def test_statuscode(self):
pass
def test_message(self):
pass
def test_body(self):
pass
| #!/usr/bin/env python3
import pyglab.exceptions as ex
| mit | Python |
f13982144a2a0710af8e082dd01d73f036f026fd | Use clean_system fixture on pypackage test | takeflight/cookiecutter,0k/cookiecutter,terryjbates/cookiecutter,cichm/cookiecutter,letolab/cookiecutter,stevepiercy/cookiecutter,0k/cookiecutter,Vauxoo/cookiecutter,ramiroluz/cookiecutter,hackebrot/cookiecutter,tylerdave/cookiecutter,michaeljoseph/cookiecutter,nhomar/cookiecutter,dajose/cookiecutter,nhomar/cookiecutte... | tests/test_pypackage.py | tests/test_pypackage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pypackage
--------------
Tests formerly known from a unittest residing in test_generate.py named
TestPyPackage.test_cookiecutter_pypackage
"""
from __future__ import unicode_literals
import os
import subprocess
import pytest
from cookiecutter import utils
from ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pypackage
--------------
Tests formerly known from a unittest residing in test_generate.py named
TestPyPackage.test_cookiecutter_pypackage
"""
from __future__ import unicode_literals
import os
import subprocess
import pytest
from cookiecutter import utils
from ... | bsd-3-clause | Python |
247e8f8ce8ed4677c629affec6b9a291c730e3a2 | Use assert_equal instead of assertEqual in fail testcase. | eerimoq/systest | tests/testcases/fail.py | tests/testcases/fail.py | from systest import TestCase
class FailTest(TestCase):
"""A test that always fails.
"""
count = 0
def __init__(self, name):
super(FailTest, self).__init__()
self.name = "fail_" + name
def run(self):
FailTest.count += 1
self.assert_equal(1, 0)
| from systest import TestCase
class FailTest(TestCase):
"""A test that always fails.
"""
count = 0
def __init__(self, name):
super(FailTest, self).__init__()
self.name = "fail_" + name
def run(self):
FailTest.count += 1
self.assertEqual(1, 0)
| mit | Python |
3c2d290452a07946880fc25af917b32766f9529d | Update test script to include deposit | c00w/BitToll,c00w/BitToll,c00w/BitToll,c00w/BitToll | testsuite/front_test.py | testsuite/front_test.py | #!/usr/bin/env python2
import gevent
import requests
import json
import time
import hashlib
ip_address = "vm"
port = "3000"
url = ''.join(['http://', ip_address, ':', port])
def secret(params, secret):
keys = params.keys()
keys.sort()
hash_str = ""
for key in keys:
hash_str += (params[key])
... | #!/usr/bin/env python2
import gevent
import requests
import json
import time
import hashlib
ip_address = "vm"
port = "3000"
url = ''.join(['http://', ip_address, ':', port])
def secret(params, secret):
keys = params.keys()
keys.sort()
hash_str = ""
for key in keys:
hash_str += (params[key])
... | mit | Python |
f6c0258e257aa537dbb64bb8c5f10c87ec32dcf9 | Update my_hooks.py | joxeankoret/diaphora | hooks/my_hooks.py | hooks/my_hooks.py | #!/usr/bin/python
"""
Example Diaphora export hooks script. In this example script the following fake
scenario is considered:
1) There is a something-user.i64 database, for user-land stuff.
2) There is a something-kernel.i64 database, for kernel-land stuff.
3) We export all functions from the something-user.i64... | #!/usr/bin/python
"""
Example Diaphora export hooks script. In this example script the following fake
scenario is considered:
1) There is a something-user.i64 database, for user-land stuff.
2) There is a something-kernel.i64 database, for kernel-land stuff.
3) We export all functions from the something-user.i64... | agpl-3.0 | Python |
4ab33cec7c0f4ee9fee7a7dce1c28466780b7074 | Add hoomd.box.Box to main namespace | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/__init__.py | hoomd/__init__.py | # Copyright (c) 2009-2019 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
""" HOOMD-blue python API
:py:mod:`hoomd` provides a high level user interface for defining and executing
simulations using HOOMD.
.. rubric:: API stability
:... | # Copyright (c) 2009-2019 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
""" HOOMD-blue python API
:py:mod:`hoomd` provides a high level user interface for defining and executing
simulations using HOOMD.
.. rubric:: API stability
:... | bsd-3-clause | Python |
c7ecf728e12dd3a59f4ef45e30b61ce5c52ceca5 | Fix corpus to Polish language | dhermyt/WONS | analysis/textclassification/bagofwords.py | analysis/textclassification/bagofwords.py | import functools
from nltk import ngrams
from nltk.collocations import BigramCollocationFinder
from nltk.metrics import BigramAssocMeasures
import nltk.corpus
import re
import definitions
INVALID_TOKEN_PATTERN = r'^[!%"%\*\(\)\+,&#-\.\$/\d:;\?\<\>\=@\[\]].*'
NEGATION_TOKEN_PATTERN = r'^nie$'
def get_stopwords_list()... | import functools
from nltk import ngrams
from nltk.collocations import BigramCollocationFinder
from nltk.metrics import BigramAssocMeasures
import nltk.corpus
import re
import definitions
INVALID_TOKEN_PATTERN = r'^[!%"%\*\(\)\+,&#-\.\$/\d:;\?\<\>\=@\[\]].*'
NEGATION_TOKEN_PATTERN = r'^nie$'
def get_stopwords_list()... | bsd-2-clause | Python |
de027652a4bb12c6d1a4cb7bc85448c8c2a0d321 | use argparse to get arguments from command line | natemara/sortroms | sortroms/__main__.py | sortroms/__main__.py | from sortroms import main
import argparse
parser = argparse.ArgumentParser(
description='Sort emulator ROM files',
prog='sortroms'
)
parser.add_argument(
'folder',
metavar='DIR',
type=str,
nargs='?',
help='The ROM folder to sort.'
)
if __name__ == '__main__':
args = parser.parse_args()
main(args)
| from sortroms import main
if __name__ == '__main__':
main()
| mit | Python |
19d81520a7fe9dd8098bd1603b455f08e465c5f7 | add getspire to init | stargaser/herschel-archive | hsadownload/__init__.py | hsadownload/__init__.py |
__all__ = ['access', 'getpacs', 'getspire']
from hsadownload import access, getpacs, getspire
|
__all__ = ['access', 'getpacs']
from hsadownload import access, getpacs
| bsd-3-clause | Python |
54b40488a7b0baefba3ada33cf9b792af1c2ca4d | fix bug with api v1 | Fresnoy/kart,Fresnoy/kart | people/api.py | people/api.py | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from common.api import WebsiteResource
from .models import Artist, Staff, Organization
class UserResource(ModelResource):
class Meta:
querys... | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from common.api import WebsiteResource
from .models import Artist, Staff, Organization
class UserResource(ModelResource):
class Meta:
querys... | agpl-3.0 | Python |
59b2d0418c787066c37904816925dad15b0b45cf | Use author display name in document list_filter | yourcelf/btb,yourcelf/btb,flexpeace/btb,flexpeace/btb,yourcelf/btb,flexpeace/btb,flexpeace/btb,yourcelf/btb,flexpeace/btb,yourcelf/btb | scanblog/scanning/admin.py | scanblog/scanning/admin.py | from django.contrib import admin
from scanning.models import PendingScan, Document, DocumentPage, Scan, ScanPage, Transcription
class ScanPageInline(admin.TabularInline):
model = ScanPage
class ScanAdmin(admin.ModelAdmin):
model = Scan
inlines = [ScanPageInline]
admin.site.register(Scan, ScanAdmin)
class... | from django.contrib import admin
from scanning.models import PendingScan, Document, DocumentPage, Scan, ScanPage, Transcription
class ScanPageInline(admin.TabularInline):
model = ScanPage
class ScanAdmin(admin.ModelAdmin):
model = Scan
inlines = [ScanPageInline]
admin.site.register(Scan, ScanAdmin)
class... | agpl-3.0 | Python |
3bc11eea2d629b316eb9a8bdf4d9c2a2c801ddf5 | Remove unused imports | konefalg/whylog,andrzejgorski/whylog,9livesdata/whylog,kgromadzki/whylog,epawlowska/whylog,9livesdata/whylog,epawlowska/whylog,kgromadzki/whylog,konefalg/whylog,andrzejgorski/whylog | whylog/tests/tests_front/tests_whylog_factory.py | whylog/tests/tests_front/tests_whylog_factory.py | from whylog.config.investigation_plan import LineSource
from whylog.front.whylog_factory import whylog_factory
from whylog.front.utils import FrontInput
from whylog.tests.utils import TestRemovingSettings
class TestWhylogFactory(TestRemovingSettings):
def tests_whylog_factory(self):
log_reader, teacher_ge... | from whylog.config.investigation_plan import LineSource
from whylog.front.whylog_factory import whylog_factory
from whylog.front.utils import FrontInput
from whylog.log_reader import LogReader
from whylog.teacher import Teacher
from whylog.tests.utils import TestRemovingSettings
class TestWhylogFactory(TestRemovingSe... | bsd-3-clause | Python |
b875084e74ee03c6b251a79f04f0db340bb356b8 | Fix #604 | Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout | scout/constants/indexes.py | scout/constants/indexes.py | from pymongo import (IndexModel, ASCENDING, DESCENDING)
INDEXES = {
'hgnc_collection': [
IndexModel([
('build', ASCENDING),
('chromosome', ASCENDING)],
name="build_chromosome"),
],
'variant_collection': [
IndexModel([
('case_id', ASCENDING),... | from pymongo import (IndexModel, ASCENDING, DESCENDING)
INDEXES = {
'hgnc_collection': [IndexModel(
[('build', ASCENDING), ('chromosome', ASCENDING)], name="build_chromosome"),
],
'variant_collection': [
IndexModel([('case_id', ASCENDING),('rank_score', DESCENDING)], name="caseid_rankscore"... | bsd-3-clause | Python |
87371774ad332a3adbe927e2609d73710f4a7678 | change method name | vangj/py-bbn,vangj/py-bbn | tests/graph/test_dag.py | tests/graph/test_dag.py | from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.node import Node
from pybbn.graph.dag import Dag
from nose import with_setup
def setup():
pass
def teardown():
pass
@with_setup(setup, teardown)
def test_dag_creation():
n0 = Node(0)
n1 = Node(1)
n2 = Node(2)
e0 = Edge(n0, n1, Ed... | from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.node import Node
from pybbn.graph.dag import Dag
from nose import with_setup
def setup():
pass
def teardown():
pass
@with_setup(setup, teardown)
def test_graph_creation():
n0 = Node(0)
n1 = Node(1)
n2 = Node(2)
e0 = Edge(n0, n1, ... | apache-2.0 | Python |
e4e10ee0ae5a18cfec0e15b7b85986b7f4fc4f9d | Fix prefetched fields in Institutions in API | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/institutions/viewsets.py | feder/institutions/viewsets.py | import django_filters
from rest_framework import filters, viewsets
from teryt_tree.rest_framework_ext.viewsets import custom_area_filter
from .models import Institution, Tag
from .serializers import InstitutionSerializer, TagSerializer
class InstitutionFilter(filters.FilterSet):
jst = django_filters.CharFilter(m... | import django_filters
from rest_framework import filters, viewsets
from teryt_tree.rest_framework_ext.viewsets import custom_area_filter
from .models import Institution, Tag
from .serializers import InstitutionSerializer, TagSerializer
class InstitutionFilter(filters.FilterSet):
jst = django_filters.CharFilter(m... | mit | Python |
9bdaf963843a9f0b44487ea3b258b50b328153d8 | Remove redis connection logic from each view, make it global, keep it threadsafe | gmcquillan/firetower,gmcquillan/firetower | firetower/web/firetower_web.py | firetower/web/firetower_web.py | from calendar import timegm
import datetime
import time
from flask import Flask, render_template
from firetower import redis_util
REDIS_HOST = "localhost"
REDIS_PORT = 6379
REDIS = redis_util.Redis(REDIS_HOST, REDIS_PORT)
app = Flask(__name__)
def timestamp(dttm):
return timegm(dttm.utctimetuple())
@app... | from calendar import timegm
import datetime
import time
from flask import Flask, render_template
from firetower import redis_util
REDIS_HOST = "localhost"
REDIS_PORT = 6379
app = Flask(__name__)
def timestamp(dttm):
return timegm(dttm.utctimetuple())
@app.route("/")
def root():
lines = []
redis ... | mit | Python |
1c48f9ad2c2a66d7c15c9216665b7f802d3498b4 | Set deprecation_summary_result so we can summarize deprecations and they get written to the report plist if specified. | autopkg/gregneagle-recipes | SharedProcessors/DeprecationWarning.py | SharedProcessors/DeprecationWarning.py | #!/usr/bin/python
#
# Copyright 2019 Greg Neagle
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | #!/usr/bin/python
#
# Copyright 2019 Greg Neagle
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
1e139567767a98914df90ec152d543bb8bfde38c | add test | dtnewman/zappa_boilerplate,dtnewman/zappa_boilerplate | basic_zappa_project/public/views_tests.py | basic_zappa_project/public/views_tests.py | from basic_zappa_project.test_utils import BaseTestCase
class TestViews(BaseTestCase):
def test_status(self):
expected = {'status': 'ok'}
response = self.client.get('/status')
self.assert200(response)
self.assertEqual(response.json, expected)
def test_about(self):
res... | from basic_zappa_project.test_utils import BaseTestCase
class TestViews(BaseTestCase):
def test_status(self):
expected = {'status': 'ok'}
response = self.client.get('/status')
self.assert200(response)
self.assertEqual(response.json, expected)
def test_about(self):
res... | mit | Python |
a82fc92938a647de620cf8a96fd5907c08060c32 | fix mistake | sagemathinc/learntheeasyway,sagemathinc/learntheeasyway,sagemathinc/learntheeasyway,sagemathinc/learntheeasyway | scripts/install/install.py | scripts/install/install.py | import os
import subprocess
import os.path
def apt_get_install(fname):
with open(fname, 'r') as f:
items = f.readlines()
for item in items:
os.system('sudo apt-get install -y %s' % (item))
def npm_global_install(fname):
with open(fname, 'r') as f:
items = f.readlines()
for item... | import os
import subprocess
import os.path
def apt_get_install(what):
with open(fname, 'r') as f:
items = f.readlines()
for item in items:
os.system('sudo apt-get install -y %s' % (item))
def npm_global_install(what):
with open(fname, 'r') as f:
items = f.readlines()
for item i... | apache-2.0 | Python |
19c0e8d856049677bc7de2bc293a87a0aac306f8 | Fix wsgi config file access for HTTPD | ging/keystone,cloudbau/keystone,cloudbau/keystone,JioCloud/keystone,townbull/keystone-dtrust,roopali8/keystone,maestro-hybrid-cloud/keystone,townbull/keystone-dtrust,rickerc/keystone_audit,rickerc/keystone_audit,jumpstarter-io/keystone,cloudbau/keystone,jamielennox/keystone,cbrucks/Federated_Keystone,jumpstarter-io/key... | httpd/keystone.py | httpd/keystone.py | import os
from paste import deploy
from keystone import config
from keystone.common import logging
LOG = logging.getLogger(__name__)
CONF = config.CONF
config_files = ['/etc/keystone/keystone.conf']
CONF(project='keystone', default_config_files=config_files)
conf = CONF.config_file[0]
name = os.path.basename(__fil... | import os
from paste import deploy
from keystone import config
from keystone.common import logging
LOG = logging.getLogger(__name__)
CONF = config.CONF
config_files = ['/etc/keystone.conf']
CONF(config_files=config_files)
conf = CONF.config_file[0]
name = os.path.basename(__file__)
if CONF.debug:
CONF.log_opt_... | apache-2.0 | Python |
8eea594e684053a7fbfe1f2f946343cf809be058 | Rename server tests | posterior/treecat,posterior/treecat | treecat/serving_test.py | treecat/serving_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import numpy as np
import pytest
from treecat.serving import TreeCatServer
from treecat.testutil import TINY_CONFIG
from treecat.testutil import TINY_DATA
from treecat.testutil import TINY_MA... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import numpy as np
import pytest
from treecat.serving import TreeCatServer
from treecat.testutil import TINY_CONFIG
from treecat.testutil import TINY_DATA
from treecat.testutil import TINY_MA... | apache-2.0 | Python |
671ca30892e3ebeb0a9140f95690853b4b92dc02 | Fix reverse since we deprecated post_object_list | praekelt/jmbo-post,praekelt/jmbo-post | post/views.py | post/views.py | from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from post.models import Post
from jmbo.generic.views import GenericObjectDetail, GenericObjectList
from jmbo.view_modifiers import DefaultViewModifier
class ObjectList(GenericObjectList):
def get_extra_context(self, *... | from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from post.models import Post
from jmbo.generic.views import GenericObjectDetail, GenericObjectList
from jmbo.view_modifiers import DefaultViewModifier
class ObjectList(GenericObjectList):
def get_extra_context(self, *... | bsd-3-clause | Python |
a03c61430abac8cac5e522a3bf391175cd261cec | fix tests | zblz/naima,cdeil/naima,cdeil/naima | gammafit/tests/test_onezone.py | gammafit/tests/test_onezone.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
import numpy as np
from numpy.testing import assert_approx_equal
electronozmpars={
'seedspec':'CMB',
'index':2.0,
'cutoff':1e13,
'beta':1.0,
'ngamd':100,
'gmin':1e4,
'g... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
import numpy as np
from numpy.testing import assert_approx_equal
electronozmpars={
'seedspec':'CMB',
'index':2.0,
'cutoff':1e13,
'beta':1.0,
'ngamd':100,
'gmin':1e4,
'g... | bsd-3-clause | Python |
74e4e5e507d908950d4458dff5ba4aa5c712866f | Allow localization of "Self Informations" | dalf/searx,dalf/searx,dalf/searx,asciimoo/searx,asciimoo/searx,dalf/searx,asciimoo/searx,asciimoo/searx | searx/plugins/self_info.py | searx/plugins/self_info.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | agpl-3.0 | Python |
d04ded85e01c4a9e0960d57a37ecd83fc92fa5cd | Add a fallback to mini_installer_tests' quit_chrome.py exit logic. | jaruba/chromium.src,Jonekee/chromium.src,fujunwei/chromium-crosswalk,dednal/chromium.src,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,ondra-novak/chromium.src,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,markYoungH/chromium.src,fujunwei/chromium-crosswalk,... | chrome/test/mini_installer/quit_chrome.py | chrome/test/mini_installer/quit_chrome.py | # Copyright 2013 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.
"""Quits Chrome.
This script sends a WM_CLOSE message to each window of Chrome and waits until
the process terminates.
"""
import optparse
import os
import... | # Copyright 2013 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.
"""Quits Chrome.
This script sends a WM_CLOSE message to each window of Chrome and waits until
the process terminates.
"""
import optparse
import pywintype... | bsd-3-clause | Python |
2d55d95c623bef4848131878061887854ff8a971 | Update utils.py | ALISCIFP/tensorflow-resnet-segmentation,nasatony/deeplab_resnet,DrSleep/tensorflow-deeplab-resnet,ALISCIFP/tensorflow-resnet-segmentation | deeplab_resnet/utils.py | deeplab_resnet/utils.py | from PIL import Image
import numpy as np
import tensorflow as tf
n_classes = 21
# colour map
label_colours = [(0,0,0)
# 0=background
,(128,0,0),(0,128,0),(128,128,0),(0,0,128),(128,0,128)
# 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle
,(0,128,128),(12... | from PIL import Image
import numpy as np
# colour map
label_colours = [(0,0,0)
# 0=background
,(128,0,0),(0,128,0),(128,128,0),(0,0,128),(128,0,128)
# 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle
,(0,128,128),(128,128,128),(64,0,0),(192,0,0),(64,128,0... | mit | Python |
a62b5955d9801f25736c42545191ff5a76a2e5b1 | Refactor UserFactory and add CommentFactory | andreagrandi/bloggato,andreagrandi/bloggato | blog/tests.py | blog/tests.py | from django.test import TestCase
from .models import BlogPost, Comment
from django.contrib.auth.models import User
class UserFactory(object):
def create(self, username="user001", email="email@domain.com", password="password123456"):
user = User.objects.create_user(username = username, email = email, passwo... | from django.test import TestCase
from .models import BlogPost
from django.contrib.auth.models import User
class UserFactory(object):
def create(self):
user = User.objects.create_user(username = "user001", email = "email@domain.com", password = "password123456")
return user
class BlogPostFactory(ob... | mit | Python |
420d104d9e674b96363db5c986ea9eea4d411c92 | Add updated template settings to conftests | st8st8/django-organizations,st8st8/django-organizations,bennylope/django-organizations,bennylope/django-organizations | conftest.py | conftest.py | """
Configuration file for py.test
"""
import django
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "test.sqlite3... | """
Configuration file for py.test
"""
import django
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "test.sqlite3... | bsd-2-clause | Python |
8d6287397b47fcaf98cadc59349f1db68c7b2d93 | Update 1.4_replace_whitespace.py | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | CrackingCodingInterview/1.4_replace_whitespace.py | CrackingCodingInterview/1.4_replace_whitespace.py | """
Replace all whitespace in a string with '%20'
"""
def replace(string):
for i in string:
string.replace("", %20)
return string
| """
Replace all whitespace in a string with '%20'
"""
| mit | Python |
8a1b902b729597f5c8536b235d7add887f097fdd | Drop box should be off by default. SSL should be on by default, HTTP should be off. | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | twistedcaldav/config.py | twistedcaldav/config.py | ##
# Copyright (c) 2005-2006 Apple Computer, 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 ap... | ##
# Copyright (c) 2005-2006 Apple Computer, 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 ap... | apache-2.0 | Python |
3e8d6e31f576fb857a1415c85a227f56225b8f06 | fix database path | SerhoLiu/serholiu.com,SerhoLiu/serholiu.com | blogconfig.py | blogconfig.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 博客名和简介
blogname = "I'm SErHo"
blogdesc = "SErHo's Blog, Please Call me Serho Liu."
blogcover = "//dn-serho.qbox.me/blogbg.jpg"
# Picky 目录和数据库
picky = "/home/serho/website/picky"
database = "/home/serho/website/newblog.db"
# 其他设置
# disqus = "serho"
# secret = "use ra... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 博客名和简介
blogname = "I'm SErHo"
blogdesc = "SErHo's Blog, Please Call me Serho Liu."
blogcover = "//dn-serho.qbox.me/blogbg.jpg"
# Picky 目录和数据库
picky = "/home/serho/website/picky"
database = "//home/serho/website/newblog.db"
# 其他设置
# disqus = "serho"
# secret = "use r... | mit | Python |
1630bb891bf57052984301b9dd191826ca7ba18e | Update test_biobambam.py | Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq | tests/test_biobambam.py | tests/test_biobambam.py | """
.. Copyright 2017 EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... | """
.. Copyright 2017 EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... | apache-2.0 | Python |
8fa0dca5cd5187126a10197883348fc6b16544b5 | Test get campaigns by email | jakesen/pyhatchbuck | tests/test_campaigns.py | tests/test_campaigns.py | import os
import vcr
import unittest
from hatchbuck.api import HatchbuckAPI
from hatchbuck.objects import Contact
class TestCampaigns(unittest.TestCase):
def setUp(self):
# Fake key can be used with existing cassettes
self.test_api_key = os.environ.get("HATCHBUCK_API_KEY", "ABC123")
@vcr.use... | import os
import vcr
import unittest
from hatchbuck.api import HatchbuckAPI
from hatchbuck.objects import Contact
class TestCampaigns(unittest.TestCase):
def setUp(self):
# Fake key can be used with existing cassettes
self.test_api_key = os.environ.get("HATCHBUCK_API_KEY", "ABC123")
@vcr.use... | mit | Python |
d8a83ea3433948447c307a894b16c2b8a12247e8 | Kill defaulting to json for now. | safwanrahman/readthedocs.org,laplaceliu/readthedocs.org,cgourlay/readthedocs.org,techtonik/readthedocs.org,singingwolfboy/readthedocs.org,SteveViss/readthedocs.org,asampat3090/readthedocs.org,VishvajitP/readthedocs.org,dirn/readthedocs.org,singingwolfboy/readthedocs.org,sid-kap/readthedocs.org,techtonik/readthedocs.org... | api/base.py | api/base.py | from django.contrib.auth.models import User
from django.conf.urls.defaults import url
from django.core.urlresolvers import reverse
from tastypie.bundle import Bundle
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorizati... | from django.contrib.auth.models import User
from django.conf.urls.defaults import url
from django.core.urlresolvers import reverse
from tastypie.bundle import Bundle
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorizati... | mit | Python |
69f46596f189786fce0e2a087e6870e5d3059331 | Fix figshare harvester date range (#764) | aaxelb/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE | share/harvesters/com_figshare_v2.py | share/harvesters/com_figshare_v2.py | import pendulum
from furl import furl
from share.harvest import BaseHarvester
class FigshareHarvester(BaseHarvester):
VERSION = 1
page_size = 50
def _do_fetch(self, start_date, end_date):
url = furl(self.config.base_url).set(query_params={
'order_direction': 'asc',
'ord... | import pendulum
from furl import furl
from share.harvest import BaseHarvester
class FigshareHarvester(BaseHarvester):
VERSION = 1
page_size = 50
def do_harvest(self, start_date, end_date):
return self.fetch_records(furl(self.config.base_url).set(query_params={
'order_direction': 'a... | apache-2.0 | Python |
83f54f57170115cda98e7d1aa68972c60b865647 | Fix test_upgrades_to_html.py test | Connexions/cnx-upgrade | cnxupgrade/tests/test_upgrades_to_html.py | cnxupgrade/tests/test_upgrades_to_html.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Tests for to_html command-line interface.
"""
import sys
import unittest
from . import DB_CONNECTION_... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Tests for to_html command-line interface.
"""
import sys
import unittest
from . import DB_CONNECTION_... | agpl-3.0 | Python |
e20f0d3ada72cb21185ca0c3c1d22a77ee254de0 | fix rogue tab | lileiting/goatools,tanghaibao/goatools,tanghaibao/goatools,lileiting/goatools | tests/test_get_paths.py | tests/test_get_paths.py | import sys
import os
from goatools.obo_parser import GODag
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/data/"
def print_paths(paths, PRT=sys.stdout):
for path in paths:
PRT.write('\n')
for GO in path:
PRT.write('{}\n'.format(GO))
def chk_results(actual_paths, expected_path... | import sys
import os
from goatools.obo_parser import GODag
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/data/"
def print_paths(paths, PRT=sys.stdout):
for path in paths:
PRT.write('\n')
for GO in path:
PRT.write('{}\n'.format(GO))
def chk_results(actual_paths, expected_... | bsd-2-clause | Python |
e42690a6f225952ddb6417edc90e27892c18d2a2 | Move api to root. | EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger | api/main.py | api/main.py | from bottle import route, request, response, run, view
from collections import OrderedDict
from parser import parse_response
from server import query_server
import bottle
import json
import os
@route('/')
@view('api/views/index')
def index():
site = "%s://%s" % (request.urlparts.scheme, request.urlparts.netloc)
... | from bottle import route, request, response, run, view
from collections import OrderedDict
from parser import parse_response
from server import query_server
import bottle
import json
import os
@route('/api/')
@view('api/views/index')
def index():
site = "%s://%s" % (request.urlparts.scheme, request.urlparts.netloc... | mit | Python |
ee3b712611ed531843134ef4ce94cb45c726c127 | Fix filename creation in csv export action | limbera/django-nap,MarkusH/django-nap | nap/extras/actions.py | nap/extras/actions.py |
from django.http import StreamingHttpResponse
from django.utils.encoding import force_text
from .models import modelserialiser_factory
from .simplecsv import CSV
class ExportCsv(object):
def __init__(self, serialiser=None, label=None, **opts):
self.serialiser = serialiser
self.opts = opts
... |
from django.http import StreamingHttpResponse
from django.utils.encoding import force_text
from .models import modelserialiser_factory
from .simplecsv import CSV
class ExportCsv(object):
def __init__(self, serialiser=None, label=None, **opts):
self.serialiser = serialiser
self.opts = opts
... | bsd-3-clause | Python |
1e03772e601fb6ed0eb6aa59555af61c29b2650f | remove fungible in parent class constructor call | nedlowe/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python | amaascore/assets/cfd.py | amaascore/assets/cfd.py | from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import datetime, date
from dateutil import parser
from amaascore.assets.derivative import Derivative
class ContractForDifference(Derivative):
def __init__(self, asset_manager_id, asset_id, asset_issuer_id=None, ass... | from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import datetime, date
from dateutil import parser
from amaascore.assets.derivative import Derivative
class ContractForDifference(Derivative):
def __init__(self, asset_manager_id, asset_id, asset_issuer_id=None, ass... | apache-2.0 | Python |
63eaf0faf56a70fadbd37f0acac6f5e61c7b19eb | Change sleep function to the end to do repeat everytime | felipebhz/checkdns | checkdns.py | checkdns.py | # coding=utf8
# 31.220.16.242
# 216.58.222.46
import socket
import time
import webbrowser
def checkdns():
print time.ctime()
retorno = True
try:
ip = socket.gethostbyname('google.com')
print ("O IP do host verificado é: " + ip)
if ip == "216.58.22.46":
... | # coding=utf8
# 31.220.16.242
# 216.58.222.46
import socket
import time
import webbrowser
def checkdns():
print time.ctime()
retorno = True
try:
ip = socket.gethostbyname('google.com')
print ("O IP do host verificado é: " + ip)
if ip == "216.58.222.46":
... | mit | Python |
4c819629552a31748e4bb266c1c13726276d7944 | Use cross version compatible iteration | peterbrittain/asciimatics,peterbrittain/asciimatics | tests/test_renderers.py | tests/test_renderers.py | import unittest
from asciimatics.renderers import StaticRenderer
from asciimatics.screen import Screen
class TestRenderers(unittest.TestCase):
def test_static_renderer(self):
"""
Check that the base static renderer class works.
"""
# Check basic API for a renderer...
render... | import unittest
from asciimatics.renderers import StaticRenderer
from asciimatics.screen import Screen
class TestRenderers(unittest.TestCase):
def test_static_renderer(self):
"""
Check that the base static renderer class works.
"""
# Check basic API for a renderer...
render... | apache-2.0 | Python |
90b991c19ef5249a09410b19c33f2c8bfe9b5ca7 | Install pypy for proper architechture. | alex/braid,alex/braid | braid/pypy.py | braid/pypy.py | import re
from os import path
from fabric.api import cd, task, sudo, abort
from braid import info
from braid.utils import fails
pypyURLs = {
'x86_64': 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux64.tar.bz2',
'x86': 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux.tar.bz2',
}
pypy... | from os import path
from fabric.api import cd, task, sudo
from braid import fails
pypyURL = 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux64.tar.bz2'
setuptoolsURL = 'http://peak.telecommunity.com/dist/ez_setup.py'
pipURL = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py'
pypyDir = '/opt/pypy-2... | mit | Python |
25030673476f9eb99a4eff980d7bb050fdaa2568 | Print size of result lists in check_files | symbooglix/boogie-runner,symbooglix/boogie-runner | analysis/check_files.py | analysis/check_files.py | #!/usr/bin/env python
# vim: set sw=2 ts=2 softtabstop=2 expandtab:
import argparse
import os
import logging
import sys
import yaml
try:
# Try to use libyaml which is faster
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
# fall back on python implementation
from yaml import Loader, D... | #!/usr/bin/env python
# vim: set sw=2 ts=2 softtabstop=2 expandtab:
import argparse
import os
import logging
import sys
import yaml
try:
# Try to use libyaml which is faster
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
# fall back on python implementation
from yaml import Loader, D... | bsd-3-clause | Python |
d115c0ceb08a350f7b367f61627ced5ab03df833 | Remove useless space | nok/sklearn-porter | sklearn_porter/language/__init__.py | sklearn_porter/language/__init__.py | # -*- coding: utf-8 -*-
import sklearn_porter.language.c
import sklearn_porter.language.go
import sklearn_porter.language.java
import sklearn_porter.language.js
import sklearn_porter.language.php
import sklearn_porter.language.ruby
LANGUAGES = {
c.KEY: c,
go.KEY: go,
java.KEY: java,
js.KEY: js,
ph... | # -*- coding: utf-8 -*-
import sklearn_porter.language.c
import sklearn_porter.language.go
import sklearn_porter.language.java
import sklearn_porter.language.js
import sklearn_porter.language.php
import sklearn_porter.language.ruby
LANGUAGES = {
c.KEY: c,
go.KEY: go,
java.KEY: java,
js.KEY: js,
... | bsd-3-clause | Python |
3fdad9fb89d70b8d81483b646e16d20f076e0ebd | Test urxvt alpha | dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal | tests/test_sequences.py | tests/test_sequences.py | """Test sequence functions."""
import unittest
import unittest.mock
import io
from pywal import sequences
from pywal import util
# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
class Testsequences(unittest.TestCase):
"""Test the sequence functions."""
def test_set_special(... | """Test sequence functions."""
import unittest
import unittest.mock
import io
from pywal import sequences
from pywal import util
# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
class Testsequences(unittest.TestCase):
"""Test the sequence functions."""
def test_set_special(... | mit | Python |
b86348349906c88b6946f757485cf41f909a9a91 | fix subtitle test for newer versions of ffmpeg | PyAV-Org/PyAV,danielballan/PyAV,pupil-labs/PyAV,mcpv/PyAV,xxr3376/PyAV,markreidvfx/PyAV,markreidvfx/PyAV,PyAV-Org/PyAV,markreidvfx/PyAV,danielballan/PyAV,mikeboers/PyAV,mcpv/PyAV,danielballan/PyAV,xxr3376/PyAV,pupil-labs/PyAV,xxr3376/PyAV,mcpv/PyAV,pupil-labs/PyAV,mikeboers/PyAV,pupil-labs/PyAV | tests/test_subtitles.py | tests/test_subtitles.py | import sys
from .common import *
from av.subtitles.subtitle import *
class TestSubtitle(TestCase):
def test_movtext(self):
path = fate_suite('sub/MovText_capability_tester.mp4')
fh = av.open(path)
subs = []
for packet in fh.demux():
try:
subs.extend... | import sys
from .common import *
from av.subtitles.subtitle import *
class TestSubtitle(TestCase):
def test_movtext(self):
path = fate_suite('sub/MovText_capability_tester.mp4')
fh = av.open(path)
subs = []
for packet in fh.demux():
try:
subs.extend... | bsd-3-clause | Python |
4a7484bccc9a92353681fb155f15629fa1059cd1 | Format users | AlexLloyd1/pointy-mcpointface | slackbot/get_scoreboard.py | slackbot/get_scoreboard.py | import logging
from typing import Dict, List, Tuple
from werkzeug.datastructures import ImmutableMultiDict
from database.main import connect, channel_resp
from database.team import check_all_scores
logger = logging.getLogger(__name__)
def get_scoreboard(form: ImmutableMultiDict) -> Dict[str, str]:
logger.debug... | import logging
from typing import Dict, List, Tuple
from werkzeug.datastructures import ImmutableMultiDict
from database.main import connect, channel_resp
from database.team import check_all_scores
logger = logging.getLogger(__name__)
def get_scoreboard(form: ImmutableMultiDict) -> Dict[str, str]:
logger.debug... | mit | Python |
29bfc1049352f59fca0b625d0ecbc7177fb565c7 | Change default value for certificate location. | sholsapp/py509 | py509/x509.py | py509/x509.py | import socket
import uuid
from OpenSSL import crypto
def make_serial():
"""Make a random serial number."""
return uuid.uuid4().int
def make_pkey(key_type=crypto.TYPE_RSA, key_bits=4096):
"""Make a public/private key pair."""
key = crypto.PKey()
key.generate_key(key_type, key_bits)
return key
def make... | import socket
import uuid
from OpenSSL import crypto
def make_serial():
"""Make a random serial number."""
return uuid.uuid4().int
def make_pkey(key_type=crypto.TYPE_RSA, key_bits=4096):
"""Make a public/private key pair."""
key = crypto.PKey()
key.generate_key(key_type, key_bits)
return key
def make... | apache-2.0 | Python |
e05a4f17fcf0ec1bedcc8188d584d31616c4e0af | Update test_toml_file.py | sdispater/tomlkit | tests/test_toml_file.py | tests/test_toml_file.py | import os
from tomlkit.toml_document import TOMLDocument
from tomlkit.toml_file import TOMLFile
def test_toml_file(example):
original_content = example("example")
toml_file = os.path.join(os.path.dirname(__file__), "examples", "example.toml")
toml = TOMLFile(toml_file)
content = toml.read()
ass... | import os
from tomlkit.toml_document import TOMLDocument
from tomlkit.toml_file import TOMLFile
def test_toml_file(example):
original_content = example("example")
toml_file = os.path.join(os.path.dirname(__file__), "examples", "example.toml")
toml = TOMLFile(toml_file)
content = toml.read()
ass... | mit | Python |
12cc5e752f9aa4700b57e3647c3676aba70bb996 | use valid exception for Python 2.7 | h2non/riprova | tests/whitelist_test.py | tests/whitelist_test.py | # -*- coding: utf-8 -*-
import pytest
from riprova import ErrorWhitelist, NotRetriableError
def test_error_whitelist():
whitelist = ErrorWhitelist()
assert type(ErrorWhitelist.WHITELIST) is set
assert len(whitelist._whitelist) > 4
assert type(whitelist._whitelist) is set
assert whitelist._whiteli... | # -*- coding: utf-8 -*-
import pytest
from riprova import ErrorWhitelist, NotRetriableError
def test_error_whitelist():
whitelist = ErrorWhitelist()
assert type(ErrorWhitelist.WHITELIST) is set
assert len(whitelist._whitelist) > 4
assert type(whitelist._whitelist) is set
assert whitelist._whiteli... | mit | Python |
f000504c624e3b07a0df4c823a2f422dc1294ed9 | fix test case | icoxfog417/mlimages | testss/test_training.py | testss/test_training.py | import os
from unittest import TestCase
from mlimages.model import ImageProperty
from mlimages.training import TrainingData
import testss.env as env
class TestLabel(TestCase):
def test_make_mean(self):
td = self.get_testdata()
mean_image_file = os.path.join(os.path.dirname(td.label_file.path), "m... | import os
from unittest import TestCase
from mlimages.model import LabelFile, ImageProperty
import testss.env as env
class TestLabel(TestCase):
def test_make_mean(self):
lf = self.get_label_file()
mean_image_file = os.path.join(os.path.dirname(lf.path), "mean_image.png")
imp = ImageProper... | mit | Python |
eadec2e53404407a7f40df483d1f3d75b599a667 | Fix PID location | XENON1T/cax,XENON1T/cax | cax/main.py | cax/main.py | from cax.tasks import checksum, clear, copy
import os
import sys
import logging
import time
from cax.config import password
import daemonocle
def main2():
password() # Check password specified
logging.basicConfig(filename='example.log',
level=logging.DEBUG,
fo... | from cax.tasks import checksum, clear, copy
import os
import sys
import logging
import time
from cax.config import password
import daemonocle
def main2():
password() # Check password specified
logging.basicConfig(filename='example.log',
level=logging.DEBUG,
fo... | isc | Python |
61cb2f72d94e8bd771e3130d68f753513e5818d5 | Add lstrip, rstrip, strip methods | msabramo/ansi_str | ansi_str.py | ansi_str.py | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | import re
_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
def strip_ansi(value):
return _ansi_re.sub('', value)
def len_exclude_ansi(value):
return len(strip_ansi(value))
class ansi_str(str):
"""A str subclass, specialized for strings containing ANSI escapes.
When you call the ``len`` metho... | mit | Python |
bc2c1a9d4c060242db1273e9608c629b2e0243cc | Fix _version.py | bryanwweber/thermostate | thermostate/_version.py | thermostate/_version.py | """The version of thermohw."""
__version_info__ = (0, 4, 1, 'dev0') # type: Tuple[int, int, int, str]
__version__ = '.'.join([str(v) for v in __version_info__ if str(v)])
| """The version of thermohw."""
from typing import Tuple
__version_info__: Tuple[int, int, int, str] = (0, 4, 1, 'dev0')
__version__ = '.'.join([str(v) for v in __version_info__ if str(v)])
| bsd-3-clause | Python |
01674bb349e9850b26aeae212ad77aa992f18ab5 | bump version | OSSystems/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | lava_scheduler_app/__init__.py | lava_scheduler_app/__init__.py | # Copyright (C) 2011 Linaro Limited
#
# Author: Michael Hudson-Doyle <michael.hudson@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software... | # Copyright (C) 2011 Linaro Limited
#
# Author: Michael Hudson-Doyle <michael.hudson@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software... | agpl-3.0 | Python |
cb5a8ac1b74cdeeea5901bb22d8600ace8f5b6e1 | Allow parsing lists of dictionaries as well as dictionaries in JSON structures | tcmitchell/geni-ch,tcmitchell/geni-ch | tools/json_extractor.py | tools/json_extractor.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without ... | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without ... | mit | Python |
df35ebdcebc8704f964d3301004fcaf88e70336f | fix filereader cd:/ replacement | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | tools/lib/filereader.py | tools/lib/filereader.py | import os
from tools.lib.url_file import URLFile
DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/")
def FileReader(fn, debug=False):
if fn.startswith("cd:/"):
fn = fn.replace("cd:/", DATA_PREFIX)
if fn.startswith("http://") or fn.startswith("https://"):
return URLFile(fn, debug=debug)
r... | import os
from tools.lib.url_file import URLFile
DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/")
def FileReader(fn, debug=False):
if fn.startswith("cd:/"):
fn.replace("cd:/", DATA_PREFIX)
if fn.startswith("http://") or fn.startswith("https://"):
return URLFile(fn, debug=debug)
return... | mit | Python |
ab78bf2c47a8bec5c1d0c5a7951dba1c98f5c28e | Revert file to moneymanager master branch. | moneymanagerex/general-reports,moneymanagerex/general-reports | check_gm.py | check_gm.py | #!/usr/bin/env python3
# vi:tabstop=4:expandtab:shiftwidth=4:softtabstop=4:autoindent:smarttab
import os, sys
import sqlite3
import urllib.request
err = False
for version in range (7, 14):
fname = 'tables_v1.sql' if version < 12 else 'tables.sql'
url = 'https://cdn.jsdelivr.net/gh/moneymanagerex/database@v%i/... | #!/usr/bin/env python3
# vi:tabstop=4:expandtab:shiftwidth=4:softtabstop=4:autoindent:smarttab
import os, sys
import sqlite3
import urllib.request
err = False
for version in range (7, 14):
fname = 'tables_v1.sql' if version < 12 else 'tables.sql'
url = 'https://cdn.jsdelivr.net/gh/moneymanagerex/database@v%i/... | mit | Python |
81bd4c6a7b94803e57a64f47bacbf3d5059282bd | add node | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | checkbst.py | checkbst.py | """
This is a very common interview question.
Given a binary tree, check whether it’s a binary
search tree or not. Simple as that..
http://www.ardendertat.com/2011/10/10/programming-interview-questions-7-binary-search-tree-check/
"""
class Node:
def __init__(self, val=None):
self.left, self.right, self.... | """
This is a very common interview question.
Given a binary tree, check whether it’s a binary
search tree or not. Simple as that..
http://www.ardendertat.com/2011/10/10/programming-interview-questions-7-binary-search-tree-check/
"""
| mit | Python |
175bbd2f181d067712d38beeca9df4063654103a | Update script to remove extension from filename | WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln | nlppln/frog_to_saf.py | nlppln/frog_to_saf.py | #!/usr/bin/env python
import click
import os
import codecs
import json
from xtas.tasks._frog import parse_frog, frog_to_saf
@click.command()
@click.argument('input_files', nargs=-1, type=click.Path(exists=True))
@click.argument('output_dir', nargs=1, type=click.Path())
def frog2saf(input_files, output_dir):
if n... | #!/usr/bin/env python
import click
import os
import codecs
import json
from xtas.tasks._frog import parse_frog, frog_to_saf
@click.command()
@click.argument('input_files', nargs=-1, type=click.Path(exists=True))
@click.argument('output_dir', nargs=1, type=click.Path())
def frog2saf(input_files, output_dir):
if n... | apache-2.0 | Python |
b3426bcd217c336f8807a5474b47dea72a994eb9 | Rename `op`-parameter to `request`. | olavmrk/python-ioctl,olavmrk/python-ioctl | ioctl/__init__.py | ioctl/__init__.py | import ctypes
import fcntl
import sys
# In Python 2, the bytearray()-type does not support the buffer interface,
# and can therefore not be used in ioctl().
# This creates a couple of helper functions for converting to and from
if sys.version_info < (3, 0):
import array
def _to_bytearray(value):
retur... | import ctypes
import fcntl
import sys
# In Python 2, the bytearray()-type does not support the buffer interface,
# and can therefore not be used in ioctl().
# This creates a couple of helper functions for converting to and from
if sys.version_info < (3, 0):
import array
def _to_bytearray(value):
retur... | mit | Python |
0ac4fe1431fd04aa2645a4afc3d4d2fbfb21bb90 | Update plone profile: copy of black, plus three settings. | PyCQA/isort,PyCQA/isort | isort/profiles.py | isort/profiles.py | """Common profiles are defined here to be easily used within a project using --profile {name}"""
from typing import Any, Dict
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
"ensure_newline_before_comments": True,
"line_length": 8... | """Common profiles are defined here to be easily used within a project using --profile {name}"""
from typing import Any, Dict
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
"ensure_newline_before_comments": True,
"line_length": 8... | mit | Python |
0a4da4bc40813362b9d6c67c2fb02f33a807f3fe | fix error on tax view | iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP,iw3hxn/LibrERP | l10n_it_account/__openerp__.py | l10n_it_account/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010-2013 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010-2013 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.