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 |
|---|---|---|---|---|---|---|---|---|
85ae1ce21f77d1fd48d03e2dfaf0aa98d9a1516d | Support WebLab API 2.0 in Binary | porduna/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto... | server/src/experiments/binary/server.py | server/src/experiments/binary/server.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | bsd-2-clause | Python |
3abb1da754184451e69137528f634627f415aa34 | Fix typo | stub42/pytz,stub42/pytz,stub42/pytz,stub42/pytz | src/setup.py | src/setup.py | '''
pytz setup script
'''
import pytz, sys, os, os.path
try:
from setuptools import setup
except ImportError:
if sys.version_info[:2] == (2,3):
print 'Python 2.3 install requires setuptools'
print 'http://www.python.org/pypi/setuptools/'
sys.exit(1)
else:
from distutils.cor... | '''
pytz setup script
'''
import pytz, sys, os, os.path
try:
from setuptools import setup
except ImportError:
if sys.version_info[:2] == (2,3):
print 'Python 2.3 install requires setuptools'
print 'http://www.python.org/pypi/setuptools/'
sys.exit(1)
else:
from distutils.cor... | mit | Python |
d40886567d32c9ad910b80595a087cc6e68a98bd | use jsonify for skeleton info files | seung-lab/cloud-volume,seung-lab/cloud-volume,seung-lab/cloud-volume | cloudvolume/datasource/precomputed/skeleton/metadata.py | cloudvolume/datasource/precomputed/skeleton/metadata.py | from ....lib import jsonify
import numpy as np
class PrecomputedSkeletonMetadata(object):
def __init__(self, meta, cache=None, info=None):
self.meta = meta
self.cache = cache
if info:
self.info = info
else:
self.info = self.fetch_info()
@property
def skeleton_path(self):
if 'sk... | import json
import numpy as np
class PrecomputedSkeletonMetadata(object):
def __init__(self, meta, cache=None, info=None):
self.meta = meta
self.cache = cache
if info:
self.info = info
else:
self.info = self.fetch_info()
@property
def skeleton_path(self):
if 'skeletons' in self... | bsd-3-clause | Python |
e419e695b39a2948142faee3986d5cabe66e2cee | Fix FK field descriptor for admin queries. Closes #322 | san-mate/python-social-auth,muhammad-ammar/python-social-auth,SeanHayes/python-social-auth,mrwags/python-social-auth,VishvajitP/python-social-auth,msampathkumar/python-social-auth,henocdz/python-social-auth,henocdz/python-social-auth,hsr-ba-fs15-dat/python-social-auth,iruga090/python-social-auth,jameslittle/python-soci... | social/apps/django_app/default/admin.py | social/apps/django_app/default/admin.py | """Admin settings"""
from django.conf import settings
from django.contrib import admin
from social.utils import setting_name
from social.apps.django_app.default.models import UserSocialAuth, Nonce, \
Association
class UserSocialAuthOption(admin.ModelAdmin):
"""So... | """Admin settings"""
from django.conf import settings
from django.contrib import admin
from social.utils import setting_name
from social.apps.django_app.default.models import UserSocialAuth, Nonce, \
Association
class UserSocialAuthOption(admin.ModelAdmin):
"""So... | bsd-3-clause | Python |
3ea15b257fb9a825c9d828039c664c59fe263334 | Fix test for 605 | raphael0202/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,Gregory-Howard/spaCy,honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,raphael0202/spaCy,spacy-io/spaCy,aikramer2/spaCy,oroszgy/spaCy.hu,banglakit/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,raphael0202/spaCy,oroszgy/spaC... | spacy/tests/regression/test_issue605.py | spacy/tests/regression/test_issue605.py | from ...attrs import LOWER, ORTH
from ...tokens import Doc
from ...vocab import Vocab
from ...matcher import Matcher
def return_false(doc, ent_id, label, start, end):
return False
def test_matcher_accept():
doc = Doc(Vocab(), words=[u'The', u'golf', u'club', u'is', u'broken'])
golf_pattern = [
... | from ...attrs import LOWER, ORTH
from ...tokens import Doc
from ...vocab import Vocab
from ...matcher import Matcher
def return_false(doc, ent_id, label, start, end):
return False
def test_matcher_accept():
doc = Doc(Vocab(), words=[u'The', u'golf', u'club', u'is', u'broken'])
golf_pattern = [
... | mit | Python |
66d78b9cd09b825181940a6f9e7f4e2369ff20cf | Fix parameter list length error in example | bees4ever/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy | spotpy/examples/tutorial_ownDatabase.py | spotpy/examples/tutorial_ownDatabase.py | '''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the Rosenbrock function into SPOT.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ im... | '''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the Rosenbrock function into SPOT.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ im... | mit | Python |
e8aae33f85f8db41ef51a79876602defa54744a9 | fix #100: account set error (#103) | samedder/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure-cli,yugangw-msft/azure-cli,samedder/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,samedder/azure... | src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/account.py | src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/account.py | from azure.cli._profile import Profile
from azure.cli.commands import CommandTable
from azure.cli._locale import L
from .command_tables import COMMAND_TABLES
from azure.cli._logging import logger
command_table = CommandTable()
COMMAND_TABLES.append(command_table)
@command_table.command('account list', description=L(... | from azure.cli._profile import Profile
from azure.cli.commands import CommandTable
from azure.cli._locale import L
from .command_tables import COMMAND_TABLES
from azure.cli._logging import logger
command_table = CommandTable()
COMMAND_TABLES.append(command_table)
@command_table.command('account list', description=L(... | mit | Python |
71293fa8c32c2d42a5c01f453ec62d9f2f8c259e | allow the specify the passive ports into the config file | dezynetechnologies/odoo,salaria/odoo,jolevq/odoopub,shaufi/odoo,bakhtout/odoo-educ,hifly/OpenUpgrade,QianBIG/odoo,Nick-OpusVL/odoo,lsinfo/odoo,0k/odoo,fdvarela/odoo8,Maspear/odoo,pplatek/odoo,christophlsa/odoo,frouty/odoogoeen,ubic135/odoo-design,fuselock/odoo,synconics/odoo,florentx/OpenUpgrade,VielSoft/odoo,idncom/od... | addons/document/ftpserver/__init__.py | addons/document/ftpserver/__init__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify... | agpl-3.0 | Python |
10611b4e490ed2c71e68ff9d22170ca90fdf82f8 | Revise BFS doc string | bowen0701/algorithms_data_structures | alg_breadth_first_search_queue.py | alg_breadth_first_search_queue.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
def bfs(graph_adj_d, start_vertex):
"""Breadth First Search (BFS) algorithm by queue.
Find shortest path from a particular node to
all vertices that are reachable from it.
... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
def bfs(graph_adj_d, start_vertex):
"""Breadth First Search (BFS) algorithm by queue.
The BFS algorithm explores the part of graph that is
reachable from a particular node `sta... | bsd-2-clause | Python |
e45bfac37910ab4670357dc065305628cdc1a570 | return appropriately sized result in getc | chubbymaggie/angr,angr/angr,tyb0807/angr,schieb/angr,tyb0807/angr,f-prettyland/angr,angr/angr,f-prettyland/angr,schieb/angr,iamahuman/angr,schieb/angr,axt/angr,iamahuman/angr,chubbymaggie/angr,tyb0807/angr,axt/angr,chubbymaggie/angr,iamahuman/angr,axt/angr,angr/angr,f-prettyland/angr | angr/procedures/glibc/_IO_getc.py | angr/procedures/glibc/_IO_getc.py | import angr
from angr.sim_type import SimTypeFd, SimTypeInt
from claripy import BVV
######################################
# getc
######################################
class _IO_getc(angr.SimProcedure):
# pylint:disable=arguments-differ
def run(self, f_p):
self.argument_types = {0: SimTypeFd()}
... | import angr
from angr.sim_type import SimTypeFd, SimTypeInt
from claripy import BVV
######################################
# getc
######################################
class _IO_getc(angr.SimProcedure):
# pylint:disable=arguments-differ
def run(self, f_p):
self.argument_types = {0: SimTypeFd()}
... | bsd-2-clause | Python |
291071273e892712a565bfa48f721904094c3c39 | Fix PEP8 | alphagov/notifications-api,alphagov/notifications-api | gunicorn_config.py | gunicorn_config.py | import sys
import traceback
def worker_abort(worker):
worker.log.info("worker received ABORT")
for threadId, stack in sys._current_frames().items():
worker.log.info(''.join(traceback.format_stack(stack)))
| def worker_abort(worker):
worker.log.info("worker received ABORT")
import sys, traceback
for threadId, stack in sys._current_frames().items():
worker.log.info(''.join(traceback.format_stack(stack)))
| mit | Python |
64dde9840fd4ae96b63d8ec6bbe6fa3f24a3c8d5 | remove another same db test, connections import needed | muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf | rdrf/rdrf/db.py | rdrf/rdrf/db.py | from io import StringIO
import os
from django.core.management import call_command
from django.db import connections
class RegistryRouter:
clinical_models = (
("rdrf", "clinical"),
("rdrf", "questionnaireresponsedata"),
# fixme: move CDEFile to clinical database. This is just
# tri... | from io import StringIO
import os
from django.core.management import call_command
class RegistryRouter:
clinical_models = (
("rdrf", "clinical"),
("rdrf", "questionnaireresponsedata"),
# fixme: move CDEFile to clinical database. This is just
# tricky with migrations.
# ("r... | agpl-3.0 | Python |
79d656a81eda1a7b633d37bef92a90eeadbf249f | Print max diff from last frame | vegardwho/useat-hub,vegardwho/useat-hub | read_thermal.py | read_thermal.py | #! /usr/bin/python
# A simple Python command line tool to control an Omron MEMS Temp Sensor D6T-44L
# By Greg Griffes http://yottametric.com
# Modified by Iver Jordal
# GNU GPL V3
# Jan 2015
import smbus
import sys
import getopt
import time
import pigpio
from img_helper import write_image
from helpers import *
from... | #! /usr/bin/python
# A simple Python command line tool to control an Omron MEMS Temp Sensor D6T-44L
# By Greg Griffes http://yottametric.com
# Modified by Iver Jordal
# GNU GPL V3
# Jan 2015
import smbus
import sys
import getopt
import time
import pigpio
from img_helper import write_image
from helpers import *
from... | mit | Python |
e6107ff21e9b4fe4fc27db9291b4f883e0374220 | Move catching of FileNotFoundError out of validate_json() so it can be handled in different ways. | mesbahamin/timebook,mesbahamin/chronophore | chronophore/utils.py | chronophore/utils.py | import collections
import json
import logging
from chronophore import config
logger = logging.getLogger(__name__)
def validate_json(json_file):
"""Raise exception if json_file contains errors or key collisions."""
try:
with json_file.open('r') as f:
d = json.load(f, object_pairs_hook=list... | import collections
import json
import logging
from chronophore import config
logger = logging.getLogger(__name__)
def validate_json(json_file):
"""Raise exception if json_file contains errors or key collisions."""
try:
with json_file.open('r') as f:
d = json.load(f, object_pairs_hook=list... | mit | Python |
1665503bbbe746534c12e8d4197d5b33955420f8 | add unit tests | ImmobilienScout24/aws-monocyte,ImmobilienScout24/aws-monocyte | src/unittest/python/monocyte_tests.py | src/unittest/python/monocyte_tests.py | from unittest import TestCase
from monocyte import Monocyte
class MonocyteTest(TestCase):
def setUp(self):
self.monocyte = Monocyte()
self.allowed_region = "EU"
self.not_allowed_region = "US"
self.ignored_region = "us-gov-west-1"
def test_is_region_allowed(self):
sel... | apache-2.0 | Python | |
b9008cf58b5d18e8ab158b0b5a46b937e8de5746 | Refactor vote models | swappsco/django-qa,swappsco/django-qa | qa/models.py | qa/models.py | from django.db import models
from django.conf import settings
from django_markdown.models import MarkdownField
from taggit.managers import TaggableManager
from annoying.fields import AutoOneToOneField
class UserQAProfile(models.Model):
# This line is required. Links UserQAProfile to a User model instance.
us... | from django.db import models
from django.conf import settings
from django_markdown.models import MarkdownField
from taggit.managers import TaggableManager
from annoying.fields import AutoOneToOneField
class UserQAProfile(models.Model):
# This line is required. Links UserQAProfile to a User model instance.
us... | mit | Python |
e13ca6ff6374eef012d66783cc184e0c1b060fa3 | Update the copyright statement. | eliteraspberries/hipshot | hipshot/hipshot.py | hipshot/hipshot.py | #!/usr/bin/env python2
'''Hipshot converts a video file or series of photographs into
a single image simulating a long-exposure photograph.
'''
import cv
from numpy import copy
from avena import image, np, ocv
__author__ = 'Mansour Moufid'
__copyright__ = 'Copyright 2013-2015, Mansour Moufid'
__license__ = 'ISC'
_... | #!/usr/bin/env python2
'''Hipshot converts a video file or series of photographs into
a single image simulating a long-exposure photograph.
'''
import cv
from numpy import copy
from avena import image, np, ocv
__author__ = 'Mansour Moufid'
__copyright__ = 'Copyright 2013, 2014, Mansour Moufid'
__license__ = 'ISC'
... | isc | Python |
a712353a8431472d2c789c741868c329c89c399e | use Event slug in url | Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization | organization/agenda/urls.py | organization/agenda/urls.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | agpl-3.0 | Python |
94164e960feb69e88ee172460ee860270ab919c5 | Remove uniquiness contraint - different roles can have grants on the same resource_uid. | Itxaka/st2,Plexxi/st2,tonybaloney/st2,alfasin/st2,peak6/st2,punalpatel/st2,nzlosh/st2,Plexxi/st2,nzlosh/st2,punalpatel/st2,StackStorm/st2,dennybaa/st2,StackStorm/st2,alfasin/st2,tonybaloney/st2,Itxaka/st2,Plexxi/st2,alfasin/st2,lakshmi-kannan/st2,peak6/st2,emedvedev/st2,peak6/st2,emedvedev/st2,lakshmi-kannan/st2,armab/... | st2common/st2common/models/db/rbac.py | st2common/st2common/models/db/rbac.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
cdce25327dee5696f02525014117971920e7bd35 | bump version and release package | job/aclhound,job/aclhound | aclhound/__init__.py | aclhound/__init__.py | __version__ = "1.3"
__author__ = "Job Snijders"
__author_email__ = "job@instituut.net"
__copyright__ = "Copyright 2014, Job Snijders"
__license__ = "BSD 2-Clause"
__status__ = "Development"
__url__ = "https://github.com/job/aclhound"
| __version__ = "1.2"
__author__ = "Job Snijders"
__author_email__ = "job@instituut.net"
__copyright__ = "Copyright 2014, Job Snijders"
__license__ = "BSD 2-Clause"
__status__ = "Development"
__url__ = "https://github.com/job/aclhound"
| bsd-2-clause | Python |
6cf9c7ec0872f4c51069817389ef80e7b8727d3f | Set it up to actually create the results folder if it doesn't exist. | erl7902/interstitials | hough-transform.py | hough-transform.py | # Adapted from http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html
import cv2
import numpy as np
import sys
import os
import distutils.dir_util
#Make the screenshot folder if it doesn't exist
distutils.dir_util.mkpath("results")
def main():
screenshots = sys.argv[1] #Tak... | # Adapted from http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html
import cv2
import numpy as np
import sys
import os
def main():
screenshots = sys.argv[1] #Take in directory
print screenshots
for filename in os.listdir(screenshots):
print screenshots+'/'+f... | mpl-2.0 | Python |
bf88702b9a4d76fd3fc0cd3dbcf43d71d7259957 | Fix a silly typo in the login popup form | magcius/sweettooth,GNOME/extensions-web,GNOME/extensions-web,GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web | sweettooth/auth/context_processors.py | sweettooth/auth/context_processors.py |
from auth import forms
def login_form(request):
if request.user.is_authenticated():
return dict()
return dict(login_popup_form=forms.InlineAuthenticationForm())
|
from auth import forms
def login_form(request):
if request.user.is_authenticated():
return dict()
return dict(login_popup_form=forms.InlineAuthenticationForm)
| agpl-3.0 | Python |
c251d8456b71a31291d7af23dd4d2260034784f6 | bump version | martin-hunt/hublib | hublib/__init__.py | hublib/__init__.py | from pint import UnitRegistry
ureg = UnitRegistry()
ureg.autoconvert_offset_to_baseunit = True
Q_ = ureg.Quantity
__version__ = "0.7.5"
| from pint import UnitRegistry
ureg = UnitRegistry()
ureg.autoconvert_offset_to_baseunit = True
Q_ = ureg.Quantity
__version__ = "0.7.4"
| mit | Python |
e7dc90c44d388b1c6a7161f92166cf427138b41f | remove limit of fop mode | jemygraw/python-sdk,weilaihui/tornado-qiniu,qiniu/python-sdk,forrest-mao/python-sdk,blahgeek/python-sdk | qiniu/fop.py | qiniu/fop.py | # -*- coding:utf-8 -*-
import json
import urllib
class BaseCall(object):
def call_url(self, url):
try:
f = urllib.urlopen(self.make_request(url))
body = json.loads(f.read())
f.close()
except IOError, e:
return None, e
except ValueError, e:
return None, e
if "error" in body:
return None, b... | # -*- coding:utf-8 -*-
import json
import urllib
class BaseCall(object):
def call_url(self, url):
try:
f = urllib.urlopen(self.make_request(url))
body = json.loads(f.read())
f.close()
except IOError, e:
return None, e
except ValueError, e:
return None, e
if "error" in body:
return None, b... | mit | Python |
d3438e85ab4158d769b0662729a8aff7d143971a | Add tests for all methods | albertyw/csv-to-ical | csv_ical/tests/test_convert.py | csv_ical/tests/test_convert.py | import datetime
import os
import tempfile
import unittest
from syspath import get_git_root
from csv_ical import convert
EXAMPLE_ICS = os.path.join(get_git_root(), 'examples', 'arrive.ics')
EXAMPLE_CSV = os.path.join(get_git_root(), 'examples', 'BostonCruiseTerminalSchedule.csv')
CSV_CONFIGS = {
'HEADER_COLUMNS_T... | import unittest
from csv_ical import convert
class TestConvert(unittest.TestCase):
def setUp(self):
self.convert = convert.Convert()
def test_generate_configs(self):
self.convert._generate_configs_from_default()
| mit | Python |
6ab9a6bc96d3f8bea9d1d98dcd4fae1170acd521 | fix imports | noyeitan/cubes,ubreddy/cubes,zejn/cubes,she11c0de/cubes,ubreddy/cubes,she11c0de/cubes,jell0720/cubes,cesarmarinhorj/cubes,she11c0de/cubes,jell0720/cubes,noyeitan/cubes,pombredanne/cubes,cesarmarinhorj/cubes,cesarmarinhorj/cubes,pombredanne/cubes,jell0720/cubes,ubreddy/cubes,zejn/cubes,noyeitan/cubes,zejn/cubes,pombreda... | cubes/backends/sql/__init__.py | cubes/backends/sql/__init__.py | from denormalizer import *
from star import *
from workspace import *
__all__ = []
__all__ += denormalizer.__all__
__all__ += star.__all__
__all__ += workspace.__all__
| from denormalizer import *
from browser import *
from star import *
from mapper import *
from workspace import *
__all__ = []
__all__ += denormalizer.__all__
__all__ += browser.__all__
__all__ += star.__all__
__all__ += mapper.__all__
__all__ += workspace.__all__
| mit | Python |
591fd0cb7377c44c5ea5f5924124316a41d33494 | Use Conan Arcus version | Ultimaker/CuraEngine,Ultimaker/CuraEngine | conanfile.py | conanfile.py | from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMakeDeps
required_conan_version = ">=1.46.2"
class CuraBuildEnvironemtConan(ConanFile):
name = "cura-build-environment"
description = "Building Cura dependencies"
topics = ("conan", "python", "pypi", "pip")
settings = "os", "... | from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMakeDeps
required_conan_version = ">=1.46.2"
class CuraBuildEnvironemtConan(ConanFile):
name = "cura-build-environment"
description = "Building Cura dependencies"
topics = ("conan", "python", "pypi", "pip")
settings = "os", "... | agpl-3.0 | Python |
3630e92c9dabffa4538b849683103c7c5a16b25f | prepare Cuttle Pool for 0.2.1 release | smitchell556/cuttlepool,smitchell556/cuttlepool | cuttlepool/__init__.py | cuttlepool/__init__.py | # -*- coding: utf-8 -*-
"""
Cuttle Pool, a SQL pool implementation.
:license: MIT, see LICENSE for details.
"""
__version__ = '0.2.1'
from .cuttlepool import CuttlePool, PoolConnection, cursors
| # -*- coding: utf-8 -*-
"""
Cuttle Pool, a SQL pool implementation.
:license: MIT, see LICENSE for details.
"""
__version__ = '0.2.0'
from .cuttlepool import CuttlePool, PoolConnection, cursors
| bsd-3-clause | Python |
034a78b654bf1a82f60d45db6761ac50f7949790 | split configLine into a separate method | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | conarycfg.py | conarycfg.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import string
import types
import versions
import sys
_cfg = None
class _SrsConfiguration:
def read(self, file):
if os.path.exists(file):
f = open(file, "r")
for line in f.readlines():
self.configLine(line)
f.close()
d... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import string
import types
import versions
import sys
_cfg = None
class _SrsConfiguration:
def read(self, file):
if os.path.exists(file):
f = open(file, "r")
for line in f.readlines():
(key, val) = string.split(line)
if not se... | apache-2.0 | Python |
7b1741a01b355ab60aff20d67660b9b6e434cfc5 | read replication sequence number onlt when url is given | osmcode/pyosmium,osmcode/pyosmium,osmcode/pyosmium | osmium/replication/utils.py | osmium/replication/utils.py | """ Helper functions for change file handling. """
import logging
from datetime import datetime
from collections import namedtuple
from osmium.io import Reader as oreader
log = logging.getLogger('pyosmium')
ReplicationHeader = namedtuple('ReplicationHeader',
['url', 'sequence', 'times... | """ Helper functions for change file handling. """
import logging
from datetime import datetime
from collections import namedtuple
from osmium.io import Reader as oreader
log = logging.getLogger('pyosmium')
ReplicationHeader = namedtuple('ReplicationHeader',
['url', 'sequence', 'times... | bsd-2-clause | Python |
e2d9746cbfa11379f5d16a81197fccba0b922af0 | update version | LoRexxar/Cobra-W,LoRexxar/Cobra-W,LoRexxar/Cobra-W,LoRexxar/Cobra-W | cobra/__version__.py | cobra/__version__.py | import sys
import platform
__title__ = 'cobra'
__description__ = 'Code Security Audit'
__url__ = 'https://github.com/LoRexxar/Cobra-W'
__issue_page__ = 'https://github.com/LoRexxar/Cobra-W/issues/new'
__python_version__ = sys.version.split()[0]
__platform__ = platform.platform()
__version__ = '1.0.1'
__author__ = 'LoR... | import sys
import platform
__title__ = 'cobra'
__description__ = 'Code Security Audit'
__url__ = 'https://github.com/LoRexxar/Cobra-W'
__issue_page__ = 'https://github.com/LoRexxar/Cobra-W/issues/new'
__python_version__ = sys.version.split()[0]
__platform__ = platform.platform()
__version__ = '1.0.0-beta.1'
__author__... | mit | Python |
a98e90d44bd93df9b6f97038ecdd6e335e939efe | fix default unix socket file path | osrg/ops-gobgp | openswitch.py | openswitch.py | # Copyright (C) 2015 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (C) 2015 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
1c46aec93aca1ed1f2ef187c016715591913acf0 | Allow Cloud Shell origin pattern in the Jupyter notebook configuration ( kubeflow/pipelines#179 ) (#1956) | kubeflow/kubeflow,kubeflow/kubeflow,kubeflow/kubeflow,kubeflow/kubeflow,kubeflow/kubeflow,kubeflow/kubeflow | components/tensorflow-notebook-image/jupyter_notebook_config.py | components/tensorflow-notebook-image/jupyter_notebook_config.py | #!/usr/bin/env python
# Copyright 2016 The Kubeflow 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... | #!/usr/bin/env python
# Copyright 2016 The Kubeflow 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... | apache-2.0 | Python |
b060852c888bea8ba2218b3aea9067c298e24348 | Make run_triage usable as either a module or a script. | mwcraig/msumastro | run_triage.py | run_triage.py | import triage_fits_files as tff
import asciitable
import sys
import os
#import pdb
object_name_file_name = 'NEEDS_OBJECT_NAME.txt'
pointing_file_name = 'NEEDS_POINTING_INFO.txt'
filter_file_name = 'NEEDS_FILTER.txt'
file_list = 'Manifest.txt'
def write_list(dir, file, info):
out = open(os.path.join(dir,file), 'w... | import triage_fits_files as tff
import asciitable
import sys
import os
#import pdb
object_name_file_name = 'NEEDS_OBJECT_NAME.txt'
pointing_file_name = 'NEEDS_POINTING_INFO.txt'
filter_file_name = 'NEEDS_FILTER.txt'
file_list = 'Manifest.txt'
def write_list(dir, file, info):
out = open(os.path.join(dir,file), 'w... | bsd-3-clause | Python |
e33c339b797af92adaf8712261d7f8d2f9cdee78 | rework weekly | unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal | backend/unpp_api/apps/notification/management/commands/send_weekly_notifications.py | backend/unpp_api/apps/notification/management/commands/send_weekly_notifications.py | from __future__ import absolute_import
from datetime import date
from django.core.management.base import BaseCommand
from django.db import transaction
from common.consts import NOTIFICATION_FREQUENCY_CHOICES
from notification.helpers import send_notification_summary_to_notified_users
from notification.models import N... | from __future__ import absolute_import
from datetime import date
from django.core.management.base import BaseCommand
from common.consts import NOTIFICATION_FREQUENCY_CHOICES
from notification.helpers import send_notification_summary_to_notified_users
from notification.models import NotifiedUser
class Command(BaseCo... | apache-2.0 | Python |
68f03d4f3c613b50a61ff244d0a47e5a81fb861f | test for xray trafo | aringh/odl,kohr-h/odl,aringh/odl,odlgroup/odl,kohr-h/odl,odlgroup/odl | test/tomo/operator/xray_trafo_test.py | test/tomo/operator/xray_trafo_test.py | # Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... | # Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... | mpl-2.0 | Python |
81cef01ebc2d295b1b405fa13259c83736edb3b3 | add one function in test_cut_milestone2.py | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | test/unit_test/test_cut_milestone2.py | test/unit_test/test_cut_milestone2.py | from lexos.processors.prepare.cutter import cut_by_milestone
class TestMileStone:
def test_milestone_regular(self):
text_content = "The bobcat slept all day.."
milestone = "bobcat"
assert cut_by_milestone(text_content, milestone) == ["The ",
... | from lexos.processors.prepare.cutter import cut_by_milestone
class TestMileStone:
def test_milestone_regular(self):
text_content = "The bobcat slept all day.."
milestone = "bobcat"
assert cut_by_milestone(text_content, milestone) == ["The ",
... | mit | Python |
b92caad544f944a713df325762d228263465d7b0 | support django versions < 1.3: check for ListView existence before declaring AlphafilterListView | bltravis/django-alphabetfilter,affan2/django-alphabetfilter,bltravis/django-alphabetfilter,affan2/django-alphabetfilter,bltravis/django-alphabetfilter,affan2/django-alphabetfilter | alphafilter/views.py | alphafilter/views.py | """
A generic view for filtering querysets via alphafilter
"""
from django.shortcuts import render_to_response
from django.template import RequestContext
try:
from django.views.generic import ListView
except ImportError:
ListView = None
def alphafilter(request, queryset, template):
"""
Render the templ... | """
A generic view for filtering querysets via alphafilter
"""
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic import ListView
def alphafilter(request, queryset, template):
"""
Render the template with the filtered queryset
"""
q... | apache-2.0 | Python |
10a0afcb6f848aca8ccc526f258c81b01f29c001 | Improve classpath reference in launch script | bnanes/svg-embed-and-crop,bnanes/svg-embed-and-crop,bnanes/svg-embed-and-crop | src/main/assembly/svg-embed-and-crop.py | src/main/assembly/svg-embed-and-crop.py | import inkex
import subprocess, os.path, sys, platform
try:
from inkex.utils import errormsg, Boolean
from inkex.colors import Color, ColorIdError, ColorError
from inkex.elements import load_svg, BaseElement, ShapeElement, Group, Layer, Grid, \
TextElement, FlowPara, FlowDiv
from inkex.base import InkscapeE... | import inkex
import subprocess, os.path, sys, platform
try:
from inkex.utils import errormsg, Boolean
from inkex.colors import Color, ColorIdError, ColorError
from inkex.elements import load_svg, BaseElement, ShapeElement, Group, Layer, Grid, \
TextElement, FlowPara, FlowDiv
from inkex.base import InkscapeE... | mit | Python |
ffac3a8afe0a077c0e568a6fdf8469684af998d7 | Fix get model in view | artofhuman/django-clever-pages | page/views.py | page/views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import get_object_or_404
from django.views.generic.detail import DetailView
from .models import Page
from meta.views import MetadataMixin
class MetaTagsMexin(MetadataMixin):
""" Mixin for show meta tegs from django-meta """
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import get_object_or_404
from django.views.generic.detail import DetailView
from .models import Page
from meta.views import MetadataMixin
class MetaTagsMexin(MetadataMixin):
""" Mixin for show meta tegs from django-meta """
... | mit | Python |
3797f41d5b8278fea80075aaa1200a588ee6982d | fix paho-mqtt usage in python mqtt quickstart | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | deployed-devices/quickstarts/paho-python/subscribe-and-print.py | deployed-devices/quickstarts/paho-python/subscribe-and-print.py | import paho.mqtt.client as mqtt
#
# Use the actual location of your downloaded certificate and key.
#
pem_location = '/…/CY499a5cbd774f4970a9ab51e2e8c4fb57.pem'
key_location = '/…/CY499a5cbd774f4970a9ab51e2e8c4fb57.key.decrypted'
client = mqtt.Client(client_id="bob", clean_session=False)
client.tls_set(None, pem_loca... | import paho.mqtt.client as mqtt
#
# Use the actual location of your downloaded certificate and key.
#
pem_location = '/…/CY499a5cbd774f4970a9ab51e2e8c4fb57.pem'
key_location = '/…/CY499a5cbd774f4970a9ab51e2e8c4fb57.key.decrypted'
client = mqtt.Client(client_id="bob", clean_session=False)
client.set_tls(None, pem_loca... | mit | Python |
2014f1b6c17e27df78e0be17ce52d9358348b09c | document Monitor.ready [skip ci] | eugene-eeo/scell | scell/core.py | scell/core.py | """
scell.core
~~~~~~~~~~
Provides abstractions over lower level APIs and
file objects and their interests.
"""
from select import select as _select
def select(rl, wl, timeout):
"""
Performs a ``~select.select`` call with the given
read-list (*rl*), write-list (*wl*), and *timeout*
... | """
scell.core
~~~~~~~~~~
Provides abstractions over lower level APIs and
file objects and their interests.
"""
from select import select as _select
def select(rl, wl, timeout):
"""
Performs a ``~select.select`` call with the given
read-list (*rl*), write-list (*wl*), and *timeout*
... | mit | Python |
67cad6842ceb9a49fbff70faa8dbff8b7ef20134 | add test for context load without orchestrator | vdemeester/docker-py,docker/docker-py,vdemeester/docker-py,docker/docker-py | tests/integration/context_api_test.py | tests/integration/context_api_test.py | import os
import tempfile
import pytest
from docker import errors
from docker.context import ContextAPI
from docker.tls import TLSConfig
from .base import BaseAPIIntegrationTest
class ContextLifecycleTest(BaseAPIIntegrationTest):
def test_lifecycle(self):
assert ContextAPI.get_context().Name == "default"
... | import os
import tempfile
import pytest
from docker import errors
from docker.context import ContextAPI
from docker.tls import TLSConfig
from .base import BaseAPIIntegrationTest
class ContextLifecycleTest(BaseAPIIntegrationTest):
def test_lifecycle(self):
assert ContextAPI.get_context().Name == "default"
... | apache-2.0 | Python |
5baf9b06b5e5c4822a6d626317d47280362dddd5 | fix json test and add json from string test | makinacorpus/mapnik2,makinacorpus/mapnik2,makinacorpus/mapnik2,makinacorpus/mapnik2,craigds/mapnik2,craigds/mapnik2,craigds/mapnik2,craigds/mapnik2 | tests/python_tests/datasource_test.py | tests/python_tests/datasource_test.py | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
import os, mapnik2
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_field_listing():
lyr = mapnik2.Layer('t... | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
import os, mapnik2
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_field_listing():
lyr = mapnik2.Layer('t... | lgpl-2.1 | Python |
d6f097fbecaba8bff6ffea12a325f023e5c15c93 | Add test for new functions | rsk-mind/rsk-mind-framework | tests/transformer/test_transformer.py | tests/transformer/test_transformer.py | from nose.tools import assert_items_equal
from rsk_mind.transformer import *
class CustomTransformer(Transformer):
class Feats:
exclude = ('a3', 'a4')
a1 = Feat()
a2 = Feat()
f1 = CompositeFeat(['a1', 'a2'])
def get_a1(self, feat):
return [-float(feat)]
def get_a2... | import os
from nose.tools import assert_equals, assert_items_equal
from rsk_mind.dataset import Dataset
from rsk_mind.transformer import *
class CustomTransformer(Transformer):
class Feats:
a1 = Feat()
a2 = Feat()
f1 = CompositeFeat(['a1', 'a2'])
def get_a1(self, feat):
retu... | mit | Python |
4afda44144ac28c694ddfd80eea099c96dbf7d0b | Update star_citizen.py | treefroog/tapir-bot | cogs/star_citizen.py | cogs/star_citizen.py | from discord.ext import commands
from .utils import checks
import discord
import asyncio
from bs4 import BeautifulSoup
import urllib.request
import datetime
class Star_Citizen:
"""All of the Star Citizen related commands"""
def __init__(self, bot):
self.bot = bot
@commands.command()
... | from discord.ext import commands
from .utils import checks
import discord
import asyncio
from bs4 import BeautifulSoup
import urllib.request
import datetime
class Star_Citizen:
"""All of the Star Citizen related commands"""
def __init__(self, bot):
self.bot = bot
@commands.command()
... | mit | Python |
f5fd74dac54f657cc64fdaa0b838b00b72ce5ee6 | Allow line breaks in changelog. | jendrikseipp/vulture,jendrikseipp/vulture | dev/make-release-notes.py | dev/make-release-notes.py | #! /usr/bin/env python3
import re
import sys
_, VERSION, CHANGELOG, LIST = sys.argv
HEADER_REGEX = fr"# {VERSION} \(\d\d\d\d-\d\d-\d\d\)\n"
notes_list = []
def add_to_release_notes(line):
assert line.endswith("."), line
with open(CHANGELOG) as f:
first_line = next(f)
if not re.match(HEADER_REGEX, fi... | #! /usr/bin/env python3
import re
import sys
_, VERSION, CHANGELOG, LIST = sys.argv
HEADER_REGEX = fr"# {VERSION} \(\d\d\d\d-\d\d-\d\d\)\n"
notes_list = []
def add_to_release_notes(line):
assert line.endswith("."), line
notes_list.append(f"* {line}\n")
with open(CHANGELOG) as f:
first_line = next(f)
... | mit | Python |
474b1b42623c530cf1422c2690cd0903a749c59f | Use constant pressure reactor instead of adding Wall | Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn | interfaces/cython/cantera/examples/reactors/reactor1.py | interfaces/cython/cantera/examples/reactors/reactor1.py | """
Constant-pressure, adiabatic kinetics simulation.
"""
import sys
import numpy as np
import cantera as ct
gri3 = ct.Solution('gri30.xml')
gri3.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4'
r = ct.IdealGasConstPressureReactor(gri3)
sim = ct.ReactorNet([r])
time = 0.0
times = np.zeros(100)
data = np.zeros((100,4))
p... | """
Constant-pressure, adiabatic kinetics simulation.
"""
import sys
import numpy as np
import cantera as ct
gri3 = ct.Solution('gri30.xml')
air = ct.Solution('air.xml')
gri3.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:4'
r = ct.IdealGasReactor(gri3)
env = ct.Reservoir(air)
# Define a wall between the reactor and the ... | bsd-3-clause | Python |
c88efde14ea79419a69a3459b5ba9ba19332fffd | Move redundant check to first point of contact | vilisimo/ads,vilisimo/ads | python/algorithms/sorting/quicksort.py | python/algorithms/sorting/quicksort.py | import random
def sort(items):
if items is None:
raise TypeError("Collection cannot be of type None")
if len(items) < 2:
return items
pivot = random.randint(0, len(items) - 1)
greater = []
less = []
for index in range(0, len(items)):
if index == pivot:
c... | import random
def sort(items):
if items is None:
raise TypeError("Collection cannot be of type None")
if len(items) < 2:
return items
pivot = random.randint(0, len(items) - 1)
greater = []
less = []
for index in range(0, len(items)):
if index == pivot:
c... | mit | Python |
bdc0667fcd28bbbf688b7ec0e6ec2dc525efd4bb | Fix some comment formatting | lmacken/moksha,ralphbean/moksha,ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,ralphbean/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,lmacken/moksha | moksha/lib/base.py | moksha/lib/base.py | # This file is part of Moksha.
# Copyright (C) 2008-2009 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later... | # This file is part of Moksha.
# Copyright (C) 2008-2009 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later... | apache-2.0 | Python |
c90a934366d81e759094f94469774abcf2e8f098 | Remove result checking in http_stats_submit, as submit_match raises exception on fail | em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings,em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings | qllr/blueprints/submission/__init__.py | qllr/blueprints/submission/__init__.py | # -*- coding: utf-8 -*-
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse
from qllr.app import App
from qllr.settings import RUN_POST_PROCESS
from qllr.submission import submit_match # TODO: перенеси в этот блупринт
bp = App()
bp.json_... | # -*- coding: utf-8 -*-
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse
from qllr.app import App
from qllr.settings import RUN_POST_PROCESS
from qllr.submission import submit_match # TODO: перенеси в этот блупринт
bp = App()
bp.json_... | agpl-3.0 | Python |
9fc45628b01cf7b25f4c745a8c04bd0100d78f9e | Add simple way to pass RH data to MM context | mic4ael/indico,ThiefMaster/indico,indico/indico,mic4ael/indico,pferreir/indico,DirkHoffmann/indico,pferreir/indico,ThiefMaster/indico,indico/indico,DirkHoffmann/indico,indico/indico,pferreir/indico,DirkHoffmann/indico,mic4ael/indico,indico/indico,ThiefMaster/indico,DirkHoffmann/indico,pferreir/indico,ThiefMaster/indico... | indico/web/args.py | indico/web/args.py | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import absolute_import, unicode_literals
from flask import g
from webargs.flaskparser imp... | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from webargs.flaskparser import FlaskParser
from indico.util.str... | mit | Python |
f9c654a60501ef734de178e7e2e7e89955eb39e0 | Complete 'About Lists Assignments' koans | JesusMtnez/devexperto-challenge,JesusMtnez/devexperto-challenge | jesusmtnez/python/koans/koans/about_list_assignments.py | jesusmtnez/python/koans/koans/about_list_assignments.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrayAssignments in the Ruby Koans
#
from runner.koan import *
class AboutListAssignments(Koan):
def test_non_parallel_assignment(self):
names = ["John", "Smith"]
self.assertEqual(["John", "Smith"], names)
def test_parallel_assi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrayAssignments in the Ruby Koans
#
from runner.koan import *
class AboutListAssignments(Koan):
def test_non_parallel_assignment(self):
names = ["John", "Smith"]
self.assertEqual(__, names)
def test_parallel_assignments(self):
... | mit | Python |
390a3072cfd80da6549921aa291016c8c1fa30d9 | Change parameters | davidgasquez/kaggle-airbnb | scripts/gb.py | scripts/gb.py | import sys
import numpy as np
import pandas as pd
import datetime
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from xgboost.sklearn import XGBClassifier
sys.path.append('..')
from utils.data_loading import load_users_data
from utils.preprocessing import one_hot_encodi... | import sys
import numpy as np
import pandas as pd
import datetime
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from xgboost.sklearn import XGBClassifier
sys.path.append('..')
from utils.data_loading import load_users_data
from utils.preprocessing import one_hot_encodi... | mit | Python |
06b3f2c4ac20f3ca58b00e2f34543b6972cc25bc | Use unittest skipIf | sophiavanvalkenburg/coala,karansingh1559/coala,coala-analyzer/coala,coala-analyzer/coala,meetmangukiya/coala,saurabhiiit/coala,rimacone/testing2,Balaji2198/coala,Shade5/coala,swatilodha/coala,damngamerz/coala,NalinG/coala,NalinG/coala,ManjiriBirajdar/coala,sudheesh001/coala,shreyans800755/coala,svsn2117/coala,Uran198/c... | bears/tests/coffee_script/CoffeeLintBearTest.py | bears/tests/coffee_script/CoffeeLintBearTest.py | import os
import sys
import unittest
from queue import Queue
from shutil import which
from unittest.case import skipIf
sys.path.insert(0, ".")
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
from bears.coffee_script.CoffeeLintBear import CoffeeLintBear
from coalib.settings.Section import Section
@ski... | import os
import subprocess
import sys
import unittest
from queue import Queue
sys.path.insert(0, ".")
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
from bears.coffee_script.CoffeeLintBear import CoffeeLintBear
from coalib.settings.Section import Section
class CoffeeLintBearTest(LocalBearTestHelper... | agpl-3.0 | Python |
1d12dd771a33a9d720dd0d2b9e19cd405e61678c | make --archive-dir default to . | tchaikov/teuthology,tchaikov/teuthology,michaelsevilla/teuthology,dmick/teuthology,ivotron/teuthology,t-miyamae/teuthology,zhouyuan/teuthology,ceph/teuthology,caibo2014/teuthology,SUSE/teuthology,dmick/teuthology,yghannam/teuthology,caibo2014/teuthology,yghannam/teuthology,dreamhost/teuthology,robbat2/teuthology,ktdrey... | scripts/ls.py | scripts/ls.py | import argparse
import teuthology.ls
def main():
teuthology.ls.main(parse_args())
def parse_args():
parser = argparse.ArgumentParser(description='List teuthology job results')
parser.add_argument(
'--archive-dir',
metavar='DIR',
default='.',
help='path under which to arch... | import argparse
import teuthology.ls
def main():
teuthology.ls.main(parse_args())
def parse_args():
parser = argparse.ArgumentParser(description='List teuthology job results')
parser.add_argument(
'--archive-dir',
metavar='DIR',
help='path under which to archive results',
... | mit | Python |
26be12d40ede6dd6edfbb0c82d64c2fa2305bf5e | Remove flask_restful response interception | EUDAT-B2STAGE/http-api-base,EUDAT-B2STAGE/http-api-base,EUDAT-B2STAGE/http-api-base | restapi/rest.py | restapi/rest.py | # -*- coding: utf-8 -*-
"""
App specifications
"""
from __future__ import division
from . import myself, lic
from commons.logs import get_logger
from flask_restful import Api as RestFulApi
from .resources.farm import EndpointsFarmer
from .config import MyConfigs
__author__ = myself
__copyright__ = myself
__license__... | # -*- coding: utf-8 -*-
"""
App specifications
"""
from __future__ import division
from . import myself, lic
from commons.logs import get_logger
from flask_restful import Api
from .resources.farm import EndpointsFarmer
from .config import MyConfigs
__author__ = myself
__copyright__ = myself
__license__ = lic
logger... | mit | Python |
b3e255d824f540facc72c62a27c40724c717e2ac | Update render_to docstring | govtrack/django-lorien-common,govtrack/django-lorien-common,govtrack/django-lorien-common | common/decorators.py | common/decorators.py | # -*- coding: utf-8 -*-
import traceback
from django.shortcuts import render_to_response
from django.template import RequestContext
from common.http import HttpResponseJson
def render_to(template):
"""
Shortcut for rendering template with RequestContext.
If decorated function returns non dict then just ... | # -*- coding: utf-8 -*-
import traceback
from django.shortcuts import render_to_response
from django.template import RequestContext
from common.http import HttpResponseJson
def render_to(template):
"""
Expects the dict from view. Render returned dict with
RequestContext.
"""
def decorator(func):... | bsd-3-clause | Python |
f4004cb86b389514e1a26ff3bca212481c84a03d | Improve error reporting in client tests. | ssorgatem/pulsar,jmchilton/pulsar,jmchilton/lwr,galaxyproject/pulsar,natefoo/pulsar,natefoo/pulsar,galaxyproject/pulsar,ssorgatem/pulsar,jmchilton/pulsar,jmchilton/lwr | run_client_tests.py | run_client_tests.py | import shutil
import tempfile
import os
import optparse
import traceback
from lwr.client import Client
def main():
""" Exercises a running lwr server application with the lwr client. """
parser = optparse.OptionParser()
parser.add_option('--url', dest='url', default='http://localhost:8913')
(options, ... | import shutil
import tempfile
import os
import optparse
from lwr.client import Client
def main():
""" Exercises a running lwr server application with the lwr client. """
parser = optparse.OptionParser()
parser.add_option('--url', dest='url', default='http://localhost:8913')
(options, args) = parser.pa... | apache-2.0 | Python |
2f7bc96d4e8f4665981738131297bb708eadb585 | Make the specializer pass handle NE nodes. | djc/runa,djc/runa,djc/runa,djc/runa | runac/specialize.py | runac/specialize.py | import ast, types
class Specializer(object):
def __init__(self, mod, fun):
self.mod = mod
self.fun = fun
self.cfg = fun.flow
def visit(self, node):
if hasattr(self, node.__class__.__name__):
getattr(self, node.__class__.__name__)(node)
return
for k in node.fields:
attr = getattr(node, k)... | import ast, types
class Specializer(object):
def __init__(self, mod, fun):
self.mod = mod
self.fun = fun
self.cfg = fun.flow
def visit(self, node):
if hasattr(self, node.__class__.__name__):
getattr(self, node.__class__.__name__)(node)
return
for k in node.fields:
attr = getattr(node, k)... | mit | Python |
0f1999905e639f1032e6e72ded564b5716e8af50 | write tests for bucketlist items | andela-tadesanya/django-bucketlist-application,andela-tadesanya/django-bucketlist-application,andela-tadesanya/django-bucketlist-application | bucketlist_django/bucketlist/tests.py | bucketlist_django/bucketlist/tests.py | from django.test import TestCase
from django.contrib.auth.models import User
from bucketlist.models import Bucketlist
# Create your tests here.
class BucketlistTestCase(TestCase):
def setUp(self):
self.user = User.objects.create_user(
username='jake',
... | from django.test import TestCase
from django.contrib.auth.models import User
from bucketlist.models import Bucketlist
# Create your tests here.
class BucketlistTestCase(TestCase):
def setUp(self):
self.user = User.objects.create_user(
username='jake',
email='jk@emai... | mit | Python |
03aabe7e0f5c669b2f348ce3a1eed52dd2dc7054 | bump 0.6.2 | assaflavie/runlike,assaflavie/runlike | runlike/__init__.py | runlike/__init__.py | __version__ = "0.6.2"
| __version__ = "0.6.0"
| bsd-2-clause | Python |
7d1c3ca61fb11aae181fb15d4ab825dfe9c2e710 | Add support for ... (`Ellipsis`). | pyos/dg | runtime/__init__.py | runtime/__init__.py | import builtins
import operator
import functools
import importlib
# Choose a function based on the number of arguments.
varary = lambda *fs: lambda *xs: fs[len(xs) - 1](*xs)
builtins.__dict__.update({
# Runtime counterparts of some stuff in `Compiler.builtins`.
'$': lambda f, *xs: f(*xs)
, ':': lambda f, ... | import builtins
import operator
import functools
import importlib
# Choose a function based on the number of arguments.
varary = lambda *fs: lambda *xs: fs[len(xs) - 1](*xs)
builtins.__dict__.update({
# Runtime counterparts of some stuff in `Compiler.builtins`.
'$': lambda f, *xs: f(*xs)
, ':': lambda f, ... | mit | Python |
ad16e07cce92c0ed23e5e82c60a00f04dabce2a3 | Add an exception based version | CubicComet/exercism-python-solutions | rna-transcription/rna_transcription.py | rna-transcription/rna_transcription.py | TRANS = {"G": "C", "C":"G", "T":"A", "A":"U"}
def to_rna(dna):
try:
return "".join([TRANS[n] for n in dna])
except KeyError:
return ""
# Old version: it's slightly slower for valid DNA, but slightly faster for invalid DNA
DNA = {"A", "C", "T", "G"}
TRANS = {"G": "C", "C":"G", "T":"A", "A":"... | DNA = {"A", "C", "T", "G"}
TRANS = {"G": "C", "C":"G", "T":"A", "A":"U"}
def to_rna(dna):
# Check validity - `difference` returns elements in dna not in DNA
if set(dna).difference(DNA):
return ""
return "".join([TRANS[n] for n in dna])
| agpl-3.0 | Python |
81aa35961ba9552701eecbdb4d8e91448835aba0 | Make login a utility so it can be re-used elsewhere. | playfire/django-autologin | django_autologin/utils.py | django_autologin/utils.py | import urllib
import urlparse
from django.conf import settings
from django.contrib import auth
from . import app_settings
def strip_token(url):
bits = urlparse.urlparse(url)
original_query = urlparse.parse_qsl(bits.query)
query = {}
for k, v in original_query:
if k != app_settings.KEY:
... | import urllib
import urlparse
from . import app_settings
def strip_token(url):
bits = urlparse.urlparse(url)
original_query = urlparse.parse_qsl(bits.query)
query = {}
for k, v in original_query:
if k != app_settings.KEY:
query[k] = v
query = urllib.urlencode(query)
retu... | bsd-3-clause | Python |
8cfb2bfdc26e9fdb47212b8dc232026ed944509a | fix #2 | visipedia/django-visipedia | django_visipedia/views.py | django_visipedia/views.py | from django.conf import settings
from django.shortcuts import redirect
from django_visipedia import init_visipedia
visipedia = init_visipedia()
def login(request):
if request.user.is_authenticated():
return redirect(getattr(settings, 'LOGIN_REDIRECT_URL', '/'))
else:
next_page = request.GET.g... | from django.conf import settings
from django.shortcuts import redirect
from django_visipedia import visipedia
def login(request):
if request.user.is_authenticated():
return redirect(getattr(settings, 'LOGIN_REDIRECT_URL', '/'))
else:
next_page = request.GET.get('next', '')
uri = reques... | mit | Python |
55cf809616f244c7e71fed39c6bc4dd497c87668 | add a better error message when the rTIS service failed to start | sassoftware/rpath-repeater | rpath_repeater/utils/windows/errors.py | rpath_repeater/utils/windows/errors.py | #
# Copyright (c) 2011 rPath, Inc.
#
from rpath_repeater.utils.base_forwarding_plugin import BaseException
from rpath_repeater.utils.base_forwarding_plugin import AuthenticationError # pyflakes=ignore
class UpdateError(BaseException):
pass
class NotEnoughSpaceError(BaseException):
pass
class ServiceFailedT... | #
# Copyright (c) 2011 rPath, Inc.
#
from rpath_repeater.utils.base_forwarding_plugin import BaseException
from rpath_repeater.utils.base_forwarding_plugin import AuthenticationError # pyflakes=ignore
class UpdateError(BaseException):
pass
class NotEnoughSpaceError(BaseException):
pass
class ServiceFailedT... | apache-2.0 | Python |
2716c165af74d800604c44e9ad1a78e83b5c8906 | Bump version. | L1NT/django-yubico-authentication-backend,Kami/django-yubico-authentication-backend,L1NT/django-yubico-authentication-backend | django_yubico/__init__.py | django_yubico/__init__.py | __version__ = (0, 3, 1)
| __version__ = (0, 3, 1, 'dev')
| bsd-3-clause | Python |
43a6f07c35d15f104833f7dec43a5c51c5aafe99 | Refactor widgets. | bradleyg/django-s3direct,bradleyg/django-s3direct,bradleyg/django-s3direct | s3direct/widgets.py | s3direct/widgets.py | from __future__ import unicode_literals
import os
from django.forms import widgets
from django.utils.safestring import mark_safe
try:
from django.urls import reverse
except ImportError:
# Django <1.10 compliance
from django.core.urlresolvers import reverse
from django.template.loader import render_to_strin... | from __future__ import unicode_literals
import os
from django.forms import widgets
from django.utils.safestring import mark_safe
try:
from django.urls import reverse
except ImportError:
# Django <1.10 compliance
from django.core.urlresolvers import reverse
from django.template.loader import render_to_strin... | mit | Python |
7fc02512d1f0c9187ace8025dd166688db93de66 | Add values to 2-2 loop | SEACodeCarrots/RNAFolding,SEACodeCarrots/RNAFolding | csvToJSON.py | csvToJSON.py | #! /usr/env/python
# this script converts the csv energy tables into a JSON file
import io
import pprint
#read in 2-2 loop
# FIRST ROW - comma is field separator
with open('/Users/sarahguermond/Files/Loop_2_2.csv', 'r') as infile:
firstLine = infile.readline()
lineList = firstLine.strip().split(",")
loop_2_2 = {}
... | #! /usr/env/python
# this script converts the csv energy tables into a JSON file
import io
#read in 2-2 loop
# FIRST ROW - comma is field separator
with open('/Users/sarahguermond/Files/Loop_2_2.csv', 'r') as infile:
firstLine = infile.readline()
lineList = firstLine.strip().split(",")
loop_2_2 = {}
for string1 in... | mit | Python |
94f6ffac450f9807177c787dca72bf8ef8884096 | update comments | bobbyluig/CCTF-Platform,bobbyluig/CCTF-Platform,bobbyluig/CCTF-Platform | ctf/admin.py | ctf/admin.py | '''This script handles the administrative work that is not implemented into the website. It is not integrated with the site. '''
import pkgutil, os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ctf.settings")
from django.db import connection
from api.attack import update_cache
from api.config import config
from i... | '''This script handles the administrative work that is not implemented into the website. It is not integrated with the site. '''
import pkgutil, os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ctf.settings")
from django.db import connection
from api.attack import update_cache
from api.config import config
from i... | mit | Python |
ac30d4e6434c6c8bbcb949465a3e314088b3fc12 | Revert changes: freezegun has been updated. | SideStudios/django-jsonfield | jsonfield/utils.py | jsonfield/utils.py | import datetime
from decimal import Decimal
from django.core.serializers.json import DjangoJSONEncoder
class TZAwareJSONEncoder(DjangoJSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
return obj.strftime("%Y-%m-%d %H:%M:%S%z")
return super(TZAwareJSONEncoder,... | import datetime
from decimal import Decimal
from django.core.serializers.json import DjangoJSONEncoder
DATETIME = (datetime.datetime,)
DATE = (datetime.date,)
TIME = (datetime.time,)
try:
import freezegun.api
except ImportError:
pass
else:
DATETIME += (freezegun.api.FakeDatetime,)
DATE += (freezegun.... | bsd-3-clause | Python |
e642fd48c2fedc4c22285dae2e98e93014237eb7 | remove secret | nrempel/rucksack-api | config/production.py | config/production.py | # -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
CSRF_ENABLED = True
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db')
| # -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
CSRF_ENABLED = True
SECRET_KEY = os.environ['FLASK_SECRET_KEY']
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db')
| mit | Python |
d8927a6fb0149d727cd0b5254a5bd3a41ee92da6 | fix doc | chainer/chainercv,yuyu2172/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv | chainercv/visualizations/vis_point.py | chainercv/visualizations/vis_point.py | from __future__ import division
import numpy as np
import six
from chainercv.visualizations.vis_image import vis_image
def vis_point(img, point, visible=None, ax=None):
"""Visualize points in an image.
Example:
>>> import chainercv
>>> import matplotlib.pyplot as plt
>>> dataset = ... | from __future__ import division
import numpy as np
import six
from chainercv.visualizations.vis_image import vis_image
def vis_point(img, point, visible=None, ax=None):
"""Visualize points in an image.
Example:
>>> import chainercv
>>> import matplotlib.pyplot as plt
>>> dataset = ... | mit | Python |
c2481268c989cff0805b4afae71f740fd2ce7c54 | Allow selecting German during jumpstart. | datadesk/panda,ibrahimcesar/panda,pandaproject/panda,pandaproject/panda,PalmBeachPost/panda,ibrahimcesar/panda,PalmBeachPost/panda,datadesk/panda,ibrahimcesar/panda,ibrahimcesar/panda,datadesk/panda,PalmBeachPost/panda,ibrahimcesar/panda,pandaproject/panda,datadesk/panda,PalmBeachPost/panda,pandaproject/panda,pandaproj... | jumpstart/views.py | jumpstart/views.py | #!/usr/bin/env python
import os
import random
import subprocess
import time
from django.conf import settings
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import gettext_noop
from pytz import common_timezones
from tastypie.models import ApiKey... | #!/usr/bin/env python
import os
import random
import subprocess
import time
from django.conf import settings
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import gettext_noop
from pytz import common_timezones
from tastypie.models import ApiKey... | mit | Python |
ae59b35121428e85fa4f7673f5a4a458981b3205 | Fix auth functions | ckan/ckanext-googleanalytics,ckan/ckanext-googleanalytics,ckan/ckanext-googleanalytics | ckanext/googleanalytics/logic/auth.py | ckanext/googleanalytics/logic/auth.py | from __future__ import absolute_import
from ckan.authz import is_authorized
def get_auth():
return dict(
googleanalytics_package_stats_show=package_stats_show,
googleanalytics_resource_stats_show=resource_stats_show,
)
def package_stats_show(context, data_dict):
return is_authorized("pa... | from __future__ import absolute_import
from ckan.authz import is_authorized
def get_auth():
return dict(
googleanalytics_package_stats_show=package_stats_show,
googleanalytics_resource_stats_show=resource_stats_show,
)
def package_stats_show(context, data_dict):
return {"success": is_au... | agpl-3.0 | Python |
d3fdbcdf60e85fe738fd84809703c4230b4b915f | Replace deprecated import of ABCs from collections | openstack/cloudkitty-dashboard,stackforge/cloudkitty-dashboard,stackforge/cloudkitty-dashboard,openstack/cloudkitty-dashboard,stackforge/cloudkitty-dashboard,openstack/cloudkitty-dashboard | cloudkittydashboard/api/cloudkitty.py | cloudkittydashboard/api/cloudkitty.py | # -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 l... | # -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 l... | apache-2.0 | Python |
f06edd63f97b26337c830fb18150064e59369197 | Convert json blocks to string before parsing | frabcus/jobschemacert,Doteveryone/BetterJobAdverts,Doteveryone/BetterJobAdverts,Doteveryone/BetterJobAdverts,frabcus/jobschemacert,frabcus/jobschemacert | server/api.py | server/api.py | import json
import os
from flask.ext.cors import CORS
from flask.ext.api import renderers
from flask.ext.api import FlaskAPI
from flask import request, send_from_directory
import requests
from bs4 import BeautifulSoup
app = FlaskAPI(__name__)
CORS(app)
class CORSRenderer(renderers.JSONRenderer):
def render(self... | import json
import os
from flask.ext.cors import CORS
from flask.ext.api import renderers
from flask.ext.api import FlaskAPI
from flask import request, send_from_directory
import requests
from bs4 import BeautifulSoup
app = FlaskAPI(__name__)
CORS(app)
class CORSRenderer(renderers.JSONRenderer):
def render(self... | agpl-3.0 | Python |
ba66ac69ae55fd3fcfd77fb5afb4b36ce156172a | fix bug with missing import | mimecuvalo/helloworld,mimecuvalo/helloworld,mimecuvalo/helloworld,mimecuvalo/helloworld | controllers/stats.py | controllers/stats.py | import re
import tornado.web
from base import BaseHandler
from logic import url_factory
class StatsHandler(BaseHandler):
def get(self):
increase_count(self)
# ok!
self.set_status(204)
class StatsStaticHandler(tornado.web.StaticFileHandler, BaseHandler):
def get(self):
BaseHandler.initialize(self... | import tornado.web
from base import BaseHandler
from logic import url_factory
class StatsHandler(BaseHandler):
def get(self):
increase_count(self)
# ok!
self.set_status(204)
class StatsStaticHandler(tornado.web.StaticFileHandler, BaseHandler):
def get(self):
BaseHandler.initialize(self)
incr... | mit | Python |
79245258a36766ca7e67fb4a75ffd7744bd68907 | Enable CORS | kshvmdn/github-list,kshvmdn/github-list,kshvmdn/github-list | server/app.py | server/app.py | #!/usr/bin/env python
import os
from flask import abort, Flask, jsonify, request
from flask_cors import CORS, cross_origin
from fetch import fetch
VERSION = '1.0'
app = Flask(__name__)
app.config["JSON_SORT_KEYS"] = False
CORS(app)
@app.route('/api/%s/<string:owner>/<string:repo>' % VERSION)
def api(owner, repo):
... | #!/usr/bin/env python
import os
from flask import abort, Flask, jsonify, request
from fetch import fetch
VERSION = '1.0'
app = Flask(__name__)
app.config["JSON_SORT_KEYS"] = False
@app.route('/api/%s/<string:owner>/<string:repo>' % VERSION)
def api(owner, repo):
data = fetch(owner, repo)
return jsonify(met... | mit | Python |
a0c0499c3da95e53e99d6386f7970079a2669141 | Add exception handling in twitter view | griimick/feature-mlsite,griimick/feature-mlsite,griimick/feature-mlsite | app/twitter/views.py | app/twitter/views.py | from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove(' ')
ascii_chars.add('...')
def takeout... | from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove(' ')
ascii_chars.add('...')
def takeo... | mit | Python |
5d51c1b6b33f6ed70a09a16f3be38ae53a29f8d0 | Make compile_shaders.py work with relative path to oslc | Vertexwahn/appleseed,aiivashchenko/appleseed,gospodnetic/appleseed,aiivashchenko/appleseed,Vertexwahn/appleseed,aiivashchenko/appleseed,Aakash1312/appleseed,dictoon/appleseed,docwhite/appleseed,dictoon/appleseed,appleseedhq/appleseed,Biart95/appleseed,gospodnetic/appleseed,pjessesco/appleseed,pjessesco/appleseed,pjesse... | sandbox/shaders/src/compile_shaders.py | sandbox/shaders/src/compile_shaders.py | #!/usr/bin/python
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2015 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any pe... | #!/usr/bin/python
import os
import shutil
import sys
if len(sys.argv) != 2:
print "Wrong number of arguments"
print "Usage compile_shaders [path to oslc]"
sys.exit(0)
oslc_cmd = sys.argv[1]
include_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "include")
for root, dirname, files in os.w... | mit | Python |
46f06a390af212a25269ac3c9cea160b7f375f1b | clean up db routers | qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/db/routers.py | corehq/db/routers.py | from .config import PartitionConfig
PROXY_APP = 'sql_proxy_accessors'
SQL_ACCESSORS_APP = 'sql_accessors'
FORM_PROCESSING_GROUP = 'form_processing'
PROXY_GROUP = 'proxy'
MAIN_GROUP = 'main'
class PartitionRouter(object):
def __init__(self):
self.config = PartitionConfig()
def allow_migrate(self, d... | from .config import PartitionConfig
class PartitionRouter(object):
def __init__(self):
self.config = PartitionConfig()
def allow_migrate(self, db, app_label, model=None, **hints):
if app_label == 'sql_proxy_accessors':
return (db in self.config.dbs_by_group('sql_proxy_accessors')... | bsd-3-clause | Python |
3af9a9a1b9b361bef5a8824cadd6a5903325d29b | update python | thuma/SnalltagetAPI,thuma/SnalltagetAPI | snalltaget.py | snalltaget.py | import requests
import re
import json
r = requests.get('https://boka.snalltaget.se/boka-biljett')
cookie = r.cookies["Token"]
cookies = dict(Token=cookie)
query = json.loads('{"DepartureLocationId":1,"DepartureLocationProducerCode":74,"ArrivalLocationId":110,"ArrivalLocationProducerCode":74,"DepartureDateTime":"2014-... | import requests
import re
import json
r = requests.get('https://boka.snalltaget.se/boka-biljett')
cookie = r.cookies["Token"]
cookies = dict(Token=cookie)
query = json.loads('{"DepartureLocationId":1,"DepartureLocationProducerCode":74,"ArrivalLocationId":120,"ArrivalLocationProducerCode":74,"DepartureDateTime":"2014-... | mit | Python |
3e585d9aac899d23a6ae1e330678f8c6b5a2651b | clarify private pools instructions (#268) | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | cloudbuild/snippets/quickstart.py | cloudbuild/snippets/quickstart.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google LLC
#
# 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, ... | apache-2.0 | Python |
d26b2fd19b048d3720d757ba850d88b683d4b367 | Add functions for retrieving a list of dynamically registered runners. | StackStorm/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,nzlosh/st2 | st2common/st2common/runners/__init__.py | st2common/st2common/runners/__init__.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
19b600b7d5ad6c781440bd65de37bfd3e731ca25 | add in admin for price tier (bug 677515) | mrrrgn/olympia,crdoconnor/olympia,ngokevin/zamboni,crdoconnor/olympia,tsl143/zamboni,magopian/olympia,mstriemer/addons-server,beni55/olympia,elysium001/zamboni,wagnerand/olympia,magopian/olympia,jbalogh/zamboni,mdaif/olympia,johancz/olympia,mozilla/zamboni,Revanth47/addons-server,harry-7/addons-server,mudithkr/zamboni,... | apps/market/admin.py | apps/market/admin.py | from django.contrib import admin
from .models import Price
admin.site.register(Price)
| bsd-3-clause | Python | |
7a886fa340598d2716e218e07a59505dae1b63da | bump version | cenkalti/kuyruk,cenkalti/kuyruk | kuyruk/__init__.py | kuyruk/__init__.py | import logging
from .kuyruk import Kuyruk
from .task import Task
from .worker import Worker
from .queue import Queue
__version__ = '0.7.1'
try:
# not available in python 2.6
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
... | import logging
from .kuyruk import Kuyruk
from .task import Task
from .worker import Worker
from .queue import Queue
__version__ = '0.7.0'
try:
# not available in python 2.6
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
... | mit | Python |
88512f56c8a01d95de9c5e287119c68528f3de1b | create app | foxichu/privly-flask,foxichu/privly-flask,spectralsun/privly-flask,privly/privly-flask,privly/privly-flask,spectralsun/privly-flask | pyvly/main.py | pyvly/main.py | from flask import Flask
app = Flask(__name__)
| mit | Python | |
d4e921de76890a90667add63827baf8ff1a0f715 | Add some info to the printouts | enjin/contracts | solidity/python/FormulaTestCombined.py | solidity/python/FormulaTestCombined.py | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
from Formula import calculatePurchaseReturn
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount):
_new_amount = calculatePurchaseReturn(_supply, _reserveBalance, _reserveRatio, _... | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
from Formula import calculatePurchaseReturn
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount):
_new_amount = calculatePurchaseReturn(_supply, _reserveBalance, _reserveRatio, _... | apache-2.0 | Python |
2d24d7c8acd727ee268ca97daa1397b935e46cb1 | make path to mxd relative | agrc/raster,agrc/raster,agrc/raster | scripts/checkMxd.py | scripts/checkMxd.py | """
used to check the raster.mxd to make sure that it has all of the indices layers
that are referenced in the *_Extents feature classes.
"""
import arcpy
from os import path
mxd = arcpy.mapping.MapDocument(path.join(path.dirname(__file__), '..', 'maps', 'Raster.mxd'))
lyrs = arcpy.mapping.ListLayers(mxd)
def FindL... | """
used to check the raster.mxd to make sure that it has all of the indices layers
that are referenced in the *_Extents feature classes.
"""
import arcpy
mxd = arcpy.mapping.MapDocument(r'Z:\Raster\maps\Raster.mxd')
lyrs = arcpy.mapping.ListLayers(mxd)
def FindLayer(name):
for l in lyrs:
if l.name == na... | mit | Python |
ac69c5f2f24b3462703b6c49933ccc9e433729a3 | Update version to 9.2.5.dev0 [ci skip] | angr/archinfo | archinfo/__init__.py | archinfo/__init__.py | """
archinfo is a collection of classes that contain architecture-specific information.
It is useful for cross-architecture tools (such as pyvex).
"""
__version__ = "9.2.5.dev0"
if bytes is str:
raise Exception("This module is designed for python 3 only. Please install an older version to use python 2.")
# NewTy... | """
archinfo is a collection of classes that contain architecture-specific information.
It is useful for cross-architecture tools (such as pyvex).
"""
__version__ = "9.2.4.dev0"
if bytes is str:
raise Exception("This module is designed for python 3 only. Please install an older version to use python 2.")
# NewTy... | bsd-2-clause | Python |
c9029ec8660dbef3bcabeb03c56e410982b115dc | remove log level setting | gabstopper/smc-python | smc/__init__.py | smc/__init__.py | from smc.actions import *
from smc.api.web import *
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHa... | from smc.actions import *
from smc.api.web import *
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHa... | apache-2.0 | Python |
a8f7a405ef71e2645225b5874734255f2e4337bc | Add full image URL to message | BytewaveMLP/randibooru | randibooru.py | randibooru.py | DISCORD_API_TOKEN = ""
DERPIBOORU_API_TOKEN = ""
BOT_NAME = "Randibooru"
REQUIRED_ROLE = BOT_NAME + " User"
COMMAND_PREFIX = "!"
COMMAND_NAME = "rb"
USER_BLACKLIST = []
import discord
import asyncio
from DerPyBooru.derpibooru import Search, sort
client = discord.Client()
helpgame ... | DISCORD_API_TOKEN = ""
DERPIBOORU_API_TOKEN = ""
BOT_NAME = "Randibooru"
REQUIRED_ROLE = BOT_NAME + " User"
COMMAND_PREFIX = "!"
COMMAND_NAME = "rb"
USER_BLACKLIST = []
import discord
import asyncio
from DerPyBooru.derpibooru import Search, sort
client = discord.Client()
helpgame ... | mit | Python |
733402f56b5c2a28b4e836564b79aac813bd9f54 | save differently | adrn/ophiuchus,adrn/ophiuchus,adrn/ophiuchus,adrn/ophiuchus | scripts/lyapunov.py | scripts/lyapunov.py | # coding: utf-8
""" Compute Lyapunov exponents for the mean orbit fits """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import cPickle as pickle
# Third-party
from astropy import log as logger
import numpy as np
import gary.dynamics as g... | # coding: utf-8
""" Compute Lyapunov exponents for the mean orbit fits """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import cPickle as pickle
# Third-party
from astropy import log as logger
import numpy as np
import gary.dynamics as g... | mit | Python |
24d7c4d1c2ae1f05f34cd25fad655aa584b8912d | add document as name for documentObject | Transkribus/TranskribusDU,Transkribus/TranskribusDU,Transkribus/TranskribusDU | src/ObjectModel/documentClass.py | src/ObjectModel/documentClass.py | # -*- coding: utf-8 -*-
"""
document class
Hervé Déjean
cpy Xerox 2013
a (abstract) class for document
"""
from objectClass import objectClass
class documentObject(objectClass):
"""
Representation of a document (a tree)
"""
def __init__(self):
obj... | # -*- coding: utf-8 -*-
"""
document class
Hervé Déjean
cpy Xerox 2013
a (abstract) class for document
"""
from objectClass import objectClass
class documentObject(objectClass):
"""
Representation of a document (a tree)
"""
def __init__(self):
obj... | bsd-3-clause | Python |
ebe8419dbb03cefc7e5a569b60bed82e35c053f2 | Update anagram.py | keon/algorithms,amaozhao/algorithms | backtrack/anagram.py | backtrack/anagram.py | def all_perms(elements):
if len(elements) <=1:
yield elements
else:
for perm in all_perms(elements[1:]):
for i in range(len(elements)):
yield perm[:i] + elements[0:1] + perm[i:]
def all_perms(elements):
if len(elements) <=1:
return elements
else:
... | def all_perms(elements):
if len(elements) <=1:
yield elements
else:
for perm in all_perms(elements[1:]):
for i in range(len(elements)):
yield perm[:i] + elements[0:1] + perm[i:]
def all_perms(elements):
if len(elements) <=1:
return elements
else:
... | mit | Python |
ea555d42c3940dced0cdd69a7ce13b85c1fcea62 | Change to double quotes for coding convention | hoh/Billabong,hoh/Billabong | billabong/archive.py | billabong/archive.py | # Copyright (c) 2016 "Hugo Herter http://hugoherter.com"
#
# This file is part of Billabong.
#
# Intercom is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your o... | # Copyright (c) 2016 "Hugo Herter http://hugoherter.com"
#
# This file is part of Billabong.
#
# Intercom is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your o... | agpl-3.0 | Python |
cb660dda983759e9a2a42e7c7e1b89955434fd86 | Use a default parameter | uwsampa/accept,jck/accept,uwsampa/accept,uwsampa/accept,jck/accept,jck/accept,uwsampa/accept,jck/accept | bin/inject_config.py | bin/inject_config.py | #!/usr/bin/env python
# These two are copied from accept.core for this one-off.
def parse_relax_config(f):
"""Parse a relaxation configuration from a file-like object.
Generates (ident, param) tuples.
"""
for line in f:
line = line.strip()
if line:
param, ident = line.spli... | #!/usr/bin/env python
# These two are copied from accept.core for this one-off.
def parse_relax_config(f):
"""Parse a relaxation configuration from a file-like object.
Generates (ident, param) tuples.
"""
for line in f:
line = line.strip()
if line:
param, ident = line.spli... | mit | Python |
459b147f3bd6df823912eb48ef3ff1c5dff6b15a | test gpio pwm | dashford/sentinel | src/Notification/Subscriber/LED/RGB.py | src/Notification/Subscriber/LED/RGB.py | import time
import RPi.GPIO as GPIO
class RGB:
def __init__(self, configuration):
self._id = configuration['id']
self._R = configuration['channels']['r']
self._G = configuration['channels']['g']
self._B = configuration['channels']['b']
pins = [
self._R,
... | import time
import RPi.GPIO as GPIO
class RGB:
def __init__(self, configuration):
self._id = configuration['id']
self._R = configuration['channels']['r']
self._G = configuration['channels']['g']
self._B = configuration['channels']['b']
pins = [
self._R,
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.