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 |
|---|---|---|---|---|---|---|---|---|
f276c840f2981ec2951e07c7b847f82811db0745 | Remove unnecessary None handling | dudymas/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,dudymas/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-opensta... | openstack/database/v1/user.py | openstack/database/v1/user.py | # 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, software
# distributed under t... | # 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, software
# distributed under t... | apache-2.0 | Python |
d1596872f11f95e406a6a3a97222e499abf4f222 | update plot_ts | johannfaouzi/pyts | examples/plot_ts.py | examples/plot_ts.py | """
======================
Plotting a time series
======================
Plotting a time series.
"""
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
# Parameters
n_samples = 100
n_features = 48
rng = np.random.RandomState(41)
delta = 0.5
dt = 1
# Generate a toy dataset
X = (norm.rvs(... | """
======================
Plotting a time series
======================
An example plot of `pyts.visualization.plot_ts`
"""
import numpy as np
from scipy.stats import norm
from pyts.visualization import plot_ts
# Parameters
n_samples = 100
n_features = 48
rng = np.random.RandomState(41)
delta = 0.5
dt = 1
# Genera... | bsd-3-clause | Python |
28e64a576a25b7fb41997da8ecfb4472d9adee38 | simplify main greenlet caching | teepark/greenhouse | greenhouse/compat.py | greenhouse/compat.py | import os
import sys
try:
from greenlet import greenlet, GreenletExit
except ImportError, error:
try:
from py.magic import greenlet
GreenletExit = greenlet.GreenletExit
except ImportError:
# suggest standalone greenlet, not the old py.magic.greenlet
raise error
__all__ = ["... | import os
import sys
try:
from greenlet import greenlet, GreenletExit
except ImportError, error:
try:
from py.magic import greenlet
GreenletExit = greenlet.GreenletExit
except ImportError:
# suggest standalone greenlet, not the old py.magic.greenlet
raise error
__all__ = ["... | bsd-3-clause | Python |
38989bf6e449bf2ada1ac4729564d9feacbc7b90 | use parseargs for cli processing | awynne/scripts | activity/activitylog.py | activity/activitylog.py | from peewee import *
from pprint import pprint
from copy import copy
import sys, os, inspect
import optparse
import argparse
db = SqliteDatabase('activitylog.db')
################
# Model classes
################
class BaseModel(Model):
is_abstract = BooleanField(default=False)
class Meta:
database ... | from peewee import *
from pprint import pprint
from copy import copy
import sys, getopt, os, inspect
db = SqliteDatabase('activitylog.db')
################
# Model classes
################
class BaseModel(Model):
is_abstract = BooleanField(default=False)
class Meta:
database = db
class NamedModel(B... | mit | Python |
4565c961eca6f0d904d010cbdbf3d42fe2a6080b | Add persistence test | seppo0010/rlite-py,seppo0010/rlite-py,pombredanne/rlite-py,pombredanne/rlite-py | test/rlite.py | test/rlite.py | # coding=utf-8
from unittest import *
import os.path
import sys
import hirlite
class RliteTest(TestCase):
def setUp(self):
self.rlite = hirlite.Rlite()
def test_none(self):
self.assertEquals(None, self.rlite.command('get', 'hello'))
def test_ok(self):
self.assertEquals(True, sel... | # coding=utf-8
from unittest import *
import hirlite
import sys
class RliteTest(TestCase):
def setUp(self):
self.rlite = hirlite.Rlite()
def test_none(self):
self.assertEquals(None, self.rlite.command('get', 'hello'))
def test_ok(self):
self.assertEquals(True, self.rlite.command(... | bsd-2-clause | Python |
18428461f230d7d57056bd1a6a0fc2a66cedb5f1 | increment version | albertfxwang/grizli | grizli/version.py | grizli/version.py | # git describe --tags
__version__ = "0.8.0-14-g548f692"
| # git describe --tags
__version__ = "0.8.0-10-g15486e6"
| mit | Python |
68eaa885e15b98bc05376d9ddca6926258be2c46 | make header fields with dates (e.g. last-modified) comparable | spaceone/httoop,spaceone/httoop,spaceone/httoop | httoop/header/conditional.py | httoop/header/conditional.py | # -*- coding: utf-8 -*-
from httoop.header.element import HeaderElement
class _DateComparable(object):
from httoop.date import Date
def sanitize(self):
self.value = self.Date.parse(self.value)
class ETag(HeaderElement):
pass
class LastModified(_DateComparable, HeaderElement):
__name__ = 'Last-Modified'
cl... | # -*- coding: utf-8 -*-
from httoop.header.element import HeaderElement
class ETag(HeaderElement):
pass
class LastModified(HeaderElement):
__name__ = 'Last-Modified'
class IfMatch(HeaderElement):
__name__ = 'If-Match'
class IfModifiedSince(HeaderElement):
__name__ = 'If-Modified-Since'
class IfNoneMatch(... | mit | Python |
82bc502cf7bb64236feba6e140d98bb9e555f4ca | Fix assert_raises for catching parents of exceptions. | rocky4570/moto,ZuluPro/moto,Affirm/moto,Affirm/moto,kefo/moto,botify-labs/moto,okomestudio/moto,spulec/moto,Affirm/moto,dbfr3qs/moto,okomestudio/moto,kefo/moto,heddle317/moto,whummer/moto,2rs2ts/moto,Brett55/moto,dbfr3qs/moto,ZuluPro/moto,kefo/moto,william-richard/moto,spulec/moto,spulec/moto,ZuluPro/moto,gjtempleton/m... | tests/backport_assert_raises.py | tests/backport_assert_raises.py | from __future__ import unicode_literals
"""
Patch courtesy of:
https://marmida.com/blog/index.php/2012/08/08/monkey-patching-assert_raises/
"""
# code for monkey-patching
import nose.tools
# let's fix nose.tools.assert_raises (which is really unittest.assertRaises)
# so that it always supports context management
# i... | from __future__ import unicode_literals
"""
Patch courtesy of:
https://marmida.com/blog/index.php/2012/08/08/monkey-patching-assert_raises/
"""
# code for monkey-patching
import nose.tools
# let's fix nose.tools.assert_raises (which is really unittest.assertRaises)
# so that it always supports context management
# i... | apache-2.0 | Python |
fc94bda4cb840b74fbd1226d69bf0aafc5e16e61 | return when not installed (#283) | cebrusfs/217gdb,cebrusfs/217gdb,0xddaa/pwndbg,0xddaa/pwndbg,cebrusfs/217gdb,pwndbg/pwndbg,disconnect3d/pwndbg,cebrusfs/217gdb,anthraxx/pwndbg,pwndbg/pwndbg,pwndbg/pwndbg,disconnect3d/pwndbg,anthraxx/pwndbg,anthraxx/pwndbg,disconnect3d/pwndbg,0xddaa/pwndbg,pwndbg/pwndbg,anthraxx/pwndbg,chubbymaggie/pwndbg,chubbymaggie/p... | pwndbg/commands/rop.py | pwndbg/commands/rop.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import re
import subprocess
import tempfile
import gdb
import pwndbg.commands
import pwndbg.vmmap
parser ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import re
import subprocess
import tempfile
import gdb
import pwndbg.commands
import pwndbg.vmmap
parser ... | mit | Python |
0a5b7c606a711307bdc41179cf94c0a72c15ee92 | Make BaseCommandTest automatically instantiate commands using decoration magic. | google/hypebot | hypebot/commands/hypetest.py | hypebot/commands/hypetest.py | # Copyright 2019 The Hypebot Authors. 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 applicabl... | # Copyright 2019 The Hypebot Authors. 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 applicabl... | apache-2.0 | Python |
6cef7f841fc34321d68e8c85ff7f78682c59eae2 | Add help and version text; check for IO errors | bdesham/py-chrome-bookmarks,bdesham/py-chrome-bookmarks,bdesham/py-chrome-bookmarks | py-chrome-bookmarks.py | py-chrome-bookmarks.py | #!/usr/bin/python
# py-chrome-bookmarks
#
# A script to convert Google Chrome's bookmarks file to the standard HTML-ish
# format.
#
# (c) Benjamin Esham, 2011. See the accompanying README for this file's
# license and other information.
import json, sys, os, re
# html escaping code from http://wiki.python.org/moin... | #!/usr/bin/python
# py-chrome-bookmarks
#
# A script to convert Google Chrome's bookmarks file to the standard HTML-ish
# format.
#
# (c) Benjamin Esham, 2011. See the accompanying README for this file's
# license and other information.
import json, sys, os, re
# html escaping code from http://wiki.python.org/moin... | isc | Python |
98467f55ef8526d343065da7d6a896b16539fa53 | use consistent hash for etag | sseg/hello_world | http_agent/utils/etag.py | http_agent/utils/etag.py | from zlib import adler32
def make_entity_tag(body):
checksum = adler32(body.encode())
return '"{checksum}"'.format(checksum=checksum)
| def make_entity_tag(body):
checksum = hash(body) + (1 << 64)
return '"{checksum}"'.format(checksum=checksum)
| bsd-3-clause | Python |
ec668c693051f70026360ac2f3bc67ced6c01a21 | fix little bug | shananin/fb_messenger | src/fb_messenger/test/test_attachements.py | src/fb_messenger/test/test_attachements.py | import unittest
class FirstTest(unittest.TestCase):
def test_first(self):
self.assertEqual(True, True, 'incorrect types')
| import unittest
class FirstTest(unittest.TestCase):
def test_first(self):
self.assertEqual(True, False, 'incorrect types')
| mit | Python |
4979e8e5ee8ac6cb86ab260f44f052b27381eeb6 | bump version | weikang9009/giddy,pysal/giddy,sjsrey/giddy | giddy/__init__.py | giddy/__init__.py | __version__ = "2.0.0"
# __version__ has to be defined in the first line
"""
:mod:`giddy` --- Spatial Dynamics and Mobility
==============================================
"""
from . import directional
from . import ergodic
from . import markov
from . import mobility
from . import rank
from . import util | __version__ = "1.2.0"
# __version__ has to be defined in the first line
"""
:mod:`giddy` --- Spatial Dynamics and Mobility
==============================================
"""
from . import directional
from . import ergodic
from . import markov
from . import mobility
from . import rank
from . import util | bsd-3-clause | Python |
522906d2842d90722776f898015fde060c967401 | Update cam.py | tcwissemann/pyCam | pyCam/build_0.3/cam.py | pyCam/build_0.3/cam.py | import cv2
import numpy as np
from twilio.rest import TwilioRestClient
import time
#importing modules ^^
body_cascade = cv2.CascadeClassifier('haarcascade_fullbody.xml')
#importing cascade-classfier ^^
vc = cv2.VideoCapture(0)
#finding default camera ^^
while -1:
ret, img = vc.read()
gray = cv2.cvtColor... | import cv2
import numpy as np
from twilio.rest import TwilioRestClient
import time
#importing modules ^^
body_cascade = cv2.CascadeClassifier('haarcascade_fullbody.xml')
#importing cascade-classfiers ^^
vc = cv2.VideoCapture(0)
#finding default camera ^^
while -1:
ret, img = vc.read()
gray = cv2.cvtColo... | mit | Python |
64c08dfc40240c7b1b4b876b12bdb57ace22d675 | remove print statement | gipit/gippy,gipit/gippy | gippy/__init__.py | gippy/__init__.py | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | apache-2.0 | Python |
30f89eacb428af7091d238d39766d6481735c670 | fix for BASH_FUNC_module on qstat output | imperial-genomics-facility/data-management-python,imperial-genomics-facility/data-management-python,imperial-genomics-facility/data-management-python,imperial-genomics-facility/data-management-python,imperial-genomics-facility/data-management-python | igf_airflow/hpc/hpc_queue.py | igf_airflow/hpc/hpc_queue.py | import json
import subprocess
from collections import defaultdict
from tempfile import TemporaryFile
def get_pbspro_job_count(job_name_prefix=''):
'''
A function for fetching running and queued job information from a PBSPro HPC cluster
:param job_name_prefix: A text to filter running jobs, default ''
:returns... | import json
import subprocess
from collections import defaultdict
from tempfile import TemporaryFile
def get_pbspro_job_count(job_name_prefix=''):
'''
A function for fetching running and queued job information from a PBSPro HPC cluster
:param job_name_prefix: A text to filter running jobs, default ''
:returns... | apache-2.0 | Python |
8998d0f617791f95b1ed6b4a1fffa0f71752b801 | Update docs/params for initialization methods. | mwhoffman/pybo,jhartford/pybo | pybo/bayesopt/inits.py | pybo/bayesopt/inits.py | """
Implementation of methods for sampling initial points.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ..utils import ldsample
# exported symbols
__all__ = ['init_middle', '... | """
Implementation of methods for sampling initial points.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ..utils import ldsample
# exported symbols
__all__ = ['init_middle', '... | bsd-2-clause | Python |
cfc13f7e98062a2eb5a9a96298ebc67ee79d9602 | Use path for urls | Clarity-89/clarityv2,Clarity-89/clarityv2,Clarity-89/clarityv2,Clarity-89/clarityv2 | src/clarityv2/deductions/admin.py | src/clarityv2/deductions/admin.py | from django.urls import path
from django.contrib import admin
from django.db.models import Sum
from clarityv2.utils.views.private_media import PrivateMediaView
from .models import Deduction
class DeductionPrivateMediaView(PrivateMediaView):
model = Deduction
permission_required = 'invoices.can_view_invoice'... | from django.conf.urls import url
from django.contrib import admin
from django.db.models import Sum
from clarityv2.utils.views.private_media import PrivateMediaView
from .models import Deduction
class DeductionPrivateMediaView(PrivateMediaView):
model = Deduction
permission_required = 'invoices.can_view_invo... | mit | Python |
a8d7afe076c14115f3282114cecad216e46e7353 | Update scipy_effects.py | jiaaro/pydub | pydub/scipy_effects.py | pydub/scipy_effects.py | """
This module provides scipy versions of high_pass_filter, and low_pass_filter
as well as an additional band_pass_filter.
Of course, you will need to install scipy for these to work.
When this module is imported the high and low pass filters from this module
will be used when calling audio_segment.high_pass_filter(... | """
This module provides scipy versions of high_pass_filter, and low_pass_filter
as well as an additional band_pass_filter.
Of course, you will need to install scipy for these to work.
When this module is imported the high and low pass filters are used when calling
audio_segment.high_pass_filter() and audio_segment.h... | mit | Python |
7508d20bd3d6af0b2e5a886c8ea2f895d9e69935 | Bump version: 0.2.1 → 0.2.2 | apetrynet/pyfilemail | pyfilemail/__init__.py | pyfilemail/__init__.py | # -*- coding: utf-8 -*-
__title__ = 'pyfilemail'
__version__ = '0.2.2'
__author__ = 'Daniel Flehner Heen'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Daniel Flehner Heen'
import os
import logging
from functools import wraps
import appdirs
# Init logger
logger = logging.getLogger('pyfilemail')
level = os.g... | # -*- coding: utf-8 -*-
__title__ = 'pyfilemail'
__version__ = '0.2.1'
__author__ = 'Daniel Flehner Heen'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Daniel Flehner Heen'
import os
import logging
from functools import wraps
import appdirs
# Init logger
logger = logging.getLogger('pyfilemail')
level = os.g... | mit | Python |
f7066d6bdd4fefbf517cd8ab44951955bb9f3a2a | Fix min/max for None types | mlouhivu/build-recipes,mlouhivu/build-recipes | gpaw/setup/gcc.py | gpaw/setup/gcc.py | #!/usr/bin/env python3
"""Wrapper for the GNU compiler that converts / removes incompatible
compiler options and allows for file-specific tailoring."""
import sys
from subprocess import call
# Default compiler and options
compiler = 'gcc'
args2change = {}
fragile_files = ['c/xc/tpss.c']
# Default optimisation sett... | #!/usr/bin/env python3
"""Wrapper for the GNU compiler that converts / removes incompatible
compiler options and allows for file-specific tailoring."""
import sys
from subprocess import call
# Default compiler and options
compiler = 'gcc'
args2change = {}
fragile_files = ['c/xc/tpss.c']
# Default optimisation sett... | mit | Python |
0b6b7ab518362445f3901f8d3b0d6281e2671c3f | Make code python3 compatible | grandquista/rethinkdb,marshall007/rethinkdb,mquandalle/rethinkdb,ajose01/rethinkdb,KSanthanam/rethinkdb,tempbottle/rethinkdb,mquandalle/rethinkdb,yaolinz/rethinkdb,yaolinz/rethinkdb,sebadiaz/rethinkdb,sontek/rethinkdb,sbusso/rethinkdb,tempbottle/rethinkdb,mbroadst/rethinkdb,alash3al/rethinkdb,catroot/rethinkdb,wujf/ret... | drivers/python/setup.py | drivers/python/setup.py | # Copyright 2010-2012 RethinkDB, all rights reserved.
from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.errors import DistutilsPlatformError, CCompilerError, DistutilsExecError
import sys
class build_ext_nofail(build_ext):
# This class can replace the build_e... | # Copyright 2010-2012 RethinkDB, all rights reserved.
from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.errors import DistutilsPlatformError, CCompilerError, DistutilsExecError
import sys
class build_ext_nofail(build_ext):
# This class can replace the build_e... | apache-2.0 | Python |
7418379d959cba0e96161c9e61f340541b82d85f | clean up xor a bit | MiniLight/DeepCL,hughperkins/DeepCL,hughperkins/DeepCL,MiniLight/DeepCL,MiniLight/DeepCL,MiniLight/DeepCL,hughperkins/DeepCL,hughperkins/DeepCL,hughperkins/DeepCL,MiniLight/DeepCL | python/examples/xor.py | python/examples/xor.py | # Copyright Hugh Perkins 2016
#
# 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/.
"""
Simple example of xor
"""
from __future__ import print_function
import PyDeepCL
imp... | # Copyright Hugh Perkins 2015
#
# 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/.
from __future__ import print_function
# import sys
# import array
import PyDeepCL
imp... | mpl-2.0 | Python |
9729c3aecccfa8130db7b5942c423c0807726f81 | Add feature importance bar chart. | yarny/gbdt,yarny/gbdt,yarny/gbdt,yarny/gbdt | python/gbdt/_forest.py | python/gbdt/_forest.py | from libgbdt import Forest as _Forest
class Forest:
def __init__(self, forest):
if type(forest) is str or type(forest) is unicode:
self._forest = _Forest(forest)
elif type(forest) is _Forest:
self._forest = forest
else:
raise TypeError, 'Unsupported fores... | from libgbdt import Forest as _Forest
class Forest:
def __init__(self, forest):
if type(forest) is str or type(forest) is unicode:
self._forest = _Forest(forest)
elif type(forest) is _Forest:
self._forest = forest
else:
raise TypeError, 'Unsupported fores... | apache-2.0 | Python |
50d44ec25eb102451a495dd645ffb2a6f77012ae | Add a shortcut for imports | EDITD/queue_util,sujaymansingh/queue_util | queue_util/__init__.py | queue_util/__init__.py | from queue_util.consumer import Consumer
from queue_util.producer import Producer
| mit | Python | |
325c5a8f407340fa8901f406c301fa8cbdac4ff8 | bump version to 0.13.0 | alex/gunicorn,prezi/gunicorn,beni55/gunicorn,malept/gunicorn,z-fork/gunicorn,prezi/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,urbaniak/gunicorn,prezi/gunicorn,MrKiven/gunicorn,zhoucen/gunicorn,zhoucen/gunicorn,wong2/gunicorn,jamesblunt/gunicorn,elelianghh/gunicorn,malept/gunicorn,gtrdotmcs/gunicorn,gtrdotmcs/gunicorn... | gunicorn/__init__.py | gunicorn/__init__.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 13, 0)
__version__ = ".".join(map(str, version_info))
SERVER_SOFTWARE = "gunicorn/%s" % __version__
| # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 12, 2)
__version__ = ".".join(map(str, version_info))
SERVER_SOFTWARE = "gunicorn/%s" % __version__
| mit | Python |
0f4d2b75cde58f6926636563691182fb5896c894 | Add docstring to autocorr and ambiguity functions so the axes and peak location of the result is made clear. | ryanvolz/echolect | echolect/core/coding.py | echolect/core/coding.py | # Copyright 2013 Ryan Volz
# This file is part of echolect.
# Echolect 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.
# Echolect is... | # Copyright 2013 Ryan Volz
# This file is part of echolect.
# Echolect 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.
# Echolect is... | bsd-3-clause | Python |
cc6bc2b9af67c064339371b43795c36ed3e5ddcb | use TemplateResponse everywhere | ella/ella-galleries,MichalMaM/ella-galleries | ella_galleries/views.py | ella_galleries/views.py | from django.http import Http404
from django.template.response import TemplateResponse
from django.utils.translation import ungettext
from django.utils.cache import patch_vary_headers
from ella.core.views import get_templates_from_publishable
def gallery_item_detail(request, context, item_slug=None):
'''
Retur... | from django.http import Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ungettext
from django.utils.cache import patch_vary_headers
from ella.core.views import get_templates_from_publishable
def gallery_item_detail(request, contex... | bsd-3-clause | Python |
63587ab033a0aabd52af6b657600d2d2547f034f | Bump release version | rigetticomputing/grove,rigetticomputing/grove | grove/__init__.py | grove/__init__.py | ##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# 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... | ##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# 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... | apache-2.0 | Python |
e0de9a865b731f3f24bc7a42909849abc738217f | Increment version | johnwlockwood/stream_tap,johnwlockwood/stream_tap,johnwlockwood/karl_data,johnwlockwood/iter_karld_tools | karld/_meta.py | karld/_meta.py | version_info = (0, 2, 1)
version = '.'.join(map(str, version_info))
| version_info = (0, 2, 0)
version = '.'.join(map(str, version_info))
| apache-2.0 | Python |
c39ce3485af781e8974a70200baa1f51e5c1633b | fix imports | nixon/gstat | gstat/__init__.py | gstat/__init__.py | from gstat import gstat, gstats, gstat_elapsed, gstat_event
| mit | Python | |
2a0e3fe9c83da1d11b892c7c35e367f414329936 | Update teaching_modules.py | sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs | src/ensae_teaching_cs/automation/teaching_modules.py | src/ensae_teaching_cs/automation/teaching_modules.py | # -*- coding: utf-8 -*-
"""
@file
@brief List of modules to maintain for the teachings.
"""
def get_teaching_modules():
"""
List of teachings modules to maintain (CI + documentation).
.. runpython::
:showcode:
from ensae_teaching_cs.automation import get_teaching_modules
print('\... | # -*- coding: utf-8 -*-
"""
@file
@brief List of modules to maintain for the teachings.
"""
def get_teaching_modules():
"""
List of teachings modules to maintain (CI + documentation).
.. runpython::
:showcode:
from ensae_teaching_cs.automation import get_teaching_modules
print('\... | mit | Python |
bc08499fd803278ea502bafdf845dec438f951f3 | Update range-sum-query-2d-immutable.py | jaredkoontz/leetcode,githubutilities/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24... | Python/range-sum-query-2d-immutable.py | Python/range-sum-query-2d-immutable.py | # Time: ctor: O(m * n)
# lookup: O(1)
# Space: O(m * n)
#
# Given a 2D matrix matrix, find the sum of the elements inside
# the rectangle defined by its upper left corner (row1, col1)
# and lower right corner (row2, col2).
#
# Range Sum Query 2D
# The above rectangle (with the red border) is defined by
# (row... | # Time: ctor: O(m * n)
# lookup: O(1)
# Space: O(m * n)
#
# Given a 2D matrix matrix, find the sum of the elements inside
# the rectangle defined by its upper left corner (row1, col1)
# and lower right corner (row2, col2).
#
# Range Sum Query 2D
# The above rectangle (with the red border) is defined by
# (row... | mit | Python |
27f8b342e1a4bea9c807b005d16f932880bb7136 | Document utils.setup_readline | flurischt/jedi,dwillmer/jedi,flurischt/jedi,jonashaag/jedi,tjwei/jedi,WoLpH/jedi,jonashaag/jedi,dwillmer/jedi,mfussenegger/jedi,mfussenegger/jedi,WoLpH/jedi,tjwei/jedi | jedi/utils.py | jedi/utils.py | """
Utilities for end-users.
"""
import sys
from jedi import Interpreter
def readline_complete(text, state):
"""
Function to be passed to :func:`readline.set_completer`.
Usage::
import readline
readline.set_completer(readline_complete)
"""
ns = vars(sys.modules['__main__'])
... | """
Utilities for end-users.
"""
import sys
from jedi import Interpreter
def readline_complete(text, state):
"""
Function to be passed to :func:`readline.set_completer`.
Usage::
import readline
readline.set_completer(readline_complete)
"""
ns = vars(sys.modules['__main__'])
... | mit | Python |
c9dceb4dc83490ab0eebcd3efc9590d3275f53df | tidy up messytables-jts integration | mk270/ktbh,mk270/ktbh | ktbh/schema.py | ktbh/schema.py | import unicodecsv
from cStringIO import StringIO
import messytables
import itertools
import slugify
import jsontableschema
from messytables.types import *
from messytables_jts import celltype_as_string
def censor(dialect):
tmp = dict(dialect)
censored = [
"doublequote",
"lineterminator",
... | import unicodecsv
from cStringIO import StringIO
import messytables
import itertools
import slugify
import jsontableschema
from messytables.types import *
from messytables_jts import rowset_as_schema
def censor(dialect):
tmp = dict(dialect)
censored = [
"doublequote",
"lineterminator",
... | agpl-3.0 | Python |
39de531241f987daf2f417fd419c7bd63248dd9d | Bump version number. | SunDwarf/Kyoukai | kyokai/util.py | kyokai/util.py | """
Misc utilities.
"""
import os
import pathlib
VERSION = "1.5.0"
VERSIONT = tuple(map(int, VERSION.split('.')))
HTTP_CODES = {
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
301: "Moved Permanently",
302: "Fo... | """
Misc utilities.
"""
import os
import pathlib
VERSION = "1.3.8"
VERSIONT = tuple(map(int, VERSION.split('.')))
HTTP_CODES = {
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
301: "Moved Permanently",
302: "Fo... | mit | Python |
34ca71d5db9c1f17d236e5e49471fb6f2a6e1747 | Implement Paulo tip about router. | aldryn/aldryn-search,nephila/aldryn-search,nephila/aldryn-search,aldryn/aldryn-search,nephila/aldryn-search,aldryn/aldryn-search | aldryn_search/router.py | aldryn_search/router.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.translation import get_language
from cms.utils.i18n import alias_from_language
from haystack import routers
from haystack.constants import DEFAULT_ALIAS
class LanguageRouter(routers.BaseRouter):
def for_read(self, **hints):
langu... | # -*- coding: utf-8 -*-
from django.conf import settings
from cms.utils.i18n import get_current_language
from haystack import routers
from haystack.constants import DEFAULT_ALIAS
class LanguageRouter(routers.BaseRouter):
def for_read(self, **hints):
language = get_current_language()
if language ... | bsd-3-clause | Python |
e5e523890dd1129402d7a0477468ee47dee3fd91 | Fix missing part/block conversion. | wakermahmud/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,ErinCall/sync-engine,gale320/sync-engine,Eagles2F/sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,nylas/sync-engine,jobscore/sync-engine,Eagles2F/sync-engine,PriviPK/privipk-sync-engine,jobscore/sync-engine,PriviPK/privipk-sync-engine,Eagles2F/sync-... | inbox/sendmail/smtp/common.py | inbox/sendmail/smtp/common.py | from inbox.sendmail.base import generate_attachments, SendError
from inbox.sendmail.smtp.postel import BaseSMTPClient
from inbox.sendmail.smtp.message import create_email, create_reply
class SMTPClient(BaseSMTPClient):
""" SMTPClient for Gmail and other providers. """
def _send_mail(self, db_session, message,... | from inbox.sendmail.base import generate_attachments, SendError
from inbox.sendmail.smtp.postel import BaseSMTPClient
from inbox.sendmail.smtp.message import create_email, create_reply
class SMTPClient(BaseSMTPClient):
""" SMTPClient for Gmail and other providers. """
def _send_mail(self, db_session, message,... | agpl-3.0 | Python |
872a96b52061bd9ab3a3178aacf3e3d0be2cc498 | Make field filter errors ValidationErrors | limbera/django-nap,MarkusH/django-nap | nap/dataviews/fields.py | nap/dataviews/fields.py |
from django.db.models.fields import NOT_PROVIDED
from django.forms import ValidationError
from nap.utils import digattr
class field(property):
'''A base class to compare against.'''
def __get__(self, instance, cls=None):
if instance is None:
return self
return self.fget(instance.... |
from django.db.models.fields import NOT_PROVIDED
from nap.utils import digattr
class field(property):
'''A base class to compare against.'''
def __get__(self, instance, cls=None):
if instance is None:
return self
return self.fget(instance._obj)
def __set__(self, instance, va... | bsd-3-clause | Python |
bbe263e8bd9bb12ccef681d4f21f6b90c89f059d | Remove some debug logging | ErinCall/splinter_demo,ErinCall/splinter_demo | flask/test/test_signup.py | flask/test/test_signup.py | from __future__ import unicode_literals
from test import TestCase
from web import app
from db import session, User
from nose.tools import eq_
class TestSignup(TestCase):
def test_sign_up(self):
app.test_client().post('/', data={'email': 'andrew@lorente.name'})
users = session().query(User.email)... | from __future__ import unicode_literals
from test import TestCase
from web import app
from db import session, User
from nose.tools import eq_
class TestSignup(TestCase):
def test_sign_up(self):
app.test_client().post('/', data={'email': 'andrew@lorente.name'})
users = session().query(User.email)... | mit | Python |
6d9e8e8831cd08fa358f33f155a760de3ec59f3b | document that this file is generated | fonttools/fonttools,googlefonts/fonttools | Lib/fontTools/ttLib/tables/__init__.py | Lib/fontTools/ttLib/tables/__init__.py | # DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
def _moduleFinderHint():
"""Dummy function to let modulefinder know what tables may be
dynamically imported. Generated by MetaTools/buildTableList.py.
"""
import B_A_S_E_
import C_F_F_
import D_S_I_G_
import G_D_E_F_
import G_P_O_S_
import G_... | def _moduleFinderHint():
"""Dummy function to let modulefinder know what tables may be
dynamically imported. Generated by MetaTools/buildTableList.py.
"""
import B_A_S_E_
import C_F_F_
import D_S_I_G_
import G_D_E_F_
import G_P_O_S_
import G_S_U_B_
import J_S_T_F_
import L_T_S_H_
import O_S_2f_2
import T_S... | mit | Python |
1f977aa5fa28ed1e351f337191291198384abe02 | Set auth_encryption_key option to be secret | noironetworks/heat,cwolferh/heat-scratch,steveb/heat,cwolferh/heat-scratch,steveb/heat,maestro-hybrid-cloud/heat,dragorosson/heat,openstack/heat,jasondunsmore/heat,openstack/heat,dragorosson/heat,miguelgrinberg/heat,takeshineshiro/heat,rh-s/heat,srznew/heat,cryptickp/heat,pratikmallya/heat,noironetworks/heat,gonzolino/... | heat/common/crypt.py | heat/common/crypt.py | #
# 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, software
# ... | #
# 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, software
# ... | apache-2.0 | Python |
197a0440ddbf31aa87a6a6998b41344be4924076 | fix on the rows update | rrpg/world-editor,rrpg/world-editor | gui/placeslist.py | gui/placeslist.py | # -*- coding: utf8 -*-
from PyQt4 import QtGui
from PyQt4 import QtCore
class placesList(QtGui.QTableWidget):
_columns = ('Name', 'Type', 'X', 'Y', 'Locate')
_app = None
_parent = None
def __init__(self, parent, app):
"""
Initialisation of the window, creates the GUI and displays the window.
"""
self._... | # -*- coding: utf8 -*-
from PyQt4 import QtGui
from PyQt4 import QtCore
class placesList(QtGui.QTableWidget):
_columns = ('Name', 'Type', 'X', 'Y', 'Locate')
_app = None
_parent = None
def __init__(self, parent, app):
"""
Initialisation of the window, creates the GUI and displays the window.
"""
self._... | mit | Python |
5809fc832340e3ee5d798fa347e4933e874bdb8b | Allow older django to find the tests | ForumDev/djangocms-applicants,ForumDev/djangocms-applicants | voting/tests/__init__.py | voting/tests/__init__.py | import django
if django.VERSION[0] == 1 and django.VERSION[1] < 6:
from .tests import *
| mit | Python | |
9246d33429e1940d5a98c3c16e708159437b88fa | enable header modification | nipy/nireg,alexis-roche/niseg,alexis-roche/nipy,nipy/nireg,bthirion/nipy,nipy/nipy-labs,bthirion/nipy,alexis-roche/register,alexis-roche/register,alexis-roche/nipy,alexis-roche/register,arokem/nipy,alexis-roche/niseg,bthirion/nipy,arokem/nipy,alexis-roche/nireg,bthirion/nipy,alexis-roche/nireg,arokem/nipy,alexis-roche/... | lib/neuroimaging/tools/AnalyzeHeaderTool.py | lib/neuroimaging/tools/AnalyzeHeaderTool.py | import os, sys
from optparse import OptionParser, Option
from neuroimaging.data import DataSource
from neuroimaging.refactoring.analyze import struct_fields, AnalyzeHeader
##############################################################################
class AnalyzeHeaderTool (OptionParser):
"Command-line tool for... | import os, sys
from optparse import OptionParser, Option
from neuroimaging.data import DataSource
from neuroimaging.refactoring.analyze import struct_fields, AnalyzeHeader
##############################################################################
class AnalyzeHeaderTool (OptionParser):
"Command-line tool for... | bsd-3-clause | Python |
1117f6e2d51ed6faf37aa2a6deab8a6ff8fa0e5b | test for compiling simple command | bwhmather/python-linemode | linemode/tests/test_command_list_printer.py | linemode/tests/test_command_list_printer.py | import unittest
from linemode.drivers.command_list import compile
class TestCommandListPrinter(unittest.TestCase):
def test_simple_command(self):
program = compile([
"reset"
])
self.assertEqual(program, b'reset')
| import unittest
from linemode.drivers.command_list import CommandListPrinter
class TestCommandListPrinter(unittest.TestCase):
pass
| bsd-3-clause | Python |
3f0b19d153360ee5cf1fda1acfa0e4ad846b6c86 | fix admin.py, remove site on AccountAccess and add it on Provider | iXioN/django-all-access,iXioN/django-all-access | allaccess/admin.py | allaccess/admin.py | from django.contrib import admin
from .models import Provider, AccountAccess
class ProviderAdmin(admin.ModelAdmin):
"Admin customization for OAuth providers."
list_display = ('name', 'enabled', 'site',)
list_filter = ('name', 'enabled', 'site', )
class AccountAccessAdmin(admin.ModelAdmin):
"Admi... | from django.contrib import admin
from .models import Provider, AccountAccess
class ProviderAdmin(admin.ModelAdmin):
"Admin customization for OAuth providers."
list_display = ('name', 'enabled', )
class AccountAccessAdmin(admin.ModelAdmin):
"Admin customization for accounts."
list_display = (
... | bsd-2-clause | Python |
ee6d4f50b4a27e9cc8c3b5f8a821a6d9c0cf4f21 | remove unwanted changes | StrellaGroup/frappe,almeidapaulopt/frappe,yashodhank/frappe,StrellaGroup/frappe,mhbu50/frappe,mhbu50/frappe,yashodhank/frappe,frappe/frappe,almeidapaulopt/frappe,yashodhank/frappe,frappe/frappe,yashodhank/frappe,mhbu50/frappe,StrellaGroup/frappe,mhbu50/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,frappe/frappe | frappe/website/page_renderers/document_page.py | frappe/website/page_renderers/document_page.py | import frappe
from frappe.model.document import get_controller
from frappe.website.page_renderers.base_template_page import BaseTemplatePage
from frappe.website.utils import cache_html
from frappe.website.router import (get_doctypes_with_web_view,
get_page_info_from_web_page_with_dynamic_routes)
class DocumentPage(B... | import frappe
from frappe.model.document import get_controller
from frappe.website.page_renderers.base_template_page import BaseTemplatePage
from frappe.website.utils import build_response
from frappe.website.router import (get_doctypes_with_web_view,
get_page_info_from_web_page_with_dynamic_routes)
class DocumentPa... | mit | Python |
d80878788ddcc1443c54c11b923da23bc295b496 | Fix wget -q flag | freeekanayaka/charmfixture,freeekanayaka/charm-test | charmtest/network.py | charmtest/network.py | import io
import argparse
class Wget(object):
name = "wget"
def __init__(self, network):
self._network = network
def __call__(self, proc_args):
parser = argparse.ArgumentParser()
parser.add_argument("url")
parser.add_argument("-O", dest="output")
parser.add_argum... | import io
import argparse
class Wget(object):
name = "wget"
def __init__(self, network):
self._network = network
def __call__(self, proc_args):
parser = argparse.ArgumentParser()
parser.add_argument("url")
parser.add_argument("-O", dest="output")
parser.add_argum... | agpl-3.0 | Python |
730e765822932b5b0b00832c41140f39a9ae8d11 | Bump version | thombashi/DateTimeRange | datetimerange/__version__.py | datetimerange/__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.3.6"
__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.3.5"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
55f3e0e222246bfbc9c1a19f68b06941bac6cd70 | Add an option to include spaces on random string generator | magnet-cl/django-project-template-py3,Angoreher/xcero,magnet-cl/django-project-template-py3,Angoreher/xcero,magnet-cl/django-project-template-py3,Angoreher/xcero,Angoreher/xcero,magnet-cl/django-project-template-py3 | base/utils.py | base/utils.py | """ Small methods for generic use """
# standard library
import itertools
import random
import re
import string
import unicodedata
# django
from django.utils import timezone
def today():
"""
This method obtains today's date in local time
"""
return timezone.localtime(timezone.now()).date()
# BROKE... | """ Small methods for generic use """
# standard library
import itertools
import random
import re
import string
import unicodedata
# django
from django.utils import timezone
def today():
"""
This method obtains today's date in local time
"""
return timezone.localtime(timezone.now()).date()
# BROKE... | mit | Python |
5496bd29c4262c252367d7b305d2a78fd1ad2fa7 | move debug call | smnorris/bcdata,smnorris/bcdata | bcdata/wcs.py | bcdata/wcs.py | import logging
import requests
import bcdata
log = logging.getLogger(__name__)
def get_dem(
bounds, out_file="dem.tif", src_crs="EPSG:3005", dst_crs="EPSG:3005", resolution=25, interpolation=None
):
"""Get TRIM DEM for provided bounds, write to GeoTIFF.
"""
bbox = ",".join([str(b) for b in bounds])... | import logging
import requests
import bcdata
log = logging.getLogger(__name__)
def get_dem(
bounds, out_file="dem.tif", src_crs="EPSG:3005", dst_crs="EPSG:3005", resolution=25, interpolation=None
):
"""Get TRIM DEM for provided bounds, write to GeoTIFF.
"""
bbox = ",".join([str(b) for b in bounds])... | mit | Python |
c4ad9519c117edfdc59f229380fa0797bc6bfffa | Update BitshareComFolder.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/crypter/BitshareComFolder.py | module/plugins/crypter/BitshareComFolder.py | # -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class BitshareComFolder(SimpleCrypter):
__name__ = "BitshareComFolder"
__type__ = "crypter"
__version__ = "0.04"
__pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+'
__config__ = [("... | # -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class BitshareComFolder(SimpleCrypter):
__name__ = "BitshareComFolder"
__type__ = "crypter"
__version__ = "0.03"
__pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+'
__config__ = [("... | agpl-3.0 | Python |
326f0b881d36ed19d0a37495ae34fc24fc1eb707 | Load the spotify header file from an absolute path | Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web | connect_ffi.py | connect_ffi.py | from cffi import FFI
ffi = FFI()
print "Loading Spotify library..."
#TODO: Use absolute paths for open() and stuff
#Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h
with open(os.path.join(sys.path[0], "spotify.processed.h")) as file:
header = file.read()
... | from cffi import FFI
ffi = FFI()
print "Loading Spotify library..."
#TODO: Use absolute paths for open() and stuff
#Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h
with open("spotify.processed.h") as file:
header = file.read()
ffi.cdef(header)
ffi.cdef(... | mit | Python |
278dcb8b2fb3e1f69434ec9c41e566501cdc50bd | Remove unused functionality | bennylope/django-organizations,bennylope/django-organizations | organizations/backends/forms.py | organizations/backends/forms.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2019, Ben Lopatin and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright ... | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2019, Ben Lopatin and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright ... | bsd-2-clause | Python |
331fb50e6a4dcef99c8a6806d3efd7531859542f | add comments | kaduuuken/achievementsystem,kaduuuken/achievementsystem | achievements/templatetags/achievement_tags.py | achievements/templatetags/achievement_tags.py | from django import template
from achievements.models import Category, Trophy
from achievements import settings
register = template.Library()
# call single_category.html with the given parameters
@register.inclusion_tag('achievements/single_category.html')
def render_category(category, user):
return {
'ca... | from django import template
from achievements.models import Category, Trophy
from achievements import settings
register = template.Library()
@register.inclusion_tag('achievements/single_category.html')
def render_category(category, user):
return {
'category': category,
'percentage': category.get... | bsd-2-clause | Python |
66fc121dbe0dbb7a69a62bfdaf98838a4f7a0bf3 | Update yeti.py | VirusTotal/misp-modules,MISP/misp-modules,VirusTotal/misp-modules,MISP/misp-modules,MISP/misp-modules,VirusTotal/misp-modules | misp_modules/modules/expansion/yeti.py | misp_modules/modules/expansion/yeti.py | import json
import json
try:
import pyeti
except ImportError:
print("pyeti module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domain'],
'output': ['hostname', 'domain', 'ip-src', 'ip-dst', 'url']}
# possible module-types: 'e... | import json
import json
try:
import pyeti
except ImportError:
print("pyeti module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domain'],
'output': ['hostname', 'domain', 'ip-src', 'ip-dst', 'url']}
# possible module-types: 'ex... | agpl-3.0 | Python |
c3dffef7869c0ce19801d78393a336b6b6ecbce7 | stop littering /tmp with temporary resource files | gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | #!/usr/bin/env python
#
# Copyright 2020 GoPro Inc.
#
# 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... | #!/usr/bin/env python
#
# Copyright 2020 GoPro Inc.
#
# 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... | apache-2.0 | Python |
deccf656db39ac949f93e562e4f41a32589feb9b | Use a more complex and extendable check for shortcuts in StructuredText | CybOXProject/python-cybox | cybox/common/structured_text.py | cybox/common/structured_text.py | # Copyright (c) 2013, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import cybox
import cybox.bindings.cybox_common as common_binding
class StructuredText(cybox.Entity):
_binding = common_binding
_namespace = 'http://cybox.mitre.org/common-2'
def __init__(self, value=... | # Copyright (c) 2013, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import cybox
import cybox.bindings.cybox_common as common_binding
class StructuredText(cybox.Entity):
_binding = common_binding
_namespace = 'http://cybox.mitre.org/common-2'
def __init__(self, value=... | bsd-3-clause | Python |
1eae87ee4435b4dda35d64295de13756394dbce9 | Add GET to 'Allow-Methods' by default. Fixes #12 | karan/HNify | crossdomain.py | crossdomain.py | #!/usr/bin/env python
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=['GET'], headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not... | #!/usr/bin/env python
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not No... | mit | Python |
9ec25b6a5f8400b68c51ce9c5667c8c0c1648521 | Remove unneeded catch | davidmogar/cucco,davidmogar/cucco,davidmogar/normalizr | cucco/regex.py | cucco/regex.py | #-*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
"""
Regular expression to match URLs as seen on http://daringfireball.net/2010/07/improved_regex_for_matching_urls
"""
URL_REGEX = re.compile(
r'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([... | #-*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
"""
Regular expression to match URLs as seen on http://daringfireball.net/2010/07/improved_regex_for_matching_urls
"""
URL_REGEX = re.compile(
r'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([... | mit | Python |
4a83439926181f26e4656d2a2b78021209d3b629 | fix the dropout to 0.2 because that is what they use | snurkabill/pydeeplearn,Warvito/pydeeplearn,mihaelacr/pydeeplearn,Warvito/pydeeplearn,snurkabill/pydeeplearn | code/nolearntrail.py | code/nolearntrail.py | from nolearn.dbn import DBN
from readfacedatabases import *
from sklearn import cross_validation
from sklearn.metrics import zero_one_score
from sklearn.metrics import classification_report
import argparse
import numpy as np
from common import *
parser = argparse.ArgumentParser(description='nolearn test')
parser.add... | from nolearn.dbn import DBN
from readfacedatabases import *
from sklearn import cross_validation
from sklearn.metrics import zero_one_score
from sklearn.metrics import classification_report
import argparse
import numpy as np
from common import *
parser = argparse.ArgumentParser(description='nolearn test')
parser.add... | bsd-3-clause | Python |
ddc571f32212a57f725101314878d17df9124bb8 | fix loop range | TheReverend403/Pyper,TheReverend403/Pyper | commands/cmd_roll.py | commands/cmd_roll.py | import random
from lib.command import Command
class RollCommand(Command):
name = 'roll'
description = 'Roll some dice.'
def run(self, message, args):
if not args:
self.reply(message, 'No roll specification supplied. Try */roll 3d6*.', parse_mode='Markdown')
return
... | import random
from lib.command import Command
class RollCommand(Command):
name = 'roll'
description = 'Roll some dice.'
def run(self, message, args):
if not args:
self.reply(message, 'No roll specification supplied. Try */roll 3d6*.', parse_mode='Markdown')
return
... | agpl-3.0 | Python |
fe06c3a839bdc13384250924a4a30d9dd3455fc7 | fix archive resource unit test | pixelated/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated... | service/test/unit/resources/test_archive_resource.py | service/test/unit/resources/test_archive_resource.py | from twisted.trial import unittest
import json
from mockito import mock, when, verify
from test.unit.resources import DummySite
from twisted.web.test.requesthelper import DummyRequest
from pixelated.resources.mails_resource import MailsArchiveResource
from twisted.internet import defer
class TestArchiveResource(unitt... | import unittest
import json
from mockito import mock, when, verify
from test.unit.resources import DummySite
from twisted.web.test.requesthelper import DummyRequest
from pixelated.resources.mails_resource import MailsArchiveResource
from twisted.internet import defer
class TestArchiveResource(unittest.TestCase):
... | agpl-3.0 | Python |
283dd9918bd16202bf799c470e8e5b50d2ef1cd6 | Increment version number to 0.7.0 | datajoint/datajoint-python,fabiansinz/datajoint-python,eywalker/datajoint-python,dimitri-yatsenko/datajoint-python | datajoint/version.py | datajoint/version.py | __version__ = "0.7.0"
| __version__ = "0.6.1"
| lgpl-2.1 | Python |
0f5fe279d6b4641b2a2741271da4f021238f00a1 | fix import in generator | lolporer/anomaly_generator | dataset_generator.py | dataset_generator.py | import csv
import os
# execfile("C:\\Users\\YONI\\Documents\\Projects\\degree\\attack detection methods\\anomaly_generator\\dataset_generator.py")
ROW_NUM = 10
path = "C:\\Users\\YONI\\Documents\\anomally_detector\\data_sets\\example\\"
users_num = 100
features_num = 20
directory = "data_sets\\"
if not os.path.exi... | import csv
# execfile("C:\\Users\\YONI\\Documents\\Projects\\degree\\attack detection methods\\anomaly_generator\\dataset_generator.py")
ROW_NUM = 10
path = "C:\\Users\\YONI\\Documents\\anomally_detector\\data_sets\\example\\"
users_num = 100
features_num = 20
directory = "data_sets\\"
if not os.path.exists(direct... | mit | Python |
7ccb9cb0d6e3ce6e3c6c09604af5e2bbdfae63ae | update urls.py | Connexions/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms | openstax/urls.py | openstax/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from wagtail.contrib.wagtailapi import urls as wagtailapi_urls
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail... | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from wagtail.contrib.wagtailapi import urls as wagtailapi_urls
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail... | agpl-3.0 | Python |
853135b61f34ece1363da9b53244e775a2ba16a8 | Add docstring for convert_timezone() | ronrest/convenience_py,ronrest/convenience_py | datetime/datetime.py | datetime/datetime.py | import datetime
# ==============================================================================
# TIMESTAMP 2 STR
# ==============================================================================
def timestamp2str(t, pattern="%Y-%m-%d %H:%M:%S"):
""" ... | import datetime
# ==============================================================================
# TIMESTAMP 2 STR
# ==============================================================================
def timestamp2str(t, pattern="%Y-%m-%d %H:%M:%S"):
""" ... | apache-2.0 | Python |
9d2ef02367380c76f39c4bd84ea2f35897d0bebf | Edit school enrollment management command | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | education/management/commands/create_school_enrollment_script.py | education/management/commands/create_school_enrollment_script.py | '''
Created on May 28, 2013
@author: raybesiga
'''
import datetime
import logging
import itertools
from logging import handlers
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.core.mail import send_mail
from djan... | '''
Created on May 28, 2013
@author: raybesiga
'''
import datetime
import logging
import itertools
from logging import handlers
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.core.mail import send_mail
from djan... | bsd-3-clause | Python |
900ddf92a1cf65270a7b420a848c0f2611647899 | handle & | ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder | freelancefinder/remotes/sources/workinstartups/workinstartups.py | freelancefinder/remotes/sources/workinstartups/workinstartups.py | """Wrapper for the WorkInStartups source."""
import json
import bleach
import maya
import requests
from jobs.models import Post
ADDITIONAL_TAGS = ['p', 'br']
class WorkInStartups(object):
"""Wrapper for the WorkInStartups source."""
json_api_address = 'http://workinstartups.com/job-board/api/api.php?acti... | """Wrapper for the WorkInStartups source."""
import json
import bleach
import maya
import requests
from jobs.models import Post
ADDITIONAL_TAGS = ['p', 'br']
class WorkInStartups(object):
"""Wrapper for the WorkInStartups source."""
json_api_address = 'http://workinstartups.com/job-board/api/api.php?acti... | bsd-3-clause | Python |
2c53bc17f98a3e9fdc71ba77f1ab9c1c06f82509 | remove test param on srvy | andrewlrogers/srvy | collection/srvy.py | collection/srvy.py | #!/usr/bin/python
import sys
import time
from time import sleep
from datetime import datetime
import random
import sqlite3
import csv
from configparser import ConfigParser
from gpiozero import Button
import pygame
# VARIABLES
question_csv_location = '../archive/questions.csv'
sqlite_file = '../archive/srvy.db'
yes_... | #!/usr/bin/python
import sys
import time
from time import sleep
from datetime import datetime
import random
import sqlite3
import csv
from configparser import ConfigParser
if __name__ == '__main__':
# Check if running on a Raspberry Pi
try:
from gpiozero import Button
except ImportError:
... | mit | Python |
a2d9edbe8b154858fe89be12ca281a926ad46ac7 | Remove double negative | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | api/init/health/routes.py | api/init/health/routes.py | import os
from flask import jsonify
from flask_restplus import Resource, Namespace
# pylint: disable=unused-variable
def register_health(namespace: Namespace):
"""Method used to register the health check namespace and endpoint."""
@namespace.route('/health')
@namespace.doc()
class Health(Resource):
... | import os
from flask import jsonify
from flask_restplus import Resource, Namespace
# pylint: disable=unused-variable
def register_health(namespace: Namespace):
"""Method used to register the health check namespace and endpoint."""
@namespace.route('/health')
@namespace.doc()
class Health(Resource):
... | apache-2.0 | Python |
a51a089e90719dfda2e6164b0f4c1aec50c26534 | Add ordering | robdmc/django-entity,ambitioninc/django-entity,wesokes/django-entity | entity/migrations/0006_entity_relationship_unique.py | entity/migrations/0006_entity_relationship_unique.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-12-12 18:20
from __future__ import unicode_literals
from django.db import migrations, connection
from django.db.models import Count, Max
def disable_triggers(apps, schema_editor):
"""
Temporarily disable user triggers on the relationship table. We d... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-12-12 18:20
from __future__ import unicode_literals
from django.db import migrations, connection
from django.db.models import Count, Max
def disable_triggers(apps, schema_editor):
"""
Temporarily disable user triggers on the relationship table. We d... | mit | Python |
d9044815f4034a51d27e4949ffcd153e253cc882 | use double quotes | yashodhank/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,yashodhank/frappe,mhbu50/frappe,mhbu50/frappe,almeidapaulopt/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,mhbu50/frappe,almeidapaulopt/frappe,mhbu50/frappe,StrellaGroup/frappe | frappe/integrations/doctype/google_settings/test_google_settings.py | frappe/integrations/doctype/google_settings/test_google_settings.py | # -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from .google_settings import get_file_picker_settings
class TestGoogleSettings(unittest.TestCase):
def setUp(self):
settings = frappe.get_sing... | # -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from .google_settings import get_file_picker_settings
class TestGoogleSettings(unittest.TestCase):
def setUp(self):
settings = frappe.get_sing... | mit | Python |
f83076f722d66ebc27d66bc13798d4e5bc9cc27a | Fix `TypeError: must use keyword argument for key function` on Python 3 | almarklein/scikit-image,vighneshbirodkar/scikit-image,ofgulban/scikit-image,emmanuelle/scikits.image,almarklein/scikit-image,bennlich/scikit-image,ClinicalGraphics/scikit-image,dpshelio/scikit-image,SamHames/scikit-image,robintw/scikit-image,ajaybhat/scikit-image,Hiyorimi/scikit-image,blink1073/scikit-image,GaZ3ll3/sci... | scikits/image/transform/tests/test_hough_transform.py | scikits/image/transform/tests/test_hough_transform.py | import numpy as np
from numpy.testing import *
import scikits.image.transform as tf
import scikits.image.transform.hough_transform as ht
from scikits.image.transform import probabilistic_hough
def append_desc(func, description):
"""Append the test function ``func`` and append
``description`` to its name.
... | import numpy as np
from numpy.testing import *
import scikits.image.transform as tf
import scikits.image.transform.hough_transform as ht
from scikits.image.transform import probabilistic_hough
def append_desc(func, description):
"""Append the test function ``func`` and append
``description`` to its name.
... | bsd-3-clause | Python |
f3cada11b253ceea129342040f7e3d75f4f0cf15 | use assertions with the form elements in test_new instead of the regex on the html content | axelhodler/notesdude,axelhodler/notesdude | test_notes.py | test_notes.py | from webtest import TestApp
import os
import re
import notes
import dbaccessor
DB = 'notes.db'
class TestWebserver():
def test_index(self):
dba = dbaccessor.DbAccessor(DB)
dba.addNote('eins', 'lorem ipsum')
dba.addNote('zwei', 'blabla')
bottle = TestApp(notes.app)
result ... | from webtest import TestApp
import os
import re
import notes
import dbaccessor
DB = 'notes.db'
class TestWebserver():
def test_index(self):
dba = dbaccessor.DbAccessor(DB)
dba.addNote('eins', 'lorem ipsum')
dba.addNote('zwei', 'blabla')
bottle = TestApp(notes.app)
result ... | mit | Python |
77e3f0da9bec64c2bf0f34faec735a29f1a74284 | remove test for Google+ | runningwolf666/you-get,linhua55/you-get,power12317/you-get,tigerface/you-get,chares-zhang/you-get,forin-xyz/you-get,specter4mjy/you-get,fffonion/you-get,xyuanmu/you-get,dream1986/you-get,zmwangx/you-get,linhua55/you-get,Red54/you-get,jindaxia/you-get,XiWenRen/you-get,cnbeining/you-get,CzBiX/you-get,lilydjwg/you-get,sha... | tests/test.py | tests/test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from you_get import *
from you_get.__main__ import url_to_module
def test_urls(urls):
for url in urls:
url_to_module(url).download(url, info_only = True)
class YouGetTests(unittest.TestCase):
def test_freesound(self):
test_ur... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from you_get import *
from you_get.__main__ import url_to_module
def test_urls(urls):
for url in urls:
url_to_module(url).download(url, info_only = True)
class YouGetTests(unittest.TestCase):
def test_freesound(self):
test_ur... | mit | Python |
bbbd535ecabc6017aec6a3549c917d26036aff3b | Remove checks for testGotTrace unit test until trace event importer is implemented. | ChromiumWebApps/chromium,Chilledheart/chromium,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,Jonekee/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,anirudhSK/chromium,pozdnyakov/chromium-crosswalk,ondra-n... | tools/telemetry/telemetry/core/chrome/tracing_backend_unittest.py | tools/telemetry/telemetry/core/chrome/tracing_backend_unittest.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import json
import logging
import os
import unittest
from telemetry.core import util
from telemetry.core.chrome import tracing_backend
... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import json
import logging
import os
import unittest
from telemetry.core import util
from telemetry.core.chrome import tracing_backend
... | bsd-3-clause | Python |
a440cef4140a4225fc093c9143d7cfd1a0c4e917 | Update metric through API | Thib17/biggraphite,criteo/biggraphite,criteo/biggraphite,Thib17/biggraphite,Thib17/biggraphite,iksaif/biggraphite,criteo/biggraphite,criteo/biggraphite,iksaif/biggraphite,iksaif/biggraphite,iksaif/biggraphite,Thib17/biggraphite | biggraphite/cli/web/namespaces/biggraphite.py | biggraphite/cli/web/namespaces/biggraphite.py | #!/usr/bin/env python
# Copyright 2018 Criteo
#
# 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 agree... | #!/usr/bin/env python
# Copyright 2018 Criteo
#
# 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 agree... | apache-2.0 | Python |
1dbb1e0f8751f37271178665a727c4eefc49a88c | Remove subclassing of exception, since there is only one. | BT-fgarbely/partner-contact,diagramsoftware/partner-contact,andrius-preimantas/partner-contact,BT-jmichaud/partner-contact,Antiun/partner-contact,Therp/partner-contact,idncom/partner-contact,gurneyalex/partner-contact,Endika/partner-contact,Ehtaga/partner-contact,QANSEE/partner-contact,raycarnes/partner-contact,open-sy... | partner_firstname/exceptions.py | partner_firstname/exceptions.py | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | agpl-3.0 | Python |
017889913a1dba443022ee032535bdc4cb40ddb6 | Make nodepool git repo caching more robust | coolsvap/project-config,osrg/project-config,osrg/project-config,open-switch/infra_project-config,dongwenjuan/project-config,coolsvap/project-config,citrix-openstack/project-config,noorul/os-project-config,Tesora/tesora-project-config,anbangr/osci-project-config,anbangr/osci-project-config,dongwenjuan/project-config,noo... | modules/openstack_project/files/nodepool/scripts/cache_git_repos.py | modules/openstack_project/files/nodepool/scripts/cache_git_repos.py | #!/usr/bin/env python
# Copyright (C) 2011-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | #!/usr/bin/env python
# Copyright (C) 2011-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 | Python |
b0133c948555c821a9dcae1df4119a2bfcc19304 | fix building | DeadSix27/python_cross_compile_script | packages/dependencies/librubberband.py | packages/dependencies/librubberband.py | {
'repo_type' : 'git',
'url' : 'https://github.com/breakfastquay/rubberband.git',
'download_header' : [
'https://raw.githubusercontent.com/DeadSix27/python_cross_compile_script/master/additional_headers/ladspa.h',
],
'env_exports' : {
'AR': '{cross_prefix_bare}ar',
'CC': '{cross_prefix_bare}gcc',
'PREFIX':... | {
'repo_type' : 'git',
'url' : 'https://github.com/breakfastquay/rubberband.git',
'download_header' : [
'https://raw.githubusercontent.com/DeadSix27/python_cross_compile_script/master/additional_headers/ladspa.h',
],
'env_exports' : {
'AR' : '{cross_prefix_bare}ar',
'CC' : '{cross_prefix_bare}gcc',
'PREFIX... | mpl-2.0 | Python |
a96cb89524f2fa17a015011d972d396e509a1079 | Add code for getting and releasing a database connection | rivese/learning_journal,EyuelAbebe/learning_journal,EyuelAbebe/learning_journal | journal.py | journal.py | # -*- coding: utf-8 -*-
from flask import Flask
import os
import psycopg2
from contextlib import closing
from flask import g
DB_SCHEMA = """
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id serial PRIMARY KEY,
title VARCHAR (127) NOT NULL,
text TEXT NOT NULL,
created TIMESTAMP NOT NULL
)
"""
... | # -*- coding: utf-8 -*-
from flask import Flask
import os
import psycopg2
from contextlib import closing
DB_SCHEMA = """
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id serial PRIMARY KEY,
title VARCHAR (127) NOT NULL,
text TEXT NOT NULL,
created TIMESTAMP NOT NULL
)
"""
app = Flask(__name_... | mit | Python |
69705079398391cdc392b18dcd440fbc3b7404fd | Set celery to ignore results | puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest | celery_cgi.py | celery_cgi.py | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | unlicense | Python |
9bdc1dbc37a67d726f808e724b862e7de84fa06a | Change function name | ricaportela/convert-data-nbf,ricaportela/convert-data-nbf | changedate.py | changedate.py | """ Calcular Data a partir de uma quantidade de minutos """
def change_date(dataEnt, op, minutosEnt):
""" Calcular nova data """
dataEnt, horaEnt = dataEnt.split(" ", 2)
diaIni, mesIni, anoIni = dataEnt.split("/", 3)
horaIni, minuIni = horaEnt.split(":", 2)
# transformar tudo em minutos
# con... | """ Calcular Data a partir de uma quantidade de minutos """
def alterar_data(dataEnt, op, minutosEnt):
""" Calcular nova data """
dataEnt, horaEnt = dataEnt.split(" ", 2)
diaIni, mesIni, anoIni = dataEnt.split("/", 3)
horaIni, minuIni = horaEnt.split(":", 2)
# transformar tudo em minutos
# co... | mit | Python |
a10729414971ee454276960fcc1a736c08b3aef7 | Fix syntax error | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/tests/noseplugins/uniformresult.py | corehq/tests/noseplugins/uniformresult.py | r"""A plugin to format test names uniformly for easy comparison
Usage:
# collect django tests
COLLECT_ONLY=1 ./manage.py test -v2 --settings=settings 2> tests-django.txt
# collect nose tests
./manage.py test -v2 --collect-only 2> tests-nose.txt
# clean up django test output: s/skipped\ \'.*\'$/o... | """A plugin to format test names uniformly for easy comparison
Usage:
# collect django tests
COLLECT_ONLY=1 ./manage.py test -v2 --settings=settings 2> tests-django.txt
# collect nose tests
./manage.py test -v2 --collect-only 2> tests-nose.txt
# clean up django test output: s/skipped\ \'.*\'$/ok... | bsd-3-clause | Python |
50805c2da2889c13485096f53de27af27a06391a | Implement tree preorder traversal | arvinsim/hackerrank-solutions | all-domains/data-structures/trees/tree-order-traversal/solution.py | all-domains/data-structures/trees/tree-order-traversal/solution.py | # https://www.hackerrank.com/challenges/tree-preorder-traversal
# Python 2
"""
Node is defined as
self.left (the left child of the node)
self.right (the right child of the node)
self.data (the value of the node)
"""
def preOrder(tree):
if tree is None: return
print(tree.data),
return preOrder(tree.left) o... | # https://www.hackerrank.com/challenges/tree-preorder-traversal
# Python 2
"""
Node is defined as
self.left (the left child of the node)
self.right (the right child of the node)
self.data (the value of the node)
"""
def preOrder(tree):
if tree is None: return
print(tree.data)
return preOrder(tree.left) or ... | mit | Python |
1097889524cf7deb4b87722d3aedd27c071117c1 | Simplify exception logging in template render method. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/views/template.py | app/soc/views/template.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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... | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 | Python |
a6ed56b37bba3f5abff73c297a8a20271d73cab2 | Add configure call to random_agent | openai/universe,rht/universe | example/random-agent/random-agent.py | example/random-agent/random-agent.py | #!/usr/bin/env python
import argparse
import logging
import sys
import gym
import universe # register the universe environments
from universe import wrappers
logger = logging.getLogger()
def main():
parser = argparse.ArgumentParser(description=None)
parser.add_argument('-v', '--verbose', action='count', des... | #!/usr/bin/env python
import argparse
import logging
import sys
import gym
import universe # register the universe environments
from universe import wrappers
logger = logging.getLogger()
def main():
parser = argparse.ArgumentParser(description=None)
parser.add_argument('-v', '--verbose', action='count', des... | mit | Python |
cd23780fdc39003f2affe7352bc3253f958faaa5 | Change assertion so it works with pytest (don't know what its problem is...) | ZeitOnline/zeit.content.cp,ZeitOnline/zeit.content.cp | src/zeit/content/cp/browser/tests/test_centerpage.py | src/zeit/content/cp/browser/tests/test_centerpage.py | import mock
import zeit.cms.testing
import zeit.content.cp
import zope.testbrowser.testing
class PermissionsTest(zeit.cms.testing.BrowserTestCase):
layer = zeit.content.cp.testing.layer
def setUp(self):
super(PermissionsTest, self).setUp()
zeit.content.cp.browser.testing.create_cp(self.brows... | import mock
import zeit.cms.testing
import zeit.content.cp
import zope.testbrowser.testing
class PermissionsTest(zeit.cms.testing.BrowserTestCase):
layer = zeit.content.cp.testing.layer
def setUp(self):
super(PermissionsTest, self).setUp()
zeit.content.cp.browser.testing.create_cp(self.brows... | bsd-3-clause | Python |
fed1475564f7ca8a496d50446e4e5924befe8628 | Update function output type annotation | tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,paolodedios/tensorflow,paolodedios/tensorfl... | tensorflow/core/function/capture/free_vars_detect.py | tensorflow/core/function/capture/free_vars_detect.py | # Copyright 2022 The TensorFlow Authors. 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 applica... | # Copyright 2022 The TensorFlow Authors. 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 applica... | apache-2.0 | Python |
cbfbc2dbeeb8a03cd96ef2756185099a9be9b714 | Update data_provider_test.py | tensorflow/gan,tensorflow/gan | tensorflow_gan/examples/esrgan/data_provider_test.py | tensorflow_gan/examples/esrgan/data_provider_test.py | # coding=utf-8
# Copyright 2021 The TensorFlow GAN Authors.
#
# 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 applicabl... | # coding=utf-8
# Copyright 2021 The TensorFlow GAN Authors.
#
# 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 applicabl... | apache-2.0 | Python |
ef0d0fa26bfd22c281c54bc348877afd0a7ee9d7 | Use regex to match user metrics | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/integration/blueprints/metrics/test_metrics.py | tests/integration/blueprints/metrics/test_metrics.py | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import re
import pytest
# To be overridden by test parametrization
@pytest.fixture
def config_overrides():
return {}
@pytest.fixture
def client(admin_app, config_overrides, make_admin_app):
app = make_admin... | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
# To be overridden by test parametrization
@pytest.fixture
def config_overrides():
return {}
@pytest.fixture
def client(admin_app, config_overrides, make_admin_app):
app = make_admin_app(**conf... | bsd-3-clause | Python |
cc1b63e76a88fd589bfe3fce2f6cbe5becf995bc | use no_backprop_mode | yuyu2172/chainercv,pfnet/chainercv,chainer/chainercv,yuyu2172/chainercv,chainer/chainercv | tests/links_tests/model_tests/vgg_tests/test_vgg16.py | tests/links_tests/model_tests/vgg_tests/test_vgg16.py | import unittest
import numpy as np
import chainer
from chainer.initializers import Zero
from chainer import testing
from chainer.testing import attr
from chainer import Variable
from chainercv.links import VGG16
@testing.parameterize(
{'pick': 'prob', 'shapes': (1, 200), 'n_class': 200},
{'pick': 'pool5', ... | import unittest
import numpy as np
from chainer.initializers import Zero
from chainer import testing
from chainer.testing import attr
from chainer import Variable
from chainercv.links import VGG16
@testing.parameterize(
{'pick': 'prob', 'shapes': (1, 200), 'n_class': 200},
{'pick': 'pool5', 'shapes': (1, 5... | mit | Python |
b635d3bb0a0de01539d66dda4555b306c59082ee | fix version number | MacHu-GWU/constant2-project | constant2/__init__.py | constant2/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from ._constant2 import Constant
except: # pragma: no cover
pass
__version__ = "0.0.10"
__short_description__ = "provide extensive way of managing your constant variable."
__license__ = "MIT"
__author__ = "Sanhe Hu"
__author_email__ = "husanhe@gmail.com"
__m... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from ._constant2 import Constant
except: # pragma: no cover
pass
__version__ = "0.0.9"
__short_description__ = "provide extensive way of managing your constant variable."
__license__ = "MIT"
__author__ = "Sanhe Hu"
__author_email__ = "husanhe@gmail.com"
__ma... | mit | Python |
770c4fd0b282ee355d2ea3e662786113dd6b4e74 | add 1.4.2 (#26472) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-nipype/package.py | var/spack/repos/builtin/packages/py-nipype/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 PyNipype(PythonPackage):
"""Neuroimaging in Python: Pipelines and Interfaces."""
home... | # 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 PyNipype(PythonPackage):
"""Neuroimaging in Python: Pipelines and Interfaces."""
home... | lgpl-2.1 | Python |
63d4d37c9194aacd783e911452a34ca78a477041 | add latest version 1.2.0 (#23528) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-vermin/package.py | var/spack/repos/builtin/packages/py-vermin/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)
class PyVermin(PythonPackage):
"""Concurrently detect the minimum Python versions needed to run code."""
homepag... | # 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)
class PyVermin(PythonPackage):
"""Concurrently detect the minimum Python versions needed to run code."""
homepag... | lgpl-2.1 | Python |
c0627c6d8d11a9b9597b8fecd10b562d46a71521 | Send fio results to fio.sc.couchbase.com | couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner | perfrunner/tests/fio.py | perfrunner/tests/fio.py | from collections import defaultdict
import requests
from logger import logger
from perfrunner.helpers.misc import pretty_dict
from perfrunner.helpers.remote import RemoteHelper
from perfrunner.tests import PerfTest
class FIOTest(PerfTest):
TRACKER = 'fio.sc.couchbase.com'
TEMPLATE = {
'group': '{}... | from collections import defaultdict
from logger import logger
from perfrunner.helpers.misc import pretty_dict
from perfrunner.helpers.remote import RemoteHelper
from perfrunner.tests import PerfTest
class FIOTest(PerfTest):
def __init__(self, cluster_spec, test_config, verbose):
self.cluster_spec = clu... | apache-2.0 | Python |
69038348a0e029d2b06c2753a0dec9b2552ed820 | Add license header to __init__.py | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/__init__.py | openquake/__init__.py | """
OpenGEM is an open-source platform for the calculation of hazard, risk,
and socio-economic impact. It is a project of the Global Earthquake Model,
nd may be extended by other organizations to address additional classes
of peril.
For more information, please see the website at http://www.globalquakemodel.org
Thi... | """
OpenGEM is an open-source platform for the calculation of hazard, risk,
and socio-economic impact. It is a project of the Global Earthquake Model,
nd may be extended by other organizations to address additional classes
of peril.
For more information, please see the website at http://www.globalquakemodel.org
Thi... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.