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 |
|---|---|---|---|---|---|---|---|---|
f22ae1dcf3ea674b8b39382f74a305c12841313f | Fix TabError for Python 3 (#11669) | szha/mxnet,apache/incubator-mxnet,tlby/mxnet,larroy/mxnet,tlby/mxnet,sxjscience/mxnet,rahul003/mxnet,tlby/mxnet,eric-haibin-lin/mxnet,DickJC123/mxnet,larroy/mxnet,sxjscience/mxnet,tlby/mxnet,szha/mxnet,dmlc/mxnet,ptrendx/mxnet,reminisce/mxnet,dmlc/mxnet,leezu/mxnet,leezu/mxnet,reminisce/mxnet,mbaijal/incubator-mxnet,sx... | example/reinforcement-learning/ddpg/strategies.py | example/reinforcement-learning/ddpg/strategies.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
c55f0d847fe3b8e3ab77dca9f0e3ce3461530862 | Remove tests for osx | NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio | ci_scripts/test_osx-gui_wallet.py | ci_scripts/test_osx-gui_wallet.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import multiprocessing as mp
import neblio_ci_libs as nci
working_dir = os.getcwd()
build_dir = "build"
nci.mkdir_p(build_dir)
os.chdir(build_dir)
nci.call_with_err_code('brew update')
nci.call_with_err_code('brew outdated qt || brew upgrade qt')
n... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import multiprocessing as mp
import neblio_ci_libs as nci
working_dir = os.getcwd()
build_dir = "build"
nci.mkdir_p(build_dir)
os.chdir(build_dir)
nci.call_with_err_code('brew update')
nci.call_with_err_code('brew outdated qt || brew upgrade qt')
n... | mit | Python |
f62ccee091e804610bfa16764260e817197abfa4 | Update __init__.py | jaredleekatzman/DeepSurv | deepsurv/__init__.py | deepsurv/__init__.py | from .deep_surv import DeepSurv
from .viz import plot_log
from . import datasets
| from .deep_surv import DeepSurv
from .viz import plot_log
import .datasets
| mit | Python |
a4a0542fd97de1d6a395c1f661b43ec84ee01948 | clean up tests | disqus/codebox,disqus/codebox | codesharer/apps/snippets/tests.py | codesharer/apps/snippets/tests.py | import time
import unittest2
from codesharer.app import create_app
from codesharer.apps.snippets.models import Snippet
from flask import g, Response, request
class FlaskTest(unittest2.TestCase):
def setUp(self):
self.app = create_app()
self.app.config.from_object('codesharer.conf.TestingConfig')
... | import time
import unittest2
from codesharer.app import create_app
from codesharer.apps.snippets.models import Snippet
from flask import g, Response
class FlaskTest(unittest2.TestCase):
def setUp(self):
self.app = create_app()
self.app.config.from_object('codesharer.conf.TestingConfig')
se... | apache-2.0 | Python |
0fe8cbe31484f7ca390725b684e620355ac222df | Fix bug for earlier change to allow using IP as hostname (#5513) | lyft/incubator-airflow,danielvdende/incubator-airflow,nathanielvarona/airflow,apache/incubator-airflow,airbnb/airflow,DinoCow/airflow,Acehaidrey/incubator-airflow,cfei18/incubator-airflow,Acehaidrey/incubator-airflow,spektom/incubator-airflow,nathanielvarona/airflow,apache/airflow,spektom/incubator-airflow,wooga/airflo... | airflow/utils/net.py | airflow/utils/net.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | apache-2.0 | Python |
234802a5a2479918cf927bcac8f824951df63f62 | use weakrefset if WeakSet is not available | bwesterb/sarah | src/refStore.py | src/refStore.py | from __future__ import with_statement
from mirte.core import Module
from sarah.event import Event
import weakref
import threading
# python 2.6 support
if hasattr(weakref, 'WeakSet'):
WeakSet = weakref.WeakSet
else:
import weakrefset
WeakSet = weakrefset.WeakSet
class RefStore(Module):
... | from __future__ import with_statement
from mirte.core import Module
from sarah.event import Event
import weakref
import threading
class RefStore(Module):
def __init__(self, *args, **kwargs):
super(RefStore, self).__init__(*args, **kwargs)
self.namespaces = weakref.WeakSet()
... | agpl-3.0 | Python |
38e9dfba0642eef16496b7f54c87c6fd55e40e9b | use full search text to allow for low faker entropy | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | foodsaving/groups/tests/test_groups_api_filter.py | foodsaving/groups/tests/test_groups_api_filter.py | from rest_framework import status
from rest_framework.test import APITestCase
from foodsaving.groups.factories import GroupFactory
from foodsaving.users.factories import UserFactory
class TestGroupsAPIFilter(APITestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.url = '/api/g... | from rest_framework import status
from rest_framework.test import APITestCase
from foodsaving.groups.factories import GroupFactory
from foodsaving.users.factories import UserFactory
class TestStoresAPIFilter(APITestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.url = '/api/g... | agpl-3.0 | Python |
f56302afef540124d2d446bb995feb18ef2d20bc | use single quotes | aldryn/aldryn-blog,aldryn/aldryn-blog | aldryn_blog/admin.py | aldryn_blog/admin.py | # -*- coding: utf-8 -*-
import copy
from django.conf import settings
from django.contrib import admin
from aldryn_blog.forms import PostForm
from aldryn_blog.models import Post
import cms
from cms.admin.placeholderadmin import PlaceholderAdmin
from cms.admin.placeholderadmin import FrontendEditableAdmin
from distuti... | # -*- coding: utf-8 -*-
import copy
from django.conf import settings
from django.contrib import admin
from aldryn_blog.forms import PostForm
from aldryn_blog.models import Post
import cms
from cms.admin.placeholderadmin import PlaceholderAdmin
from cms.admin.placeholderadmin import FrontendEditableAdmin
from distuti... | bsd-3-clause | Python |
8a249d7a881d07f1f2ddef529fe221579745663c | Fix typo | shirone/angkot,angkot/angkot,angkot/angkot,shirone/angkot,angkot/angkot,shirone/angkot,angkot/angkot,shirone/angkot | angkot/decorators.py | angkot/decorators.py | class APIResponse(object):
def __init__(self):
self.headers = {}
def __setitem__(self, key, value):
self.headers[key] = value
def __getitem__(self, key):
return self.headers[key]
class OK(APIResponse):
def __init__(self, data, http_code=200):
super(OK, self).__init__()... | class APIResponse(object):
def __init__(self):
self.headers = {}
def __setitem__(self, key, value):
self.headers[key] = value
def __getitem__(self, key):
return self.headers[key]
class OK(APIResponse):
def __init__(self, data, http_code=200):
super(OK, self).__init__()... | agpl-3.0 | Python |
93f2ff45ff3d61487ed061ae3d1a65051c3d1799 | Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. | svn2github/django,svn2github/django,svn2github/django | django/contrib/admin/__init__.py | django/contrib/admin/__init__.py | # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInli... | from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInline
from django.contrib.admin.sites import AdminSite, site
def autodiscover():
"""
Auto-discover INSTALLED_APPS admin.py modules and fail silently when
not present. T... | bsd-3-clause | Python |
4dc7dc14ddc9309cde0c06089c9c544b3a6d94a3 | Put back methods for platform controller | ednad/ooi-ui-services,oceanzus/ooi-ui-services,FBRTMaka/ooi-ui-services,DanielJMaher/ooi-ui-services,asascience-open/ooi-ui-services,Bobfrat/ooi-ui-services,birdage/ooi-ui-services | ooiservices/controller/platform.py | ooiservices/controller/platform.py | #!/usr/bin/env python
'''
ooiservices.controller.platform.py
PlatformController
'''
from ooiservices.controller.base import BaseController
from ooiservices.model.platform import PlatformModel
from flask.ext.restful import Resource
from flask import request
__author__ = "Brian McKenna"
class PlatformController(Base... | #!/usr/bin/env python
'''
ooiservices.controller.platform.py
PlatformController
'''
from ooiservices.controller.base import BaseController
from ooiservices.model.platform import PlatformModel
from flask.ext.restful import Resource
from flask import request
__author__ = "Brian McKenna"
class PlatformController(Base... | apache-2.0 | Python |
e9046eaaf2058bba137139ce903898e2b22b6343 | Fix a couple of bugs in AttemptViewSet.submit | ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo | web/attempts/rest.py | web/attempts/rest.py | import json
from rest_framework.viewsets import ModelViewSet
from rest_framework.serializers import ModelSerializer
from rest_framework.response import Response
from rest_framework import fields, decorators, validators
from rest_framework.status import HTTP_200_OK, HTTP_201_CREATED, HTTP_400_BAD_REQUEST
from .models im... | import json
from rest_framework.viewsets import ModelViewSet
from rest_framework.serializers import ModelSerializer
from rest_framework.response import Response
from rest_framework import fields, decorators, validators
from rest_framework.status import HTTP_200_OK, HTTP_201_CREATED
from .models import Attempt
class A... | agpl-3.0 | Python |
cb71ba473c70ee4a5269f0f3adcfff0815e46789 | Use MD5 password hashing for tests | pculture/unisubs,pculture/unisubs,ReachingOut/unisubs,ofer43211/unisubs,wevoice/wesub,norayr/unisubs,eloquence/unisubs,norayr/unisubs,eloquence/unisubs,norayr/unisubs,ofer43211/unisubs,eloquence/unisubs,pculture/unisubs,wevoice/wesub,ofer43211/unisubs,ujdhesa/unisubs,ujdhesa/unisubs,ujdhesa/unisubs,ReachingOut/unisubs,... | dev_settings_test.py | dev_settings_test.py | # Amara, universalsubtitles.org
#
# Copyright (C) 2012 Participatory Culture Foundation
#
# This program 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 op... | # Amara, universalsubtitles.org
#
# Copyright (C) 2012 Participatory Culture Foundation
#
# This program 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 op... | agpl-3.0 | Python |
445f244ddac6001b65f03d058a14178a19919eed | Allow Config to be initialised without any args | praekelt/diamondash,praekelt/diamondash,praekelt/diamondash | diamondash/config.py | diamondash/config.py | import yaml
from diamondash import utils
class ConfigError(Exception):
"""Raised when there is an error parsing a configuration"""
class ConfigMetaClass(type):
def __new__(mcs, name, bases, dict):
cls = type.__new__(mcs, name, bases, dict)
defaults = {}
for base in bases:
... | import yaml
from diamondash import utils
class ConfigError(Exception):
"""Raised when there is an error parsing a configuration"""
class ConfigMetaClass(type):
def __new__(mcs, name, bases, dict):
cls = type.__new__(mcs, name, bases, dict)
defaults = {}
for base in bases:
... | bsd-3-clause | Python |
809df0ddfae0ffe2268c94d41be366d8a28f6854 | replace deepcopy with copy | AlexYukikaze/JSONx | JSONx/utils.py | JSONx/utils.py | __all__ = ['on', 'when', 'decode_escapes', 'get_dict_path']
import re
import codecs
import copy
ESCAPE_SEQUENCE_RE = re.compile(r'''
( \\U........ # 8-digit hex escapes
| \\u.... # 4-digit hex escapes
| \\x.. # 2-digit hex escapes
| \\[0-7]{1,3} # Octal escapes
| \\N\... | __all__ = ['on', 'when', 'decode_escapes', 'get_dict_path']
import re
import codecs
ESCAPE_SEQUENCE_RE = re.compile(r'''
( \\U........ # 8-digit hex escapes
| \\u.... # 4-digit hex escapes
| \\x.. # 2-digit hex escapes
| \\[0-7]{1,3} # Octal escapes
| \\N\{[^}]+\} ... | mit | Python |
6542cde820ed65e9f64a5d8e42e09f950b0d4986 | Document Luna.Logger.Logger.log | Ghostkeeper/Luna | Luna/Logger.py | Luna/Logger.py | #!/usr/bin/env python
#This is free and unencumbered software released into the public domain.
#
#Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
#software, either in source code form or as a compiled binary, for any purpose,
#commercial or non-commercial, and by any means.
#
#In jurisd... | #!/usr/bin/env python
#This is free and unencumbered software released into the public domain.
#
#Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
#software, either in source code form or as a compiled binary, for any purpose,
#commercial or non-commercial, and by any means.
#
#In jurisd... | cc0-1.0 | Python |
5ef6aaa6743fc6996ed06dfc4622a456cc817095 | Remove redundant space line | bowen0701/algorithms_data_structures | lc0063_unique_paths_ii.py | lc0063_unique_paths_ii.py | """Leetcode 63. Unique Paths II.
Medium
URL: https://leetcode.com/problems/unique-paths-ii/
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time.
The robot is trying to reach the bottom-right corner of the... | """Leetcode 63. Unique Paths II.
Medium
URL: https://leetcode.com/problems/unique-paths-ii/
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time.
The robot is trying to reach the bottom-right corner of the... | bsd-2-clause | Python |
e843793d0a611143bbee179469ab3557744e19ef | fix sillyness | tonybaloney/st2contrib,armab/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,armab/st2contrib,StackStorm/st2contrib,armab/st2contrib | packs/windows/actions/winrm_cmd.py | packs/windows/actions/winrm_cmd.py | from winrm.protocol import Protocol
from st2actions.runners.pythonrunner import Action
__all__ = [
'WinRMCmdAction'
]
class WinRMCmdAction(Action):
def run(self, host, password, command, params, username='Administrator',
port=5732, secure=True):
proto = 'https' if secure else... | from winrm.protocol import Protocol
from st2actions.runners.pythonrunner import Action
__all__ = [
'WinRMCmdAction'
]
class WinRMCmdAction(Action):
def run(self, host, password, command, params, username='Administrator',
port=5732, secure=True):
proto = 'https' if secure else... | apache-2.0 | Python |
ff77d37b09c798ed68b27b5e91978a471408b437 | Update __init__.py | r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent,Tendrl/node_agent,r0h4n/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent | tendrl/node_agent/objects/global_network/__init__.py | tendrl/node_agent/objects/global_network/__init__.py | from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons import objects
class GlobalNetwork(objects.BaseObject):
def __init__(self, interface=None, interface_id=None,
ipv4=None, ipv6=None, netmask=None, subnet=None,
status=None, sysfs_id=None, device_link=None,
... | from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons import objects
class GlobalNetwork(objects.BaseObject):
def __init__(self, interface=None, interface_id=None,
ipv4=None, ipv6=None, netmask=None, subnet=None,
status=None, sysfs_id=None, device_link=None,
... | lgpl-2.1 | Python |
1bc661472b2e20fc3f5d1d97db7dd7e3e7dc0661 | Fix the test bug with fetching the Encrypted property and fix doc comment | stratis-storage/stratisd,stratis-storage/stratisd,stratis-storage/stratisd | tests/client-dbus/tests/dbus/pool/test_properties.py | tests/client-dbus/tests/dbus/pool/test_properties.py | # Copyright 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | # Copyright 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | mpl-2.0 | Python |
bfcec696308ee8bfd226a54c17a7e15d49e2aed7 | Add standard header, use spack helpers | matthiasdiener/spack,mfherbst/spack,lgarren/spack,tmerrick1/spack,TheTimmy/spack,LLNL/spack,tmerrick1/spack,TheTimmy/spack,TheTimmy/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,EmreAtes/spack,TheTimmy/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack... | var/spack/repos/builtin/packages/nextflow/package.py | var/spack/repos/builtin/packages/nextflow/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | from spack import *
from glob import glob
import os
class Nextflow(Package):
"""Data-driven computational pipelines"""
homepage = "http://www.nextflow.io"
version('0.20.1', '0e4e0e3eca1c2c97f9b4bffd944b923a',
url='https://github.com/nextflow-io/nextflow/releases/download/v0.20.1/nextflow',
... | lgpl-2.1 | Python |
bcd272b80fdaca9f77a55e4c5ea276a3af94f0aa | update files | takekazuomi/azure-quickstart-templates,nzthiago/azure-quickstart-templates,slapointe/azure-quickstart-templates,MCKLMT/azure-quickstart-templates,jmservera/azure-quickstart-templates,matt1883/azure-quickstart-templates,jmservera/azure-quickstart-templates,tfitzmac/azure-quickstart-templates,takekazuomi/azure-quickstart... | 101-machine-learning-service-create/prereqs/Driver.py | 101-machine-learning-service-create/prereqs/Driver.py | import json
import numpy
from sklearn.externals import joblib
from azureml.core.model import Model
from azureml.contrib.services.aml_request import AMLRequest, rawhttp
from azureml.contrib.services.aml_response import AMLResponse
def init():
global model
model_path = Model.get_model_path('sklearn_regression_m... | import os
import json
import numpy
import joblib
def init():
global model
# note here "sklearn_regression_model.pkl" is the name of the model registered under
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'sklearn_regression_model.pkl')
# deserialize the model file back into a sklearn model... | mit | Python |
03ed25cee706ff0e2e1a6d5e8202a6f0b790059f | modify comments | Som-Energia/invoice-janitor | Importacions_F1_Q1/Fact_impF1_eliminar_Ja_existeix.py | Importacions_F1_Q1/Fact_impF1_eliminar_Ja_existeix.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from ooop import OOOP
import configdb
O = OOOP(**configdb.ooop)
imp_obj = O.GiscedataFacturacioImportacioLinia
imp_del_ids = imp_obj.search([('state','=','erroni'),('info','=','Aquest fitxer XML ja s\'ha processat en els següents IDs')])
imp_del_ids = imp_obj.s... | <<<<<<< HEAD
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ooop import OOOP
import configdb
O = OOOP(**configdb.ooop)
imp_obj = O.GiscedataFacturacioImportacioLinia
imp_del_ids = imp_obj.search([('state','=','erroni'),('info','=','Aquest fitxer XML ja s\'ha processat en els següents IDs')])
imp_del_id... | agpl-3.0 | Python |
6389552dcbda0161b708b4a9551faa5d2a13d764 | Revert "just pull cases being updated without the ones from stock transactions [skip ci]" | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/form_processor/management/commands/archive_all_forms_for_user_in_domain.py | corehq/form_processor/management/commands/archive_all_forms_for_user_in_domain.py | from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from io import open
from django.core.management.base import BaseCommand
from casexml.apps.case.cleanup import rebuild_case_from_forms
from casexml.apps.case.xform import get_case_ids_from_form
from co... | from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from io import open
from django.core.management.base import BaseCommand
from casexml.apps.case.cleanup import rebuild_case_from_forms
from corehq.apps.users.models import CouchUser
from corehq.form_pr... | bsd-3-clause | Python |
46b76c96309cdeb435502a7ee96c672edc2abee7 | Update binary-tree-longest-consecutive-sequence-ii.py | tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-... | Python/binary-tree-longest-consecutive-sequence-ii.py | Python/binary-tree-longest-consecutive-sequence-ii.py | # Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def longestConsecutive(self, root):
"""
:type root: TreeNode
:rtype:... | # Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def longestConsecutive(self, root):
"""
:type root: TreeNode
:rtype:... | mit | Python |
e81b1ce7536ce32e022fb3132f8468d2472b2e31 | Improve logging of openended extension | PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas | atlas/prodtask/management/commands/extendopenended.py | atlas/prodtask/management/commands/extendopenended.py | from django.core.management.base import BaseCommand, CommandError
import time
from atlas.prodtask.open_ended import check_open_ended
class Command(BaseCommand):
args = '<request_id, request_id>'
help = 'Extend open ended requests'
def handle(self, *args, **options):
self.stdout.write('Start open ... | from django.core.management.base import BaseCommand, CommandError
from atlas.prodtask.open_ended import check_open_ended
class Command(BaseCommand):
args = '<request_id, request_id>'
help = 'Extend open ended requests'
def handle(self, *args, **options):
if not args:
try:
... | apache-2.0 | Python |
0325ad9244835fac724126f918b049a145f6cdb7 | Add documentation for DNSimple | jsha/letsencrypt,stweil/letsencrypt,lmcro/letsencrypt,letsencrypt/letsencrypt,letsencrypt/letsencrypt,lmcro/letsencrypt,stweil/letsencrypt,jsha/letsencrypt | certbot-dns-dnsimple/certbot_dns_dnsimple/__init__.py | certbot-dns-dnsimple/certbot_dns_dnsimple/__init__.py | """
The `~certbot_dns_dnsimple.dns_dnsimple` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the DNSimple API.
Named Arguments
---------------
======================================== =============================... | """DNSimple DNS Authenticator"""
| apache-2.0 | Python |
710f6cc458948e6e404d625ac3d8372cfd1ed304 | update swarm config | cogmission/nupic.research,ThomasMiconi/htmresearch,ThomasMiconi/nupic.research,ywcui1990/htmresearch,ThomasMiconi/nupic.research,ywcui1990/htmresearch,ywcui1990/nupic.research,cogmission/nupic.research,mrcslws/htmresearch,ywcui1990/nupic.research,BoltzmannBrain/nupic.research,chanceraine/nupic.research,neuroidss/nupic.... | sequence_prediction/continuous_sequence/swarm_description/SWARM_CONFIG_nyc_taxi.py | sequence_prediction/continuous_sequence/swarm_description/SWARM_CONFIG_nyc_taxi.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | agpl-3.0 | Python |
4f2945a2e7891bfaa68b7e301e18d34032204127 | Stop writing to sys.stdout | tamentis/rpdb,kenmanheimer/rpdb,inirudebwoy/rpdb,coddingtonbear/ircpdb | rpdb/__init__.py | rpdb/__init__.py | """Remote Python Debugger (pdb wrapper)."""
__author__ = "Bertrand Janin <b@janin.com>"
__version__ = "0.1.3"
import pdb
import socket
import sys
class Rpdb(pdb.Pdb):
def __init__(self, addr="127.0.0.1", port=4444):
"""Initialize the socket and initialize pdb."""
# Writes to stdout are forbidd... | """Remote Python Debugger (pdb wrapper)."""
__author__ = "Bertrand Janin <b@janin.com>"
__version__ = "0.1.3"
import pdb
import socket
import sys
class Rpdb(pdb.Pdb):
def __init__(self, addr="127.0.0.1", port=4444):
"""Initialize the socket and initialize pdb."""
# Writes to stdout are forbidd... | bsd-2-clause | Python |
a4acd7c50d9b1705b130663c23c2f0a2eaace863 | Fix a broken Last.fm url | philgyford/django-ditto,philgyford/django-ditto,philgyford/django-ditto | ditto/lastfm/urls.py | ditto/lastfm/urls.py | from django.conf.urls import url
from . import views
# The pattern for matching an Album/Artist/Track slug:
slug_chars = '[\w.,:=@&+%()$!°-]+'
urlpatterns = [
url(
regex=r"^$",
view=views.HomeView.as_view(),
name='home'
),
url(
regex=r"^library$",
view=views.Scro... | from django.conf.urls import url
from . import views
# The pattern for matching an Album/Artist/Track slug:
slug_chars = '[\w.,:=@&+%()$!-]+'
urlpatterns = [
url(
regex=r"^$",
view=views.HomeView.as_view(),
name='home'
),
url(
regex=r"^library$",
view=views.Scrob... | mit | Python |
3ae76d7338c967bcf60216c5ec46f6406de45116 | Support directory as local URI | hundeboll/core,diorcety/oe-lite-core,sknsean/core,hundeboll/core,hundeboll/core,sknsean/core,diorcety/oe-lite-core,sknsean/core,hundeboll/core,sknsean/core,sknsean/core | lib/oelite/fetch/local.py | lib/oelite/fetch/local.py | import oelite.fetch
import oelite.path
import os
import hashlib
class LocalFetcher():
SUPPORTED_SCHEMES = ("file")
def __init__(self, uri, d):
if not uri.scheme in self.SUPPORTED_SCHEMES:
raise Exception(
"Scheme %s not supported by oelite.fetch.UrlFetcher"%(scheme))
... | import oelite.fetch
import oelite.path
import os
import hashlib
class LocalFetcher():
SUPPORTED_SCHEMES = ("file")
def __init__(self, uri, d):
if not uri.scheme in self.SUPPORTED_SCHEMES:
raise Exception(
"Scheme %s not supported by oelite.fetch.UrlFetcher"%(scheme))
... | mit | Python |
e21e971c67954b1d0f5ca2ee41518322f259a96b | handle case in which one swapString is empty | philippotto/Sublime-SwapStrings | SwapStrings.py | SwapStrings.py | import sublime, sublime_plugin
class SwapStringsCommand(sublime_plugin.TextCommand):
def run(self, edit, stringA=None, stringB=None):
if not stringA and not stringB:
inputView = sublime.active_window().show_input_panel(
"Specify the strings which shall be swapped. <> functions as a separator.",
... | import sublime, sublime_plugin
class SwapStringsCommand(sublime_plugin.TextCommand):
def run(self, edit, stringA=None, stringB=None):
if not stringA and not stringB:
inputView = sublime.active_window().show_input_panel(
"Specify the strings which shall be swapped. <> functions as a separator.",
... | mit | Python |
29393bef20ab33da2844571dd50bd73308adf5e2 | use time.clock | cyberdelia/astrolabe,cyberdelia/astrolabe | astrolabe/instant.py | astrolabe/instant.py | from time import clock
CONVERSION_FACTOR = 1
def instant():
return clock()
| from time import time
CONVERSION_FACTOR = 1
def instant():
return time()
| mit | Python |
6632157febfed7ce99fa1aaecb72393b0301d3aa | Make empty migration authent 3 | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/authent/migrations/0003_auto_20181203_1518.py | geotrek/authent/migrations/0003_auto_20181203_1518.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authent', '0002_auto_20181107_1620'),
]
operations = [
]
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.core.management import call_command
from django.conf import settings
def add_permissions(apps, schema_editor):
if 'geotrek.infrastructure' in settings.INSTALLED_APPS:
call_command('update_geotrek_... | bsd-2-clause | Python |
f85202d64cf2520b4ad9e2cca77d6b49336a044a | Bump version to 3.5.0a17 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
b14abeff48ae46c849848bec15052b448a24634a | Bump version to 4.0.0a13 | platformio/platformio-core,platformio/platformio-core,platformio/platformio | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
4efae77c0c290cae919477c438cb1f02d86837c9 | convert to new open source trigger | motmot/strokelitude,motmot/strokelitude-jfi-emulator | plot_raw_timeseries.py | plot_raw_timeseries.py | import pylab
import numpy as np
import sys
import tables
import motmot.fview_ext_trig.easy_decode as easy_decode
import matplotlib.ticker as mticker
if 1:
fname = sys.argv[1]
h5 = tables.openFile(fname,mode='r')
stroke_data=h5.root.stroke_data[:]
stroke_times = stroke_data['trigger_timestamp']
... | import pylab
import numpy as np
import sys
import tables
import fview_ext_trig.easy_decode as easy_decode
import matplotlib.ticker as mticker
if 1:
fname = sys.argv[1]
h5 = tables.openFile(fname,mode='r')
stroke_data=h5.root.stroke_data[:]
stroke_times = stroke_data['trigger_timestamp']
time_d... | bsd-3-clause | Python |
284c82863a1bdf8c192ca04ca424dadcca1c7bc7 | scale the frequency plot correctly after decimation | emeb/iceRadio,emeb/iceRadio,emeb/iceRadio,emeb/iceRadio | FPGA/rxadc_2/python/tst_cic.py | FPGA/rxadc_2/python/tst_cic.py | #!/usr/bin/python3
#
# CIC decimator test bench
#
# 07-23-2015 E. Brombaugh
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.signal as signal
from scipy.fftpack import fft, ifft, fftfreq, fftshift
from ddc import cic_dec
# generate a signal
data_len = 2**16
Fs = 40e6
Fc = 20e3
... | #!/usr/bin/python3
#
# CIC decimator test bench
#
# 07-23-2015 E. Brombaugh
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.signal as signal
from scipy.fftpack import fft, ifft, fftfreq, fftshift
from ddc import cic_dec
# generate a signal
data_len = 2**16
Fs = 40e6
Fc = 20e3
... | mit | Python |
2fbf927113aaaeae9ec533814609d5c835d4604a | check that files are written | salilab/rmf,salilab/rmf,salilab/rmf,salilab/rmf | test/test_closing.py | test/test_closing.py | #!/usr/bin/python
import unittest
import RMF
import shutil
class Tests(unittest.TestCase):
def _show(self, g):
for i in range(0, g.get_number_of_children()):
print i, g.get_child_name(i), g.get_child_is_group(i)
"""Test the python code"""
def test_perturbed(self):
"""Test closin... | #!/usr/bin/python
import unittest
import RMF
import shutil
class GenericTest(unittest.TestCase):
def _show(self, g):
for i in range(0, g.get_number_of_children()):
print i, g.get_child_name(i), g.get_child_is_group(i)
"""Test the python code"""
def test_perturbed(self):
"""Test ... | apache-2.0 | Python |
a03d406bd61d45ca4ca3f7367146d9a08d81d4c0 | test boundary cases | abacusresearch/gitflow,abacusresearch/gitflow | test/unit/version.py | test/unit/version.py | from gitflow import version
from gitflow.version import VersionConfig
config = VersionConfig()
config.qualifiers = ['alpha', 'beta']
def test_major_increment():
assert version.version_bump_major(config, "0.0.0").value == "1.0.0-alpha.1"
assert version.version_bump_major(config, "1.0.0-beta.4").value == "2.0.... | from gitflow import version
from gitflow.version import VersionConfig
config = VersionConfig()
config.qualifiers = ['alpha', 'beta']
def test_major_increment():
assert version.version_bump_major(config, "0.0.0").value == "1.0.0-alpha.1"
assert version.version_bump_major(config, "1.0.0-beta.4").value == "2.0.... | mit | Python |
560cefff06f3e8b288c9ceecf6c84438c4d9783b | implement -z mode for statistics | narayandesai/diy-lsi | diylsi/statistics.py | diylsi/statistics.py | import argparse, json, multiprocessing, os, re, sys
# all functions in this library take a disk info dict as input
def poll_smart_status(diskinfo):
data = os.popen("/opt/omni/sbin/smartctl -a -d sat,12 /devices/scsi_vhci/disk@g%s:a,raw |grep self-assess" % diskinfo['guid']).readlines()[0]
#data = os.popen("/o... | import argparse, json, multiprocessing, os, re, sys
# all functions in this library take a disk info dict as input
def poll_smart_status(diskinfo):
data = os.popen("/opt/omni/sbin/smartctl -a -d sat,12 /devices/scsi_vhci/disk@g%s:a,raw |grep self-assess" % diskinfo['guid']).readlines()[0]
#data = os.popen("/o... | bsd-3-clause | Python |
40172c5dd09435aad8aff1083903810ccddff29b | add searching and paging to the data endpoint | BD2KGenomics/brca-website,BD2KGenomics/brca-website,BD2KGenomics/brca-website | django/data/views.py | django/data/views.py | import json
from operator import __or__
from django.core import serializers
from django.http import JsonResponse
from django.db.models import Q
from .models import Variant
def index(request):
order_by = request.GET.get('order_by')
direction = request.GET.get('direction')
page_size = int... | import json
from django.core import serializers
from django.http import JsonResponse
from .models import Variant
def index(request):
# Convert django's model representation to the format
# expected by the frontend
header = map(lambda field: field.name, Variant._meta.get_fields())
rows = list(Varia... | apache-2.0 | Python |
723b405b1defad5d6284d99bb3af4f3c224844a8 | Update ER docstring | skggm/skggm,skggm/skggm | inverse_covariance/profiling/erdos_renyi_graph.py | inverse_covariance/profiling/erdos_renyi_graph.py | from __future__ import absolute_import
import numpy as np
from sklearn.datasets import make_sparse_spd_matrix
from .graphs import Graph
class ErdosRenyiGraph(Graph):
"""Returns the adjacency matrix for Erdos-Renyi network via .create().
Parameters
-----------
spd_low : float (0, 1)
Equiva... | from __future__ import absolute_import
import numpy as np
from sklearn.datasets import make_sparse_spd_matrix
from .graphs import Graph
class ErdosRenyiGraph(Graph):
"""Returns the adjacency matrix for Erdos-Renyi network via .create().
Parameters
-----------
spd_low : float (0, 1)
Equiva... | mit | Python |
6b1df5bdc1d89fc3ba008eab2d2955e2234de317 | make trailing slash on authenticate URLs optional | whitews/ReFlow,whitews/ReFlow,whitews/ReFlow | authenticate/urls.py | authenticate/urls.py | from django.conf.urls import patterns, url
__author__ = 'swhite'
urlpatterns = patterns('authenticate.views',
url(r'^login/?$', 'login_view', name="login"),
url(r'^logout/?$', 'logout_view', name="logout"),
url(r'^login_failed/?$', 'login_failed', name="login_failed"),
)
| from django.conf.urls import patterns, url
__author__ = 'swhite'
urlpatterns = patterns('authenticate.views',
url(r'^login/$', 'login_view', name="login"),
url(r'^logout/$', 'logout_view', name="logout"),
url(r'^login_failed/$', 'login_failed', name="login_failed"),
)
| bsd-3-clause | Python |
21e238fb49338992f846cfa22ed5638325cbd425 | Correct dependent migration | hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2 | jobs/migrations/0028_promote_pbf_export_format.py | jobs/migrations/0028_promote_pbf_export_format.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from ..models import ExportFormat
class Migration(migrations.Migration):
def promote_pbf_export_format(apps, schema_editor):
ExportFormat = apps.get_model('jobs', 'ExportFormat')
ExportFormat... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from ..models import ExportFormat
class Migration(migrations.Migration):
def promote_pbf_export_format(apps, schema_editor):
ExportFormat = apps.get_model('jobs', 'ExportFormat')
ExportFormat... | bsd-3-clause | Python |
08d60c54fb92c1c0092bb071e3ca964d7569fd5c | Add some error handling that will output a formatted message. | sunlightlabs/python-sunlight,BrianPainter/python-sunlight | sunlight/cli.py | sunlight/cli.py | import json
import itertools
from clint import arguments
from clint.textui import puts, puts_err, indent, colored
import sunlight
def main():
args = arguments.Args()
services = sunlight.available_services()
service = services.get(args.get(0), None)
if service is not None:
available_methods =... | import json
import itertools
from clint import arguments
from clint.textui import puts, puts_err, indent, colored
import sunlight
def main():
args = arguments.Args()
services = sunlight.available_services()
service = services.get(args.get(0), None)
if service is not None:
available_methods =... | bsd-3-clause | Python |
092c3205a475d8230a113b798f89e754d0902a59 | remove superflous list() | dpshelio/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy | sunpy/io/jp2.py | sunpy/io/jp2.py | """JPEG 2000 File Reader"""
from __future__ import absolute_import, division, print_function
__author__ = "Keith Hughitt"
__email__ = "keith.hughitt@nasa.gov"
from xml.etree import cElementTree as ET
from glymur import Jp2k
from sunpy.util.xml import xml_to_dict
from sunpy.io.header import FileHeader
__all__ = ['r... | """JPEG 2000 File Reader"""
from __future__ import absolute_import, division, print_function
__author__ = "Keith Hughitt"
__email__ = "keith.hughitt@nasa.gov"
from xml.etree import cElementTree as ET
from glymur import Jp2k
from sunpy.util.xml import xml_to_dict
from sunpy.io.header import FileHeader
__all__ = ['r... | bsd-2-clause | Python |
735debaba58c9b09d393279391eda4955df1312a | move repo cloning into setUp | GoogleChrome/wptdashboard,GoogleChrome/wptdashboard,GoogleChrome/wptdashboard | run/shas_test.py | run/shas_test.py | #!/usr/bin/env python
# Copyright 2017 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import mock
import os
import shas
import shutil
import subprocess
import unittest
from datetime import date
cla... | #!/usr/bin/env python
# Copyright 2017 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import mock
import os
import shas
import shutil
import subprocess
import unittest
from datetime import date
here... | apache-2.0 | Python |
e1d76e8ac5270f6abc18137cce0f103ca567709f | Fix bug in image2 widget | frostidaho/qtile,frostidaho/qtile | libqtile/widget/image2.py | libqtile/widget/image2.py | from __future__ import division
import os
import cairocffi
from . import base
from .. import bar
from .. import images
class Image2(base._Widget, base.MarginMixin):
"""Display an image on the bar"""
orientations = base.ORIENTATION_BOTH
defaults = [
('loaded_image', None, 'image created by libqt... | from __future__ import division
import os
import cairocffi
from . import base
from .. import bar
from .. import images
class Image2(base._Widget, base.MarginMixin):
"""Display an image on the bar"""
orientations = base.ORIENTATION_BOTH
defaults = [
('loaded_image', None, 'image created by libqt... | mit | Python |
e9ee6aae523905e9efa30033663a3be695a6b863 | bump to next dev version | planetlabs/planet-client-python,planetlabs/planet-client-python | planet/__version__.py | planet/__version__.py | __version__ = '2.0a6dev'
| __version__ = '2.0a5'
| apache-2.0 | Python |
09a2323bcfc47b00d71846ac69022a3dbae2b031 | Bump to version 0.0.7 | cogniteev/backache | backache/__init__.py | backache/__init__.py | from . core import *
from . antioxidant import ( # flake8: noqa
AsyncOperationContext,
celerize,
ProcessingInQuarantineException,
)
from . errors import *
__version__ = (0, 0, 7)
| from . core import *
from . antioxidant import ( # flake8: noqa
AsyncOperationContext,
celerize,
ProcessingInQuarantineException,
)
from . errors import *
__version__ = (0, 0, 6)
| apache-2.0 | Python |
0324d220872ef063cb39ce62264bd4835f260920 | Replace str into call in url | makinacorpus/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity | test_project/urls.py | test_project/urls.py | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
from test_app.models import DummyModel, MushroomSpot
from test_app.views import DummyDocumentOdt, DummyDocumentWeasyprint
from mapentity.registry import registry
from django.contrib.auth import view... | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
from test_app.models import DummyModel, MushroomSpot
from test_app.views import DummyDocumentOdt, DummyDocumentWeasyprint
from mapentity.registry import registry
handler403 = 'mapentity.views.hand... | bsd-3-clause | Python |
e2ec3241a3becf19954e287a6f9caba3ba445829 | Add flags for protocol | dotoscat/Polytank-ASIR | polytanks/protocol.py | polytanks/protocol.py | #Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com>
#This program 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 ... | #Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com>
#This program 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 ... | agpl-3.0 | Python |
27c10b93aeb6c6c69b401686787db245e4f0f01d | bump version for pypi | jld23/saspy,jld23/saspy | saspy/version.py | saspy/version.py | __version__ = '2.3.1'
| __version__ = '2.3.0'
| apache-2.0 | Python |
b7805df4b2d103b1cea63ddcb58dc86d0a90465a | Update Flask extension import | belxlaz/portfolio,belxlaz/portfolio | portfolio/__init__.py | portfolio/__init__.py | from flask import Flask
from flask_assets import Environment
from portfolio.views import site
# init the app, its compressor and its manager
app = Flask('portfolio')
# config
app.config.from_pyfile('config.py')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# assets
assets = Environment(app)
ass... | from flask import Flask
from flask.ext.assets import Environment
from portfolio.views import site
# init the app, its compressor and its manager
app = Flask('portfolio')
# config
app.config.from_pyfile('config.py')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# assets
assets = Environment(app)... | mit | Python |
cb4a113ccb628971018e4d275c1e2f6c43144d38 | CHange import settings | SlugocM/bayesfit,SlugocM/bayesfit,SlugocM/bayesfit | bayesfit/plot_CDF.py | bayesfit/plot_CDF.py | """
*******************************************************
*
* plot_cdf - PLOT MODEL FIT TO DATA
*
* Version: Version 2.0
* License: Apache 2.0
* Written by: Michael Slugocki
* Created on: April 18, 2017
* Last updated: April 18, 2018
*
*******************************************************
"""
... | """
*******************************************************
*
* plot_cdf - PLOT MODEL FIT TO DATA
*
* Version: Version 2.0
* License: Apache 2.0
* Written by: Michael Slugocki
* Created on: April 18, 2017
* Last updated: April 18, 2018
*
*******************************************************
"""
... | apache-2.0 | Python |
893e5d9272d8e9a8f105424cdf9b2ded7a3fd2d9 | Validate correct count | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | tests/cli/qa_test.py | tests/cli/qa_test.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] 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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] 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... | apache-2.0 | Python |
e8de5506847d015172acb43248581763ed8ea40c | make listen on right place | moypray/flocker-docker-plugin,wallnerryan/flocker-docker-plugin,moypray/flocker-docker-plugin,mbrukman/flocker-docker-plugin,hackday-profilers/flocker-docker-plugin,mbrukman/flocker-docker-plugin,moypray/flocker-docker-plugin,wallnerryan/flocker-docker-plugin,wallnerryan/flocker-docker-plugin,mbrukman/flocker-docker-pl... | powerstripflocker.tac | powerstripflocker.tac | # Copyright ClusterHQ Limited. See LICENSE file for details.
from twisted.web import server, resource
from twisted.application import service, internet
from powerstripflocker.adapter import AdapterResource, HandshakeResource
def getAdapter():
root = resource.Resource()
v1 = resource.Resource()
root.putC... | # Copyright ClusterHQ Limited. See LICENSE file for details.
from twisted.web import server, resource
from twisted.application import service, internet
from powerstripflocker.adapter import AdapterResource, HandshakeResource
def getAdapter():
root = resource.Resource()
v1 = resource.Resource()
root.putC... | apache-2.0 | Python |
3d3b8c4347eee02787ef626bf176c5a7f1923235 | bump to 0.6.4 | ghickman/couchdbkit,ghickman/couchdbkit,benoitc/couchdbkit,benoitc/couchdbkit,benoitc/couchdbkit,ghickman/couchdbkit | couchdbkit/version.py | couchdbkit/version.py | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 6, 4)
__version__ = ".".join(map(str, version_info))
| # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 6, 3)
__version__ = ".".join(map(str, version_info))
| mit | Python |
a53612d5f276180d204378b9e4974fcd812f6a5b | Add licence header in fake camera test file. | angus-ai/angus-sdk-python | tests/fake_camera.py | tests/fake_camera.py | # -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# ... | from os import listdir
from os.path import isfile, join
class Camera(object):
def __init__(self, path):
self.files = [join(path, f) for f in listdir(path)]
self.files = sorted([f for f in self.files if isfile(f)])
self.current = 0
def reset(self):
self.current = 0
def ha... | apache-2.0 | Python |
7ba9066cd921858e0263a7a43b8527eb3d24574e | add serializer while returning shared_task | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/celery/shared_task.py | corehq/apps/celery/shared_task.py | from celery import shared_task
def task(*args, **kwargs):
"""
A wrapper over shared_task decorator which enforces the default task
serializer as JSON this decorator to create celery tasks in HQ.
This is planned to be used until https://github.com/celery/celery/issues/6759 is fixed.
After the fix ... | from celery import shared_task
def task(*args, **kwargs):
"""
A wrapper over shared_task decorator which enforces the default task
serializer as JSON this decorator to create celery tasks in HQ.
This is planned to be used until https://github.com/celery/celery/issues/6759 is fixed.
After the fix ... | bsd-3-clause | Python |
29ae43413fe8f3ec5b8dc376450711d2b9b49dac | add try except to logger | eseom/glide,eseom/glide | procwatcher/logger.py | procwatcher/logger.py | #!/usr/bin/env python
#
# http://github.com/eseom/procwatcher
#
# @author: EunseokEom <me@eseom.org>
# @desc: logger
import logging
import logging.handlers
from socket import error as socket_error
class Log(object):
def __init__(self):
self.logger = None
self.queue = []
self.get_logger... | #!/usr/bin/env python
#
# http://github.com/eseom/procwatcher
#
# @author: EunseokEom <me@eseom.org>
# @desc: logger
import logging
import logging.handlers
from socket import error as socket_error
class Log(object):
def __init__(self):
self.logger = None
self.queue = []
self.get_logger... | mit | Python |
a3091b3ad0ce95dffedd8b2d9a8f9e72e36ad157 | add ability for importer to handle thecb data too | texastribune/the-dp,texastribune/the-dp,texastribune/the-dp,texastribune/the-dp | tx_highered/management/commands/tx_highered_import.py | tx_highered/management/commands/tx_highered_import.py | import os
from django.core.management.base import BaseCommand, CommandError
from tx_highered.scripts.import_customreport import generic as ipeds
from tx_highered.scripts.import_thecb_report import generic as thecb
class Command(BaseCommand):
args = '(ipeds|thecb) <file file ...>'
help = "Import Data"
d... | import os
from django.core.management.base import BaseCommand
from tx_highered.scripts.import_customreport import generic
class Command(BaseCommand):
args = '(ipeds|thecb) <file file ...>'
help = "Import Data"
def handle(self, importer_type, *args, **options):
# TODO handle THECB data
... | apache-2.0 | Python |
328583decceda16b73d0c278a398a1cc632f3ce3 | Add py-pluggy 0.13.0 (#13176) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-pluggy/package.py | var/spack/repos/builtin/packages/py-pluggy/package.py | # Copyright 2013-2019 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 PyPluggy(PythonPackage):
"""Plugin and hook calling mechanisms for python."""
homepag... | # Copyright 2013-2019 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 PyPluggy(PythonPackage):
"""Plugin and hook calling mechanisms for python."""
homepag... | lgpl-2.1 | Python |
87cf38a4279d247b3e6b5380cc4222641a123343 | add v1.14.0 from github (#27660) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/random123/package.py | var/spack/repos/builtin/packages/random123/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 Random123(Package):
"""Random123 is a library of 'counter-based' random number
generat... | # 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 Random123(Package):
"""Random123 is a library of 'counter-based' random number
generat... | lgpl-2.1 | Python |
40109263f0efd73fb4fab78f03f9222045ae4165 | Fix initial debug configuration for J-Link | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/commands/debug/initcfgs.py | platformio/commands/debug/initcfgs.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
55f5ff9db2b819096630d9547bb5a3e7fa1e80dd | Fix printing unrelated files in output | Brickstertwo/git-commands | bin/commands/tuck.py | bin/commands/tuck.py | """Stash specific files."""
from subprocess import call, check_output
from utils.messages import error, info
def tuck(files, message=None, quiet=False):
"""Stash specific files."""
# resolve the files to be tucked
files_to_tuck = check_output(['git', 'diff', '--name-only', '--cached', '--'] + files).sp... | """Stash specific files."""
from subprocess import call, check_output
from utils.messages import error, info
def tuck(files, message=None, quiet=False):
"""Stash specific files."""
# resolve the files to be tucked
files_to_tuck = check_output(['git', 'ls-files', '--others', '--cached', '--'] + files).s... | mit | Python |
3e259105659c8738ad559275011721f15eaa64c0 | Create a new Talk Reviewers group | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/management/commands/wafer_add_default_groups.py | wafer/management/commands/wafer_add_default_groups.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
class Command(BaseCommand):
help = "Add some useful default groups"
GROUPS = {
# Permissions are specified as (app, code_name) pairs
'Page Editors': (
... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
class Command(BaseCommand):
help = "Add some useful default groups"
GROUPS = {
# Permissions are specified as (app, code_name) pairs
'Page Editors': (
... | isc | Python |
b694e36df79850b7c47dd62f17b1895da810c4cf | Fix default parameters at run_benchmark.py. | pictools/pica,pictools/pica,pictools/pica | bin/run_benchmark.py | bin/run_benchmark.py | import datetime
import itertools
import os
import subprocess
# Modify parameters here
benchmark_path = "benchmark"
out_directory = datetime.datetime.now().strftime('benchmark_%Y-%m-%d_%H-%M-%S')
dimension = 3
size = 50
ppc = 100
temperature = 0.0
iterations = 100
representations = ["SoA", "AoS"]
storages... | import datetime
import itertools
import os
import subprocess
# Modify parameters here
benchmark_path = "benchmark"
out_directory = datetime.datetime.now().strftime('benchmark_%Y-%m-%d_%H-%M-%S')
dimension = 3
size = 50
ppc = 1
temperature = 0.0
iterations = 1
representations = ["SoA", "AoS"]
storages = [... | mit | Python |
005198ff1c7076e0a872456cd633c9b718dcb1ea | Fix flake8 issue | JIC-CSB/dtoolcore | dtoolcore/compare.py | dtoolcore/compare.py | """Module with helper functions for comparing datasets."""
def diff_identifiers(a, b):
"""Return list of tuples where identifiers in datasets differ.
Tuple structure:
(identifier, present in a, present in b)
:param a: first :class:`dtoolcore.DataSet`
:param b: second :class:`dtoolcore.DataSet`
... | """Module with helper functions for comparing datasets."""
def diff_identifiers(a, b):
"""Return list of tuples where identifiers in datasets differ.
Tuple structure:
(identifier, present in a, present in b)
:param a: first :class:`dtoolcore.DataSet`
:param b: second :class:`dtoolcore.DataSet`
... | mit | Python |
0a7e722fd872722788affa7c40f2c122c1a04828 | Add test for existing bucket name | patlub/BucketListAPI,patlub/BucketListAPI | tests/test_bucket.py | tests/test_bucket.py | import unittest
from flask import json
from api import db
from api.BucketListAPI import app
from instance.config import application_config
class BucketTestCase(unittest.TestCase):
def setUp(self):
app.config.from_object(application_config['TestingEnv'])
self.client = app.test_client()
# B... | import unittest
from flask import json
from api import db
from api.BucketListAPI import app
from instance.config import application_config
class BucketTestCase(unittest.TestCase):
def setUp(self):
app.config.from_object(application_config['TestingEnv'])
self.client = app.test_client()
# B... | mit | Python |
0446ff796442fd34053209ec1a8860b7f3971a05 | Support custom user models | ejucovy/django-opendebates,ejucovy/django-opendebates,ejucovy/django-opendebates,caktus/django-opendebates,caktus/django-opendebates,caktus/django-opendebates,caktus/django-opendebates,ejucovy/django-opendebates | opendebates/opendebates/authentication_backend.py | opendebates/opendebates/authentication_backend.py | from django.contrib.auth import get_user_model
class EmailAuthBackend(object):
"""
Email Authentication Backend
Allows a user to sign in using an email/password pair rather than
a username/password pair.
"""
def authenticate(self, username=None, password=None):
""" Authenticate a use... | from django.contrib.auth.models import User, check_password
class EmailAuthBackend(object):
"""
Email Authentication Backend
Allows a user to sign in using an email/password pair rather than
a username/password pair.
"""
def authenticate(self, username=None, password=None):
""... | apache-2.0 | Python |
d1f4ab4c7da9eaaeaebe5b9d0a45b0d8cc9762bf | Fix oversight in test_config.py | getnikola/nikola,getnikola/nikola,okin/nikola,okin/nikola,okin/nikola,okin/nikola,getnikola/nikola,getnikola/nikola | tests/test_config.py | tests/test_config.py | # -*- coding: utf-8 -*-
import os
import re
from nikola import __main__ as nikola
from .base import BaseTestCase
class ConfigTest(BaseTestCase):
"""Provides tests for the configuration-file handling."""
@classmethod
def setUpClass(self):
self.metadata_option = "ADDITIONAL_METADATA"
scrip... | # -*- coding: utf-8 -*-
import os
import re
from nikola import __main__ as nikola
from .base import BaseTestCase
class ConfigTest(BaseTestCase):
"""Provides tests for the configuration-file handling."""
@classmethod
def setUpClass(self):
self.metadata_option = "ADDITIONAL_METADATA"
scrip... | mit | Python |
20caf44978ea4a839bb7cc4df7cc4b0b48cf64df | Test customized and disabled messages | rochacbruno/flask_simplelogin,rochacbruno/flask_simplelogin | tests/test_config.py | tests/test_config.py | import pytest
from flask import Flask
from flask_simplelogin import SimpleLogin, Message
class Settings(dict):
"""A dictionary-like object that allows access to its values using the
attribute syntax (as required by Flask.config.from_object)"""
def __init__(self, *args, **kwargs):
super(Settings, ... | import pytest
from flask import Flask
from flask_simplelogin import SimpleLogin
class Settings(dict):
"""A dictionary-like object that allows access to its values using the
attribute syntax (as required by Flask.config.from_object)"""
def __init__(self, *args, **kwargs):
super(Settings, self).__i... | mit | Python |
a35799477172d6b8b2b70e92ab254998373b7643 | use config realpath for testing forked | 20c/vaping,20c/vaping | tests/test_daemon.py | tests/test_daemon.py |
import os
import pytest
import munge
import vaping
import vaping.daemon
import vaping.config
def test_plugin_context():
data = {
'1': 'two'
}
cfg = vaping.Config(data=data)
ctx = vaping.daemon.PluginContext(cfg)
assert data == ctx.config.data
# test immutable
ctx.config.data[... |
import os
import pytest
import munge
import vaping
import vaping.daemon
import vaping.config
def test_plugin_context():
data = {
'1': 'two'
}
cfg = vaping.Config(data=data)
ctx = vaping.daemon.PluginContext(cfg)
assert data == ctx.config.data
# test immutable
ctx.config.data[... | apache-2.0 | Python |
5f7e22a6e11a3d5ecea0e413b40559a8fc169941 | Add bunch more tests. | ionelmc/pytest-benchmark,thedrow/pytest-benchmark,aldanor/pytest-benchmark,SectorLabs/pytest-benchmark | tests/test_manual.py | tests/test_manual.py | from pytest import raises
def test_single(benchmark):
runs = []
benchmark.manual(runs.append, args=[123])
assert runs == [123]
def test_setup(benchmark):
runs = []
def stuff(foo, bar=123):
runs.append((foo, bar))
def setup():
return [1], {"bar": 2}
benchmark.manual(stu... | from pytest import raises
def test_single(benchmark):
runs = []
benchmark.manual(runs.append, args=[123])
assert runs == [123]
def test_setup(benchmark):
runs = []
def stuff(foo, bar=123):
runs.append((foo, bar))
def setup():
return [1], {"bar": 2}
benchmark.manual(stu... | bsd-2-clause | Python |
79901400dfda1de507a667c5cab1df6e5163600e | Update test_models.py #41 | 7pairs/twingo,7pairs/twingo | tests/test_models.py | tests/test_models.py | # -*- coding: utf-8 -*-
#
# Copyright 2015-2019 Jun-ya HASEBA
#
# 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... | # -*- coding: utf-8 -*-
#
# Copyright 2015 Jun-ya HASEBA
#
# 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 ... | apache-2.0 | Python |
2a1622fcaec83ca496fa088299dd036e9d46961c | Remove boost from user mapping | cutoffthetop/recommender,cutoffthetop/recommender,cutoffthetop/recommender | scripts/usync.py | scripts/usync.py | # -*- coding: utf-8 -*-
"""
Copyright: (c) 2013 by Nicolas Drebenstedt.
License: BSD, see LICENSE for more details.
"""
from datetime import date
from time import sleep
from elasticsearch.client import IndicesClient
from elasticsearch import Elasticsearch
dest = Elasticsearch(hosts=[{'host': 'localhost', 'p... | # -*- coding: utf-8 -*-
"""
Copyright: (c) 2013 by Nicolas Drebenstedt.
License: BSD, see LICENSE for more details.
"""
from datetime import date
from time import sleep
from elasticsearch.client import IndicesClient
from elasticsearch import Elasticsearch
dest = Elasticsearch(hosts=[{'host': 'localhost', 'p... | bsd-2-clause | Python |
e4b8ab1ac8d15037e71538dda8a3f73daed5972e | Add NOQA comment to version imports in project init | jmagnusson/pkgtmpl | pkgtmpl/python/pkgname/__init__.py | pkgtmpl/python/pkgname/__init__.py | from .metadata import __version_info__, __version__ # NOQA
| from .metadata import __version_info__, __version__
| bsd-2-clause | Python |
d1ea64d6645f60df38221cbd194c26dff9686dcd | Handle logging unicode messages in python2. | guilherme-pg/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt | scripts/utils.py | scripts/utils.py | import sys
import hashlib
def e(s):
if type(s) == str:
return str
return s.encode('utf-8')
def d(s):
if type(s) == unicode:
return s
return unicode(s, 'utf-8')
def mkid(s):
return hashlib.sha1(e(s)).hexdigest()[:2*4]
class Logger(object):
def __init__(self):
self._mod... | import sys
import hashlib
def e(s):
if type(s) == str:
return str
return s.encode('utf-8')
def d(s):
if type(s) == unicode:
return s
return unicode(s, 'utf-8')
def mkid(s):
return hashlib.sha1(e(s)).hexdigest()[:2*4]
class Logger(object):
def __init__(self):
self._mod... | mit | Python |
01b0d4066cd709e75585da1b36e74f9b8f412669 | Increase poll timeout (#63) | bjustin-ibm/openwhisk-package-kafka,dubeejw/openwhisk-package-kafka,bjustin-ibm/openwhisk-package-kafka,bjustin-ibm/openwhisk-package-kafka,dubeejw/openwhisk-package-kafka,dubeejw/openwhisk-package-kafka | provider/thedoctor.py | provider/thedoctor.py | import logging
import time
from consumer import Consumer
from consumercollection import ConsumerCollection
from threading import Thread
class TheDoctor (Thread):
# maximum time to allow a consumer to not successfully poll() before restarting
poll_timeout_seconds = 20
# interval between the Doctor making ... | import logging
import time
from consumer import Consumer
from consumercollection import ConsumerCollection
from threading import Thread
class TheDoctor (Thread):
# maximum time to allow a consumer to not successfully poll() before restarting
poll_timeout_seconds = 2
# interval between the Doctor making r... | apache-2.0 | Python |
4468ff9e38fcb846ac1f07fed26c1bbfb64c88c8 | test choices render | satyrius/cmsplugin-polls,satyrius/cmsplugin-polls | tests/test_render.py | tests/test_render.py | from bs4 import BeautifulSoup
from cms.api import add_plugin
from cms.models import Placeholder
from django.http import HttpRequest
from django.template import Context, RequestContext
from django.test import TestCase
from cmsplugin_polls.models import Poll
from cmsplugin_polls.cms_plugins import PollPlugin
class Pol... | from bs4 import BeautifulSoup
from cms.api import add_plugin
from cms.models import Placeholder
from django.http import HttpRequest
from django.template import Context, RequestContext
from django.test import TestCase
from cmsplugin_polls.models import Poll
from cmsplugin_polls.cms_plugins import PollPlugin
class Pol... | mit | Python |
84a99e9557a323e094c360e748c7d7042980fc59 | Test PEP8 integration into Atom | davidgasquez/tip | tests/test_sample.py | tests/test_sample.py | import unittest
from tip.algorithms.dummy import dummy_add
class TestDummyAdd(unittest.TestCase):
def test_lcm(self):
r = dummy_add(2, 2)
self.assertEqual(r, 4)
| import unittest
from tip.algorithms.dummy import dummy_add
class TestDummyAdd(unittest.TestCase):
def test_lcm(self):
r = dummy_add(2, 2)
self.assertEqual(r, 4)
| unlicense | Python |
6e97ca8107a16da42b7e60711e5112e8a2b7b22d | add functions to extract features from textual data | DucAnhPhi/LinguisticAnalysis | dataset.py | dataset.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 18:23:39 2017
Prepare datasets for neural_network.py
@author: duc
"""
import numpy as np
import utils
import copy
from nltk.corpus import cmudict
import linguistic_analysis as la
import flesch_kincaid as fk
import neural_network as nn
def get... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 18:23:39 2017
Prepare datasets for neural_network.py
@author: duc
"""
import numpy as np
def getXOR():
input = np.array([[0,0],[1,0],[0,1],[1,1]])
output = np.array([[0],[1],[1],[0]])
return(input, output)
| mit | Python |
dec8f4ad43b2852bed15ff6a88890262d0ae126c | fix AttributeError | jermowery/xos,opencord/xos,wathsalav/xos,cboling/xos,cboling/xos,jermowery/xos,jermowery/xos,zdw/xos,zdw/xos,open-cloud/xos,xmaruto/mcord,cboling/xos,wathsalav/xos,wathsalav/xos,opencord/xos,open-cloud/xos,open-cloud/xos,cboling/xos,jermowery/xos,zdw/xos,cboling/xos,wathsalav/xos,xmaruto/mcord,zdw/xos,opencord/xos,xmar... | plstackapi/planetstack/api/keys.py | plstackapi/planetstack/api/keys.py | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.api.auth import auth_check
from plstackapi.planetstack.models import Key, User
def lookup_user(fields):
user = None
if 'user' in fields:
if isinstance(fields['use... | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.api.auth import auth_check
from plstackapi.planetstack.models import Key, User
def lookup_user(fields):
user = None
if 'user' in fields:
if isinstance(fields['use... | apache-2.0 | Python |
fad7441706822f2070f6bc1a94e3bb6b42647e4c | Add arg parsing | mediachain/mediachain-client,mediachain/mediachain-client | mediachain/reader/main.py | mediachain/reader/main.py | import sys
import argparse
import os
import mediachain.api
def main(arguments=None):
if arguments == None:
arguments = sys.argv[1:]
parser = argparse.ArgumentParser(
prog='mediachain-reader',
description='Mediachain Reader CLI'
)
subparsers = parser.add_subparsers(help='Mediach... | import sys
import argparse
import os
def main(arguments=None):
if arguments == None:
arguments = sys.argv[1:]
if __name__ == "__main__":
main()
| mit | Python |
6d25f4ae41f6eb0459ed01cec526f57f298b4733 | Add list_routes command to application.py | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | application.py | application.py | #!/usr/bin/env python
import os
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
from app import create_app, db
application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))... | #!/usr/bin/env python
import os
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
from app import create_app, db
application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))... | mit | Python |
0858a56c31cbab9dcecf6388a26b0ae65e501d16 | add custom method to log the gist exceptions | adnedelcu/SyncSettings,mfuentesg/SyncSettings | sync_settings/sync_settings_manager.py | sync_settings/sync_settings_manager.py | # -*- coding: utf-8 -*-
import sublime, os
from .logger import Logger
class SyncSettingsManager:
settingsFilename = 'SyncSettings.sublime-settings'
files = [
"Package Control.merged-ca-bundle",
"Package Control.system-ca-bundle",
"Package Control.user-ca-bundle",
"Package Control.sublime-settings",
"Prefe... | # -*- coding: utf-8 -*-
import sublime, os
class SyncSettingsManager:
settingsFilename = 'SyncSettings.sublime-settings'
files = [
"Package Control.merged-ca-bundle",
"Package Control.system-ca-bundle",
"Package Control.user-ca-bundle",
"Package Control.sublime-settings",
"Preferences.sublime-settings",
... | mit | Python |
8809c8d0027ad5c034a9101fe1e27d29971b3543 | Combine two timestamp gt/lt assertions. | alphagov/tagalog,alphagov/tagalog | test/helpers.py | test/helpers.py | import os
from mock import *
from nose.tools import *
from datetime import datetime
HERE = os.path.dirname(__file__)
def fixture(*path):
return open(fixture_path(*path), 'rb')
def fixture_path(*path):
return os.path.join(HERE, 'fixtures', *path)
class TimestampRange:
"""
Helper for timestamp cre... | import os
from mock import *
from nose.tools import *
from datetime import datetime
HERE = os.path.dirname(__file__)
def fixture(*path):
return open(fixture_path(*path), 'rb')
def fixture_path(*path):
return os.path.join(HERE, 'fixtures', *path)
class TimestampRange:
"""
Helper for timestamp cre... | mit | Python |
74b7b8f9ea326a4293cd7790632138ed4e741500 | add device authentication support | bboozzoo/mender-backend-cli | mender/client/__init__.py | mender/client/__init__.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Maciej Borzecki
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | # The MIT License (MIT)
#
# Copyright (c) 2016 Maciej Borzecki
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | mit | Python |
a5d7bc1e7d1b5b1bef737aa205cfd40d34efc154 | Fix test_open_home | frafra/is-osm-uptodate,frafra/is-osm-uptodate | tests/test_webapp.py | tests/test_webapp.py | from common import URL
from parameterized import parameterized
from seleniumbase import BaseCase
from seleniumbase.config import settings
buttons = "creation lastedit revisions frequency".split()
class TestWebapp(BaseCase):
def test_open_home(self):
self.set_window_size("768", "432")
self.open(UR... | from common import URL
from parameterized import parameterized
from seleniumbase import BaseCase
from seleniumbase.config import settings
buttons = "creation lastedit revisions frequency".split()
class TestWebapp(BaseCase):
def test_open_home(self):
self.set_window_size("768", "432")
self.open(UR... | agpl-3.0 | Python |
f96c60abacd6e44a3fc43ac83e7cfb794f1e02ad | Remove log translations | openstack/python-zaqarclient | zaqarclient/_i18n.py | zaqarclient/_i18n.py | # Copyright 2014 Red Hat, 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... | # Copyright 2014 Red Hat, 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... | apache-2.0 | Python |
0753885bf362e7800c2a7817fe037417bd38dc9e | Check character not check digit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism | python/isbn-verifier/isbn_verifier.py | python/isbn-verifier/isbn_verifier.py | class IsbnVerifier(object):
VALID_SEPERATOR = "-"
VALID_CHECK_CHARACTER = "X"
VALID_DIGITS = list(map(str, range(0, 10)))
VALID_CHARACTERS = set(VALID_DIGITS) | set([VALID_SEPERATOR, VALID_CHECK_CHARACTER])
VALID_LENGTH = 10
@classmethod
def is_valid(cls, string):
if cls.invalid(st... | class IsbnVerifier(object):
VALID_SEPERATOR = "-"
VALID_CHECK_DIGIT = "X"
VALID_DIGITS = list(map(str, range(0, 10)))
VALID_CHARACTERS = set(VALID_DIGITS) | set([VALID_SEPERATOR, VALID_CHECK_DIGIT])
VALID_LENGTH = 10
@classmethod
def is_valid(cls, string):
if cls.invalid(string):
... | mit | Python |
2cd7a53f92d0a8c79fa9e89da08abce8b07988b0 | fix off my 1 error | closeio/closeio-api-scripts | contacts_from_search_query.py | contacts_from_search_query.py | #!/usr/bin/env python
import argparse
from flask_common.utils import CsvWriter
from closeio_api import Client as CloseIO_API
HEADERS = ['lead_name', 'contact_name', 'title', 'primary_email', 'primary_phone']
parser = argparse.ArgumentParser(description='Exports the primary contact information for each contact to CSV ... | #!/usr/bin/env python
import argparse
from flask_common.utils import CsvWriter
from closeio_api import Client as CloseIO_API
HEADERS = ['lead_name', 'contact_name', 'title', 'primary_email', 'primary_phone']
parser = argparse.ArgumentParser(description='Exports the primary contact information for each contact to CSV ... | mit | Python |
98dca5076dbcd6f7fa3830dd5cdaab60c2d0a46e | Fix indent on test code for test/assembly broken in r1220 Review URL: https://chromiumcodereview.appspot.com/9429007 | old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google | test/assembly/gyptest-assembly.py | test/assembly/gyptest-assembly.py | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A basic test of compiling assembler files.
"""
import sys
import TestGyp
if sys.platform != 'win32':
# TODO(bradnelson): get this wo... | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A basic test of compiling assembler files.
"""
import sys
import TestGyp
if sys.platform != 'win32':
# TODO(bradnelson): get this wo... | bsd-3-clause | Python |
1c28341a4cd828de607d9cc4252f444844c0a892 | Tweak up timeout in UDP test | rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel | test/bibliopixel/util/udp_test.py | test/bibliopixel/util/udp_test.py | import contextlib, queue, time, unittest
from bibliopixel.util import udp
TEST_ADDRESS = '127.0.0.1', 5678
TIMEOUT = 0.3
@contextlib.contextmanager
def receive_udp(address, results):
receiver = udp.QueuedReceiver(address)
receiver.start()
yield
try:
while True:
results.append(r... | import contextlib, queue, time, unittest
from bibliopixel.util import udp
TEST_ADDRESS = '127.0.0.1', 5678
TIMEOUT = 0.2
@contextlib.contextmanager
def receive_udp(address, results):
receiver = udp.QueuedReceiver(address)
receiver.start()
yield
try:
while True:
results.append(r... | mit | Python |
56401448a09723677331b736b3a76c1eab976881 | Change the way cornice services are defined. | mostlygeek/tokenserver,mostlygeek/tokenserver,mozilla-services/tokenserver,mozilla-services/tokenserver | tokenserver/views.py | tokenserver/views.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import json
from cornice import Service
from vep.errors import Error as BrowserIDError
from tokenserver.util... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import json
from cornice import Service
from cornice.resource import resource, view
from tokenserver.util imp... | mpl-2.0 | Python |
dec7214d65a900ace53d173a4abc9bb884a13eb8 | Improve testing | danbob123/oi,walkr/oi | test/test_oi.py | test/test_oi.py | import unittest
import oi
class TestOi(unittest.TestCase):
def setUp(self):
self.address = 'ipc:///tmp/test-programd.sock'
self.p = oi.Program('programd', self.address)
self.ctl = oi.CtlProgram('programctl', self.address)
def tearDown(self):
self.p.service.sock.close()
... | import unittest
import oi
class TestOi(unittest.TestCase):
def setUp(self):
self.address = 'ipc:///tmp/test-programd.sock'
self.p = oi.Program('programd', self.address)
self.ctl = oi.CtlProgram('programctl', self.address)
def tearDown(self):
self.p.service.sock.close()
... | mit | Python |
f949118c6056f14e72226a2e70a11a3a75bc93e8 | Print chars instead of strings, this should take meta chars in consideration as well | jtwaleson/decrypt | decrypt.py | decrypt.py | #!/usr/bin/env python
import curses
import time
import fileinput
import random
import string
lines = []
chance = 0.1
confirmed_per_line = []
screen = curses.initscr()
curses.noecho()
try:
curses.curs_set(0)
except:
pass
screen.keypad(1)
def iterate(increase = False):
still_random = 0
global chance, ... | #!/usr/bin/env python
import curses
import time
import fileinput
import random
import string
lines = []
chance = 0.1
confirmed_per_line = []
screen = curses.initscr()
curses.noecho()
try:
curses.curs_set(0)
except:
pass
screen.keypad(1)
def iterate(increase = False):
still_random = 0
global chance, ... | mit | Python |
2c356f404de628c23aad9bead3c5c592c508dff5 | Allow to run with no directory passed in. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tools/make-frozen.py | tools/make-frozen.py | #!/usr/bin/env python
#
# Create frozen modules structure for MicroPython.
#
# Usage:
#
# Have a directory with modules to be frozen (only modules, not packages
# supported so far):
#
# frozen/foo.py
# frozen/bar.py
#
# Run script, passing path to the directory above:
#
# ./make-frozen.py frozen > frozen.c
#
# Include ... | #!/usr/bin/env python
#
# Create frozen modules structure for MicroPython.
#
# Usage:
#
# Have a directory with modules to be frozen (only modules, not packages
# supported so far):
#
# frozen/foo.py
# frozen/bar.py
#
# Run script, passing path to the directory above:
#
# ./make-frozen.py frozen > frozen.c
#
# Include ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.