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 |
|---|---|---|---|---|---|---|---|---|
ee6ad550ebeeaebf7c0959932ec60cbd923d480e | Add proper header and fix import. | Storj/plowshare-wrapper | plowshare/__init__.py | plowshare/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Storj Labs
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | from .plowshare import *
| mit | Python |
4fa75f0d403bc49b19eb77f9bd2cdb3115d3a5f6 | Set custom command role to user_level | CactusDev/CactusBot | cactusbot/commands/magic/command.py | cactusbot/commands/magic/command.py | """Manage commands."""
from . import Command
class Meta(Command):
"""Manage commands."""
COMMAND = "command"
ROLES = {
'+': 50,
'$': 20
}
@Command.subcommand
async def add(self, command: r'!?([+$]?)(.+)', *response, raw: "packet"):
"""Add a command."""
symb... | """Manage commands."""
from . import Command
class Meta(Command):
"""Manage commands."""
COMMAND = "command"
ROLES = {
'+': 50,
'$': 20
}
@Command.subcommand
async def add(self, command: r'!?([+$]?)(.+)', *response, raw: "packet"):
"""Add a command."""
symb... | mit | Python |
1cb02398d835201100d4643cdf751aafa6e7fd78 | Fix potential errors in product administration controller | urdh/streck,urdh/streck | streck/controller/admin/product.py | streck/controller/admin/product.py | # -*- coding: utf-8 -*-
from os import path, mkdir
from streck import app
from streck.models.product import *
from flask import render_template, request, flash, redirect
from werkzeug.utils import secure_filename
def upload_product_picture(file):
if not file:
return None
if not path.exists(path.join(app.config['UP... | # -*- coding: utf-8 -*-
from os import path
from streck import app
from streck.models.product import *
from flask import render_template, request, flash, redirect
def upload_product_picture(file):
if not file:
return None
fname = path.join('products/', secure_filename(file.filename))
file.save(path.join(app.confi... | isc | Python |
ecb21905a499b6d43b862d47f5ca73fd11ff18d1 | fix watching gay porn (not tested, don't worry) | Konubinix/weboob,laurent-george/weboob,willprice/weboob,Boussadia/weboob,RouxRC/weboob,sputnick-dev/weboob,Boussadia/weboob,RouxRC/weboob,franek/weboob,Konubinix/weboob,franek/weboob,nojhan/weboob-devel,laurent-george/weboob,sputnick-dev/weboob,RouxRC/weboob,Boussadia/weboob,yannrouillard/weboob,eirmag/weboob,laurent-g... | weboob/backends/youporn/browser.py | weboob/backends/youporn/browser.py | # -*- coding: utf-8 -*-
"""
Copyright(C) 2010 Romain Bignon
This program 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, version 3 of the License.
This program is distributed in the hope that it will be useful... | # -*- coding: utf-8 -*-
"""
Copyright(C) 2010 Romain Bignon
This program 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, version 3 of the License.
This program is distributed in the hope that it will be useful... | agpl-3.0 | Python |
959d8b73ee95af8ba1c324a1d6d52d1063014e13 | fix bug - no object set for post' | althalus/knotcrafters,althalus/knotcrafters,althalus/knotcrafters | knotdirectory/knotdirectory/knots/inlineformsetsviews.py | knotdirectory/knotdirectory/knots/inlineformsetsviews.py | from django.http import HttpResponseRedirect
from django.views.generic import CreateView, UpdateView
class FormsetsMixin(object):
formsets = []
def get(self, request, *args, **kwargs):
form_class = self.get_form_class()
form = self.get_form(form_class)
formsets = self.get_formsets()
... | from django.http import HttpResponseRedirect
from django.views.generic import CreateView, UpdateView
class FormsetsMixin(object):
formsets = []
def get(self, request, *args, **kwargs):
form_class = self.get_form_class()
form = self.get_form(form_class)
formsets = self.get_formsets()
... | mit | Python |
b56b29a024c81ac0e100c1b3e020fd25fcc4386a | increase version to 0.9.0 | byteweaver/django-coupons,byteweaver/django-coupons | coupons/__init__.py | coupons/__init__.py | __version__ = '0.9.0'
| __version__ = '0.0.0'
| bsd-3-clause | Python |
0f9021df0ae97fb4f13240a8d79fc2e1382845d1 | update to 1.2.0a12 | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | coupons/__init__.py | coupons/__init__.py | # Copyright (C) 2016-2017, Raffaele Salmaso <raffaele@salmaso.org>
# Copyright (C) 2013, byteweaver
# 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 re... | # Copyright (C) 2016-2017, Raffaele Salmaso <raffaele@salmaso.org>
# Copyright (C) 2013, byteweaver
# 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 re... | bsd-3-clause | Python |
84720ac10326c22a8acf7fd72aae5b91a2534ec0 | Bump the version to 4.0b1 | hugovk/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,jayhetee/coveragepy,nedbat/coveragepy,blueyed/coveragepy,blueyed/coveragepy,7WebPages/coveragepy,7WebPages/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,blueyed/coveragepy,hugovk/coveragepy,blueyed/coveragepy,nedbat/coverag... | coverage/version.py | coverage/version.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""The version and URL for coverage.py"""
# This file is exec'ed in setup.py, don't import anything!
__version__ = "4.0b1" # see detailed history... | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""The version and URL for coverage.py"""
# This file is exec'ed in setup.py, don't import anything!
__version__ = "4.0a7" # see detailed history... | apache-2.0 | Python |
db89b8c6d68b77887ea0294498bc38a028e8ff78 | bump version to v0.2.8 | guyingbo/cowfish | cowfish/__init__.py | cowfish/__init__.py | "A useful asynchronous library that is built on top of aiobotocore"
__version__ = "0.2.8"
| "A useful asynchronous library that is built on top of aiobotocore"
__version__ = "0.2.7"
| mit | Python |
b9fca2dcc8cccba67911a4fba5401aa45fa8665a | use wrap_tool | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/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 |
968ba704fb036f55b0394e011dac66507783a54a | Test reorder method with offset and utc params | bufferapp/buffer-python,vtemian/buffpy | buffer/tests/test_updates_manager.py | buffer/tests/test_updates_manager.py | import json
from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.managers.updates import Updates
from buffer.models.update import Update
def test_updates_manager_pending():
'''
Test basic pending updates retrieving
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {
... | import json
from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.managers.updates import Updates
from buffer.models.update import Update
def test_updates_manager_pending():
'''
Test basic pending updates retrieving
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {
... | mit | Python |
643c8896b23cc1d008ce1e2a278d4379fb3b9b08 | Fix name of languages table | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/services/language/dbmodels.py | byceps/services/language/dbmodels.py | """
byceps.services.language.dbmodels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ...database import db
class Language(db.Model):
"""A language.
The code can be just `en` or `de`, but also `en-gb` or `de-de`.
... | """
byceps.services.language.dbmodels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ...database import db
class Language(db.Model):
"""A language.
The code can be just `en` or `de`, but also `en-gb` or `de-de`.
... | bsd-3-clause | Python |
67923d9aff2b396d2a5185ca0f59d2442434abc6 | Bump version to 0.3.0 | Ape/samsungctl,dominikkarall/samsungctl | samsungctl/__init__.py | samsungctl/__init__.py | """Remote control Samsung televisions via TCP/IP connection"""
__title__ = "samsungctl"
__version__ = "0.3.0-git"
__url__ = "https://github.com/Ape/samsungctl"
__author__ = "Lauri Niskanen"
__author_email__ = "ape@ape3000.com"
__license__ = "MIT"
| """Remote control Samsung televisions via TCP/IP connection"""
__title__ = "samsungctl"
__version__ = "0.2.0-git"
__url__ = "https://github.com/Ape/samsungctl"
__author__ = "Lauri Niskanen"
__author_email__ = "ape@ape3000.com"
__license__ = "MIT"
| mit | Python |
dbbb95bb44040f7f3894923463c4c5ae164c1a42 | fix python lint issues [ci skip] | vszakats/harbour-deps,vszakats/harbour-deps | _peclean.py | _peclean.py | #!/usr/bin/env python
# Copyright 2015-2016 Viktor Szakats <https://github.com/vszakats>
# See LICENSE.md
import calendar
import datetime
import glob
import os
import sys
import pefile
if len(sys.argv) > 2:
FTIME = calendar.timegm(
datetime.datetime.fromtimestamp(
os.path.getmtime(sys.argv[1... | #!/usr/bin/env python
# Copyright 2015-2016 Viktor Szakats <https://github.com/vszakats>
# See LICENSE.md
import calendar
import datetime
import glob
import os
import pefile
import sys
if len(sys.argv) > 2:
ts = calendar.timegm(datetime.datetime.fromtimestamp(os.path.getmtime(sys.argv[1])).timetuple())
for fil... | mit | Python |
c7e57721ebc18139fc42fd5fd0eb5ea30e3fa8a6 | Fix Django 1.10 deprecation warnings. | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/server/urls.py | nodeconductor/server/urls.py | from __future__ import unicode_literals
import permission
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from django.views.generic import TemplateView
from nodeconductor.core import NodeConductorExtension
from nodeconductor.core... | from __future__ import unicode_literals
import permission
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from django.views.generic import TemplateView
from nodeconductor.core import NodeConductorExtension
from nodeconductor.core... | mit | Python |
20766d3449332a5e2bff418d7866592983c638f6 | fix missing import | bretth/woven | woven/management/commands/patch.py | woven/management/commands/patch.py | #!/usr/bin/env python
from optparse import make_option
from fabric.context_managers import settings
from woven.api import deploy, activate
from woven.management.base import WovenCommand
from woven.environment import set_project_env
class Command(WovenCommand):
option_list = WovenCommand.option_list + (
)
... | #!/usr/bin/env python
from optparse import make_option
from woven.api import deploy, activate
from woven.management.base import WovenCommand
from woven.environment import set_project_env
class Command(WovenCommand):
option_list = WovenCommand.option_list + (
)
help = "Patch the current version of your ... | bsd-3-clause | Python |
b8a2487a5d0ad45e630febef87ada2effb5fff0e | make a bug in pep8 to see if jenkins will catch this up | Opentopic/falcon-api | api/exceptions.py | api/exceptions.py | class ApiException(Exception):
pass
class ParamException(ApiException):
pass
| class ApiException(Exception):
pass
class ParamException(ApiException):
pass
| mit | Python |
cd27138b6cc963450851417ef06303027da51419 | remove commented code | pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2 | wqflask/wqflask/markdown_routes.py | wqflask/wqflask/markdown_routes.py | """Markdown routes
Render pages from github, or if they are unavailable, look for it else where
"""
import requests
import markdown
from flask import Blueprint
from flask import render_template
glossary_blueprint = Blueprint('glossary_blueprint', __name__)
references_blueprint = Blueprint("references_blueprint", __n... | """Markdown routes
Render pages from github, or if they are unavailable, look for it else where
"""
import requests
import markdown
from flask import Blueprint
from flask import render_template
glossary_blueprint = Blueprint('glossary_blueprint', __name__)
references_blueprint = Blueprint("references_blueprint", __n... | agpl-3.0 | Python |
c5e5b3d6c3d8cad75b1d2eac16179872dd415eb9 | Use environment var for AMI_ID. | eltoncarr/tubular,eltoncarr/tubular | scripts/asgard-deploy.py | scripts/asgard-deploy.py | #!/usr/bin/env python
import sys
import logging
import click
import tubular.asgard as asgard
logging.basicConfig(stream=sys.stdout, level=logging.ERROR)
@click.command()
@click.option('--ami_id', envvar='AMI_ID', help='The ami-id to deploy', required=True)
def deploy(ami_id):
try:
asgard.deploy(ami_id)
... | #!/usr/bin/env python
import sys
import logging
import click
import tubular.asgard as asgard
logging.basicConfig(stream=sys.stdout, level=logging.ERROR)
@click.command()
@click.option('--ami_id', help='The ami-id to deploy', required=True)
def deploy(ami_id):
try:
asgard.deploy(ami_id)
except Exceptio... | agpl-3.0 | Python |
9167d103c82b7d2c4528082b96dddbf5b6fea0bb | Handle mixed page path lengths. | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | scripts/ca-image-ids.py | scripts/ca-image-ids.py | from __future__ import print_function
import os, sys
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import col, collect_list, collect_set, concat_ws, input_file_name, \
posexplode, regexp_replace, size, split, sort_array, udf
def idPrefix(batch, path):
dirs = path.lower().split('/')
i... | from __future__ import print_function
import os, sys
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import col, collect_list, collect_set, concat_ws, input_file_name, \
posexplode, regexp_replace, size, split, sort_array, udf
def idPrefix(batch, path):
dirs = path.lower().split('/')
i... | apache-2.0 | Python |
51a126c0ada7c00a99416b241bb1c11888e82836 | Use bounds to determing jra55 grid cell locations. | DoublePrecision/esmgrids | esmgrids/jra55_grid.py | esmgrids/jra55_grid.py |
import numpy as np
import netCDF4 as nc
from .base_grid import BaseGrid
class Jra55Grid(BaseGrid):
def __init__(self, h_grid_def, description='JRA55 regular grid'):
self.type = 'Arakawa A'
self.full_name = 'JRA55'
with nc.Dataset(h_grid_def) as f:
lon_bnds = f.variables['lon... |
import numpy as np
import netCDF4 as nc
from .base_grid import BaseGrid
class Jra55Grid(BaseGrid):
def __init__(self, h_grid_def, description='JRA55 regular grid'):
self.type = 'Arakawa A'
self.full_name = 'JRA55'
with nc.Dataset(h_grid_def) as f:
x_t = f.variables['lon'][:]... | apache-2.0 | Python |
5bcbbc153f101915ec2ca14874d1f10ad3d7ad23 | Update thermal_storage.py | architecture-building-systems/CEAforArcGIS,architecture-building-systems/CEAforArcGIS | cea/technologies/thermal_storage.py | cea/technologies/thermal_storage.py | """
thermal storage
"""
from __future__ import division
import pandas as pd
from math import log
__author__ = "Thuy-An Nguyen"
__copyright__ = "Copyright 2015, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Thuy-An Nguyen", "Tim Vollrath", "Jimeno A. Fonseca"]
__license__ = "MIT"
__version__ = "0.1"
... | """
thermal storage
"""
from __future__ import division
import pandas as pd
from math import log
__author__ = "Thuy-An Nguyen"
__copyright__ = "Copyright 2015, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Thuy-An Nguyen", "Tim Vollrath", "Jimeno A. Fonseca"]
__license__ = "MIT"
__version__ = "0.1"
... | mit | Python |
937b02b9de492d809f37e2b70a34775a27fcd62a | Refactor _get_property_value | yola/property-caching | property_caching/__init__.py | property_caching/__init__.py | from functools import update_wrapper
_CLASS_CACHE_ATTR_NAME = '_class_cached_properties'
_OBJ_CACHE_ATTR_NAME = '_cached_properties'
def class_cached_property(fn):
def _class_cached_property(self):
return _get_property_value(fn, self.__class__, _CLASS_CACHE_ATTR_NAME)
return property(update_wrapper(... | from functools import update_wrapper
_CLASS_CACHE_ATTR_NAME = '_class_cached_properties'
_OBJ_CACHE_ATTR_NAME = '_cached_properties'
def class_cached_property(fn):
def _class_cached_property(self):
return _get_property_value(fn, self.__class__, _CLASS_CACHE_ATTR_NAME)
return property(update_wrapper(... | mit | Python |
4dac07032e3c752480f0f993a9553215fad5e210 | Update processes.py | xapple/plumbing | plumbing/processes.py | plumbing/processes.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
Processes and parallelism
=========================
The ``processes`` module provides some convenience functions
for using parallel processes in python.
Adapted from http://stackoverflow.com/a/160... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
Processes and parallelism
=========================
The ``processes`` module provides some convenience functions
for using parallel processes in python.
Adapted from http://stackoverflow.com/a/160... | mit | Python |
2ff871e4536c5628c12152c986f0929ad0c74b31 | remove unused imports | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | commit.py | commit.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import package
import copy
# version is a short package version, not an SRS version string
def finalCommit(repos, cfg, pkgName, simpleVersion, fileList):
pkgSet = repos.getPackageSet(pkgName, "w")
version = pkgSet.getLatestVersion(cfg.defaultbranch... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import package
import files
import shutil
import string
import copy
# version is a short package version, not an SRS version string
def finalCommit(repos, cfg, pkgName, simpleVersion, fileList):
pkgSet = repos.getPackageSet(pkgName, "w")
version = ... | apache-2.0 | Python |
eda91cfa962668e5c10059b0ae487fa8066462ec | Add missing __future__ import | mokieyue/mopidy,mopidy/mopidy,adamcik/mopidy,kingosticks/mopidy,tkem/mopidy,jodal/mopidy,mopidy/mopidy,adamcik/mopidy,vrs01/mopidy,kingosticks/mopidy,ZenithDK/mopidy,kingosticks/mopidy,jodal/mopidy,mokieyue/mopidy,vrs01/mopidy,tkem/mopidy,tkem/mopidy,mopidy/mopidy,tkem/mopidy,adamcik/mopidy,vrs01/mopidy,ZenithDK/mopidy... | mopidy/internal/gi.py | mopidy/internal/gi.py | from __future__ import absolute_import, print_function, unicode_literals
import sys
import textwrap
try:
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstPbutils', '1.0')
from gi.repository import GLib, GObject, Gst, GstPbutils
except ImportError:
print(textwrap.dedent("""
... | from __future__ import absolute_import, unicode_literals
import sys
import textwrap
try:
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstPbutils', '1.0')
from gi.repository import GLib, GObject, Gst, GstPbutils
except ImportError:
print(textwrap.dedent("""
ERROR: A GObje... | apache-2.0 | Python |
cb7d396944eea2d33d3023cde31b4a4e1d392eab | fix ampq connection settings | openrural/open-data-nc,OpenData-NC/open-data-nc,openrural/open-data-nc,OpenData-NC/open-data-nc,openrural/open-data-nc,OpenData-NC/open-data-nc | opendata/settings/staging.py | opendata/settings/staging.py | from opendata.settings.base import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = os.environ['SECRET_KEY']
DATABASES['default']['NAME'] = 'opendata_staging'
PUBLIC_ROOT = '/var/www/opendata-staging/public/'
STATIC_ROOT = os.path.join(PUBLIC_ROOT, 'static')
MEDIA_ROOT = os.path.join(PUBLIC_ROOT, 'media')
CAC... | from opendata.settings.base import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = os.environ['SECRET_KEY']
DATABASES['default']['NAME'] = 'opendata_staging'
PUBLIC_ROOT = '/var/www/opendata-staging/public/'
STATIC_ROOT = os.path.join(PUBLIC_ROOT, 'static')
MEDIA_ROOT = os.path.join(PUBLIC_ROOT, 'media')
CAC... | mit | Python |
baac2d190ea5e43e59dbac33861499645b48529d | fix indentation | patrickwolf/python-tutorial,patrickwolf/python-tutorial | pyintro_d_unittests/multi_add_test.py | pyintro_d_unittests/multi_add_test.py | __author__ = 'Patrick'
import unittest
import multi_add as f
class MultiAddTestCase(unittest.TestCase):
def test_add(self):
result = f.add(5)
self.assertEqual(result, 5)
self.assertEqual(f.add(5, 10), 15)
self.assertEqual(f.add(5, cint=20), 25)
def test_multi_add(self):
... | __author__ = 'Patrick'
import unittest
import multi_add as f
class MultiAddTestCase(unittest.TestCase):
def test_add(self):
result = f.add(5)
self.assertEqual(result, 5)
self.assertEqual(f.add(5, 10), 15)
self.assertEqual(f.add(5, cint=20), 25)
def test_multi_add(self):
... | mit | Python |
5204ad5627a5068d2c5e1dd50089a46c8964fa8c | Include TAUtil.Gdi in Mappy release zip | MHeasell/Mappy,MHeasell/Mappy | dist/MakeReleaseZip.py | dist/MakeReleaseZip.py | from subprocess import check_output
import zipfile
import os
import os.path
from os.path import join
import sys
import shutil
import argparse
parser = argparse.ArgumentParser(description="Release packaging script")
parser.add_argument("--release", dest="release", action="store_const",
const=True, default=Fals... | from subprocess import check_output
import zipfile
import os
import os.path
from os.path import join
import sys
import shutil
import argparse
parser = argparse.ArgumentParser(description="Release packaging script")
parser.add_argument("--release", dest="release", action="store_const",
const=True, default=Fals... | mit | Python |
97967e437552d40bb6670b3c8dff738cbade784d | Rename function in Chordal to PerfectEliminationOrdering. | jfinkels/PADS | Chordal.py | Chordal.py | """Chordal.py
Recognize and compute elimination ordering of chordal graphs, using
an algorithm from http://www.cs.colostate.edu/~rmm/lexbfs.ps
D. Eppstein, November 2003.
"""
from LexBFS import LexBFS
from sets import Set
def PerfectEliminationOrdering(G):
"""Return a perfect elimination ordering, or None if G ... | """Chordal.py
Recognize and compute elimination ordering of chordal graphs, using
an algorithm from http://www.cs.colostate.edu/~rmm/lexbfs.ps
D. Eppstein, November 2003.
"""
from LexBFS import LexBFS
from sets import Set
def Chordal(G):
"""Return a perfect elimination ordering, or None if G is not chordal.
... | mit | Python |
0cab9446397057b9d175fc6298448fb020b7036c | Remove the mono camera thread, and rename capture functions. | microy/PyStereoVisionToolkit,microy/PyStereoVisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/VisionToolkit,microy/StereoVision | StereoVision/Camera.py | StereoVision/Camera.py | # -*- coding:utf-8 -*-
#
# Module to capture images from USB cameras
#
# External dependencies
import threading
import cv2
# Thread to read the images from two USB cameras
class UsbStereoCamera( threading.Thread ) :
# Initialisation
def __init__( self ) :
# Initialize the thread
super( UsbStereoCamera, self )... | # -*- coding:utf-8 -*-
#
# Module to capture images from USB cameras
#
# External dependencies
import threading
import cv2
# Thread to read the images from a USB camera
class UsbCapture( threading.Thread ) :
# Initialisation
def __init__( self, image_callback ) :
# Initialize the thread
super( UsbCapture, sel... | mit | Python |
01dbc0668ea2c7fc36f6b50b9f87ac0398d45fcc | add queue size limitation | noirbee/savate,noirbee/savate | savate/buffer_event.py | savate/buffer_event.py | # -*- coding: utf-8 -*-
import errno
import collections
# FIXME: should this be a method of BufferEvent below ?
try:
memoryview
def make_buffer(data):
return memoryview(data)
def buffer_slice(buff, offset):
return buff[offset:]
except NameError:
def make_buffer(data):
return b... | # -*- coding: utf-8 -*-
import errno
import collections
# FIXME: should this be a method of BufferEvent below ?
try:
memoryview
def make_buffer(data):
return memoryview(data)
def buffer_slice(buff, offset):
return buff[offset:]
except NameError:
def make_buffer(data):
return b... | agpl-3.0 | Python |
cb3143351958ede27a068097e9cd08d1747b9d2f | remove 'from pylab import *' | guziy/basemap,matplotlib/basemap,matplotlib/basemap,guziy/basemap | examples/nytolondon.py | examples/nytolondon.py | # example demonstrating how to draw a great circle on a map.
from matplotlib.toolkits.basemap import Basemap
from pylab import title, arange, show, figure
# setup lambert azimuthal map projection.
# create new figure
fig=figure()
m = Basemap(llcrnrlon=-100.,llcrnrlat=20.,urcrnrlon=20.,urcrnrlat=60.,\
rsphe... | # example demonstrating how to draw a great circle on a map.
from matplotlib.toolkits.basemap import Basemap
from pylab import *
# setup lambert azimuthal map projection.
# create new figure
fig=figure()
m = Basemap(llcrnrlon=-100.,llcrnrlat=20.,urcrnrlon=20.,urcrnrlat=60.,\
rsphere=(6378137.00,6356752.314... | mit | Python |
3d5442b0c78a2d2214d583321a66308c5693ba7a | Fix python3 | tpeng/graphite-beacon,fried-sausage/graphite-beacon,pirogoeth/graphite-beacon,klen/graphite-beacon,boomtrain/graphite-beacon,pirogoeth/graphite-beacon,OnBloom/graphite-beacon,pirogoeth/graphite-beacon,peterkshultz/graphite-beacon,OnBloom/graphite-beacon,boomtrain/graphite-beacon,peterkshultz/graphite-beacon,peterkshult... | graphite_beacon/handlers/victorops.py | graphite_beacon/handlers/victorops.py | import json
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin
from tornado import gen, httpclient as hc
from . import AbstractHandler, LOGGER
class VictorOpsHandler(AbstractHandler):
name = 'victorops'
def init_handler(self):
self.url = self.options.get... | import json
from urlparse import urljoin
from tornado import gen, httpclient as hc
from . import AbstractHandler, LOGGER
class VictorOpsHandler(AbstractHandler):
name = 'victorops'
def init_handler(self):
self.url = self.options.get('endpoint')
assert self.url, 'REST Endpoint is not defined... | mit | Python |
03fa6aa3d423889080e0f47e1c59812087591fdc | add new line at end of example | paulmueller/radontea,RI-imaging/radontea | examples/3D_example.py | examples/3D_example.py | """Volumetric data reconstruction
"""
from multiprocessing import cpu_count
import time
import numpy as np
import radontea as rt
A = 70 # number of angles
N = 128 # detector size x
M = 24 # detector size y (number of slices)
# generate random data
sino0 = np.random.random((A, N)) # for 2d example
sin... | """Volumetric data reconstruction
"""
from multiprocessing import cpu_count
import time
import numpy as np
import radontea as rt
A = 70 # number of angles
N = 128 # detector size x
M = 24 # detector size y (number of slices)
# generate random data
sino0 = np.random.random((A, N)) # for 2d example
sin... | bsd-3-clause | Python |
da48a52f464a545695dc2f34045472e3894f5216 | Update ParseTsvFile.py | naturalis/biovel-nbc,naturalis/biovel-nbc,naturalis/biovel-nbc,naturalis/biovel-nbc,naturalis/biovel-nbc | script/ParseTsvFile.py | script/ParseTsvFile.py | import sys,os
sys.stdout.write('Insert the input file location\n')
Input=raw_input()
sys.stdout.write('Insert a list of column names seperated by semicolon\n')
Cols=raw_input()
S='GeographicalOrigin;Pathogenic_Potential;Biomass;host;phenology'
S1='Biomass'
def dict2TSV(D_TaxRequestedValues):
L=[]
for TaxID in D_T... | import sys,os
sys.stdout.write('Insert the input file location\n')
Input=raw_input()
sys.stdout.write('Insert a list of column names seperated by semicolon\n')
Cols=raw_input()
S='GeographicalOrigin;Pathogenic_Potential;Biomass;host;phenology'
S1='Biomass'
def dict2TSV(D_TaxRequestedValues):
L=[]
for TaxID in D_T... | apache-2.0 | Python |
38dcf85e8e80a7a6a2213fb80f7f480c74f87cac | extend session experation to 3 hours | xander-blr/kicker-scorer,dpfg/kicker-scorer-api,dpfg/kicker-scorer-api,xander-blr/kicker-scorer | config.py | config.py | import os
from datetime import timedelta
# App settings
APPLICATION_ROOT = '/api'
DEBUG = True
# DB settings
db_host = os.getenv('DB_HOST', 'localhost')
db_user = os.getenv('DB_USER', 'root')
db_pwd = os.getenv('DB_PWD', '')
SQLALCHEMY_DATABASE_URI = "mysql://{:s}:{:s}@{:s}:3306/kicker_db".format(db_user, db_pwd, db_... | import os
from datetime import timedelta
# App settings
APPLICATION_ROOT = '/api'
DEBUG = True
# DB settings
db_host = os.getenv('DB_HOST', 'localhost')
db_user = os.getenv('DB_USER', 'root')
db_pwd = os.getenv('DB_PWD', '')
SQLALCHEMY_DATABASE_URI = "mysql://{:s}:{:s}@{:s}:3306/kicker_db".format(db_user, db_pwd, db_... | mit | Python |
d4e92d25cfe2b5baf1e5d165b6a2957d5ba0065b | Update pocs/scheduler/__init__.py | panoptes/POCS,panoptes/POCS,panoptes/POCS,panoptes/POCS | pocs/scheduler/__init__.py | pocs/scheduler/__init__.py | import os
from astropy import units as u
from pocs.scheduler.constraint import Altitude
from pocs.scheduler.constraint import Duration
from pocs.scheduler.constraint import MoonAvoidance
from pocs.scheduler.scheduler import BaseScheduler # pragma: no flakes
from pocs.utils import error
from pocs.utils import horizon... | import os
from astropy import units as u
from pocs.scheduler.constraint import Altitude
from pocs.scheduler.constraint import Duration
from pocs.scheduler.constraint import MoonAvoidance
from pocs.scheduler.scheduler import BaseScheduler # pragma: no flakes
from pocs.utils import error
from pocs.utils import horizon... | mit | Python |
c7793f6271ed6ee82d97f01d372ae14d595a849e | Fix for SQLALCHEMY_DATABASE_URI in config.py | paulaylingdev/blogsite,paulaylingdev/blogsite | config.py | config.py | """Application configuration file."""
# Flask SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqlite:///foo.db"
| """Application configuration file."""
# Flask SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqllite:///foo.db"
| mit | Python |
c59685bf3555b98900999cf721de6394c906585e | 修改 SQL_URI 获取方式 | xiuchundao/xiuchundao-site,xiuchundao/xiuchundao-site | config.py | config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
SECRET_KEY = os.environ.get('SECRET_KEY') or '\x03d\xf4\x95J\x15\xa4B\xfb\xc0\xaf \xd1A[j$}\x18\x16a\xe7\xd0\xec'
SSL_DISABLE = False
# SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
BABEL_DEFA... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
SECRET_KEY = os.environ.get('SECRET_KEY') or '\x03d\xf4\x95J\x15\xa4B\xfb\xc0\xaf \xd1A[j$}\x18\x16a\xe7\xd0\xec'
SSL_DISABLE = False
# SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
BABEL_DEFA... | mit | Python |
54db90c66e6bc32d792117909935abb8174876c6 | Remove unused import, add more logging | indx/indx-core,indx/indx-core,indx/indx-core,indx/indx-core,indx/indx-core | apps/moves/__init__.py | apps/moves/__init__.py | # Copyright (C) 2011-2013 University of Southampton
# Copyright (C) 2011-2013 Daniel Alexander Smith
# Copyright (C) 2011-2013 Max Van Kleek
# Copyright (C) 2011-2013 Nigel R. Shadbolt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gener... | # Copyright (C) 2011-2013 University of Southampton
# Copyright (C) 2011-2013 Daniel Alexander Smith
# Copyright (C) 2011-2013 Max Van Kleek
# Copyright (C) 2011-2013 Nigel R. Shadbolt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gener... | agpl-3.0 | Python |
d97140346990e1cf6acac335dab158814b18d66e | Set Release 4.1.0 as versions branches in config | smartdevicelink/sdl_atf_test_scripts,smartdevicelink/sdl_atf_test_scripts,smartdevicelink/sdl_atf_test_scripts | config.py | config.py | #!/usr/bin/env python
# Copyright (c) 2016 Ford Motor Company,
# 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 notice, this
# ... | #!/usr/bin/env python
# Copyright (c) 2016 Ford Motor Company,
# 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 notice, this
# ... | bsd-3-clause | Python |
1ee826a80793035601243d68fd8f0a00ec69ff6c | Use full words. | CUDEN-CLAS/atlas,CuBoulder/atlas,CuBoulder/atlas,CUDEN-CLAS/atlas,CuBoulder/atlas | config.py | config.py | """
Configuration file for Atlas
All variable settings should go here so values can be propagated to the various
functions from a central location.
"""
# Import config_local.py.
try:
from config_local import *
except ImportError:
raise Exception("You need a config_local.py file!")
# URL to eve instance, no ... | """
Configuration file for Atlas
All variable settings should go here so values can be propagated to the various
functions from a central location.
"""
# Import config_local.py.
try:
from config_local import *
except ImportError:
raise Exception("You need a config_local.py file!")
# URL to eve instance, no ... | mit | Python |
88306ae2052fe6661c13d98427d9a71d3d21bbc8 | Add support for multiple model/conf arguments | d53dave/cgopt,d53dave/cgopt,d53dave/csaopt,d53dave/csaopt | csaopt.py | csaopt.py | #!/usr/bin/env python3
import sys
import click
from csaopt.utils import internet_connectivity_available, get_configs
from csaopt import Runner
from csaopt import __appname__ as csaopt_name
from csaopt import __version__ as csaopt_version
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def eprint(*args, ... | #!/usr/bin/env python3
import sys
import click
from csaopt.utils import internet_connectivity_available, get_configs
from csaopt import Runner
from csaopt import __appname__ as csaopt_name
from csaopt import __version__ as csaopt_version
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def eprint(*args, ... | mit | Python |
6641567e4f4e843f8ddb56f135f4fa3535dd3df4 | Update Bubblesort example (issue #73 fixed) | stefanseefeld/numba,gmarkall/numba,pombredanne/numba,shiquanwang/numba,gdementen/numba,pitrou/numba,GaZ3ll3/numba,pitrou/numba,seibert/numba,stuartarchibald/numba,sklam/numba,stuartarchibald/numba,gmarkall/numba,sklam/numba,cpcloud/numba,stefanseefeld/numba,jriehl/numba,gdementen/numba,ssarangi/numba,jriehl/numba,stefa... | examples/bubblesort.py | examples/bubblesort.py | from numba import *
import numpy as np
from timeit import default_timer as timer
def bubblesort(X, doprint):
N = X.shape[0]
for end in range(N, 1, -1):
for i in range(end - 1):
cur = X[i]
if cur > X[i + 1]:
tmp = X[i]
X[i] = X[i + 1]
... | from numba import *
import numpy as np
from timeit import default_timer as timer
#@autojit
#def bubbleswap(X, i):
# tmp = X[i]
# X[i] = X[i + 1]
# X[i + 1] = tmp
def bubblesort(X, doprint):
N = X.shape[0]
for end in range(N, 1, -1):
for i in range(end - 1):
cur = X[i]
... | bsd-2-clause | Python |
f0fe10497ad8059cbba95a2f41d5a781f3aa182b | Add SK_IGNORE_DWRITE_BITMAP_FIX to Blink defines. | crosswalk-project/blink-crosswalk-efl,modulexcite/blink,jtg-gg/blink,hgl888/blink-crosswalk-efl,Pluto-tv/blink-crosswalk,nwjs/blink,jtg-gg/blink,Pluto-tv/blink-crosswalk,PeterWangIntel/blink-crosswalk,smishenk/blink-crosswalk,Bysmyyr/blink-crosswalk,crosswalk-project/blink-crosswalk-efl,Pluto-tv/blink-crosswalk,hgl888/... | public/blink_skia_config.gyp | public/blink_skia_config.gyp | #
# Copyright (C) 2012 Google Inc. 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
# notice, this list of conditions an... | #
# Copyright (C) 2012 Google Inc. 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
# notice, this list of conditions an... | bsd-3-clause | Python |
c5b05e9c73eb0348af5d21fc535cd4d57efdfc9b | Update server.py | quinnjn/GarageDoor | garagedoor/server.py | garagedoor/server.py | from flask import Flask
from garagedoor import GarageDoor
app = Flask(__name__)
garageDoor = GarageDoor()
@app.route("/open")
def openGarage():
garageDoor.open()
return "open"
@app.route("/close")
def closeGarage():
garageDoor.close()
return "close"
if __name__ == "__main__":
try:
app.run(host='0.0.0.0', po... | from flask import Flask
from garagedoor import GarageDoor
app = Flask(__name__)
garageDoor = GarageDoor()
@app.route("/open")
def openGarage():
garageDoor.open()
return "open"
@app.route("/close")
def closeGarage():
garageDoor.close()
return "close"
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80, ... | apache-2.0 | Python |
674d2925787c39837f5daf18a223ae824e091bc4 | add more tests for import_gds | gdsfactory/gdsfactory,gdsfactory/gdsfactory | gdsfactory/tests/test_import_gds.py | gdsfactory/tests/test_import_gds.py | import gdsfactory as gf
from gdsfactory.import_gds import add_ports_from_markers_inside, import_gds
def test_import_gds_snap_to_grid() -> None:
gdspath = gf.CONFIG["gdsdir"] / "mmi1x2.gds"
c = import_gds(gdspath, snap_to_grid_nm=5)
assert len(c.get_polygons()) == 8, len(c.get_polygons())
for x, y in ... | import gdsfactory as gf
from gdsfactory.import_gds import import_gds
def test_import_gds_snap_to_grid() -> None:
gdspath = gf.CONFIG["gdsdir"] / "mmi1x2.gds"
c = import_gds(gdspath, snap_to_grid_nm=5)
assert len(c.get_polygons()) == 8, len(c.get_polygons())
for x, y in c.get_polygons()[0]:
as... | mit | Python |
f46cec1a1121a5a7a7aff597c68dfc693b75eaa0 | fix error in SSHKeyDetail | cboling/xos,cboling/xos,xmaruto/mcord,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,xmaruto/mcord,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,cboling/xos | xos/core/xoslib/methods/sshkeys.py | xos/core/xoslib/methods/sshkeys.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from syndi... | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from syndi... | apache-2.0 | Python |
2163f2ef395e29d9e17c71c97884c175f8467329 | Add divider | amaotone/murasame | murasame/formatter.py | murasame/formatter.py | import os
import pandas as pd
from . import CONFIG
def standardize_prefecture(df):
conf = CONFIG["formatter"]["region"]
res = df.copy()
res[conf["ref"]] = res[conf["ref"]].str.replace("[府県]", "")
res[conf["ref"]] = res[conf["ref"]].str.replace("東京都", "東京")
return res
def append_region(df):
... | import pandas as pd
from . import CONFIG
def standardize_prefecture(df):
conf = CONFIG["formatter"]["region"]
res = df.copy()
res[conf["ref"]] = res[conf["ref"]].str.replace("[府県]", "")
res[conf["ref"]] = res[conf["ref"]].str.replace("東京都", "東京")
return res
def append_region(df):
conf = CON... | mit | Python |
60362ec80f3fe03ebb38dd94a896eeaef11e290d | change decorators to py3.6 | Z-Tool/ztool-backhend-mongo,Z-Tool/ztool-backhend-mongo | app/decorators.py | app/decorators.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Kun Jia
# date: 2/23/17
# email: me@jarrekk.com
from functools import wraps
from flask import request, current_app
def jsonp(f):
@wraps(f)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', None)
rtn = f(*arg... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Kun Jia
# date: 2/23/17
# email: me@jarrekk.com
from functools import wraps
from flask import request, current_app
def jsonp(f):
@wraps(f)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', None)
rtn = f(*arg... | mit | Python |
5b8b8d19247e16ca6dbaa131d6b9d717c0462071 | Remove another unused setup method | meshy/django-conman,Ian-Foote/django-conman,meshy/django-conman | conman/redirects/tests/test_views.py | conman/redirects/tests/test_views.py | from django.test import TestCase
from conman.nav_tree.tests.factories import ChildNodeFactory
from conman.tests.utils import RequestTestCase
from .factories import ChildNodeRedirectFactory
from .. import views
class TestNodeRedirectView(RequestTestCase):
"""Verify behaviour of NodeRedirectView."""
def setUp(... | from django.test import TestCase
from conman.nav_tree.tests.factories import ChildNodeFactory
from conman.tests.utils import RequestTestCase
from .factories import ChildNodeRedirectFactory
from .. import views
class TestNodeRedirectView(RequestTestCase):
"""Verify behaviour of NodeRedirectView."""
def setUp(... | bsd-2-clause | Python |
6251bffd124e3ab960f6150ef66585a3653ef4cf | Add the license header where it's missing. | micumatei/cloudbase-init-ci,stefan-caraiman/cloudbase-init-ci,AlexandruTudose/cloudbase-init-ci,PCManticore/argus-ci,cloudbase/cloudbase-init-ci,cmin764/argus-ci | argus/backends/base.py | argus/backends/base.py | # Copyright 2015 Cloudbase Solutions Srl
# 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 r... | import abc
import six
@six.add_metaclass(abc.ABCMeta)
class BaseBackend(object):
@abc.abstractmethod
def setup_instance(self):
"""Called by setUpClass to setup an instance"""
@abc.abstractmethod
def cleanup(self):
"""Needs to cleanup the resources created in ``setup_instance``"""
| apache-2.0 | Python |
7ef90efdbcb77d049205d2257dc8e410135973f2 | Improve proxy to require login and cache images | stephenrjones/geoq,khazhyk/geoq,khazhyk/geoq,meilinger/geoq,ngageoint/geoq,jdaigneau/geoq,stephenrjones/geoq,ngageoint/geoq,ngageoint/geoq,Pkthunder/geoq,jdaigneau/geoq,ajoubert-mitre/geoq,Pkthunder/geoq,stephenrjones/geoq,meilinger/geoq,jdaigneau/geoq,meilinger/geoq,ngageoint/geoq,khazhyk/geoq,Pkthunder/geoq,ajoubert-... | geoq/core/proxies.py | geoq/core/proxies.py | # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import patch_cache_c... | # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.http import HttpResponse
import json
import mimetypes
import urllib2
import logging
logger = loggin... | mit | Python |
2728687722e63bae4c5043f98e0c35eabfdf0631 | test cases | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/reports/tests/test_case_display.py | corehq/apps/reports/tests/test_case_display.py | from datetime import datetime, timezone
from nose.tools import assert_equal, assert_not_equal
from corehq.apps.reports.standard.cases.data_sources import CaseDisplay
def test_happy_case_display():
case_dict = {
'name': 'Foo',
'modified_on': '2022-04-06T12:13:14Z',
}
case_display = CaseDis... | from datetime import datetime, timezone
from nose.tools import assert_equal, assert_not_equal
from corehq.apps.reports.standard.cases.data_sources import CaseDisplay
def test_happy_case_display():
case_dict = {
'name': 'Foo',
'modified_on': '2022-04-06T12:13:14Z',
}
case_display = CaseDis... | bsd-3-clause | Python |
7cf69b437961e5df9d35d68f8496434ddd180fd0 | Adjust micro bench attribute-bool remove object allocation from the hot path | wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy,wdv4758h/ZipPy | graal/edu.uci.python.benchmark/src/micro/attribute-bool.py | graal/edu.uci.python.benchmark/src/micro/attribute-bool.py | # zwei 04/21/2014
# micro benchmark: boolean attribute access
import time
iteration = 500000
class TaskState(object):
def __init__(self):
self.packet_pending = True
self.task_waiting = False
self.task_holding = False
def packetPending(self):
self.packet_pending = True
... | # zwei 04/04/2014
# micro benchmark: attribute access
import time
iteration = 50000 # 50000
class TaskState(object):
def __init__(self):
self.packet_pending = True
self.task_waiting = False
self.task_holding = False
def packetPending(self):
self.packet_pending = True
s... | bsd-3-clause | Python |
e38638dec1af91c7ad10a8b5ebf0d7bec13ad313 | Fix typo | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/serializers/stats.py | api/radar_api/serializers/stats.py | from radar_api.serializers.groups import GroupReferenceField
from radar.serializers.core import Serializer
from radar.serializers.fields import DateField, IntegerField, ListField, EnumField
from radar.models.groups import GROUP_TYPE
class DataPointSerializer(Serializer):
date = DateField()
newPatients = Integ... | from radar_api.serializers.groups import GroupReferenceField
from radar.serializers.core import Serializer
from radar.serializers.fields import DateField, IntegerField, ListField, EnumField
from radar.models.groups import GROUP_TYPE
class DataPointSerializer(Serializer):
date = DateField()
newPatients = Integ... | agpl-3.0 | Python |
42a869793ab278da9246c337bfb6b35f43d4469a | fix Elasticsearch podcast query | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/search/index.py | mygpo/search/index.py |
""" Contains code for indexing other objects """
from pyes import ES, QueryStringQuery, FunctionScoreQuery
from pyes.exceptions import IndexAlreadyExistsException, NoServerAvailable
from django.conf import settings
from mygpo.search.json import podcast_to_json
from mygpo.search.models import PodcastResult
import l... |
""" Contains code for indexing other objects """
from pyes import ES, QueryStringQuery, FunctionScoreQuery
from pyes.exceptions import IndexAlreadyExistsException, NoServerAvailable
from django.conf import settings
from mygpo.search.json import podcast_to_json
from mygpo.search.models import PodcastResult
import l... | agpl-3.0 | Python |
1f031e60f20e83ff0e92d2683b513280ad7e4d32 | Use ndarray.fill instead of __setitem__ | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | cupy/manipulation/basic.py | cupy/manipulation/basic.py | import numpy
import six
from cupy import core
def copyto(dst, src, casting='same_kind', where=None):
"""Copies values from one array to another with broadcasting.
This function can be called for arrays on different devices. In this case,
casting, ``where``, and broadcasting is not supported, and an exce... | import numpy
import six
from cupy import core
def copyto(dst, src, casting='same_kind', where=None):
"""Copies values from one array to another with broadcasting.
This function can be called for arrays on different devices. In this case,
casting, ``where``, and broadcasting is not supported, and an exce... | mit | Python |
32432291eea4b3b6d6ac3cf597102740ae83df28 | Fix int extractor (greedy > lazy) | Holovin/D_GrabDemo | d_parser/helpers/re_set.py | d_parser/helpers/re_set.py | # re_set.py
# Module for generating regex rules
# r1
import re
class Ree:
float = None
number = None
page_number = None
extract_int = None
@staticmethod
def init():
Ree.is_float()
Ree.is_number()
Ree.is_page_number('')
Ree.extract_int_compile()
@staticme... | # re_set.py
# Module for generating regex rules
# r1
import re
class Ree:
float = None
number = None
page_number = None
extract_int = None
@staticmethod
def init():
Ree.is_float()
Ree.is_number()
Ree.is_page_number('')
Ree.extract_int_compile()
@staticme... | mit | Python |
bc62f9c094bc71d5151cb0c26c18829d24f72c9f | Fix wrong condition | akpersad/GitGutter,biodamasceno/GitGutter,tushortz/GitGutter,robfrawley/sublime-git-gutter,akpersad/GitGutter,tushortz/GitGutter,jisaacks/GitGutter,tushortz/GitGutter,michaelhogg/GitGutter,natecavanaugh/GitGutter,biodamasceno/GitGutter,biodamasceno/GitGutter,natecavanaugh/GitGutter,biodamasceno/GitGutter,robfrawley/sub... | git_gutter_events.py | git_gutter_events.py | import sublime
import sublime_plugin
try:
from GitGutter.view_collection import ViewCollection
except ImportError:
from view_collection import ViewCollection
class GitGutterEvents(sublime_plugin.EventListener):
def __init__(self):
self.load_settings()
# Synchronous
def on_modified(self, v... | import sublime
import sublime_plugin
try:
from GitGutter.view_collection import ViewCollection
except ImportError:
from view_collection import ViewCollection
class GitGutterEvents(sublime_plugin.EventListener):
def __init__(self):
self.load_settings()
# Synchronous
def on_modified(self, v... | mit | Python |
8bc37fff1e50716867eea450abfafd6aa381c7dc | Add check for appropriate teardown | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | cupy/testing/random.py | cupy/testing/random.py | import atexit
import numpy
import cupy
# In some tests (which utilize condition.repeat or condition.retry),
# setUp/tearDown is nested. setup_random() and teardown_random() do their
# work only in the outermost setUp/tearDown pair.
_nest_count = 0
@atexit.register
def _check_teardown():
assert _nest_count == 0... | import numpy
import cupy
# In some tests (which utilize condition.repeat or condition.retry),
# setUp/tearDown is nested. setup_random() and teardown_random() do their
# work only in the outermost setUp/tearDown pair.
_nest_count = 0
def setup_random(numpy_seed=None, cupy_seed=None):
"""Sets up the determinist... | mit | Python |
026c38926741b4c01ba16d2d056b6bb5e96506fb | Make DashDoc work with Python 3 (and thus Sublime Text 3) | farcaller/DashDoc | DashDoc.py | DashDoc.py | import sublime, sublime_plugin
import os
import subprocess
try:
from urllib import quote # Python 2
except ImportError:
from urllib.parse import quote # Python 3
def syntax_name(view):
syntax = os.path.basename(view.settings().get('syntax'))
syntax = os.path.splitext(syntax)[0]
return ... | import sublime, sublime_plugin
import os
import subprocess
import urllib
def syntax_name(view):
syntax = os.path.basename(view.settings().get('syntax'))
syntax = os.path.splitext(syntax)[0]
return syntax
def docset_keys(view, syntax_docset_map):
syntax = syntax_name(view)
try:
return s... | apache-2.0 | Python |
fa58835d532126c4cfb0baf4cb8d9d8a0e2703d2 | Update to boggle | carlb15/Python | boggle.py | boggle.py | dictionary = {"GEEKS", "FOR", "QUIZ", "GO"}
N, M = 3, 3
board = [['G','I','Z'],
['U','E','K'],
['Q','S','E']]
class Graph:
class Vertex:
def __int__(self, v):
self.val = v
self.adj = []
def findWords(board=board):
def search(node, word, visited):
if node not in visited:
visited.appen... | dictionary = {"GEEKS", "FOR", "QUIZ", "GO"}
N, M = 3, 3
board = [['G','I','Z'],
['U','E','K'],
['Q','S','E']]
class Graph:
class Vertex:
def __int__(self, v):
self.val = v
self.adj = []
def findWords(board):
def search(node, word, visited):
if node not in visited:
visited.append(node... | mit | Python |
3ce0db9cccea34998674e340c1dcc7f49b487e9a | Convert JSON into Tweet and TwitterUser objects | joealcorn/TweetPoster,tytek2012/TweetPoster,r3m0t/TweetPoster,aperson/TweetPoster | TweetPoster/twitter.py | TweetPoster/twitter.py | from datetime import datetime
from requests_oauthlib import OAuth1
from TweetPoster import User, config
class Twitter(User):
def __init__(self, *a, **kw):
super(Twitter, self).__init__(*a, **kw)
self.session.auth = OAuth1(
config['twitter']['consumer_key'],
config['twit... | from requests_oauthlib import OAuth1
from TweetPoster import User, config
class Twitter(User):
def __init__(self, *a, **kw):
super(Twitter, self).__init__(*a, **kw)
self.session.auth = OAuth1(
config['twitter']['consumer_key'],
config['twitter']['consumer_secret'],
... | mit | Python |
069d6e6a85cf55a01cc80a5074323e42319d2a6c | fix generate_rest_api_docs. | pchmieli/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,madmax983/h2o-3,madmax983/h2o-3,jangorecki/h2o-3,pchmieli/h2o-3,h2oai/h2o-dev,pchmieli/h2o-3,h2oai/h2o-dev,madmax983/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,madmax983/h2o-3,h2oai/h2o-dev,pchmieli/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,jangorecki/h2o-3,madmax983/h2o-3,kyoren/https-... | py/generate_rest_api_docs.py | py/generate_rest_api_docs.py | # TODO: ugh:
import sys, pprint, argparse, string, errno, sets
sys.path.extend(['.','py'])
import h2o, h2o_test_utils
import os
# print "ARGV is:", sys.argv
here=os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser(
description='Attach to an H2O instance and call its REST API to generate... | # TODO: ugh:
import sys, pprint, argparse, string, errno, sets
sys.path.extend(['.','py'])
import h2o, h2o_util
import os
# print "ARGV is:", sys.argv
here=os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser(
description='Attach to an H2O instance and call its REST API to generate the R... | apache-2.0 | Python |
9816a1501444921a7486520df6078219fae3e418 | add subprocess? | NordicSHIFT/NordicSHIFT,NordicSHIFT/NordicSHIFT,NordicSHIFT/NordicSHIFT,NordicSHIFT/NordicSHIFT | app/server/app.py | app/server/app.py | # server.py
from flask import Flask, flash, redirect, render_template, request, session, abort, jsonify
from calRetrieve import *
import subprocess
subprocess.call(['app/startbuild.sh'])
app = Flask(__name__, static_folder="../static/dist", template_folder="../static")
@app.route("/")
def index():
calendarCall()
... | # server.py
from flask import Flask, flash, redirect, render_template, request, session, abort, jsonify
from calRetrieve import *
# import subprocess
#
# subprocess.call(['../../startbuild.sh'])
app = Flask(__name__, static_folder="../static/dist", template_folder="../static")
@app.route("/")
def index():
calendarC... | mit | Python |
7b4a8672a804e29d518fa9b32f60408ccb4d7fe1 | move down the examples | valdur55/py3status,guiniol/py3status,ultrabug/py3status,alexoneill/py3status,valdur55/py3status,valdur55/py3status,guiniol/py3status,ultrabug/py3status,tobes/py3status,Andrwe/py3status,tobes/py3status,Andrwe/py3status,ultrabug/py3status,vvoland/py3status | py3status/modules/getjson.py | py3status/modules/getjson.py | # -*- coding: utf-8 -*-
"""
Display JSON data fetched from a URL.
This module gets the given `url` configuration parameter and assumes the
response is a JSON object. The keys of the JSON object are used as the format
placeholders. The format placeholders are replaced by the value. Objects that
are nested can be access... | # -*- coding: utf-8 -*-
"""
Display JSON data fetched from a URL.
This module gets the given `url` configuration parameter and assumes the
response is a JSON object. The keys of the JSON object are used as the format
placeholders. The format placeholders are replaced by the value. Objects that
are nested can be access... | bsd-3-clause | Python |
2705c799800c5bbaeed2dca3ebd2e2fbb2e57e8a | Prepare for v1.11.0 | antidot/Pyckson | src/pyckson/__init__.py | src/pyckson/__init__.py | from pyckson.decorators import *
from pyckson.json import *
from pyckson.parser import parse
from pyckson.parsers.base import Parser
from pyckson.serializer import serialize
from pyckson.serializers.base import Serializer
from pyckson.dates.helpers import configure_date_formatter, configure_explicit_nulls
from pyckson.... | from pyckson.decorators import *
from pyckson.json import *
from pyckson.parser import parse
from pyckson.parsers.base import Parser
from pyckson.serializer import serialize
from pyckson.serializers.base import Serializer
from pyckson.dates.helpers import configure_date_formatter, configure_explicit_nulls
from pyckson.... | lgpl-2.1 | Python |
89a68416e6ec7611db19d8d397a712f8ae835000 | fix TestProvider missing methods | Cobliteam/shelver,Cobliteam/shelver | shelver/provider/test.py | shelver/provider/test.py | import logging
import asyncio
from shelver.artifact import Artifact
from shelver.registry import Registry
from shelver.build import Builder
from .base import Provider
logger = logging.getLogger('shelver.provider.test')
class TestArtifact(Artifact):
def __init__(self, id, **kwargs):
super().__init__(**k... | import logging
import asyncio
from shelver.artifact import Artifact
from shelver.registry import Registry
from shelver.build import Builder
from .base import Provider
logger = logging.getLogger('shelver.provider.test')
class TestArtifact(Artifact):
def __init__(self, id, **kwargs):
super().__init__(**k... | mpl-2.0 | Python |
cb29f8522c4e90b7db82bac408bc16bd2f1d53da | Revert "revert part of 27cd680" | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/common/run.py | cs251tk/common/run.py | import copy
import os
from subprocess import STDOUT, run as _run, CalledProcessError, TimeoutExpired
# This env stuff is to catch glibc errors, because
# it apparently prints to /dev/tty instead of stderr.
# (see http://stackoverflow.com/a/27797579)
ENV = copy.copy(os.environ)
ENV["LIBC_FATAL_STDERR_"] = "1"
def ru... | import shlex
import copy
import os
from subprocess import STDOUT, run as _run, CalledProcessError, TimeoutExpired
# This env stuff is to catch glibc errors, because
# it apparently prints to /dev/tty instead of stderr.
# (see http://stackoverflow.com/a/27797579)
ENV = copy.copy(os.environ)
ENV["LIBC_FATAL_STDERR_"] =... | mit | Python |
c8e341335f60d452ce3ffc633680efc6808d70f0 | add choice fields autocomplete | Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks | select2rocks/fields.py | select2rocks/fields.py | from django import forms
from select2rocks.widgets import AjaxSelect2Widget, Select2TextInput
def label_from_instance_with_pk(obj, val):
"""Associates a label with the pk of the object that generated it.
This is needed because we cannot rely on the order elements will appear
in select2. By doing a bindi... | from django import forms
from select2rocks.widgets import AjaxSelect2Widget
def label_from_instance_with_pk(obj, val):
"""Associates a label with the pk of the object that generated it.
This is needed because we cannot rely on the order elements will appear
in select2. By doing a binding like this, we a... | bsd-2-clause | Python |
56b0cde36de220919755ce94c644f33ada7cf392 | Change to pytest fixtures SasviewLoggerTest.py | SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview | src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py | src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py | import sys
import logging
import pytest
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
# Local
from sas.qtgui.Utilities.SasviewLogger import QtHandler
class SasviewLoggerTest:
@pytest.fixture(autouse=True)
def logger(self, qapp):
'''Create/Destroy the logger'''
... | import sys
import unittest
import logging
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
# set up import paths
import sas.qtgui.path_prepare
# Local
from sas.qtgui.Utilities.SasviewLogger import QtHandler
if not QApplication.instance():
app = QApplication(sys.argv)
class Sas... | bsd-3-clause | Python |
b836a7347d66e6fb8df2f97c011b875e24c91e17 | Add user to the group when he first connects | alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor | dashboard/consumers.py | dashboard/consumers.py | from channels import Group
from channels.auth import channel_session_user, channel_session_user_from_http
@channel_session_user_from_http
def ws_connect(message):
Group('btc-price').add(message.reply_channel)
message.reply_channel.send({
'accept': True
})
| from channels.auth import channel_session_user, channel_session_user_from_http
@channel_session_user_from_http
def ws_connect(message):
message.reply_channel.send({
'accept': True
})
| mit | Python |
5f518129aa7e8e4ac230211539edbde7828bd772 | Complete stack sol | bowen0701/algorithms_data_structures | lc0844_backspace_string_compare.py | lc0844_backspace_string_compare.py | """Leetcode 844. Backspace String Compare
Easy
URL: https://leetcode.com/problems/backspace-string-compare/
Given two strings S and T, return if they are equal when both are typed into
empty text editors. # means a backspace character.
Example 1:
Input: S = "ab#c", T = "ad#c"
Output: true
Explanation: Both S and T b... | """Leetcode 844. Backspace String Compare
Easy
URL: https://leetcode.com/problems/backspace-string-compare/
Given two strings S and T, return if they are equal when both are typed into
empty text editors. # means a backspace character.
Example 1:
Input: S = "ab#c", T = "ad#c"
Output: true
Explanation: Both S and T b... | bsd-2-clause | Python |
aeaf802100cd6869178dd9f412d35e452916a63d | Fix `vintageous_enter_insert_mode` for NeoVintageous 1.22.0 | divmain/GitSavvy,divmain/GitSavvy,divmain/GitSavvy | common/commands/view_manipulation.py | common/commands/view_manipulation.py | from sublime_plugin import TextCommand
from ...core.git_command import GitCommand
__all__ = (
"gs_handle_vintageous",
"gs_handle_arrow_keys"
)
class gs_handle_vintageous(TextCommand, GitCommand):
"""
Set the vintageous_friendly view setting if needed.
Enter insert mode if vintageous_enter_inser... | from sublime_plugin import TextCommand
from ...core.git_command import GitCommand
__all__ = (
"gs_handle_vintageous",
"gs_handle_arrow_keys"
)
class gs_handle_vintageous(TextCommand, GitCommand):
"""
Set the vintageous_friendly view setting if needed.
Enter insert mode if vintageous_enter_inser... | mit | Python |
f3d9eac714efb3b8b20aa26d080170dfa7b19ff3 | Add definitions for param_dict, etc. | opencog/ros-behavior-scripting,opencog/ros-behavior-scripting | sensors/control_psi.py | sensors/control_psi.py | #
# control_psi.py - Control messages issued by the operator or pupeteer
# Copyright (C) 2016, 2017 Hanson Robotics
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1... | #
# control_psi.py - Control messages issued by the operator or pupeteer
# Copyright (C) 2016, 2017 Hanson Robotics
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1... | agpl-3.0 | Python |
dbbdf8f1d8cb93b1bf1f66c239ee356233e1facd | fix wrong licensing in short header sign | ghisvail/scikit-fftw,ghisvail/scikit-fftw | skfftw/bindings/_fftw.py | skfftw/bindings/_fftw.py | # coding: utf8
# Copyright (c) 2014, 2015 Ghislain Antony Vaillant.
#
# This file is distributed under the new BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-3-Clause).
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include ... | # coding: utf8
# Copyright (c) 2014-2015 Ghislain Antony Vaillant
#
# This file is distributed under the MIT License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/MIT).
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <fftw3.h>
"""
... | bsd-3-clause | Python |
311563a8203f11b0e1efe037b3fd4d182fead6d2 | add pyjd support to onclicktest | jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas | examples/onclicktest/OnClickTest.py | examples/onclicktest/OnClickTest.py | import pyjd # dummy in pyjs
from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas import Window
def onButtonClick(sender):
Window.alert("function called")
class OnClickTest:
def onModuleLoad(self):
self.b = Button("function callback", onButtonClick)
self.b2 = Button("ob... | from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas import Window
def onButtonClick(sender):
Window.alert("function called")
class OnClickTest:
def onModuleLoad(self):
self.b = Button("function callback", onButtonClick)
self.b2 = Button("object callback", self)
RootP... | apache-2.0 | Python |
97144fc045e1bb301861d1a46347eb8845d7f892 | implement dictionary based property mapping (#31) | OpenBounds/Processing | property_transformation.py | property_transformation.py | from types import UnicodeType, StringType
class PropertyMappingFailedException(Exception):
pass
def get_transformed_properties(source_properties, prop_map):
results = {}
for key, value in prop_map.iteritems():
if type(value) in (StringType, UnicodeType):
if value in source_properties:
... | from types import UnicodeType, StringType
class PropertyMappingFailedException(Exception):
pass
def get_transformed_properties(source_properties, prop_map):
results = {}
for key, value in prop_map.iteritems():
if type(value) in (StringType, UnicodeType):
if value in source_properties:
... | mit | Python |
b31696986ad4fbda91915383d6e65c6a7aa2b6c8 | Add no pictogram factories | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/infrastructure/factories.py | geotrek/infrastructure/factories.py | import factory
from geotrek.common.utils.testdata import dummy_filefield_as_sequence
from geotrek.core.factories import TopologyFactory
from . import models
class InfrastructureTypeFactory(factory.DjangoModelFactory):
class Meta:
model = models.InfrastructureType
label = factory.Sequence(lambda n: ... | import factory
from geotrek.common.utils.testdata import dummy_filefield_as_sequence
from geotrek.core.factories import TopologyFactory
from . import models
class InfrastructureTypeFactory(factory.DjangoModelFactory):
class Meta:
model = models.InfrastructureType
label = factory.Sequence(lambda n: ... | bsd-2-clause | Python |
dc8cfacb572923e86f945ff89e1339d5c3355266 | Add get_pardir() | ronrest/convenience_py,ronrest/convenience_py | file/maybe_make_dir.py | file/maybe_make_dir.py | import os
# ==============================================================================
# MAYBE_MAKE_DIR
# ==============================================================================
def maybe_make_dir(path):
""" Checks if a directory path exist... | import os
# ==============================================================================
# MAYBE_MAKE_DIR
# ==============================================================================
def maybe_make_dir(path):
""" Checks if a directory path exist... | apache-2.0 | Python |
52e26eb5c7dcf1bc7dcc0e84dafb5d917817eb0c | Fix urlregexps | idupree/idupree-websitepy,idupree/idupree-websitepy,idupree/idupree-websitepy | aux/urlregexps.py | aux/urlregexps.py |
# See RFC 3986 and http://url.spec.whatwg.org/
# These *_*set variables are suitable for putting inside
# a regex's [...] or [^...] set (and not suitable for much else).
nonurl_byteset = br'\0- "<>\\^`|{}\177'
nonurl_charset = nonurl_byteset.decode()
urlbyte = br'[^'+nonurl_byteset+br']'
urlbytes = urlbyte + br'+'
# ... |
# Character-based REs are listing out the alphabet rather than a-zA-Z0-9 so that locale doesn't affect them.
# see RFC 3986
urlbyte = br'[^\0- "<>\\^{}\177]'
urlbytes = urlbyte + br'+'
urlchar = br"""[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\-._~:/?#[\]@!$&'()*+,;=]"""
schemechar = br"""[ABCDEFGH... | mit | Python |
48da7af4402d3c8239f804e935af54d86e936186 | Fix Twisted version. | twisted/axiom | axiom/__init__.py | axiom/__init__.py | # -*- test-case-name: axiom.test -*-
from axiom._version import __version__
from twisted.python import versions
def asTwistedVersion(packageName, versionString):
return versions.Version(packageName, *map(int, versionString.split(".")[:3]))
version = asTwistedVersion("axiom", __version__)
| # -*- test-case-name: axiom.test -*-
from axiom._version import __version__
from twisted.python import versions
def asTwistedVersion(packageName, versionString):
return versions.Version(packageName, *map(int, versionString.split(".")))
version = asTwistedVersion("axiom", __version__)
| mit | Python |
d25b6dd0ba6286f6a723d0d2686b833e42fd70ac | fix missed import | leonardo-modules/leonardo-package-index,leonardo-modules/leonardo-package-index | leonardo_package_index/__init__.py | leonardo_package_index/__init__.py |
from django.apps import AppConfig
from .widget import *
default_app_config = 'leonardo_package_index.Config'
LEONARDO_APPS = [
'leonardo_package_index',
]
LEONARDO_OPTGROUP = 'Leonardo Packages'
LEONARDO_WIDGETS = [
PackageListWidget,
]
LEONARDO_PLUGINS = [
('leonardo_package_index.apps.package_in... |
from django.apps import AppConfig
from .widget import *
default_app_config = 'leonardo_package_index.Config'
LEONARDO_APPS = [
'leonardo_package_index',
]
LEONARDO_OPTGROUP = 'Leonardo Packages'
LEONARDO_WIDGETS = [
PackageListWidget,
]
LEONARDO_PLUGINS = [
('leonardo_package_index.apps.package_in... | bsd-3-clause | Python |
b6bf61d56a9648ac0d52a97a27bc79b3984c0037 | update module list | bambinos/bambi,bambinos/bambi | bambi/__init__.py | bambi/__init__.py | __all__ = ['model', 'transformations', 'utils', 'backends', 'priors']
| __all__ = ['model', 'transformations', 'utils']
| mit | Python |
585dc10b3e7a6abded21f8542865942ae023fa5b | Remove missing capability | stackforge/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,briancurtin/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk | openstack/tests/functional/telemetry/v2/test_capability.py | openstack/tests/functional/telemetry/v2/test_capability.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 |
a55b96a7d64643af6d2adcd6a15fe3348c5d1c41 | Add create dns on main workflow | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/settings.py | dbaas/workflow/settings.py | DEPLOY_MYSQL_WORKFLOW = (
'util.gen_names',
'util.gen_dbinfra',
'dbaas_cloudstack.create_vm'
)
DEPLOY_VIRTUALMACHINE = (
'workflow.steps.build_databaseinfra.BuildDatabaseInfra',
'workflow.steps.create_virtualmachines.CreateVirtualMachine',
'workflow.steps.create_dns.CreateDns'
... | DEPLOY_MYSQL_WORKFLOW = (
'util.gen_names',
'util.gen_dbinfra',
'dbaas_cloudstack.create_vm'
)
DEPLOY_VIRTUALMACHINE = (
'workflow.steps.build_databaseinfra.BuildDatabaseInfra',
'workflow.steps.create_virtualmachines.CreateVirtualMachine',
)
DEPLOY_MONGO_WORKFLOW = (
'util.gen_names... | bsd-3-clause | Python |
60b184ace6b785a26b26f8db96280c5cb992b7b3 | check in example settings | sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp | tcamp/local_settings.example.py | tcamp/local_settings.example.py | DEBUG = True
ADMINS = (
('', ''),
)
MANAGERS = ADMINS
INTERNAL_IPS = ('127.0.0.1',)
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': '', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER'... | bsd-3-clause | Python | |
bdad4fc1689e41cce29fbcc8e1e9dee4388ea8ef | Insert step_counter into workflow_dict | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/workflow.py | dbaas/workflow/workflow.py | # -*- coding: utf-8 -*-
from django.utils.module_loading import import_by_path
from notification.models import TaskHistory
import logging
LOG = logging.getLogger(__name__)
def start_workflow(workflow_dict, task=None):
try :
if not 'steps' in workflow_dict:
return False
workflow_dict['step_counter'] = 0
... | from django.utils.module_loading import import_by_path
def start_workflow(workflow_dict):
try :
step_counter = 0
for step in workflow_dict['steps']:
step_counter+=1
my_class = import_by_path(step)
my_instance = my_class()
if my_instance.do(workflow_dict)!=True:
raise Exception
except Exce... | bsd-3-clause | Python |
32ec38bff219aa200cef9a9a42ce08ae1af21bb9 | Streamline version | arangodb/arangodb-dcos,arangodb/arangodb-dcos | dcos_arangodb/constants.py | dcos_arangodb/constants.py | version = '0.3.0'
"""DCOS ArangoDB version"""
PATH_ENV = 'PATH'
| version = '1.0.0'
"""DCOS ArangoDB version"""
PATH_ENV = 'PATH'
| apache-2.0 | Python |
186dac653558477ee7fb64f978da457023074948 | Split parser creation and parser for inventory | openstack-infra/shade,openstack-infra/shade | shade/cmd/inventory.py | shade/cmd/inventory.py | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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 (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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 |
5fdbfe650a7925898bd6749110a97fe6939ba4d2 | fix argument bug | latusrepo/propmtime,latusrepo/propmtime | propmtime.py | propmtime.py |
import argparse
import os
import propmtime.propmtime
if __name__ == "__main__":
desc = """Many OSs (including Windows) only change the modification time of a folder/directory based on its
immediate children. This code analyzes a folder and all of its children, and propagates (changes) the
modification times of e... |
import argparse
import os
import propmtime.propmtime
if __name__ == "__main__":
desc = """Many OSs (including Windows) only change the modification time of a folder/directory based on its
immediate children. This code analyzes a folder and all of its children, and propagates (changes) the
modification times of e... | mit | Python |
9de5ccb55a989c40813f068cd2d2f6882eaed741 | add additional metadata | erbriones/shapeshift | shapeshift/__init__.py | shapeshift/__init__.py | # -*- coding: utf-8 -*-
"""
Transforming python logs
"""
from __future__ import absolute_import
from collections import namedtuple
from .formatters import JSONFormatter, KeyValueFormatter
version_info = namedtuple("version_info", ["major", "minor", "patch"])
VERSION = version_info(0, 3, 1)
__title__ = "shapeshift"
_... | # -*- coding: utf-8 -*-
"""
Transforming python logs
"""
from __future__ import absolute_import
from collections import namedtuple
from .formatters import JSONFormatter, KeyValueFormatter
version_info = namedtuple("version_info", ["major", "minor", "patch"])
VERSION = version_info(0, 3, 1)
__version__ = "{0.major}.{0... | mit | Python |
e661f01eca7a49bcaafdd974e3f538d496e08d87 | fix bugs | littlezz/IslandCollection | gui/second/frames.py | gui/second/frames.py | from .. import widgets
from .. import layouts
from tkinter import ttk
from PIL import Image, ImageTk
__author__ = 'zz'
class RowFrame(ttk.Frame):
def __init__(self, master, **kwargs):
image = kwargs.pop('image', None)
text = kwargs.pop('text', '')
link = kwargs.pop('link', '')
siz... | from .. import widgets
from .. import layouts
from tkinter import ttk
__author__ = 'zz'
class RowFrame(ttk.Frame):
def __init__(self, master, **kwargs):
image = kwargs.pop('image', None)
text = kwargs.pop('text', '')
link = kwargs.pop('link', '')
size = kwargs.pop('size', (128, 12... | mit | Python |
6e9a19d362005125036f5c0ecdbe88fc1c4f01aa | FIX price type 'list_price' inactivation | ingadhoc/product,ingadhoc/product | product_computed_list_price/__init__.py | product_computed_list_price/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import product
from . import pricelist
| # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import product | agpl-3.0 | Python |
3e35660ff31ededb00036877690a75e07979f681 | Remove unnecessary escaping on double quotes | jackwilsdon/beets,SusannaMaria/beets,artemutin/beets,xsteadfastx/beets,mosesfistos1/beetbox,sampsyo/beets,pkess/beets,sampsyo/beets,lengtche/beets,ibmibmibm/beets,SusannaMaria/beets,MyTunesFreeMusic/privacy-policy,diego-plan9/beets,shamangeorge/beets,artemutin/beets,jcoady9/beets,beetbox/beets,jackwilsdon/beets,jcoady9... | beetsplug/hook.py | beetsplug/hook.py | # This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | # This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | mit | Python |
51fd70edce477e8b1d0a9e5f278a68da7979d1dc | Debug output removed | t-neumann/slamdunk,t-neumann/slamdunk,t-neumann/slamdunk | bin/_preamble.py | bin/_preamble.py | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
# This makes sure that users don't have to set up their environment
# specially in order to run these programs from bin/.
# This helper is shared by many different actual scripts. It is not intended to
# be packaged or installed, it is o... | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
# This makes sure that users don't have to set up their environment
# specially in order to run these programs from bin/.
# This helper is shared by many different actual scripts. It is not intended to
# be packaged or installed, it is o... | agpl-3.0 | Python |
f2ea241e9bb6e5e927a90c56438bf7883ae3744f | Add trigger to module import | dogoncouch/siemstress | siemstress/__init__.py | siemstress/__init__.py | __version__ = '0.2'
__author__ = 'Dan Persons <dpersonsdev@gmail.com>'
__license__ = 'MIT License'
__github__ = 'https://github.com/dogoncouch/siemstress'
__all__ = ['core', 'querycore', 'query']
import siemstress.query
import siemstress.trigger
| __version__ = '0.2'
__author__ = 'Dan Persons <dpersonsdev@gmail.com>'
__license__ = 'MIT License'
__github__ = 'https://github.com/dogoncouch/siemstress'
__all__ = ['core', 'querycore', 'query']
import siemstress.query
| mit | Python |
05bfaccfed5280fd243048cfc990ce67d9dc21f0 | Bump version | detectlanguage/detectlanguage-python | detectlanguage/__init__.py | detectlanguage/__init__.py | __version__ = '1.2.1'
from .exceptions import *
from .configuration import Configuration
from .client import Client
from .api import simple_detect, detect, user_status, languages
configuration = Configuration()
client = Client(configuration)
| __version__ = '1.1.1'
from .exceptions import *
from .configuration import Configuration
from .client import Client
from .api import simple_detect, detect, user_status, languages
configuration = Configuration()
client = Client(configuration)
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.