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 |
|---|---|---|---|---|---|---|---|---|
cc3cb0904f5a2ab3306e55326d3e1613c245db43 | Include remote server IP, just in case. Tolerate warning in case of duplicate | ISISComputingGroup/EPICS-inst_servers,ISISComputingGroup/EPICS-inst_servers | scripts/hex_compress_and_put_pv.py | scripts/hex_compress_and_put_pv.py | #This file is part of the ISIS IBEX application.
#Copyright (C) 2012-2016 Science & Technology Facilities Council.
#All rights reserved.
#
#This program is distributed in the hope that it will be useful.
#This program and the accompanying materials are made available under the
#terms of the Eclipse Public License v1.0 ... | #This file is part of the ISIS IBEX application.
#Copyright (C) 2012-2016 Science & Technology Facilities Council.
#All rights reserved.
#
#This program is distributed in the hope that it will be useful.
#This program and the accompanying materials are made available under the
#terms of the Eclipse Public License v1.0 ... | bsd-3-clause | Python |
671e73e59e394e33bc67dcce515e19a1fb26f743 | Add two docstrings | numba/llvmlite,m-labs/llvmlite,m-labs/llvmlite,markdewing/llvmlite,ssarangi/llvmlite,sklam/llvmlite,numba/llvmlite,squisher/llvmlite,numba/llvmlite,m-labs/llvmlite,ssarangi/llvmlite,m-labs/llvmlite,pitrou/llvmlite,squisher/llvmlite,markdewing/llvmlite,sklam/llvmlite,ssarangi/llvmlite,numba/llvmlite,pitrou/llvmlite,skla... | llvmlite/binding/common.py | llvmlite/binding/common.py |
import sys
if sys.version_info < (3, 0):
def _encode_string(s):
if isinstance(s, bytes):
return s
else:
return s.encode('utf-8')
def _decode_string(b):
return b
else:
def _encode_string(s):
return s.encode('utf-8')
def _decode_string(b):
... |
import sys
if sys.version_info < (3, 0):
def _encode_string(s):
if isinstance(s, bytes):
return s
else:
return s.encode('utf-8')
def _decode_string(b):
return b
else:
def _encode_string(s):
return s.encode('utf-8')
def _decode_string(b):
... | bsd-2-clause | Python |
7b5e8433df56b0d033e3f12079276be6aa99870c | remove debug prints | LEWASatVT/lewas | lewas/parsers.py | lewas/parsers.py | import re
__all__ = [ 'split_parser', 'ParseError' ]
class ParseError(RuntimeError):
pass
def split_parser(**kwargs):
return lambda astring: _split_parser(astring, **kwargs)
def _split_parser(astring, **kwargs):
"""regexp: a regular expression that will be applied to the full line,
strin... | import re
__all__ = [ 'split_parser', 'ParseError' ]
class ParseError(RuntimeError):
pass
def split_parser(**kwargs):
return lambda astring: _split_parser(astring, **kwargs)
def _split_parser(astring, **kwargs):
"""regexp: a regular expression that will be applied to the full line,
strin... | mit | Python |
15c7c3ed8f77ecb4a723c7f52cf37d14b88ee0c8 | Fix script after r232641 | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/slave/chromium/test_webkitpy_wrapper.py | scripts/slave/chromium/test_webkitpy_wrapper.py | #!/usr/bin/env python
# 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.
"""A wrapper script that invokes test-webkitpy."""
import optparse
import os
import sys
from common import chromium_utils
from slave ... | #!/usr/bin/env python
# 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.
"""A wrapper script that invokes test-webkitpy."""
import optparse
import os
import sys
from common import chromium_utils
from slave ... | bsd-3-clause | Python |
f5bbc9f1f6d4660e55978048f86930d67ac8b610 | Fix quotes in addresses | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/misc_fixes.py | polling_stations/apps/data_collection/management/commands/misc_fixes.py | from django.core.management.base import BaseCommand
from django.contrib.gis.geos import Point
from pollingstations.models import PollingStation, PollingDistrict
from councils.models import Council
class Command(BaseCommand):
def handle(self, *args, **kwargs):
#SCambs
ps = PollingStation.objects... | from django.core.management.base import BaseCommand
from django.contrib.gis.geos import Point
from pollingstations.models import PollingStation, PollingDistrict
from councils.models import Council
class Command(BaseCommand):
def handle(self, *args, **kwargs):
#SCambs
ps = PollingStation.objects... | bsd-3-clause | Python |
41cea329d9cf7159df3c387038a26277bb93c9d5 | Update for logging purposes | CodingAnarchy/Amon | lib/addresses.py | lib/addresses.py | import logging
import warnings
try:
import cPickle as pickle
except ImportError:
import pickle
logger = logging.getLogger(__name__)
try:
address_book = pickle.load(open('address_book.p', 'rb'))
except IOError:
logger.debug('Could not load address book!')
warnings.warn('Could not load address book!... | import logging
import warnings
try:
import cPickle as pickle
except ImportError:
import pickle
logger = logging.getLogger(__name__)
try:
address_book = pickle.load(open('address_book.p', 'rb'))
except IOError:
logger.warning('Could not load address book!')
warnings.warn('Could not load address boo... | unlicense | Python |
79c8d40d8a47a4413540acac671345dd5faed46e | Add name parameter to Tag Detail URL. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | suorganizer/urls.py | suorganizer/urls.py | """suorganizer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | """suorganizer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | bsd-2-clause | Python |
02ae944c744041fabb11bb807287a12a9b59559f | fix typo in version number (#12855) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pyudev/package.py | var/spack/repos/builtin/packages/py-pyudev/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 PyPyudev(PythonPackage):
"""Pure Python libudev binding"""
homepage = "https://pyudev... | # 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 PyPyudev(PythonPackage):
"""Pure Python libudev binding"""
homepage = "https://pyudev... | lgpl-2.1 | Python |
3f5d6b76492ea224fad21faf145db08d966c0dda | Apply the PAGE_OUT_OF_RANGE_404 in the proper place. | shtalinberg/django-el-pagination,shtalinberg/django-el-pagination,shtalinberg/django-el-pagination,shtalinberg/django-el-pagination | el_pagination/tests/integration/test_feed_wrapper.py | el_pagination/tests/integration/test_feed_wrapper.py | """Twitter-style pagination feeding an specific content wrapper integration tests."""
from __future__ import unicode_literals
import el_pagination.settings
from el_pagination.tests.integration import SeleniumTestCase
class FeedWrapperPaginationTest(SeleniumTestCase):
view_name = 'feed-wrapper'
selector = '... | """Twitter-style pagination feeding an specific content wrapper integration tests."""
from __future__ import unicode_literals
from django.test import override_settings
from el_pagination.tests.integration import SeleniumTestCase
@override_settings(PAGE_OUT_OF_RANGE_404=True)
class FeedWrapperPaginationTest(Seleniu... | mit | Python |
e2b7f23270eb6a404601b18a26fc1beb73af610b | Add a name property to Profile | onitake/Uranium,onitake/Uranium | UM/Settings/Profile.py | UM/Settings/Profile.py | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import configparser
from UM.Signal import Signal, SignalEmitter
from UM.Settings import SettingsError
class Profile(SignalEmitter):
ProfileVersion = 1
def __init__(self):
super().__init__()
sel... | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import configparser
from UM.Settings import SettingsError
class Profile():
ProfileVersion = 1
def __init__(self):
super().__init__()
self._changed_settings = {}
def setSettingValue... | agpl-3.0 | Python |
72748cf910be4a36b6e22f8a64f414488c784c1f | use wrap_tool | simbuerg/benchbuild,simbuerg/benchbuild | pprof/projects/pprof/sdcc.py | pprof/projects/pprof/sdcc.py | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory, log_with, log
from pprof.settings import config
from group import PprofGroup
from os import path
from plumbum import FG, local
import logging
class SDCC(PprofGroup):
class Factory:
def create(self, exp):
retu... | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory, log_with, log
from pprof.settings import config
from group import PprofGroup
from os import path
from plumbum import FG, local
import logging
class SDCC(PprofGroup):
class Factory:
def create(self, exp):
retu... | mit | Python |
93af79da49d9e50e4d0662eff2f42416d38f6d67 | Update P4_drawingOnImages.py added docstring and wrapped in main function | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | pythontutorials/books/AutomateTheBoringStuff/Ch17/P4_drawingOnImages.py | pythontutorials/books/AutomateTheBoringStuff/Ch17/P4_drawingOnImages.py | """Drawing on images
This program uses :py:mod:`PIL.Image` and :py:mod:`PIL.ImageDraw` to draw on digital images.
"""
def main():
from PIL import Image, ImageDraw
im = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(im)
# Drawing Shapes
draw.line([(0, 0), (199, 0), (199, 199), (0, ... | # This program uses the pillow module to draw on digital images
from PIL import Image, ImageDraw
im = Image.new('RGBA', (200, 200), 'white')
draw = ImageDraw.Draw(im)
# Drawing Shapes
draw.line([(0, 0), (199, 0), (199, 199), (0, 199), (0, 0)], fill='black')
draw.rectangle((20, 30, 60, 60), fill='blue')
draw.ellipse((... | mit | Python |
c6f55a2cc5ad630debf12f2a43230bbf9dffa8a8 | Check for Python version at import time. (#2351) | cseed/hail,cseed/hail,danking/hail,danking/hail,hail-is/hail,danking/hail,cseed/hail,cseed/hail,hail-is/hail,cseed/hail,danking/hail,cseed/hail,danking/hail,danking/hail,danking/hail,hail-is/hail,cseed/hail,hail-is/hail,hail-is/hail,cseed/hail,hail-is/hail,hail-is/hail,hail-is/hail,danking/hail | python/hail/__init__.py | python/hail/__init__.py | from hail.representation import *
from hail.context import HailContext
from hail.dataset import VariantDataset
from hail.typ import *
from hail.keytable import KeyTable
from hail.kinshipMatrix import KinshipMatrix
from hail.ldMatrix import LDMatrix
from hail.utils import hadoop_read, hadoop_write, hadoop_copy
import s... | from hail.representation import *
from hail.context import HailContext
from hail.dataset import VariantDataset
from hail.typ import *
from hail.keytable import KeyTable
from hail.kinshipMatrix import KinshipMatrix
from hail.ldMatrix import LDMatrix
from hail.utils import hadoop_read, hadoop_write, hadoop_copy
__all__ ... | mit | Python |
8f70b5c1833390c130541e558b78755743a46dd1 | Fix missing default latitude/longitude/elevation in OpenUV config flow (#52380) | FreekingDean/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,w1ll1am23/home-assistant,lukas-hetzenecker/home-assistant,home-assistant/home-assistant,lukas-hetzenecker/home-assistant,nkgilley/home-assistant,home-assistant/home-assistant,sander76/home-assistant,sander76/home-assistant,rohitranjan1991/home-a... | homeassistant/components/openuv/config_flow.py | homeassistant/components/openuv/config_flow.py | """Config flow to configure the OpenUV component."""
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY,
CONF_ELEVATION,
CONF_LATITUDE,
CONF_LONGITUDE,
)
from homeassistant.... | """Config flow to configure the OpenUV component."""
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY,
CONF_ELEVATION,
CONF_LATITUDE,
CONF_LONGITUDE,
)
from homeassistant.... | apache-2.0 | Python |
91f99fb553747d5c7e7face4c51882db40a4daaf | Remove version and dosctring. | moigagoo/swagger2markdown | swagger2markdown.py | swagger2markdown.py | import argparse, json, os.path
import jinja2, requests
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-i", "--input",
default="swagger.json",
help="path to or URL of the Swagger JSON file (default: swagger.json)",
metavar=""
)
parser.add_argument... | """Converter from Swagger JSON to Markdown."""
__version__ = "0.1.0"
import argparse, json, os.path
import jinja2, requests
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-i", "--input",
default="swagger.json",
help="path to or URL of the Swagger JSON file (de... | mit | Python |
450f4de523671c163b704ab3caf1b7db37e408d8 | Refactor series to use list comprehension | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism | python/series/series.py | python/series/series.py | def slices(string, length):
if length <= 0 or length > len(string):
raise ValueError('Invalid slice length')
nums = list(map(int, list(string)))
return [nums[i : i + length] for i in range(len(nums) - length + 1)]
| def slices(string, length):
if length <= 0 or length > len(string):
raise ValueError('Invalid slice length')
slices = []
for indx, _elem in enumerate(string):
if len(string) - indx >= length:
curr_slice = []
curr_indx = indx
while len(curr_slice) < length... | mit | Python |
29b9604797f0018be0860e9a7a2be0ad8ddb9a2e | Deal with prep errors | IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site | apps/predict/management/commands/submit_predict.py | apps/predict/management/commands/submit_predict.py | """
Submit the pipeline job as soon as the file download is complete.
"""
import sys
import time
from datetime import datetime
from django.core.management.base import BaseCommand
from chore import JobSubmissionError
from apps.pipeline.models import PrepareError
from apps.predict.models import (
PredictStrain, ge... | """
Submit the pipeline job as soon as the file download is complete.
"""
import sys
import time
from datetime import datetime
from django.core.management.base import BaseCommand
from chore import JobSubmissionError
from apps.predict.models import (
PredictStrain, get_timeout, STATUS_WAIT, STATUS_START, STATUS_E... | agpl-3.0 | Python |
f8352dcd3dbf9bd69307cd9527c805f826e2b17f | Hide host aggregates from horizon | blueboxgroup/horizon-customization | horizon-customization/horizon_customization.py | horizon-customization/horizon_customization.py | import horizon
# expose host aggregates to cloud_admin
# default permissions for admin_dashboard _should_ be ('openstack.roles.admin',)
# so we want to append our cloud_admin role to the first tuple
# https://github.com/openstack/django_openstack_auth/blob/master/openstack_auth/user.py#L376
# (('openstack.roles.admin'... | import horizon
# expose host aggregates to cloud_admin
# default permissions for admin_dashboard _should_ be ('openstack.roles.admin',)
# so we want to append our cloud_admin role to the first tuple
# https://github.com/openstack/django_openstack_auth/blob/master/openstack_auth/user.py#L376
# (('openstack.roles.admin'... | apache-2.0 | Python |
3d71a09837d73e2a976f1911ed072225ffc2f841 | Fix misspellings in python marconiclient | openstack/python-zaqarclient | marconiclient/auth/base.py | marconiclient/auth/base.py | # Copyright (c) 2013 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 writ... | # Copyright (c) 2013 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 writ... | apache-2.0 | Python |
5a5dc0916d28472b3c1f98255fd7cca8a8029118 | Add note about Graph doing work in init | ciarand/exhausting-search-homework | src/exhaustive_search/euclidean_mst.py | src/exhaustive_search/euclidean_mst.py | """ Provides a solution (`solve`) to the EMST problem. """
from .graph import Graph
# Euclidean Minimum Spanning Tree (MST) algorithm
#
# input: a list of n Point objects
#
# output: a list of (p, q) tuples, where p and q are each input Point
# objects, and (p, q) should be connected in a minimum spanning tree
# of t... | """ Provides a solution (`solve`) to the EMST problem. """
from .graph import Graph
# Euclidean Minimum Spanning Tree (MST) algorithm
#
# input: a list of n Point objects
#
# output: a list of (p, q) tuples, where p and q are each input Point
# objects, and (p, q) should be connected in a minimum spanning tree
# of t... | isc | Python |
e43343ef5b13095a71fd3e85aa361c6b126dc05a | fix uuid being used as an object, missing tags argument | ceph/ceph-installer,ceph/ceph-installer,ceph/mariner-installer,ceph/ceph-installer | mariner/controllers/mon.py | mariner/controllers/mon.py | import os
from pecan import expose, request
import logging
from uuid import uuid4
from mariner.controllers import error
from mariner import process, models, util
logger = logging.getLogger(__name__)
class MONController(object):
@expose('json')
def index(self):
# TODO: allow some autodiscovery here ... | import os
from pecan import expose, request
from uuid import uuid4
from mariner.controllers import error
from mariner import process, models, util
class MONController(object):
@expose('json')
def index(self):
# TODO: allow some autodiscovery here so that clients can see what is
# available
... | mit | Python |
73c9644f4b07fb1ec923c2dfa6bc2d2177ef842a | Remove trailing space | StegSchreck/RatS,StegSchreck/RatS,StegSchreck/RatS | RatS/rottentomatoes/rottentomatoes_ratings_inserter.py | RatS/rottentomatoes/rottentomatoes_ratings_inserter.py | import time
import urllib.parse
from RatS.base.base_ratings_inserter import RatingsInserter
from RatS.rottentomatoes.rottentomatoes_site import RottenTomatoes
class RottenTomatoesRatingsInserter(RatingsInserter):
def __init__(self, args):
super(RottenTomatoesRatingsInserter, self).__init__(RottenTomatoes... | import time
import urllib.parse
from RatS.base.base_ratings_inserter import RatingsInserter
from RatS.rottentomatoes.rottentomatoes_site import RottenTomatoes
class RottenTomatoesRatingsInserter(RatingsInserter):
def __init__(self, args):
super(RottenTomatoesRatingsInserter, self).__init__(RottenTomatoes... | agpl-3.0 | Python |
38ae4ddab1a5b94d03941c4080df72fea4e750bc | Add secret key env var | daviferreira/defprogramming,daviferreira/defprogramming,daviferreira/defprogramming | defprogramming/settings_production.py | defprogramming/settings_production.py | import os
from defprogramming.settings import *
ALLOWED_HOSTS = ['*']
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Update database configuration with $DATABASE_URL.
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_F... | from defprogramming.settings import *
ALLOWED_HOSTS = ['*']
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Update database configuration with $DATABASE_URL.
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_P... | mit | Python |
e034c01f7107d7d92a5f3d544ec7b97e9684042a | Update organize_flowers17.py | prashantas/MyDataScience | Python/Flower-regnition/organize_flowers17.py | Python/Flower-regnition/organize_flowers17.py | ### This file creates separates directories for each class of images.
### It considers first n ( here 80 ) imagesa are of one class, 2nd n images are of another class ans so on.
import os
import glob
import datetime
print ("[INFO] program started on - {}".format(str(datetime.datetime.now)))
# get the input ... | import os
import glob
import datetime
print ("[INFO] program started on - {}".format(str(datetime.datetime.now)))
# get the input and output path
# C:\\Users\\prassha\\Desktop\\MachineLearning\\Python\\FlowerRecognition\\jpg
input_path = "C:\\Users\\prassha\\Desktop\\MachineLearning\\Python\\FlowerRecognitio... | bsd-2-clause | Python |
fb6099b5b309f4cfd36962b7387496c0df491ab5 | Create small test problem | thomasgibson/firedrake-hybridization | hybridization_solver.py | hybridization_solver.py | from __future__ import absolute_import, print_function, division
from firedrake import *
qflag = False
degree = 1
mesh = UnitSquareMesh(2, 2, quadrilateral=qflag)
n = FacetNormal(mesh)
if qflag:
RT = FiniteElement("RTCF", quadrilateral, degree)
DG = FiniteElement("DQ", quadrilateral, degree - 1)
else:
... | from __future__ import absolute_import, print_function, division
from firedrake import *
from firedrake.formmanipulation import split_form
qflag = False
degree = 1
mesh = UnitSquareMesh(32, 32, quadrilateral=qflag)
n = FacetNormal(mesh)
if qflag:
RT = FiniteElement("RTCF", quadrilateral, degree)
DG = Finite... | mit | Python |
f6ffdbcf1ebc82d1e291f05b97a7ec62b1f8c126 | correct function name | lisitsyn/shogun,Saurabh7/shogun,shogun-toolbox/shogun,lambday/shogun,sorig/shogun,sorig/shogun,Saurabh7/shogun,karlnapf/shogun,lisitsyn/shogun,besser82/shogun,lambday/shogun,besser82/shogun,besser82/shogun,lambday/shogun,besser82/shogun,lambday/shogun,lisitsyn/shogun,shogun-toolbox/shogun,shogun-toolbox/shogun,shogun-t... | examples/undocumented/python_modular/mkl_regression_modular.py | examples/undocumented/python_modular/mkl_regression_modular.py | #!/usr/bin/env python
from numpy import *
parameter_list=[[20,100,6,10,0.5,1, 1], [20,100,6,10,0.5,1, 2]]
def mkl_regression_modular(n=100,n_test=100, \
x_range=6,x_range_test=10,noise_var=0.5,width=1, seed=1):
from modshogun import RegressionLabels, RealFeatures
from modshogun import GaussianKernel, PolyKernel,... | #!/usr/bin/env python
from numpy import *
parameter_list=[[20,100,6,10,0.5,1, 1], [20,100,6,10,0.5,1, 2]]
def regression_libsvr_modular (n=100,n_test=100, \
x_range=6,x_range_test=10,noise_var=0.5,width=1, seed=1):
from modshogun import RegressionLabels, RealFeatures
from modshogun import GaussianKernel, PolyKer... | bsd-3-clause | Python |
75c48ecbac476fd751e55745cc2935c1dac1f138 | Move todos into issues tracking on GitHub | taylor-peterson/longest-duplicated-substring | longest_duplicated_substring.py | longest_duplicated_substring.py | #!/usr/bin/env python
import sys
def longest_duplicated_substring(string):
"""Return the longest duplicated substring.
Keyword Arguments:
string -- the string to examine for duplicated substrings
This approach examines each possible pair of starting points
for duplicated substrings. If the char... | #!/usr/bin/env python
import sys
# O(n^4) approach: generate all possible substrings and
# compare each for equality.
def longest_duplicated_substring(string):
"""Return the longest duplicated substring.
Keyword Arguments:
string -- the string to examine for duplicated substrings
This approach exa... | mit | Python |
b9744b515e4d32dcdc455f430c641be3a748dcf6 | Fix webhook processing | alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,LibCrowds/libcrowds-analyst,alexandermendes/pybossa-analyst | pybossa_analyst/view/home.py | pybossa_analyst/view/home.py | # -*- coding: utf8 -*-
from rq import Queue
from redis import Redis
from flask import Blueprint
from flask import render_template, request, session, flash, redirect, url_for
from flask import current_app, send_file, Response
from pybossa_analyst import forms
blueprint = Blueprint('home', __name__)
queue = Queue('pyb... | # -*- coding: utf8 -*-
from rq import Queue
from redis import Redis
from flask import Blueprint
from flask import render_template, request, session, flash, redirect, url_for
from flask import current_app, send_file, Response
from pybossa_analyst import forms
blueprint = Blueprint('home', __name__)
queue = Queue('pyb... | unknown | Python |
dc1ece6111d5f7651c9b8394d5a8fb80c2e756b0 | add safari support. #970, #972 | chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts | pyecharts/render/snapshot.py | pyecharts/render/snapshot.py | # coding=utf-8
import base64
import time
import os
from selenium import webdriver
from selenium.common import exceptions
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def make_snapshot(
html_path: str,
image_name: str,
pixel_ratio: int = 2,
delay: int = 2,
is_remo... | # coding=utf-8
import base64
import os
from selenium import webdriver
from selenium.common import exceptions
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def make_snapshot(
html_path: str,
image_name: str,
pixel_ratio: int = 2,
delay: int = 2,
is_remove_html: boo... | mit | Python |
847a88c579118f8a0d528284ab3ea029ccca7215 | Add description to rst plugin | evvers/git-pre-commit-hook | git_pre_commit_hook/builtin_plugins/rst_check.py | git_pre_commit_hook/builtin_plugins/rst_check.py | """Check that files contains valid ReStructuredText."""
import os
import fnmatch
import restructuredtext_lint
DEFAULTS = {
'files': '*.rst',
}
def make_message(error):
return '%s %s:%s %s\n' % (
error.type, error.source, error.line, error.message,
)
def check(file_staged_for_commit, options):
... | import os
import fnmatch
import restructuredtext_lint
DEFAULTS = {
'files': '*.rst',
}
def make_message(error):
return '%s %s:%s %s\n' % (
error.type, error.source, error.line, error.message,
)
def check(file_staged_for_commit, options):
basename = os.path.basename(file_staged_for_commit.p... | mit | Python |
72a7867035e46992ecc654fd6703ba52bf8a9970 | make the test work for anyone other than me | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/tst_scan_varying_integration_bug.py | test/tst_scan_varying_integration_bug.py | from __future__ import division
import glob
import os
from libtbx import easy_run
from libtbx.test_utils import approx_equal, open_tmp_directory
from cctbx import uctbx
import libtbx.load_env
have_xia2_regression = libtbx.env.has_module("xia2_regression")
if have_xia2_regression:
xia2_regression = libtbx.env.under_b... | from __future__ import division
import glob
import os
from libtbx import easy_run
from libtbx.test_utils import approx_equal, open_tmp_directory
from cctbx import uctbx
import libtbx.load_env
have_xia2_regression = libtbx.env.has_module("xia2_regression")
if have_xia2_regression:
xia2_regression = libtbx.env.find_in... | bsd-3-clause | Python |
5d0064bd3c970953db4c1e8efea23164ad40a80a | Fix duplicated line | cyp-opennet/ons_cyp_github,BT-ojossen/l10n-switzerland,BT-fgarbely/l10n-switzerland,BT-csanchez/l10n-switzerland,BT-fgarbely/l10n-switzerland,ndtran/l10n-switzerland,BT-ojossen/l10n-switzerland,CompassionCH/l10n-switzerland,CompassionCH/l10n-switzerland,open-net-sarl/l10n-switzerland,michl/l10n-switzerland,cgaspoz/l10n... | l10n_ch_payment_slip_layouts/tests/__init__.py | l10n_ch_payment_slip_layouts/tests/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | agpl-3.0 | Python |
b576bbe872074faba832e5dad2c8cf260d49b2c9 | fix tests for Django 1.8 | artinnok/djangoql,artinnok/djangoql,ivelum/djangoql,ivelum/djangoql,ivelum/djangoql,artinnok/djangoql | test_project/core/tests/test_queryset.py | test_project/core/tests/test_queryset.py | from django.contrib.auth.models import User
from django.test import TestCase
from djangoql.queryset import apply_search
from djangoql.schema import DjangoQLSchema, IntField
from ..models import Book
class WrittenInYearField(IntField):
model = Book
name = 'written_in_year'
def get_lookup_name(self):
... | from django.contrib.auth.models import User
from django.test import TestCase
from djangoql.queryset import apply_search
from djangoql.schema import DjangoQLSchema, IntField
from ..models import Book
class WrittenInYearField(IntField):
model = Book
name = 'written_in_year'
def get_lookup_name(self):
... | mit | Python |
4f9a90c88bd7952c77948451d9c3166d946e4523 | Bump version | thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader | pytablereader/__version__.py | pytablereader/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.21.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.20.7"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
7c175778ac0057d4965f181eff2d7dedf0519816 | use full version as the "short version" | piskvorky/gensim,RaRe-Technologies/gensim,RaRe-Technologies/gensim,RaRe-Technologies/gensim,piskvorky/gensim,RaRe-Technologies/gensim,piskvorky/gensim | release/bump_version.py | release/bump_version.py | """Bumps the version of gensim in all the required places."""
import os.path
import re
import sys
def bump(path, pattern, repl, check=True):
with open(path) as fin:
contents = fin.read()
new_contents = pattern.sub(repl, contents)
if check and new_contents == contents:
print('*' * 79)
... | """Bumps the version of gensim in all the required places."""
import os.path
import re
import sys
def bump(path, pattern, repl, check=True):
with open(path) as fin:
contents = fin.read()
new_contents = pattern.sub(repl, contents)
if check and new_contents == contents:
print('*' * 79)
... | lgpl-2.1 | Python |
f082c7e7f89020b8d4c55f696a1a242772ecfd3b | fix RadioButton issue where radio group key did not first exist | griffy/sikwidgets,griffy/sikwidgets | sikwidgets/widgets/radio_button.py | sikwidgets/widgets/radio_button.py | from sikwidgets.widgets.widget import Widget
from sikwidgets.widgets.widget import WidgetError
radio_groups = {}
class RadioButton(Widget):
required_states = ['selected', 'unselected']
optional_states = ['selected_and_disabled', 'unselected_and_disabled',
'selected_and_focused', 'unsel... | from sikwidgets.widgets.widget import Widget
from sikwidgets.widgets.widget import WidgetError
radio_groups = {}
class RadioButton(Widget):
required_states = ['selected', 'unselected']
optional_states = ['selected_and_disabled', 'unselected_and_disabled',
'selected_and_focused', 'unsel... | mit | Python |
81a50c62189542534d4895165dd07ffda3c99a8e | make sub dir contains test data printed during testing multi_load | ssato/python-anyconfig,ssato/python-anyconfig | tests/api/load/multi_load/test_basics.py | tests/api/load/multi_load/test_basics.py | #
# Copyright (C) 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring
import pathlib
import unittest
import anyconfig.api._load as TT
from .common import RES_DIR
def datasets_itr():
for rdir in pathlib.Path(RES_DIR / 'multi').glob('*'):
if not rdir.is_dir():
... | #
# Copyright (C) 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring
import pathlib
import unittest
import anyconfig.api._load as TT
from .common import RES_DIR
def datasets_itr():
for rdir in pathlib.Path(RES_DIR / 'multi').glob('*'):
if not rdir.is_dir():
... | mit | Python |
ac0ccf268a29259f9dce1bea013afc9b4d6c7a8c | Bump to 0.1.1-dev | axiom-data-science/modflow2netcdf | modflow2netcdf/__init__.py | modflow2netcdf/__init__.py | __version__ = '0.1.1-dev'
# Package level logger
import logging
try:
# Python >= 2.7
from logging import NullHandler
except ImportError:
# Python < 2.7
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger("modflow")
logger.addHandler(logging.Nu... | __version__ = '0.1.0'
# Package level logger
import logging
try:
# Python >= 2.7
from logging import NullHandler
except ImportError:
# Python < 2.7
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger("modflow")
logger.addHandler(logging.NullHa... | mit | Python |
ac8ba093907c3b4dee111b582bbf224cdfa18094 | add information about method execution in the empty_class example | guiniol/py3status,alexoneill/py3status,vvoland/py3status,guiniol/py3status,tobes/py3status,valdur55/py3status,goto-bus-stop/py3status,jantuomi/py3status,Spirotot/py3status,tobes/py3status,ultrabug/py3status,Andrwe/py3status,ultrabug/py3status,hburg1234/py3status,valdur55/py3status,schober-ch/py3status,valdur55/py3statu... | examples/empty_class.py | examples/empty_class.py | class Py3status:
"""
Empty and basic py3status class.
NOTE: py3status will NOT execute :
- methods starting with '_'
- methods decorated by @property and @staticmethod
"""
def empty(self, json, i3status_config):
"""
This method will return an empty text message, so i... | class Py3status:
"""
Empty and basic py3status class
"""
def empty(self, json, i3status_config):
"""
This method will return an empty text message, so it will NOT be displayed.
If you want something displayed you should write something in the 'full_text' key of your response.
... | bsd-3-clause | Python |
47362081224d1b9855648c7fcbd50a3d8037e1cc | Fix python lint in the spark pmml example (#1567) | kubeflow/kfserving-lts,kubeflow/kfserving-lts,kubeflow/kfserving-lts,kubeflow/kfserving-lts,kubeflow/kfserving-lts,kubeflow/kfserving-lts | docs/samples/v1beta1/spark/sparkml.py | docs/samples/v1beta1/spark/sparkml.py | from pyspark.sql import SparkSession
from pyspark.ml import Pipeline
from pyspark.ml.classification import DecisionTreeClassifier
from pyspark.ml.feature import RFormula
from pyspark2pmml import PMMLBuilder
spark = SparkSession.builder.appName('SparkByExamples.com').getOrCreate()
df = spark.read.csv("Iris.csv", header... | from pyspark.ml import Pipeline
from pyspark.ml.classification import DecisionTreeClassifier
from pyspark.ml.feature import RFormula
df = spark.read.csv("Iris.csv", header = True, inferSchema = True)
formula = RFormula(formula = "Species ~ .")
classifier = DecisionTreeClassifier()
pipeline = Pipeline(stages = [formul... | apache-2.0 | Python |
bc7b1fc053150728095ec5d0a41611aa4d4ede45 | Remove JWT_AUTH check from settings | City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi | kerrokantasi/settings/__init__.py | kerrokantasi/settings/__init__.py | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
settings['CKEDITOR_CONFIGS'] = {
'default': {
'stylesSet': [
{
"name": 'Lead',
... | from .util import get_settings, load_local_settings, load_secret_key
from . import base
settings = get_settings(base)
load_local_settings(settings, "local_settings")
load_secret_key(settings)
if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi":
raise ValueError("Refusing to run o... | mit | Python |
c0fc60aa5fd51ac9a5795017fdc57d5b89b300e7 | Add comments + return 1 if inconsistencies found | YunoHost/yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost | tests/check_locale_format_consistency.py | tests/check_locale_format_consistency.py | import re
import json
import glob
# List all locale files (except en.json being the ref)
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
locale_files.remove("en.json")
reference = json.loads(open(locale_folder + "en... | import re
import json
import glob
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
locale_files.remove("en.json")
reference = json.loads(open(locale_folder + "en.json").read())
for locale_file in locale_files:
... | agpl-3.0 | Python |
b12c4706a755aba0788e01b5b17af8d3193b8524 | Fix time import | BrodaNoel/bropy,BrodaNoel/bropy | modules/camera/core/get.py | modules/camera/core/get.py | import picamera
import os
import time
folder = os.path.dirname(os.path.realpath(__file__)) + '/../internals'
camera = picamera.PiCamera()
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 50
camera.saturation = 0
camera.ISO = 0
camera.video_stabilization = False
camera.exposure_compensation = 0
camera.expo... | import picamera
import os
folder = os.path.dirname(os.path.realpath(__file__)) + '/../internals'
camera = picamera.PiCamera()
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 50
camera.saturation = 0
camera.ISO = 0
camera.video_stabilization = False
camera.exposure_compensation = 0
camera.exposure_mode = ... | mit | Python |
a81135a4c0f2138f0d86d904c9706e4720b5a65a | refactor example gear.py | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/render/gear.py | examples/render/gear.py | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf.render.forms import gear
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# This exa... | from pathlib import Path
import ezdxf
from ezdxf.render.forms import gear
DIR = Path("~/Desktop/Outbox").expanduser()
doc = ezdxf.new()
msp = doc.modelspace()
msp.add_lwpolyline(
gear(16, top_width=1, bottom_width=3, height=2, outside_radius=10),
close=True,
)
doc.saveas(DIR / "gear.dxf")
| mit | Python |
eb955e2e6f8b16ed66889784a04693d4f4133f14 | remove repeated code | nsi-iff/nsi_site,nsi-iff/nsi_site,nsi-iff/nsi_site | apps/members/models.py | apps/members/models.py | from django.db import models
from django.template.defaultfilters import slugify
from thumbs import ImageWithThumbsField
from apps.projects.models import Project
MEMBER_FUNCTIONS = (
('0', 'gerente'),
('1', 'coordenador'),
('2', 'pesquisador'),
('3', 'bolsista'),
('4', 'colaborador'))
class Parti... | from django.db import models
from django.template.defaultfilters import slugify
from thumbs import ImageWithThumbsField
from apps.projects.models import Project
MEMBER_FUNCTIONS = (
('0', 'gerente'),
('1', 'coordenador'),
('2', 'pesquisador'),
('3', 'bolsista'),
('4', 'colaborador'))
class Parti... | mit | Python |
2134191df334394450d5cae1a5437c366034dc44 | Remove the DBSprockets dep | pombredanne/moksha,ralphbean/moksha,lmacken/moksha,pombredanne/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,mokshaproject/moksha,mokshaproject/moksha,ralphbean/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha | moksha/controllers/secc.py | moksha/controllers/secc.py | # This file is part of Moksha.
#
# Moksha is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Moksha is distributed in the hope that i... | # This file is part of Moksha.
#
# Moksha is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Moksha is distributed in the hope that i... | apache-2.0 | Python |
36a6fa773f7ccf5d80468de3f61af9b4654454ed | Update temperature.py | Koheron/lase | examples/temperature.py | examples/temperature.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import csv
import time
from scipy import signal
from lase.core import KClient, ZynqSSH
from lase.drivers import Oscillo
# Load the oscillo instrument
host = os.getenv('HOST','192.1... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import csv
import time
from scipy import signal
from lase.core import KClient, ZynqSSH
from lase.drivers import Oscillo
host = os.getenv('HOST','192.168.1.12')
password = os.getenv... | mit | Python |
4b13e2012e15e898ec3d46cf6723c9429e09e36f | Delete invalidate views in l10n_cr_hr_payroll | ClearCorp-dev/odoo-costa-rica,ClearCorp/odoo-costa-rica | l10n_cr_hr_payroll/__openerp__.py | l10n_cr_hr_payroll/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | agpl-3.0 | Python |
dc90a7d26fede0768b2aa91fbcacdd32c765a99a | test for aliases using TicksLeft which is a documented alias | spyder-ide/qtpy | qtpy/tests/test_qtwidgets.py | qtpy/tests/test_qtwidgets.py | """Test QtWidgets."""
import pytest
from qtpy import PYQT5, PYQT_VERSION, QtWidgets
def test_qtextedit_functions():
"""Test functions mapping for QtWidgets.QTextEdit."""
assert QtWidgets.QTextEdit.setTabStopWidth
assert QtWidgets.QTextEdit.tabStopWidth
assert QtWidgets.QTextEdit.print_
def test_qpl... | """Test QtWidgets."""
import pytest
from qtpy import PYQT5, PYQT_VERSION, QtWidgets
def test_qtextedit_functions():
"""Test functions mapping for QtWidgets.QTextEdit."""
assert QtWidgets.QTextEdit.setTabStopWidth
assert QtWidgets.QTextEdit.tabStopWidth
assert QtWidgets.QTextEdit.print_
def test_qpl... | mit | Python |
1c5f8dd968b8d94c381af92848bbd405fb197d26 | Update plug-in configuration | khalim19/gimp-plugin-export-layers,khalim19/gimp-plugin-export-layers | export_layers/config.py | export_layers/config.py | # -*- coding: utf-8 -*-
#
# This file is part of Export Layers.
#
# Copyright (C) 2013-2015 khalim19 <khalim19@gmail.com>
#
# Export Layers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | #
# This file is part of Export Layers.
#
# Copyright (C) 2013-2015 khalim19 <khalim19@gmail.com>
#
# Export Layers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | bsd-3-clause | Python |
9e7731fc1dd85d1cc0f451caadc948d777994623 | Fix small refactoring regression with Sanankou and closed kans | MahjongRepository/mahjong | mahjong/hand_calculating/yaku_list/sanankou.py | mahjong/hand_calculating/yaku_list/sanankou.py | # -*- coding: utf-8 -*-
from mahjong.hand_calculating.yaku import Yaku
from mahjong.utils import is_chi, is_pon
from mahjong.meld import Meld
class Sanankou(Yaku):
"""
Three closed pon sets, the other sets need not to be closed
"""
def set_attributes(self):
self.yaku_id = 29
self.name... | # -*- coding: utf-8 -*-
from mahjong.hand_calculating.yaku import Yaku
from mahjong.utils import is_chi, is_pon
from mahjong.meld import Meld
class Sanankou(Yaku):
"""
Three closed pon sets, the other sets need not to be closed
"""
def set_attributes(self):
self.yaku_id = 29
self.name... | mit | Python |
cb705d45f8a407d91716da3886db8d456b30aca6 | Add a few more tests for password strength and sensitivity MINIMUM_ZXCVBN_SCORE setting | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/domain/tests/test_password_strength.py | corehq/apps/domain/tests/test_password_strength.py | from django import forms
from django.test import SimpleTestCase, override_settings
from corehq.apps.domain.forms import clean_password
class PasswordStrengthTest(SimpleTestCase):
@override_settings(MINIMUM_ZXCVBN_SCORE=2)
def test_score_0_password(self):
self.assert_bad_password(PASSWORDS_BY_STRENGT... | from django import forms
from django.test import SimpleTestCase, override_settings
from corehq.apps.domain.forms import clean_password
class PasswordStrengthTest(SimpleTestCase):
@override_settings(MINIMUM_ZXCVBN_SCORE=2)
def test_score_0_password(self):
self.assert_bad_password(PASSWORDS_BY_STRENGT... | bsd-3-clause | Python |
029f738dc80c0635b43fcfbd0798284085e0a88f | fix usage of test table prefixing to use valid characters in dynamodb table name | globality-corp/microcosm-dynamodb | microcosm_dynamodb/factories.py | microcosm_dynamodb/factories.py | """
Factory that configures flywheel DynamoDB ORM-like framework.
"""
from os import environ
from flywheel import Engine
from microcosm.api import defaults
@defaults(
namespace='',
region=environ.get("AWS_DEFAULT_REGION"),
)
def configure_flywheel_engine(graph):
"""
Create the flywheel engine.
... | """
Factory that configures flywheel DynamoDB ORM-like framework.
"""
from os import environ
from flywheel import Engine
from microcosm.api import defaults
@defaults(
namespace='',
region=environ.get("AWS_DEFAULT_REGION"),
)
def configure_flywheel_engine(graph):
"""
Create the flywheel engine.
... | apache-2.0 | Python |
c3292f1f86cb0be80640b86d2474663fca1da968 | add missing import | cr33dog/pyxfce,cr33dog/pyxfce,cr33dog/pyxfce | netk/tests/testtrayicon.py | netk/tests/testtrayicon.py | #!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
label = gtk.Label("Boo!")
label.show()
ti = xfce4.netk.TrayIcon(gtk.gdk.screen_get_default())
ti.add(label)
ti.show()
gtk.main()
| #!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import xfce4
label = gtk.Label("Boo!")
label.show()
ti = xfce4.netk.TrayIcon(gtk.gdk.screen_get_default())
ti.add(label)
ti.show()
gtk.main()
| bsd-3-clause | Python |
875e9df7d59cbf8d504696b1eb906f4da0ffabc2 | Fix style in cooper test. | EmbodiedCognition/pagoda,EmbodiedCognition/pagoda | test/cooper_test.py | test/cooper_test.py | import pagoda.cooper
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def test_c3d(self):
self.markers.load_c3d('examples/co... | import pagoda.cooper
class Base(object):
def setUp(self):
self.world = pagoda.cooper.World()
class TestMarkers(Base):
def setUp(self):
super(TestMarkers, self).setUp()
self.markers = pagoda.cooper.Markers(self.world)
def test_c3d(self):
self.markers.load_c3d('examples/co... | mit | Python |
aab590ae2172b61ee5ea22ba93fcaf868a89ee1f | Save also chats in user store | alvarogzp/telegram-bot,alvarogzp/telegram-bot | bot/action/userinfo.py | bot/action/userinfo.py | from bot.action.core.action import Action
class SaveUserAction(Action):
def post_setup(self):
self.handler = UserStorageHandler(self.state)
def process(self, event):
message = event.message
self.save_user(message.from_)
self.save_user(message.forward_from)
self.save_us... | from bot.action.core.action import Action
class SaveUserAction(Action):
def post_setup(self):
self.handler = UserStorageHandler(self.state)
def process(self, event):
message = event.message
self.save_user(message.from_)
self.save_user(message.forward_from)
self.save_us... | agpl-3.0 | Python |
423dcb102fc2b7a1108a0b0fe1e116e8a5d451c9 | Add error message for malformed request | hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem | netsecus/korrekturtools.py | netsecus/korrekturtools.py | from __future__ import unicode_literals
import os
from . import helper
def readStatus(student):
student = student.lower()
if not os.path.exists("attachments"):
return
if not os.path.exists(os.path.join("attachments", student)):
return "Student ohne Abgabe"
if not os.path.exists(o... | from __future__ import unicode_literals
import os
def readStatus(student):
student = student.lower()
if not os.path.exists("attachments"):
return
if not os.path.exists(os.path.join("attachments", student)):
return "Student ohne Abgabe"
if not os.path.exists(os.path.join("attachment... | mit | Python |
c8b49a6a1003e16a748ddfd0b929760ab2b636a6 | fix tests for fixtures | nebril/fuel-web,AnselZhangGit/fuel-main,zhaochao/fuel-main,koder-ua/nailgun-fcert,zhaochao/fuel-main,Fiware/ops.Fuel-main-dev,ddepaoli3/fuel-main-dev,ddepaoli3/fuel-main-dev,teselkin/fuel-main,Fiware/ops.Fuel-main-dev,zhaochao/fuel-web,ddepaoli3/fuel-main-dev,stackforge/fuel-main,stackforge/fuel-web,huntxu/fuel-web,Sma... | nailgun/nailgun/test/test_fixture_uploading.py | nailgun/nailgun/test/test_fixture_uploading.py | # -*- coding: utf-8 -*-
import json
import logging
import unittest
import cStringIO
from nailgun.test.base import BaseHandlers
from nailgun.fixtures.fixman import upload_fixture
from nailgun.api.models import Release, Node
class TestFixture(BaseHandlers):
fixtures = ['sample_environment']
def test_upload_... | # -*- coding: utf-8 -*-
import json
import logging
import unittest
import cStringIO
from nailgun.test.base import BaseHandlers
from nailgun.fixtures.fixman import upload_fixture
from nailgun.api.models import Release, Node
class TestFixture(BaseHandlers):
fixtures = ['sample_environment']
def test_upload_... | apache-2.0 | Python |
776c03ef12ce23b69f22408db730ba8d1f90ddfe | Fix leaking DB sessions in host probe task | unikmhz/npui,unikmhz/npui,unikmhz/npui,unikmhz/npui | netprofile_devices/netprofile_devices/tasks.py | netprofile_devices/netprofile_devices/tasks.py | #!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Devices module - Tasks
# © Copyright 2016 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public... | #!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Devices module - Tasks
# © Copyright 2016 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public... | agpl-3.0 | Python |
c88789847a9bf604d897f4b469a3585347fef3f9 | Fix another typo in migration | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/migrate/2819_clean_unused_license_data/operations.py | portality/migrate/2819_clean_unused_license_data/operations.py | def clean(record):
if record.bibjson().get_journal_license():
record.bibjson().remove_journal_licences()
return record
| def clean(record):
if record.bibjson().get_journal_license():
record.bibjson().remove_journal_license()
return record
| apache-2.0 | Python |
99e8487085a506c5296cd2058adc928ca6bab9c3 | fix merge | RoboJackets/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software | soccer/gameplay/tests/test_circle_near_ball.py | soccer/gameplay/tests/test_circle_near_ball.py | import unittest
import main
import behavior
import robocup
import standard_play
import play
import math
import tactics.stopped.circle_near_ball
import constants
class Moc_Ball:
def __init__(self, x, y):
self.pos = robocup.Point(x, y)
class TestCircleNearBall(unittest.TestCase):
def __init__(self, *args, **kwargs)... | import unittest
import main
import behavior
import robocup
import standard_play
import play
import math
import tactics.stopped.circle_near_ball
import constants
class Moc_Ball:
def __init__(self, x, y):
self.pos = robocup.Point(x, y)
class TestCircleNearBall(unittest.TestCase):
def __init__(self, *args, **kwargs)... | apache-2.0 | Python |
4dd4415251f2f690c52154bbfabaa77e756058d8 | update code etticet | MoonShineVFX/core,getavalon/core,mindbender-studio/core,MoonShineVFX/core,mindbender-studio/core,getavalon/core | mindbender/maya/pythonpath/mayafpsconverter.py | mindbender/maya/pythonpath/mayafpsconverter.py | def mayafpsconverter(Sfps):
condition = 0
if Sfps == "":
condition = 1
return Sfps
if Sfps == "15":
condition = 1
return "game"
if Sfps == "24":
condition = 1
return "film"
if Sfps == "25":
condition = 1
return "pal"
if Sfps == "30"... | def mayafpsconverter(Sfps):
condition = 0
if Sfps == "":
condition = 1
return Sfps
if Sfps == "15":
condition = 1
return "game"
if Sfps == "24":
condition = 1
return "film"
if Sfps == "25":
condition = 1
return "pal"
if Sfps == "30"... | mit | Python |
fb53a273913b22853c4d348c0c13b6b3c063b8af | Change import *. | alanjds/django_object_permissions,alanjds/django_object_permissions,osuosl/django_object_permissions,osuosl/django_object_permissions | object_permissions/urls.py | object_permissions/urls.py | import os
from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('object_permissions.views.groups',
# Groups
url(r'^groups/$', 'list', name="usergroup-list"),
url(r'^group/?$', 'detail', name="usergroup"),
url(r'^group/(?P<id>\d+)/?$', 'detail', name="usergroup-detail"),
url(r'... | import os
from django.conf.urls.defaults import *
urlpatterns = patterns('object_permissions.views.groups',
# Groups
url(r'^groups/$', 'list', name="usergroup-list"),
url(r'^group/?$', 'detail', name="usergroup"),
url(r'^group/(?P<id>\d+)/?$', 'detail', name="usergroup-detail"),
url(r'^group/(?P<i... | mit | Python |
2f984f7beec07ed25c58a7792a2711a0d357fd90 | Correct prerequisites | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/portal/migrations/0010_add_precomputed_rna_type.py | rnacentral/portal/migrations/0010_add_precomputed_rna_type.py | from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_add_precomputed_rna_table'),
]
operations = [
# rna_type is a / seperated field that represents the set of rna_types
# for a ... | from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('portal', '0009_add_precomputed_rna_table'),
]
operations = [
# rna_type is a / seperated field that represents the set of rna_types
# for a ... | apache-2.0 | Python |
00a8ea05c6bd16156c703eb8c34f10bf7727acf9 | add tilt fixes, normalize names | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | lg_navlib/scripts/navtransform.py | lg_navlib/scripts/navtransform.py | mport math
import rospy
from geometry_msgs.msg import Twist, PoseStamped
class NavTransform(object):
""" transform twist messages """
def __init__(self):
self.node = rospy.init_node('navtransform')
self.puber = rospy.Publisher('/navtransform/twist', Twist, queue_size=10)
self.sub_twist... | #!/usr/bin/python3
# import time, tracback
import math
import rospy
from geometry_msgs.msg import Twist, PoseStamped
class MultiPanFix(object):
""" emit /lg_navlib/twist messages with 'pan x' where 'zoom' detected """
def __init__(self):
self.node = rospy.init_node('zoom_panner')
self.puber =... | apache-2.0 | Python |
54cdab911d18c173c388e2536dca3518a5dc775f | Document rubric functions | pombredanne/discern,pombredanne/discern,pombredanne/discern,pombredanne/discern | examples/problem_grader/grader/rubric_functions.py | examples/problem_grader/grader/rubric_functions.py | from models import Rubric, RubricOption
import logging
log = logging.getLogger(__name__)
def get_rubric_data(problem_id, target_scores = None):
"""
Retrieve the local rubric that is associated with a given api problem
problem_id - the id of the problem object that the rubric is associated with
target_... | from models import Rubric, RubricOption
import logging
log = logging.getLogger(__name__)
def get_rubric_data(problem_id, target_scores = None):
rubric = Rubric.objects.filter(associated_problem=int(problem_id))
rubric_dict = []
if rubric.count()>=1:
rubric = rubric[0]
rubric_dict = rubric.... | agpl-3.0 | Python |
7bc162d24e773d1a85746c496c2ab30f1f8428eb | test of arctan error func | OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic | ogusa/tests/test_income.py | ogusa/tests/test_income.py | '''
Tests of income.py module
'''
import pytest
import numpy as np
from ogusa import income
def test_artctan_func():
'''
Test of arctan_func()
'''
expected_vals = np.array([0.14677821, 0.083305594, 0.057901228])
xvals = np.array([1, 2, 3])
a = 1.3
b = 2.2
c = 0.5
test_vals = incom... | '''
Tests of income.py module
'''
import pytest
import numpy as np
from ogusa import income
def test_artctan_func():
'''
Test of arctan_func()
'''
expected_vals = np.array([0.14677821, 0.083305594, 0.057901228])
xvals = np.array([1, 2, 3])
a = 1.3
b = 2.2
c = 0.5
test_vals = incom... | mit | Python |
3679f1fc51e7ab0c12021c978f46eff6260ae3ce | Simplify csv parsing | albertyw/csv-to-ical | convert.py | convert.py | """
This file reads the CSV file and saves an ical file.
There are a bunch of configurable variables
"""
import csv
from icalendar import Calendar, Event
class ConvertCSVToICal():
def __init__(self):
self.CSV_FILE_LOCATION = None
self.SAVE_LOCATION = None
self.HEADER_COLUMNS_TO_SKIP = 0
... | """
This file reads the CSV file and saves an ical file.
There are a bunch of configurable variables
"""
import csv
from icalendar import Calendar, Event
class ConvertCSVToICal():
def __init__(self):
self.CSV_FILE_LOCATION = None
self.SAVE_LOCATION = None
self.HEADER_COLUMNS_TO_SKIP = 0
... | mit | Python |
85276a1e71b86af877e9c7e6160306f026137be8 | Apply @jaimergp's re-wording suggestion. | openforcefield/openff-toolkit,open-forcefield-group/openforcefield,openforcefield/openff-toolkit,open-forcefield-group/openforcefield,open-forcefield-group/openforcefield | openforcefield/__init__.py | openforcefield/__init__.py | import warnings
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
warnings.warn(
"Importing this package as `import openforcefield.XXX` and "
"`from openforcefield import XXX` was marked for deprecation in version `0.8.3`. From version "
"`0.9.0` onwards this pa... | import warnings
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
warnings.warn(
"Importing this package as `import openforcefield.XXX` and "
"`from openforcefield import XXX` was deprecated in version `0.8.3`. From version "
"`0.9.0` onwards this package will n... | mit | Python |
23f078d83abe680e9bdba442bf2767c127d48440 | Use plist from pkg in launchd runner. | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/runners/launchd.py | salt/runners/launchd.py | # -*- coding: utf-8 -*-
'''
Manage launchd plist files
'''
from __future__ import absolute_import
# Import python libs
import os
import sys
def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd... | # -*- coding: utf-8 -*-
'''
Manage launchd plist files
'''
from __future__ import absolute_import
# Import python libs
import os
import sys
def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd... | apache-2.0 | Python |
e0c7264ff0671477169cd9932d2747478bdf8f17 | Support overwriting cookie and config paths: 1. if cookie file (.xunlei.lixian.cookies) or config file (.xunlei.lixian.config) exists in current path, use it, otherwise... 2. if LIXIAN_HOME environment variable is set, use $LIXIAN_HOME/.xunlei.lixian.cookies for cookie file, and $LIXIAN_HOME/.xunlei.lixian.config for c... | liujianpc/xunlei-lixian,windygu/xunlei-lixian,wogong/xunlei-lixian,GeassDB/xunlei-lixian,ccagg/xunlei,wangjun/xunlei-lixian,xieyanhao/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,iambus/xunlei-lixian,myself659/xunlei-lixian,sndnvaps/xunlei-lixian,davies/xunlei-lixian | lixian_config.py | lixian_config.py |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') or user_home
return os.path.join(lixian_home, filename)
LIXIAN_DEFAULT_CONFIG = get_config_path('.xunlei.lixian.c... |
import os
LIXIAN_DEFAULT_CONFIG = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.config')
LIXIAN_DEFAULT_COOKIES = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.cookies')
def load_config(path):
values = {}
if os.path.exists(path):
with open(path) as x:
... | mit | Python |
0e2e30e3009a649a68a09a77cc48354628848374 | Add a restriction on number of players to the evaluator. | deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel | open_spiel/python/algorithms/alpha_zero/evaluator.py | open_spiel/python/algorithms/alpha_zero/evaluator.py | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | apache-2.0 | Python |
3cbc3b96d3f91c940c5d762ce08da9814c29b04d | Revert "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols" | roambotics/swift,glessard/swift,ahoppen/swift,roambotics/swift,apple/swift,roambotics/swift,gregomni/swift,ahoppen/swift,JGiola/swift,JGiola/swift,apple/swift,gregomni/swift,benlangmuir/swift,gregomni/swift,glessard/swift,atrick/swift,benlangmuir/swift,ahoppen/swift,atrick/swift,benlangmuir/swift,gregomni/swift,atrick/... | utils/gyb_syntax_support/protocolsMap.py | utils/gyb_syntax_support/protocolsMap.py | SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = {
'ExpressibleAsConditionElement': [
'ExpressibleAsConditionElementList'
],
'ExpressibleAsDeclBuildable': [
'ExpressibleAsCodeBlockItem',
'ExpressibleAsMemberDeclListItem',
'ExpressibleAsSyntaxBuildable'
],
'ExpressibleAs... | SYNTAX_BUILDABLE_EXPRESSIBLE_BY_CONFORMANCES = {
'ExpressibleByConditionElement': [
'ExpressibleByConditionElementList'
],
'ExpressibleByDeclBuildable': [
'ExpressibleByCodeBlockItem',
'ExpressibleByMemberDeclListItem',
'ExpressibleBySyntaxBuildable'
],
'ExpressibleBy... | apache-2.0 | Python |
bea54646bb1af09f8e7d746a1929b2b1735341c0 | Add an unarchiver | nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN,nushio3/UFCORIN | script/unarchive-forecast.py | script/unarchive-forecast.py | #!/usr/bin/env python3
import astropy.time as time
import datetime, os,math,sys
import pickle
import subprocess
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
class Forecast:
pass
for fn in sys.argv:
with open(fn,"rb") as fp:
forecast = pickl... | #!/usr/bin/env python3
import pickle
import sys
class Forecast:
pass
for fn in sys.argv:
with open(fn,"rb") as fp:
forecast = pickle.load(fp)
print(dir(forecast))
| mit | Python |
8df7706816e6b50bfa8605552c71e03b2d1ef18a | update model name in second migration | gustavrannestig/otp_twilio_encrypted,prototypsthlm/otp_twilio_encrypted | otp_twilio_encrypted/migrations/0002_last_t.py | otp_twilio_encrypted/migrations/0002_last_t.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('otp_twilio_encrypted', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='twiliosmsdevice',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('otp_twilio_encrypted', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='encryptedtwiliosmsdevi... | bsd-2-clause | Python |
1b3f97ff7bc219588b94a2346ac91f10203e44b9 | Add report file deployment to init | Empiria/matador | matador/commands/deployment/__init__.py | matador/commands/deployment/__init__.py | from .deploy_sql_script import DeploySqlScript, DeployOraclePackage
from .deploy_report import DeployExceleratorReport, DeployReportFile
| from .deploy_sql_script import DeploySqlScript, DeployOraclePackage
from .deploy_report import DeployExceleratorReport
| mit | Python |
5687760b4ba77fe5d5492479d32ca93d3bdb568d | Fix how base_url is determined to handle root location | origingod/hug,jean/hug,giserh/hug,MuhammadAlkarouri/hug,philiptzou/hug,gbn972/hug,STANAPO/hug,shaunstanislaus/hug,MuhammadAlkarouri/hug,alisaifee/hug,yasoob/hug,STANAPO/hug,yasoob/hug,gbn972/hug,MuhammadAlkarouri/hug,janusnic/hug,janusnic/hug,origingod/hug,timothycrosley/hug,shaunstanislaus/hug,alisaifee/hug,giserh/hug... | hug/run.py | hug/run.py | """hug/run.py
Contains logic to enable execution of hug APIS from the command line
"""
from wsgiref.simple_server import make_server
import json
import falcon
import sys
import importlib
from collections import namedtuple, OrderedDict
from hug import documentation
def documentation_404(module):
def handle_404(r... | """hug/run.py
Contains logic to enable execution of hug APIS from the command line
"""
from wsgiref.simple_server import make_server
import json
import falcon
import sys
import importlib
from collections import namedtuple, OrderedDict
from hug import documentation
def documentation_404(module):
def handle_404(re... | mit | Python |
af8e7c69162e2ffd9ba75412a13214ec5743354e | ADD created_at at grid/user models | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/grid/api/users/models.py | packages/grid/backend/grid/api/users/models.py | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | apache-2.0 | Python |
5a8efb33a4413e5d8f9847ee9385caa39119d403 | introduce the same behavior than 8.0 | JayVora-SerpentCS/server-tools,JayVora-SerpentCS/server-tools | base_optional_quick_create/models/ir_model.py | base_optional_quick_create/models/ir_model.py | # -*- coding: utf-8 -*-
# © 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2016 ACSONE SA/NA (<http://acsone.eu>)
from openerp import api, fields, models
from openerp.exceptions import Warning
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class IrModel(models.Model):
_inhe... | # -*- coding: utf-8 -*-
# © 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2016 ACSONE SA/NA (<http://acsone.eu>)
from openerp import api, fields, models
from openerp.exceptions import Warning
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class IrModel(models.Model):
_inhe... | agpl-3.0 | Python |
f132bed31cbe9e8e922c0f90b6c8b43188faa096 | Replace THP-related startup error message | migue/voltdb,creative-quant/voltdb,deerwalk/voltdb,ingted/voltdb,kumarrus/voltdb,paulmartel/voltdb,ingted/voltdb,creative-quant/voltdb,flybird119/voltdb,VoltDB/voltdb,paulmartel/voltdb,flybird119/voltdb,migue/voltdb,zuowang/voltdb,creative-quant/voltdb,simonzhangsm/voltdb,kumarrus/voltdb,kumarrus/voltdb,paulmartel/volt... | lib/python/voltcli/checkconfig.py | lib/python/voltcli/checkconfig.py | # This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# This file contains original code and/or modifications of original code.
# Any modifications made by VoltDB Inc. are licensed under the following
# terms and conditions:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a... | # This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# This file contains original code and/or modifications of original code.
# Any modifications made by VoltDB Inc. are licensed under the following
# terms and conditions:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a... | agpl-3.0 | Python |
2870aa3aa2999955a4420aefb2f360731880762d | Handle localized directory name | alexey4petrov/reinteract,alexey4petrov/reinteract,alexey4petrov/reinteract | lib/reinteract/global_settings.py | lib/reinteract/global_settings.py | # Copyright 2008-2009 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
#
# This module holds preferences and options tha... | # Copyright 2008-2009 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
#
# This module holds preferences and options tha... | bsd-2-clause | Python |
7dea8bd4855c5bc4090f036c5246d5cb8a66e2b0 | Return None if there is no question | praekelt/molo.polls,praekelt/molo.polls | molo/polls/templatetags/poll_votings.py | molo/polls/templatetags/poll_votings.py |
from copy import copy
from django import template
from molo.polls.models import Question, Choice, PollsIndexPage
from molo.core.templatetags.core_tags import get_pages
register = template.Library()
@register.inclusion_tag('polls/poll_page.html',
takes_context=True)
def poll_page(context, ... |
from copy import copy
from django import template
from molo.polls.models import Question, Choice, PollsIndexPage
from molo.core.templatetags.core_tags import get_pages
register = template.Library()
@register.inclusion_tag('polls/poll_page.html',
takes_context=True)
def poll_page(context, ... | bsd-2-clause | Python |
4b334827dbe5bcd0e9ab01eba8ecd1015a725bc2 | create the mock objects needed to test the CloudFactory celery tasks without actually hitting their API (these are unit tests, after all) | ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM | myhpom/tests/test_cloudfactory_tasks.py | myhpom/tests/test_cloudfactory_tasks.py |
import os
import random
import requests.models
from mock import MagicMock
from django.test import TestCase
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.timezone import now
from myhpom.tests.factories import UserFactory
from myhpom.models import CloudF... |
from django.test import TestCase
class CloudFactorySubmitAdvanceDirectiveTaskTestCase(TestCase):
"""In the task:
* submitting a run with valid data to CloudFactory returns 201 and run object with expected vals
* various situations that raise exceptions in the task:
* the AdvanceDirective id that ... | bsd-3-clause | Python |
d5751122f4895867b1b1a6227df758e79b21afea | fix test_text tests | spaam/svtplay-dl,spaam/svtplay-dl | lib/svtplay_dl/tests/test_text.py | lib/svtplay_dl/tests/test_text.py | #!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et:fenc=utf-8
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
import pathlib
import unittest
from svtplay_dl.utils.parser import setup_defaults
from svtplay_dl.utils.text import decode_html_entities
from svtplay_dl.utils.text import ensure_uni... | #!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et:fenc=utf-8
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
import unittest
from svtplay_dl.utils.parser import setup_defaults
from svtplay_dl.utils.text import decode_html_entities
from svtplay_dl.utils.text import ensure_unicode
from svtpl... | mit | Python |
6f4276c85c118d69e784e2eb256f1c2b180dae0b | remove old import | adrn/globber,adrn/globber | scripts/deredden-ps1.py | scripts/deredden-ps1.py | """ Write out a binary file containing the PS1 data with dereddened photometry """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import astropy.coordinates as coord
import astropy.table as table
import astropy.units as u
impo... | """ Write out a binary file containing the PS1 data with dereddened photometry """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import sys
# Third-party
import astropy.coordinates as coord
import astropy.table as table
import astropy.unit... | mit | Python |
c937211250efdbee37c706a3caa7ef6297f20e75 | update templates | raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd,raonyguimaraes/mendelmd | mendelmd/urls.py | mendelmd/urls.py | from django.conf.urls import *
from django.contrib import admin
from django.views.generic import TemplateView
admin.autodiscover()
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
# Examples:
# url(r'^$', 'mendelmd.views.home', name='home'),
... | from django.conf.urls import *
from django.contrib import admin
from django.views.generic import TemplateView
admin.autodiscover()
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
# Examples:
# url(r'^$', 'mendelmd.views.home', name='home'),
... | bsd-3-clause | Python |
7ea03c6ded823458d7159c05f89d99ee3c4a2e42 | Tweak import statement to satisfy presubmit checks. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/tools/botmap.py | scripts/tools/botmap.py | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Dumps a list of known slaves, along with their OS and master."""
import os
import sys
path = os.path.join(os.path.dirname(__fil... | #!/usr/bin/env python
import os
import sys
path = os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')
sys.path.append(path)
import chromium_utils
slaves = []
for master in chromium_utils.ListMasters():
masterbase = os.path.basename(master)
master_slaves = {}
execfile(os.path.join(master, 'slaves.c... | bsd-3-clause | Python |
f278a7cba5df2328de8fabcac35ad44365e4eedf | Add more tests | sebastinas/python-libdiscid,sebastinas/python-libdiscid | libdiscid/tests/test_libdiscid.py | libdiscid/tests/test_libdiscid.py | import unittest
import libdiscid
from libdiscid.discid import DiscError
class TestLibDiscId(unittest.TestCase):
def test_default_device(self):
self.assertTrue(libdiscid.DEFAULT_DEVICE is not None)
def test_features(self):
self.assertTrue(libdiscid.FEATURES is not None)
def test_read_fail(self):
sel... | import unittest
import libdiscid
from libdiscid.discid import DiscError
class TestLibDiscId(unittest.TestCase):
def test_default_device(self):
self.assertTrue(libdiscid.DEFAULT_DEVICE is not None)
def test_features(self):
self.assertTrue(libdiscid.FEATURES is not None)
def test_read_fail(self):
sel... | mit | Python |
2701be8429c68216e04bc6d1aa9d615c990eceaa | Use direct socket interface, not file-based hack | GENI-NSF/gram,GENI-NSF/gram,GENI-NSF/gram | src/gram/am/gram/compute_node_interface.py | src/gram/am/gram/compute_node_interface.py | #!/usr/bin/python
# class to allow invoking calls on remote compute nodes
# This file contains a client interface
# (to be called by GRAM on the control node)
# And a server interface
# (to be invoked in 'sudo' mode on each compute node
import SocketServer
import socket
import subprocess
import tempfile
import... | #!/usr/bin/python
# class to allow invoking calls on remote compute nodes
# This file contains a client interface
# (to be called by GRAM on the control node)
# And a server interface
# (to be invoked in 'sudo' mode on each compute node
import SocketServer
import socket
import subprocess
import tempfile
import... | mit | Python |
2b92f484e9c2554dedf18f9335e8537a561c73c7 | Add a lot more resiliancy/output to better_webbrowser.py. We now use webbrowser, but register a WindowsHttpDefault class | somehume/namebench | libnamebench/better_webbrowser.py | libnamebench/better_webbrowser.py | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | apache-2.0 | Python |
74ee207e56f905835bdcc6c9617a76a38b92eb16 | Update follow-sync.py | yjwx0017/test,yjwx0017/test,yjwx0017/test | python-codes/github-follow-sync/follow-sync.py | python-codes/github-follow-sync/follow-sync.py | #!/usr/bin/env python
# coding: utf-8
# GitHub
# Follow我的, Follow之
# 未Follow我的,从Following中删除之
# 即同步互Follow关系
import getpass
from github import Github
from github import PaginatedList
from github import NamedUser
# 始终Follow
ALWAYS_FOLLOW = [
'torvalds',
'jiangdon2007',
'michaelliao',
'zcbenz',
'r... | # /usr/bin/env python
# coding: utf-8
# GitHub
# Follow我的, Follow之
# 未Follow我的,从Following中删除之
# 即同步互Follow关系
import getpass
from github import Github
from github import PaginatedList
from github import NamedUser
# 始终Follow
ALWAYS_FOLLOW = [
'torvalds',
'jiangdon2007',
'michaelliao',
'zcbenz',
'r... | mit | Python |
22798719d6e8344cb56d263b2382c0895b8f89ee | Update community.py | hhkaos/developer-support,hhkaos/developer-support,bsnider/developer-support,hhkaos/developer-support,AkshayHarshe/developer-support,jgravois/developer-support,marlak/developer-support,briantwatson/developer-support,jgravois/developer-support,hhkaos/developer-support,briantwatson/developer-support,marlak/developer-suppo... | python/general-python/agol-helper/community.py | python/general-python/agol-helper/community.py | from agol import AGOL
class community(AGOL):
"""
Community object that contains operations related to users and groups, \
and inherits properties from the AGOL object.
"""
def groupSearch(self):
"""
The Group Search operation searches for groups in the portal:
http://resour... | from agol import AGOL
class community(AGOL):
"""Community object, that inherits properties from the AGOL object."""
def groupSearch(self):
"""The Group Search operation searches for groups in the portal:
http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000m1000000"""
... | apache-2.0 | Python |
8715f8eac507e3bcf388c901fac0df8f9c8dae11 | add manager service for bluetooth | librallu/cohorte-herald,librallu/cohorte-herald,librallu/cohorte-herald | python/herald/transports/bluetooth/__init__.py | python/herald/transports/bluetooth/__init__.py | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald Bluetooth transport implementation
:author: Luc Libralesso
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "Licen... | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald Bluetooth transport implementation
:author: Luc Libralesso
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "Licen... | apache-2.0 | Python |
bfb1aa5317cd145993cedda3752f147239e718a1 | Add second head variable | derekmpham/interview-prep,derekmpham/interview-prep | linked-list/is-list-palindrome.py | linked-list/is-list-palindrome.py | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if not l.value or not l.next.value:
return True
fake_head = Node(None)
fake_head.next = l
f... | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if not l.value or not l.next.value:
return True
fake_head = Node(None)
fake_head.next = l
f... | mit | Python |
d583d6098daa2016caddd8b2abeeb675b6be6ad1 | Update credentials.py | ITHACA-org/gpm-accumul,ITHACA-org/gpm-accumul | gpm_repo/credentials.py | gpm_repo/credentials.py | user = 'username'
passwd = 'password'
DATADIR = '/path/to/the/gpm/data/directory'
| user = 'username'
passwd = 'password' | mit | Python |
99608789de2e09e5f27e415c66e3593a44db2e29 | Update credentials.py | ITHACA-org/gpm-accumul,ITHACA-org/gpm-accumul | gpm_repo/credentials.py | gpm_repo/credentials.py | user = 'username'
passwd = 'password'
DATADIR = '/path/to/the/gpm/data/directory'
THRESH_ADJ_ABSPATH = '/path/to/the/threshold/adjustment/raster'
THRESHOLDS_ABSPATH = '/path/to/the/threshold/values/file'
| user = 'username'
passwd = 'password'
DATADIR = '/path/to/the/gpm/data/directory'
| mit | Python |
f4f098e877e25cedbf380c76340f516783c29908 | clean up misc init | Redball45/Redball-Cogs | misc/__init__.py | misc/__init__.py | from .misc import misc
def setup(bot):
n = misc(bot)
bot.add_cog(n)
| from .misc import misc
import asyncio
def setup(bot):
n = misc(bot)
#loop = asyncio.get_event_loop()
#loop.create_task(n.gandarafullcheck())
bot.add_cog(n)
bot.add_listener(n.check_poll_votes, "on_message") | mit | Python |
f444303ce5c1fd274192dbc10e6783ddd601e0bd | Add new pygments (#25455) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pygments/package.py | var/spack/repos/builtin/packages/py-pygments/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 PyPygments(PythonPackage):
"""Pygments is a syntax highlighting package written in Python.... | # 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 PyPygments(PythonPackage):
"""Pygments is a syntax highlighting package written in Python.... | lgpl-2.1 | Python |
64b168625ebb5944b9b5990502580f09a6b06752 | use settings in conftest | linovia/cookiecutter-django-linovia | {{cookiecutter.repo_name}}/conftest.py | {{cookiecutter.repo_name}}/conftest.py | import os.path
from copy import copy
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def pytest_configure(config):
from django.conf import settings
if not settings.configured:
from {{cookiecutter.project_name}} import settings as {{cookiecutter.project_name}}_settings
default = copy({{... |
def pytest_configure(config):
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASE_ENGINE='sqlite3',
DATABASES={
'default': {
'NAME': ':memory:',
'ENGINE': 'django.db.backends.sqlite3',
... | mit | Python |
795bdf4c61ed6ed26a1cb72674398177788fe2ad | remove ford fingerprints (#23136) | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | selfdrive/car/ford/values.py | selfdrive/car/ford/values.py | # flake8: noqa
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
MAX_ANGLE = 87. # make sure we never command the extremes (0xfff) which cause latching fault
class CAR:
FUSION = "FORD FUSION 2018"
DBC = {
CAR.FUSION: dbc_dict('ford_fusion_2018_pt', 'ford_fusion_2018_adas'),
}
| # flake8: noqa
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
MAX_ANGLE = 87. # make sure we never command the extremes (0xfff) which cause latching fault
class CAR:
FUSION = "FORD FUSION 2018"
FINGERPRINTS = {
CAR.FUSION: [{
71: 8, 74: 8, 75: 8, 76: 8, 90: 8, 92: 8, 93: ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.