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 |
|---|---|---|---|---|---|---|---|---|
b1e1e73de9b8281fb641aabe72187800158a0bca | Improve raised exceptions (#27) | nanomsg/nnpy | nnpy/errors.py | nnpy/errors.py | from _nnpy import ffi, lib as nanomsg
class NNError(Exception):
def __init__(self, error_no, *args, **kwargs):
super().__init__(*args, **kwargs)
self.error_no = error_no
def convert(rc, value=None):
if rc < 0:
error_no = nanomsg.nn_errno()
chars = nanomsg.nn_strerror(error_no)
... | from _nnpy import ffi, lib as nanomsg
class NNError(Exception):
pass
def convert(rc, value=None):
if rc < 0:
chars = nanomsg.nn_strerror(nanomsg.nn_errno())
raise NNError(ffi.string(chars))
if callable(value):
return value()
return value
| mit | Python |
f653b392dfb276eb4801e9726dd3c4330bc131b5 | update dev tag version | atria-soft/zeus,atria-soft/zeus | lutin_zeus.py | lutin_zeus.py | #!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
def get_type():
return "LIBRARY"
def get_desc():
return "Zeus ewol micro-service"
def get_licence():
return "APACHE-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ... | #!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
def get_type():
return "LIBRARY"
def get_desc():
return "Zeus ewol micro-service"
def get_licence():
return "APACHE-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return ... | apache-2.0 | Python |
b2e06816af91ff40ec68493098894cfeb5cd60ff | Rewrite markdown extension | svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app | svenv/blog/templatetags/formatting.py | svenv/blog/templatetags/formatting.py | import dateutil.parser
from django import template
from re import sub, findall
from markdown2 import Markdown
register = template.Library()
@register.filter
def datetime(value):
try:
return dateutil.parser.parse(value)
except(AttributeError):
return value
@register.filter
def markdown(valu... | import dateutil.parser
from django import template
from re import sub, findall
import markdown2
register = template.Library()
@register.filter
def datetime(value):
try:
return dateutil.parser.parse(value)
except(AttributeError):
return value
@register.filter
def markdown(value):
value ... | mit | Python |
750c7bef1483c914e195e26a179a3b362fa3f059 | Format event title error message titles in quotation marks | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | pmg/admin/validators.py | pmg/admin/validators.py | from wtforms.validators import AnyOf
from wtforms.compat import string_types, text_type
class BillEventTitleAllowed(object):
"""
Checks that the bill event title is one of the allowed titles when the
event type is "bill-passed".
"""
ALLOWED_TITLES = [
'Bill passed by the National Assembly... | from wtforms.validators import AnyOf
class BillEventTitleAllowed(object):
"""
Checks that the bill event title is one of the allowed titles when the
event type is "bill-passed".
"""
ALLOWED_TITLES = [
'Bill passed by the National Assembly and transmitted to the NCOP for concurrence',
... | apache-2.0 | Python |
fd176b8eae33cac5fa7b2ba4f7a7586d9e6ebf14 | Raise NotImplemented if methods aren't overridden | tmuic/mlat-server,mutability/mlat-server,mutability/mlat-server,tmuic/mlat-server | mlat/connection.py | mlat/connection.py | # -*- mode: python; indent-tabs-mode: nil -*-
class Connection(object):
"""Interface for receiver connections.
A receiver connection is something that can send messages (filter requests,
multilateration results) to a particular receiver. A single connection
may handle only a single receiver, or may m... | # -*- mode: python; indent-tabs-mode: nil -*-
class Connection(object):
"""Interface for receiver connections.
A receiver connection is something that can send messages (filter requests,
multilateration results) to a particular receiver. A single connection
may handle only a single receiver, or may m... | agpl-3.0 | Python |
7e46bad8cfb3e7406876bb5a99b3faa329ffa461 | Document 'create' flag in driver's init_db | kylehogan/haas,henn/haas,meng-sun/hil,henn/hil_sahil,SahilTikale/switchHaaS,apoorvemohan/haas,lokI8/haas,henn/hil,meng-sun/hil,CCI-MOC/haas,kylehogan/hil,apoorvemohan/haas,kylehogan/hil,henn/hil_sahil,henn/hil,SahilTikale/haas | haas/drivers/__init__.py | haas/drivers/__init__.py | """Network switch drivers for the HaaS.
This package provides HaaS drivers for various network switches. The
functions in the top-level module should not be used; they only exist
as a place to document the interface shared by all of the drivers.
Port IDs and network IDs should both be strings. The content of them wi... | """Network switch drivers for the HaaS.
This package provides HaaS drivers for various network switches. The
functions in the top-level module should not be used; they only exist
as a place to document the interface shared by all of the drivers.
Port IDs and network IDs should both be strings. The content of them wi... | apache-2.0 | Python |
db683993228ac76c571c77ed9c9573dd457eb158 | Add testcase for Product | bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics | main/tests.py | main/tests.py | # -*- coding: utf-8 -*-
"""
SynLogistics accounting tests
"""
#
# Copyright (C) by Kristian Vlaardingerbroek <kristian.vlaardingerbroek@gmail.com> 2012
#
# 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 Sof... | agpl-3.0 | Python | |
b74b641b6d7e8f21f9a4286ce893816dbaf44ddc | add get about view method | OKThess/website,OKThess/website,OKThess/website | main/views.py | main/views.py | from django.shortcuts import render
def get_index(request):
return render(request, 'main/index.html')
def get_about(request):
return render(request, 'main/about.html', {
'page_title': 'Σχετικά',
})
| from django.shortcuts import render
def get_index(request):
return render(request, 'main/index.html')
| mit | Python |
7f98a98037f85a5718797683c8c8a488ad0d977b | add comments | bahmanh/Auto-Flight-Check-In | autocheckin/checkmein.py | autocheckin/checkmein.py | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class CheckMeIn(object):
def __init__(self, firstName, lastName, confNum):
self.firstName = firstName
self.lastName = lastName
self.confNum = confNum
#Using PhantomJS instead of Firefox so that thi... | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class CheckMeIn(object):
def __init__(self, firstName, lastName, confNum):
self.firstName = firstName
self.lastName = lastName
self.confNum = confNum
def checkIn(self):
try:
driver ... | mit | Python |
f90c083c313549c810348b6622c90f1874dcfb20 | Update config comment | maxzheng/workspace-tools | src/workspace/config.py | src/workspace/config.py | """
# Default config. Change these in your personal ~/.config/workspace.cfg ::
###########################################################################################################
# Define product groups to take action upon (such as ws develop)
#############################################################... | """
# Default config. Change these in your personal ~/.config/workspace.cfg ::
# Define product groups to take action upon (such as ws develop)
[product_groups]
#group_name = product_checkout1 lib_checkout2
# Settings for checkout command
[checkout]
# Check out SVN repo using git-svn and clone the speci... | mit | Python |
11fa2601e9afc0a20da71bdc5ac762a8a5343301 | remove unused code | googlearchive/cloud-playground,googlearchive/cloud-playground,silverlinings/cloud-playground,silverlinings/cloud-playground,googlearchive/cloud-playground,googlearchive/cloud-playground,silverlinings/cloud-playground | template/collection.py | template/collection.py | """Class representing a code repository."""
import shared
from mimic.__mimic import common
class RepoCollection(object):
"""An abstract base class for accessing a collection of code repositories."""
def __init__(self, repo_collection):
"""Constructor.
Args:
repo_collection: The repo collection e... | """Class representing a code repository."""
import os
import model
import shared
from mimic.__mimic import common
class RepoCollection(object):
"""An abstract base class for accessing a collection of code repositories."""
def __init__(self, repo_collection):
"""Constructor.
Args:
repo_collectio... | apache-2.0 | Python |
6b5b583b454cd36cc6bd07f5b5a5b317026c22db | Add a PSTH plot function | johannesmik/neurons,timqian/neurons | spiketrain.py | spiketrain.py | import numpy as np
def poisson_homogenous(mu, timesteps):
"""
Generate a spiketrain for a single neuron
"""
size = (1, timesteps)
spiketrain = np.random.poisson(lam=mu, size=size)
spiketrain = np.array(spiketrain, dtype=bool)
return spiketrain
def poisson_inhomogenous(mus, timesteps):
... | import numpy as np
def poisson_homogenous(mu, timesteps):
"""
Generate a spiketrain for a single neuron
"""
size = (1, timesteps)
spiketrain = np.random.poisson(lam=mu, size=size)
spiketrain = np.array(spiketrain, dtype=bool)
return spiketrain
def poisson_inhomogenous(mus, timesteps):
... | bsd-2-clause | Python |
feaaf36921286fd372ab5567a8691a1d6244e7d2 | fix issue #42 "no no, no no no no no, there's no limit" and run faster | fgirault/smeuhsocial,amarandon/smeuhsocial,amarandon/smeuhsocial,fgirault/smeuhsocial,amarandon/smeuhsocial,fgirault/smeuhsocial | apps/smeuhoverride/views.py | apps/smeuhoverride/views.py | # Create your views here.
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import User
from django.http import Http404, HttpResponse
from d... | # Create your views here.
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import User
from django.http import Http404, HttpResponse
from d... | mit | Python |
a63930d9c47fcfd9f6f491009d3ecdabd0454de9 | bump version | vmalloc/backslash-python,slash-testing/backslash-python | backslash/__version__.py | backslash/__version__.py | __version__ = "2.19.4"
| __version__ = "2.19.3"
| bsd-3-clause | Python |
8f2d6d2714aa1b60950a2fc355d39297b7f2cdfb | Add support for time-distributed softmax. | daviddiazvico/keras,DeepGnosis/keras,kemaswill/keras,keras-team/keras,relh/keras,keras-team/keras,dolaameng/keras,kuza55/keras,nebw/keras | keras/activations.py | keras/activations.py | from __future__ import absolute_import
from . import backend as K
def softmax(x):
ndim = K.ndim(x)
if ndim == 2:
return K.softmax(x)
elif ndim == 3:
# apply softmax to each timestep
def step(x, states):
return K.softmax(x), []
last_output, outputs, states = K.rn... | from __future__ import absolute_import
from . import backend as K
def softmax(x):
return K.softmax(x)
def softplus(x):
return K.softplus(x)
def relu(x, alpha=0., max_value=None):
return K.relu(x, alpha=alpha, max_value=max_value)
def tanh(x):
return K.tanh(x)
def sigmoid(x):
return K.sigmo... | mit | Python |
0c833808e9c761a98e11ffb4834b8344221db1d5 | Remove lines which deleted and checked out file for substitution | Empiria/matador | matador/commands/deployment/deploy_sql_script.py | matador/commands/deployment/deploy_sql_script.py | #!/usr/bin/env python
import os
import shutil
import subprocess
from matador.session import Session
from .deployment_command import DeploymentCommand
from matador.commands.run_sql_script import run_sql_script
class DeploySqlScript(DeploymentCommand):
def _execute(self):
scriptPath = self.args[0]
... | #!/usr/bin/env python
import os
import shutil
import subprocess
from matador.session import Session
from .deployment_command import DeploymentCommand
from matador.commands.run_sql_script import run_sql_script
class DeploySqlScript(DeploymentCommand):
def _execute(self):
scriptPath = self.args[0]
... | mit | Python |
c1399ab0b6597a25769adcab869d43f25b8c8a50 | Fix to Stable Version | jpace121/pyCalcTension | Lab2.py | Lab2.py | #!/usr/bin/env python
import xlrd as xl
import numpy as np
import matplotlib.pyplot as mpl
class Run(object):
"""Variables and Methods to analyze data from a spreadsheet with times and
positions"""
def __init__(self, numRows):
self.size = numRows
self.time = [None]*self.size
self.position = [None]*self.... | #!/usr/bin/env python
import xlrd as xl
import numpy as np
import matplotlib.pyplot as mpl
class Run(object):
"""Stores variables for each run for easy access.
Allows fake namespace/struct like thing."""
def __init__(self, numRows):
self.size = numRows
self.time = [None]*self.size
self.position = [None]... | bsd-2-clause | Python |
0fb818d1b0c07c5d9c3e4cfb9e5aa1aa6e57cce5 | Check for empty lists | dangoldin/jersy-city-parking-mapper,dangoldin/jersy-city-parking-mapper,dangoldin/jersy-city-parking-mapper,dangoldin/jersey-city-open-data,dangoldin/jersey-city-open-data,dangoldin/jersey-city-open-data | geocode.py | geocode.py | #!/usr/bin/env python
import json
import time
from geopy.geocoders import Nominatim, GoogleV3
from pyhull.convex_hull import ConvexHull
import settings
TIMEOUT_SECONDS = 1
MAX_ATTEMPTS = 5
# geolocator = Nominatim(timeout=TIMEOUT_SECONDS)
geolocator = GoogleV3(timeout=TIMEOUT_SECONDS,api_key=settings.GOOGLE_MAPS_... | #!/usr/bin/env python
import json
import time
from geopy.geocoders import Nominatim, GoogleV3
from pyhull.convex_hull import ConvexHull
import settings
TIMEOUT_SECONDS = 1
MAX_ATTEMPTS = 5
# geolocator = Nominatim(timeout=TIMEOUT_SECONDS)
geolocator = GoogleV3(timeout=TIMEOUT_SECONDS,api_key=settings.GOOGLE_MAPS_... | mit | Python |
eb140dd9788e9dac4c9619e863fe643e42abcdef | Fix for OPAL-796 | chrisspen/django-feeds,operasoftware/django-feeds,chrisspen/django-feeds | djangofeeds/tests/test_feedutil.py | djangofeeds/tests/test_feedutil.py | import unittest2 as unittest
from datetime import datetime
from djangofeeds import feedutil
from djangofeeds.feedutil import date_to_datetime, find_post_content
NOT_ENCODEABLE = ('\xd0\x9e\xd1\x82\xd0\xb2\xd0\xb5\xd1\x82\xd1\x8b '
'\xd0\xbd\xd0\xb0 \xd0\xb2\xd0\xb0\xd1\x88\xd0\xb8 '
... | import unittest2 as unittest
from datetime import datetime
from djangofeeds import feedutil
from djangofeeds.feedutil import date_to_datetime, find_post_content
NOT_ENCODEABLE = ('\xd0\x9e\xd1\x82\xd0\xb2\xd0\xb5\xd1\x82\xd1\x8b '
'\xd0\xbd\xd0\xb0 \xd0\xb2\xd0\xb0\xd1\x88\xd0\xb8 '
... | bsd-2-clause | Python |
059514b3a69004a272f4e2608cc3ba5e3fe1affa | Remove superfluous import. | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | lastscrape/import.py | lastscrape/import.py | #!/usr/bin/python
from datetime import datetime
import getpass
# The md5 module is deprecated since Python 2.5
try:
import hashlib
md5hash = hashlib.md5
except ImportError:
import md5
md5hash = md5.new
from optparse import OptionParser
import time
from urllib import urlencode
from urllib2 import urlopen... | #!/usr/bin/python
from datetime import datetime
import getpass
# The md5 module is deprecated since Python 2.5
try:
import hashlib
md5hash = hashlib.md5
except ImportError:
import md5
md5hash = md5.new
import md5
from optparse import OptionParser
import time
from urllib import urlencode
from urllib2 imp... | agpl-3.0 | Python |
7ff7ce92403d3908758945ef8c02b9e1ca1ba963 | use simplejson instead of cjson (re #7843) | ZeitOnline/zeit.edit,ZeitOnline/zeit.edit,ZeitOnline/zeit.edit | src/zeit/edit/browser/view.py | src/zeit/edit/browser/view.py | # Copyright (c) 2009-2010 gocept gmbh & co. kg
# See also LICENSE.txt
import ZODB.POSException
import simplejson
import logging
import transaction
import zeit.cms.browser.view
import zope.i18n
log = logging.getLogger(__name__)
class Form(object):
def __init__(self, var_name, json=False, default=None):
... | # Copyright (c) 2009-2010 gocept gmbh & co. kg
# See also LICENSE.txt
import ZODB.POSException
import cjson
import logging
import transaction
import zeit.cms.browser.view
import zope.i18n
log = logging.getLogger(__name__)
class Form(object):
def __init__(self, var_name, json=False, default=None):
self... | bsd-3-clause | Python |
5d98760a38c0f7babd22894f30eb154705558177 | add docstrings and add pk parameter to detail views | palmerev/can-i-eat-this,palmerev/can-i-eat-this,palmerev/can-i-eat-this | ciet/api/views.py | ciet/api/views.py | from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.models import Food, DietPlan
from api.serializers import FoodSerializer, DietPlanSerializer
def api_index(request):
return... | from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.models import Food, DietPlan
from api.serializers import FoodSerializer, DietPlanSerializer
def api_index(request):
return... | mit | Python |
2d88efa5b4747fb4d41653bf1a4c7191fdf927fa | add doc | pannal/Subliminal.bundle,pannal/Subliminal.bundle,pannal/Subliminal.bundle | Contents/Libraries/Shared/subzero/modification/processors/re_processor.py | Contents/Libraries/Shared/subzero/modification/processors/re_processor.py | # coding=utf-8
import re
import logging
from subzero.modification.processors import Processor
logger = logging.getLogger(__name__)
class ReProcessor(Processor):
"""
Regex processor
"""
pattern = None
replace_with = None
def __init__(self, pattern, replace_with, name=None):
super(ReP... | # coding=utf-8
import re
import logging
from subzero.modification.processors import Processor
logger = logging.getLogger(__name__)
class ReProcessor(Processor):
"""
Regex processor
"""
pattern = None
replace_with = None
def __init__(self, pattern, replace_with, name=None):
super(ReP... | mit | Python |
9ae6e5854f48502e1250a743eeecd4680692b2d4 | use qos rule type details api def from neutron-lib | openstack/neutron,mahak/neutron,openstack/neutron,noironetworks/neutron,openstack/neutron,mahak/neutron,huntxu/neutron,noironetworks/neutron,huntxu/neutron,mahak/neutron | neutron/extensions/qos_rule_type_details.py | neutron/extensions/qos_rule_type_details.py | # Copyright (c) 2017 OVH SAS
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | # Copyright (c) 2017 OVH SAS
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | apache-2.0 | Python |
05b2874c54658e451841637d534156c2407f0b0a | Remove weird matplot lib defaults thing that did nothing | jollyra/hubot-streak-podium,supermitch/streak-podium,jollyra/hubot-commit-streak,jollyra/hubot-streak-podium,jollyra/hubot-commit-streak,supermitch/streak-podium | streak-podium/render.py | streak-podium/render.py | import matplotlib.pyplot as plt
import numpy as np
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
# Only extract those users & streaks for streaks that are non-zero:
users, streaks = zip(*[(user, streak.get(... | import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
# Only extract those users & streaks for streaks that are non-zero:
users, streaks = zip(*[... | mit | Python |
18ac52cc4b132ec41e0f7576c6689244db2a5b36 | Add ``ui_sortable`` dependency | teixas/js.jquery_ui_multiselect2,teixas/js.jquery_ui_multiselect2 | js/jquery_ui_multiselect2/__init__.py | js/jquery_ui_multiselect2/__init__.py | # -*- coding: utf-8 -*-
from fanstatic import Group
from fanstatic import Library
from fanstatic import Resource
from js.jqueryui import ui_button
from js.jqueryui import ui_droppable
from js.jqueryui import ui_sortable
from js.jqueryui import ui_widget
library = Library('jquery-ui-multiselect2', 'resources')
multi... | # -*- coding: utf-8 -*-
from fanstatic import Group
from fanstatic import Library
from fanstatic import Resource
from js.jqueryui import ui_button
from js.jqueryui import ui_droppable
from js.jqueryui import ui_widget
library = Library('jquery-ui-multiselect2', 'resources')
multiselect2_common_css = Resource(
l... | bsd-3-clause | Python |
a9ea956503acbb8719e0376a4367cf1369fcda85 | Clean up __init__.py a bit and prevent some logging woes | msmakhlouf/streamparse,msmakhlouf/streamparse,msmakhlouf/streamparse,petchat/streamparse,msmakhlouf/streamparse,Parsely/streamparse,eric7j/streamparse,petchat/streamparse,eric7j/streamparse,msmakhlouf/streamparse,petchat/streamparse,petchat/streamparse,hodgesds/streamparse,phanib4u/streamparse,hodgesds/streamparse,croh... | streamparse/__init__.py | streamparse/__init__.py | '''
This package makes it easier to work with Storm and Python.
:organization: Parsely
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from . import (bolt, cmdln, component, contextmanagers, debug, decorators, dsl,
spout, storm)
from .version import __versi... | '''
This package makes it easier to work with Storm and Python.
:organization: Parsely
'''
from __future__ import absolute_import, print_function, unicode_literals
import streamparse.bolt
import streamparse.cmdln
import streamparse.component
import streamparse.contextmanagers
import streamparse.debug
import streampa... | apache-2.0 | Python |
700c9a5056b6c60d2f2a477008df13503d2b0626 | Make ns pipelines picklable | analysiscenter/dataset | batchflow/ns_pipeline.py | batchflow/ns_pipeline.py | """ Namespace pipeline """
import sys
from functools import partial
import numpy as np
from .named_expr import NamedExpression, eval_expr
class NamespacePipeline:
""" Namespace pipeline allows declarative chains of methods from namespaces given """
def __init__(self, pipeline=None, *namespaces):
self... | """ Namespace pipeline """
from functools import partial
import numpy as np
from .named_expr import NamedExpression, eval_expr
class NamespacePipeline:
""" Namespace pipeline allows declarative chains of methods from namespaces given """
def __init__(self, pipeline=None, *namespaces):
self.pipeline =... | apache-2.0 | Python |
62027b8c881db17a40c010ddc3980f10e1eaa8e6 | Fix tests | yceruto/django-ajax,yceruto/django-ajax | tests/example/tests.py | tests/example/tests.py | from __future__ import unicode_literals
from django.test import TestCase
from django.utils import six
from django_ajax.response import JSONResponse
class ResponseTestCase(TestCase):
def test_json_response(self):
data = {'test': True}
response = JSONResponse(data)
self.assertEquals(200, res... | from __future__ import unicode_literals
from django.test import TestCase
from django_ajax.response import JSONResponse
class ResponseTestCase(TestCase):
def test_json_response(self):
data = {'test': True}
response = JSONResponse(data)
self.assertEquals(200, response.status_code)
se... | mit | Python |
9d997ecb56e74820a862bdc93bd2b0c17ebed97f | Improve synchronizer | cboling/xos,opencord/xos,zdw/xos,zdw/xos,open-cloud/xos,cboling/xos,zdw/xos,open-cloud/xos,cboling/xos,open-cloud/xos,cboling/xos,opencord/xos,zdw/xos,cboling/xos,opencord/xos | xos/synchronizers/vpn/steps/sync_vpntenant.py | xos/synchronizers/vpn/steps/sync_vpntenant.py | import os
import sys
from django.db.models import F, Q
from services.vpn.models import VPNService, VPNTenant
from synchronizers.base.SyncInstanceUsingAnsible import \
SyncInstanceUsingAnsible
parentdir = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, parentdir)
class SyncVPNTenant(SyncInstance... | import os
import sys
from django.db.models import F, Q
from services.vpn.models import VPNService, VPNTenant
from synchronizers.base.SyncInstanceUsingAnsible import \
SyncInstanceUsingAnsible
parentdir = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, parentdir)
class SyncVPNTenant(SyncInstance... | apache-2.0 | Python |
c0e87ce5e3830b3313cbee03e862f81f62486eb2 | Use proper numerical formatting | Zaexu/JiyuuBot,Flat/JiyuuBot | modules/youtube.py | modules/youtube.py | def youtube(self, msginfo):
string = msginfo["msg"]
stuff = re.findall("youtu.be/([^\#\?\s]+)", string) + re.findall("youtube.com/watch\?([^\#\?\s]+)", string)
if len(stuff) > 0:
import requests
for match in stuff:
if "v=" in match:
match = re.findall("v=([\w-]+[^... | def youtube(self, msginfo):
string = msginfo["msg"]
stuff = re.findall("youtu.be/([^\#\?\s]+)", string) + re.findall("youtube.com/watch\?([^\#\?\s]+)", string)
if len(stuff) > 0:
import requests
for match in stuff:
if "v=" in match:
match = re.findall("v=([\w-]+[^... | agpl-3.0 | Python |
242f27f943a107bf7dd2a472f08a71a8382f6467 | Use subprocess instead of os.popen | ZenithDK/mopidy,bacontext/mopidy,adamcik/mopidy,kingosticks/mopidy,jcass77/mopidy,jmarsik/mopidy,bacontext/mopidy,mopidy/mopidy,hkariti/mopidy,bencevans/mopidy,ZenithDK/mopidy,dbrgn/mopidy,hkariti/mopidy,SuperStarPL/mopidy,jodal/mopidy,adamcik/mopidy,jcass77/mopidy,jodal/mopidy,vrs01/mopidy,ali/mopidy,diandiankan/mopid... | mopidy/__init__.py | mopidy/__init__.py | import sys
if not (2, 6) <= sys.version_info < (3,):
sys.exit(u'Mopidy requires Python >= 2.6, < 3')
from subprocess import PIPE, Popen
VERSION = (0, 4, 0)
def get_git_version():
process = Popen(['git', 'describe'], stdout=PIPE)
if process.wait() != 0:
raise Exception|('Execution of "git describe... | import os
import sys
if not (2, 6) <= sys.version_info < (3,):
sys.exit(u'Mopidy requires Python >= 2.6, < 3')
VERSION = (0, 4, 0)
def is_in_git_repo():
git_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), '../.git'))
return os.path.exists(git_dir)
def get_git_version():
if not ... | apache-2.0 | Python |
feb0b3f5f382fb0fee28c8f6e7f7dc364c026a05 | Add logging marker | mopidy/mopidy,bacontext/mopidy,glogiotatidis/mopidy,adamcik/mopidy,jodal/mopidy,swak/mopidy,pacificIT/mopidy,liamw9534/mopidy,vrs01/mopidy,hkariti/mopidy,bencevans/mopidy,pacificIT/mopidy,glogiotatidis/mopidy,ZenithDK/mopidy,woutervanwijk/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,priestd09/mopidy,ali/mopidy,rawdlite... | mopidy/__main__.py | mopidy/__main__.py | import asyncore
import logging
import logging.handlers
import multiprocessing
import optparse
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from mopidy import get_version, settings, SettingsError
from mopidy.process import CoreProcess
from mopidy.utils im... | import asyncore
import logging
import logging.handlers
import multiprocessing
import optparse
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from mopidy import get_version, settings, SettingsError
from mopidy.process import CoreProcess
from mopidy.utils im... | apache-2.0 | Python |
1566ded8651961e3c27957dd8456c4f47f01fecd | support rendering of images, better unsupported type msg | bepasty/bepasty-server,makefu/bepasty-server,makefu/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,makefu/bepasty-server | bepasty/views/display.py | bepasty/views/display.py | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, render_template, Markup, request, url_for
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from pygments import highlight
from pygments.lexers... | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
import errno
from flask import current_app, render_template, Markup, request
from flask.views import MethodView
from werkzeug.exceptions import NotFound
from pygments import highlight
from pygments.lexers import g... | bsd-2-clause | Python |
32148f2a4d876712d39b3ae34fb618758fb3a463 | change allowed_hosts | dresl/django_choice_and_question,dresl/django_choice_and_question | mysite/settings.py | mysite/settings.py | """
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | """
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | apache-2.0 | Python |
d66ff002400b90e322aa7f7cd8d0541786424484 | Revert update version | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/version.py | mythril/version.py | # This file is suitable for sourcing inside POSIX shell, e.g. bash as
# well as for importing into Python
VERSION = "v0.19.8" # NOQA
| # This file is suitable for sourcing inside POSIX shell, e.g. bash as
# well as for importing into Python
VERSION = "v0.19.9" # NOQA
| mit | Python |
d63de6cc108172b01c688916772dc2234b791329 | fix ImportError: No module named 'hhtpywrapper.emd' | YihaoSu/HHTpywrapper,HHTpy/HHTpywrapper,YihaoSu/HHTpywrapper | hhtpywrapper/__init__.py | hhtpywrapper/__init__.py | import hhtpywrapper.eemd
| import hhtpywrapper.emd
| mit | Python |
74fa3e6b9b83f18da278e804e5b480e5511d6aef | remove unused defer property | lunixbochs/SublimeXiki,lunixbochs/SublimeXiki | edit.py | edit.py | # edit.py
# buffer editing for both ST2 and ST3 that "just works"
import sublime
import sublime_plugin
try:
sublime.edit_storage
except AttributeError:
sublime.edit_storage = {}
class EditStep:
def __init__(self, cmd, *args):
self.cmd = cmd
self.args = args
def run(self, view, edit):... | # edit.py
# buffer editing for both ST2 and ST3 that "just works"
import sublime
import sublime_plugin
from collections import defaultdict
try:
sublime.edit_storage
except AttributeError:
sublime.edit_storage = {}
class EditStep:
def __init__(self, cmd, *args):
self.cmd = cmd
self.args = ... | mit | Python |
a4c31c838b84dad2bcc05bfa2579c0299bf37ddb | Use dates as keys/ids. Iterative (traversing) logic for deleting items based on date. | 0ortmann/wg-tools,0ortmann/wg-tools,0ortmann/wg-tools,0ortmann/wg-tools | py-backend/server.py | py-backend/server.py | #!/usr/bin/python
from flask import Flask, request, json, Response
import deptCalculator
from mongoengine import *
from datetime import datetime, timedelta
import copy
'''
Define some mongo stuff, very rudimentary storing of posted data.
'''
connect('localhost:27017')
class Post(Document):
date_modified = DateT... | #!/usr/bin/python
from flask import Flask, request, json, make_response
import deptCalculator
from mongoengine import *
import datetime
'''
Define some mongo stuff, very rudimentary storing of posted data.
'''
connect('localhost:27017')
class Post(Document):
date_modified = DateTimeField(default=datetime.dateti... | mit | Python |
e391994609b880441a03a40cde3f4e368a65941d | add undirected graph | vangj/py-bbn,vangj/py-bbn | pybbn/graph/graph.py | pybbn/graph/graph.py | from pybbn.graph.edge import EdgeType
class Graph:
def __init__(self):
self.nodes = dict()
self.edges = dict()
self.map = dict()
def get_neighbors(self, id):
set1 = set([x for x in self.map[id]])
set2 = set([x for x in self.map if id in self.map[x]])
return set... | from pybbn.graph.edge import EdgeType
class Graph:
def __init__(self):
self.nodes = dict()
self.edges = dict()
self.map = dict()
def get_neighbors(self, id):
set1 = set([x for x in self.map[id]])
set2 = set([x for x in self.map if id in self.map[x]])
return set... | apache-2.0 | Python |
35e0dc7b8db667bacc498f93c26899d4f173676e | Bump version 2.1.3 | arteria/django-hijack-admin,arteria/django-hijack-admin,arteria/django-hijack-admin | hijack_admin/__init__.py | hijack_admin/__init__.py | # -*- coding: utf-8 -*-
__version__ = '2.1.3' # pragma: no cover
default_app_config = 'hijack_admin.apps.HijackAdminConfig'
| # -*- coding: utf-8 -*-
__version__ = '2.1.2' # pragma: no cover
default_app_config = 'hijack_admin.apps.HijackAdminConfig'
| mit | Python |
fa2f871d19fd8f8e25a8b784d09244f87ab2b7f9 | delete old PYTHONPATH hack (#807) | Akuli/porcupine,Akuli/porcupine,Akuli/editor,Akuli/porcupine | porcupine/plugins/run/windows_run.py | porcupine/plugins/run/windows_run.py | # this is a python script because handling Ctrl+C interrupts in batch
# scripts seems to be impossible
#
# This should always run in the same python that Porcupine uses.
from __future__ import annotations
import subprocess
import sys
import colorama
colorama.init()
prog, directory, command = sys.argv
print(colorama... | # this is a python script because handling Ctrl+C interrupts in batch
# scripts seems to be impossible
#
# This should always run in the same python that Porcupine uses.
from __future__ import annotations
import os
import subprocess
import sys
import colorama
colorama.init()
# When installed from the exe installer,... | mit | Python |
8650c114c6da0f26668f2452bdb48908a033bc17 | Update to 2.0.0 to to V5 API | arraylabs/pymyq | pymyq/__version__.py | pymyq/__version__.py | """Define a version constant."""
__version__ = '2.0.0'
| """Define a version constant."""
__version__ = '1.2.1'
| mit | Python |
da238e29efcf8ab4cf68d29d87869031d74d761a | Make sure the user does not prepend plugin_name with pytest | pytest-dev/cookiecutter-pytest-plugin | hooks/pre_gen_project.py | hooks/pre_gen_project.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import sys
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('pre_gen_project')
PLUGIN_REGEX = r'^(?!pytest)[_a-zA-Z][_a-zA-Z0-9]+$'
plugin_name = '{{cookiecutter.plugin_name}}'
if not re.match(PLUGIN_REGEX, plugin_name):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import sys
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('pre_gen_project')
PLUGIN_REGEX = r'^[_a-zA-Z][_a-zA-Z0-9]+$'
plugin_name = '{{cookiecutter.plugin_name}}'
if not re.match(PLUGIN_REGEX, plugin_name):
logger.err... | mit | Python |
e1e6d46c7af4c6eb36a22cd3b5e88797267066e0 | remove dead code | csparpa/pyowm,csparpa/pyowm | pyowm/tiles/enums.py | pyowm/tiles/enums.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class MapLayerEnum:
"""
Allowed map layer values for tiles retrieval
"""
PRECIPITATION = 'precipitation_new'
WIND = 'wind_new'
TEMPERATURE = 'temp_new'
PRESSURE = 'pressure_new'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
class MapLayerEnum:
"""
Allowed map layer values for tiles retrieval
"""
PRECIPITATION = 'precipitation_new'
WIND = 'wind_new'
TEMPERATURE = 'temp_new'
PRESSURE = 'pressure_new'
@classmethod
def items(cls):
"""
All val... | mit | Python |
56facba626cfa770d27a9b7d7b4b45c07b32c735 | Disable pylint rule causing failure with fastjsonschema 2.15.0 (#5767) | QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py | qiskit/qobj/utils.py | qiskit/qobj/utils.py | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | apache-2.0 | Python |
0ad2ae45841d83be0c9957417f1b177d203ededa | Add fix to RNDF id mapper | ekumenlabs/terminus,ekumenlabs/terminus | terminus/generators/rndf_id_mapper.py | terminus/generators/rndf_id_mapper.py | from city_visitor import CityVisitor
class RNDFIdMapper(CityVisitor):
"""Simple city visitor that generates the RNDF ids for segments,
lanes and waypoints. Ids and objects are stored in two dictionaries,
so we can later perform lookups in either way"""
# Note: For the time being we treat streets and ... | from city_visitor import CityVisitor
class RNDFIdMapper(CityVisitor):
"""Simple city visitor that generates the RNDF ids for segments,
lanes and waypoints. Ids and objects are stored in two dictionaries,
so we can later perform lookups in either way"""
# Note: For the time being we treat streets and ... | apache-2.0 | Python |
88b46d922f1f9e6f036a7e08403725ff1be5bc5d | Add Performance Factory | barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api | project/apps/convention/factories.py | project/apps/convention/factories.py | import factory
from .models import (
Contest,
Contestant,
Performance,
)
class ContestFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Contest
class ContestantFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Contestant
class PerformanceFactory(factory.django.DjangoModelFacto... | import factory
from django.utils.text import slugify
from .models import (
Contest,
Contestant,
# Performance,
)
class ContestFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Contest
class ContestantFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Contestant
slug = factor... | bsd-2-clause | Python |
247e39ab3628431f6643aa62f051552e94b22f91 | use with to ensure closure | mkneierV/kaggle_avazu_benchmark | lib/preprocessing.py | lib/preprocessing.py | from csv import DictReader
features = ['hour',
'banner_pos',
'site_id',
'site_domain',
'site_category',
'app_id',
'app_domain',
'app_category',
'device_id',
'device_ip',
'device_model',
... | from csv import DictReader
features = ['hour',
'banner_pos',
'site_id',
'site_domain',
'site_category',
'app_id',
'app_domain',
'app_category',
'device_id',
'device_ip',
'device_model',
... | apache-2.0 | Python |
58f8a72dc03bb571eb3da14052bb6ab871ecbd1c | update preprocessing.py | yasfmy/chainer_attention_model | lib/preprocessing.py | lib/preprocessing.py | from chainer import functions as F
from wrapper import xp
from config import START_TOKEN, END_TOKEN, IGNORE_LABEL
def gen_lines(filename):
with open(filename) as f:
for line in f:
yield line.split()
def line2batch(lines, vocab, batch_size):
batch = []
wtoi = vocab.wtoi
for line in... | from itertools import chain
import io
from chainer import Variable as V
from wrapper import xp
from config import START_TOKEN, END_TOKEN
def gen_lines(filename):
with open(filename) as f:
for line in f:
yield line.split()
def line2batch(lines, vocab, batch_size):
batch = []
wtoi = vo... | mit | Python |
b6f7d51cd73097fc0a1ebe409d7760ecda9df773 | make ints for high and low | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | htdocs/request/maxcsv.py | htdocs/request/maxcsv.py | #!/usr/bin/env python
"""Provide some CSV Files
first four columns need to be
ID,Station,Latitude,Longitude
"""
import cgi
import datetime
import sys
import psycopg2
from pandas.io.sql import read_sql
#>> * Road condition dots
#>> * DOT plows
#>> * RWIS sensor data
#>> * River gauges
#... | #!/usr/bin/env python
"""Provide some CSV Files
first four columns need to be
ID,Station,Latitude,Longitude
"""
import cgi
import datetime
import sys
import psycopg2
from pandas.io.sql import read_sql
#>> * Road condition dots
#>> * DOT plows
#>> * RWIS sensor data
#>> * River gauges
#... | mit | Python |
15b3af937da199446fa6856d68e9d7ee0693700b | Change lang["lang"] value | jyri78/PyUnitConverter | lang/en.py | lang/en.py | #! /usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
lang = {
"lang": "english", # should be in english
"flPoint_comma": False, # floating point symbol is `,` instead `.`
"translator": "Jüri Kormik"
}
messages = {
"program.ext": [".json", ".pickle"],
"program.title": "Simp... | #! /usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
lang = {
"lang": "en", # same as filename
"flPoint_comma": False, # floating point symbol is `,` instead `.`
"translator": "Jüri Kormik"
}
messages = {
"program.ext": [".json", ".pickle"],
"program.title": "Simple Unit C... | mit | Python |
091891abcb49b97984d8b96605451b0d4937bc78 | Change to radians. | bm5w/lat_lng | lat_lng.py | lat_lng.py | from math import atan, tan, radians
def lat_lng(lat, lng):
"""
Return corrected lat/lng.
Lat: -90 to 90
Lng: -180 to 180
"""
# lat
# if lat > 180: # reduce to value less than 180
# lat = lat - (lat//180)*180
# if lat < -180: # increase to value greater than -180
# ... | from math import atan, tan
def lat_lng(lat, lng):
"""
Return corrected lat/lng.
Lat: -90 to 90
Lng: -180 to 180
"""
# lat
# if lat > 180: # reduce to value less than 180
# lat = lat - (lat//180)*180
# if lat < -180: # increase to value greater than -180
# lat = lat... | mit | Python |
d44f03d24f9e87516ab9813f21155641baf29dda | update RSS | saraivaufc/jornalEletronico,saraivaufc/jornalEletronico,saraivaufc/jornalEletronico,saraivaufc/jornalEletronico,saraivaufc/jornalEletronico | newspaper/feeds.py | newspaper/feeds.py | from django.contrib.syndication.views import Feed
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from models import News
class NewsLatests(Feed):
title = _('Latest News Published in The UFC Times')
link = '/newspaper/'
description = _("The UFC is reported here!")
... | from django.contrib.syndication.views import Feed
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from models import News
class NewsLatests(Feed):
title = _('Latest News Published in The UFC Times')
link = '/newspaper/'
description = _("The UFC is reported here!")
... | mit | Python |
5fae9252041e24a6b8f8971802a4855aa4a0eeef | add default values in config_parser | yngcan/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor | lib/config_parser.py | lib/config_parser.py | import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': True,
'consolidate': True,
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml',
'years': [2013],
'downloaddir' : 'tmp'}
def extract_process_options(handler):
... | import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': True,
'consolidate': True,
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml'}
def extract_process_options(handler):
"""
Extracts the high level options from the [process] sec... | bsd-2-clause | Python |
1a903d980b48ad988d7ed4adcafbcdda50a21d45 | add documentation for factory functions | keurfonluu/StochOPy | stochopy/factory/benchmark.py | stochopy/factory/benchmark.py | import numpy
__all__ = [
"ackley",
"griewank",
"quartic",
"rastrigin",
"rosenbrock",
"sphere",
"styblinski_tang",
]
def ackley(x):
"""
The Ackley function.
Parameters
----------
x : array_like
1-D array of points at which the Ackley function is to be computed.... | import numpy
__all__ = [
"ackley",
"griewank",
"quartic",
"rastrigin",
"rosenbrock",
"sphere",
"styblinski_tang",
]
def ackley(x):
x = numpy.asarray(x)
ndim = x.size
e = 2.7182818284590451
sum1 = numpy.sqrt(1.0 / ndim * numpy.square(x).sum())
sum2 = 1.0 / ndim * numpy.... | mit | Python |
96a7bd0b1e2b0db7b468d0afb08a87badff49220 | fix error type | DasAllFolks/PyAlgo | heap.py | heap.py | # -*- coding: utf-8 -*-
class Heap(object):
"""Implements a heap data structure in Python.
The underlying data structure used to hold the data is a list.
"""
__heap = []
def __init__(self, initial=None):
"""Creates a new heap.
Args:
initial: (Optional): A continguous list containing the da... | # -*- coding: utf-8 -*-
class Heap(object):
"""Implements a heap data structure in Python.
The underlying data structure used to hold the data is a list.
"""
__heap = []
def __init__(self, initial=None):
"""Creates a new heap.
Args:
initial: (Optional): A continguous list containing the da... | mit | Python |
8244c811d294f1f5b75d9ad1d9eec4217aed8882 | Remove the upper bound constraint on tensorflow_datasets dependency. | tensorflow/cloud,tensorflow/cloud | src/python/dependencies.py | src/python/dependencies.py | # Lint as: python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | # Lint as: python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 | Python |
1f581c948bdeb50789076127e1e337989c4ce5fb | update internal release version num | niteoweb/libcloud,niteoweb/libcloud,niteoweb/libcloud | libcloud/__init__.py | libcloud/__init__.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python |
94a71979bfc61d9c23e4b182439205c2f92cde81 | Fix config BUG | noahziheng/freeiot | libfreeiot/config.py | libfreeiot/config.py | """
Default Configuration for Flask Config
"""
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv(usecwd=True), override=True)
class Config:
"""
Config base class
"""
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
MONGO_HOST = os.environ.get(... | """
Default Configuration for Flask Config
"""
import os
class Config:
"""
Config base class
"""
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
MONGO_HOST = os.environ.get('MONGO_HOST') or 'localhost'
MONGO_PORT = int(os.environ.get('MONGO_PORT') or 27017)
MONGO... | mit | Python |
16104788f9d518d648f1f8729d67f2829eae9354 | improve test | dankilman/clue,dankilman/clue | clue/tests/test_install.py | clue/tests/test_install.py | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | apache-2.0 | Python |
5ac7c07277ef1c7e714336e1b96571cdfea15a13 | Remove unnecessary import of logging | vincent-octo/ktbs_bench_manager,vincent-octo/ktbs_bench_manager | ktbs_bench_manager/benchable_graph.py | ktbs_bench_manager/benchable_graph.py | from rdflib import Graph
class BenchableGraph(object):
"""
Provides a convenient way to use a graph for benchmarks.
"""
def __init__(self, store, graph_id, store_config, graph_create=False):
"""
:param str store: Type of store to use.
:param str graph_id: The graph identifier.... | import logging
from rdflib import Graph
class BenchableGraph(object):
"""
Provides a convenient way to use a graph for benchmarks.
"""
def __init__(self, store, graph_id, store_config, graph_create=False):
"""
:param str store: Type of store to use.
:param str graph_id: The g... | mit | Python |
94fcdfc3a3960470d5e14a151c4324cef58ee932 | Enhance docs | python/importlib_metadata | importlib_metadata/__init__.py | importlib_metadata/__init__.py | import os
import sys
import glob
import email
import itertools
import contextlib
class Distribution:
"""
A Python Distribution package.
"""
def __init__(self, path):
"""
Construct a distribution from a path to the metadata dir.
"""
self.path = path
@classmethod
... | import os
import sys
import glob
import email
import itertools
import contextlib
class Distribution:
def __init__(self, path):
"""
Construct a distribution from a path to the metadata dir
"""
self.path = path
@classmethod
def for_name(cls, name, path=sys.path):
glo... | apache-2.0 | Python |
a7547b3c6f9196fe07ac19cbd2410bcb59a04ba6 | add missing formatting template | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/student/clone.py | cs251tk/student/clone.py | import logging
from os import path
from cs251tk.common import run
def clone_student(student, baseurl):
if not path.exists(student):
clone_url('{}/{}.git'.format(baseurl, student))
def clone_url(url, into=None):
if into:
logging.info('cloning {} into {}'.format(url, into))
_, output, ... | import logging
from os import path
from cs251tk.common import run
def clone_student(student, baseurl):
if not path.exists(student):
clone_url('{}/{}.git'.format(baseurl, student))
def clone_url(url, into=None):
if into:
logging.info('cloning {} into'.format(url, into))
_, output, _ =... | mit | Python |
f20a93620008ac32be197caa0ec616233c092f37 | clean up | ndawe/rootpy,rootpy/rootpy,kreczko/rootpy,ndawe/rootpy,kreczko/rootpy,rootpy/rootpy,kreczko/rootpy,ndawe/rootpy,rootpy/rootpy | rootpy/registry.py | rootpy/registry.py | import warnings
TYPES = {}
class register(object):
def __init__(self, names=None, demote=None, builtin=False):
self.names = names
if names is not None:
if type(names) not in (list, tuple):
raise TypeError("names must be a list or tuple")
self.demote = demote... | import warnings
TYPES = {}
class register(object):
def __init__(self, names=None, demote=None, builtin=False):
self.names = names
if names is not None:
if type(names) not in (list, tuple):
raise TypeError("names must be a list or tuple")
self.demote = demote
... | bsd-3-clause | Python |
63c3cd258404d864e70a2c09f04991fbb60e9f0c | upgrade to delete warnings with strings in urlpatterns. | Fenykepy/phiroom,Fenykepy/phiroom | src/api/phiroom/urls.py | src/api/phiroom/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.contrib import admin
from rest_framework_jwt.views import refresh_jwt_token, obtain_jwt_token, verify_jwt_token... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.contrib import admin
from phiroom.views import api_root
urlpatterns = patterns('',
## django admin interf... | agpl-3.0 | Python |
0e88ea0eb6b2db0c967b73057deda58101e143ce | Fix invalid attribute access | nblock/feeds,Lukas0907/feeds,Lukas0907/feeds,nblock/feeds | feeds/spiders/ak_ciando_com.py | feeds/spiders/ak_ciando_com.py | import scrapy
from feeds.loaders import FeedEntryItemLoader
from feeds.spiders import FeedsSpider
class AkCiandoComSpider(FeedsSpider):
name = "ak.ciando.com"
start_urls = [
"https://ak.ciando.com/shop/index.cfm?fuseaction=cat_overview&cat_ID=0"
"&cat_nav=0&more_new=1&rows=100&intStartRow=1"
... | import scrapy
from feeds.loaders import FeedEntryItemLoader
from feeds.spiders import FeedsSpider
class AkCiandoComSpider(FeedsSpider):
name = "ak.ciando.com"
start_urls = [
"https://ak.ciando.com/shop/index.cfm?fuseaction=cat_overview&cat_ID=0"
"&cat_nav=0&more_new=1&rows=100&intStartRow=1"
... | agpl-3.0 | Python |
dfc5b632e5b37977325683aaca1d78cf26e5ef77 | Fix wsgi.py for deployment | akatsoulas/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator,akatsoulas/mozmoderator,akatsoulas/mozmoderator,johngian/mozmoderator | moderator/wsgi.py | moderator/wsgi.py | """
WSGI config for moderator project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | """
WSGI config for moderator project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | agpl-3.0 | Python |
260ba7cb52c5fb7be6486a42975843b4cf7cc2ba | Add function for ROC plot | freedomofpress/FingerprintSecureDrop,freedomofpress/FingerprintSecureDrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop | fpsd/evaluation.py | fpsd/evaluation.py | def get_feature_importances(model):
try:
return model.feature_importances_
except:
pass
try:
# Must be 1D for feature importance plot
if len(model.coef_) <= 1:
return model.coef_[0]
else:
return model.coef_
except:
pass
return ... | def get_feature_importances(model):
try:
return model.feature_importances_
except:
pass
try:
# Must be 1D for feature importance plot
if len(model.coef_) <= 1:
return model.coef_[0]
else:
return model.coef_
except:
pass
return ... | agpl-3.0 | Python |
5cdc5755b1a687c9b34bfd575163ac367816f12a | Fix extend artifact name migration script. | dropbox/changes,dropbox/changes,dropbox/changes,dropbox/changes | migrations/versions/3961ccb5d884_increase_artifact_name_length.py | migrations/versions/3961ccb5d884_increase_artifact_name_length.py | """increase artifact name length
Revision ID: 3961ccb5d884
Revises: 1b229c83511d
Create Date: 2015-11-05 15:34:28.189700
"""
# revision identifiers, used by Alembic.
revision = '3961ccb5d884'
down_revision = '1b229c83511d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('artifact... | """increase artifact name length
Revision ID: 3961ccb5d884
Revises: 1b229c83511d
Create Date: 2015-11-05 15:34:28.189700
"""
# revision identifiers, used by Alembic.
revision = '3961ccb5d884'
down_revision = '1b229c83511d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('artifact... | apache-2.0 | Python |
a1b5e733ed90199c43bfbbae68fe8193f430dab4 | bump v1.7.0 | sqlboy/fileseq | src/fileseq/__version__.py | src/fileseq/__version__.py | __version__ = '1.7.0'
| __version__ = '1.6.3'
| mit | Python |
d5336e3389c4e33d7b37aa7756006fa19018d6f2 | Make interactions new style objects. | Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents | enactiveagents/model/interaction/interaction.py | enactiveagents/model/interaction/interaction.py | """
Module to hold interaction classes.
"""
import abc
class Interaction(object):
def __init__(self, name):
self.name = name
def get_name(self):
"""
Get the name of this interaction.
:return: The name of this interaction.
"""
return self.name
@abc.abstract... | """
Module to hold interaction classes.
"""
class Interaction:
def __init__(self, name):
self.name = name
def get_name(self):
"""
Get the name of this interaction.
:return: The name of this interaction.
"""
return self.name
def unwrap(self):
raise N... | mit | Python |
1d293053a38ddba4dfb6647c638a1b9780d9d3c3 | Add generic security group exception | gogoair/foremast,gogoair/foremast | src/foremast/exceptions.py | src/foremast/exceptions.py | """Spinnaker related custom exceptions."""
class SpinnakerError(Exception):
"""Spinnaker related error."""
pass
class SpinnakerAppNotFound(SpinnakerError):
"""Spinnaker app not found error."""
pass
class SpinnakerApplicationListError(SpinnakerError):
"""Spinnaker application list error."""
... | """Spinnaker related custom exceptions."""
class SpinnakerError(Exception):
"""Spinnaker related error."""
pass
class SpinnakerAppNotFound(SpinnakerError):
"""Spinnaker app not found error."""
pass
class SpinnakerApplicationListError(SpinnakerError):
"""Spinnaker application list error."""
... | apache-2.0 | Python |
a09646831efe9a8646dce79e3dceea4ade2c207d | Apply requested changes | mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges | challenge_9/python/alexbotello/src/square.py | challenge_9/python/alexbotello/src/square.py | def square_soft(input_list):
"""
Returns a list with all values squared and sorted
"""
squared = []
# Separate negative and positive values
# Reverse the negative array to preserve order
# ex: [-3, -2, -1] -> [-1, -2, -3] -> [1, 4, 9]
neg = [x**2 for x in input_list if x < 0]
pos = ... | def square_soft(input_list):
"""
Returns a list with all values squared and sorted
"""
squared = []
# Separate negative and positive values
# Reverse the negative array to preserve order
# ex: [-3, -2, -1] -> [-1, -2, -3] -> [1, 4, 9]
neg = [x**2 for x in input_list if x < 0]
pos =... | mit | Python |
d015f0ad98517edea271058fec6cb64566aecc72 | Add TODO for periodogram. | cournape/talkbox,cournape/talkbox | scikits/talkbox/spectral/basic.py | scikits/talkbox/spectral/basic.py | import numpy as np
from scipy.fftpack import fft, ifft
def periodogram(x, nfft=256):
"""Compute the periodogram of the given signal, with the given fft size.
Parameters
----------
x: array-like
input signal
nfft: int
size of the fft to compute the periodogram
Notes
-----
... | import numpy as np
from scipy.fftpack import fft, ifft
def periodogram(x, nfft=256):
"""Compute the periodogram of the given signal, with the given fft size.
Parameters
----------
x: array-like
input signal
nfft: int
size of the fft to compute the periodogram
Notes
-----
... | mit | Python |
ebe66d1a842a936caedf697c16efe2d4e557b425 | add test for FlowData.write_fcs | whitews/FlowIO | flowio/tests/flowdata_tests.py | flowio/tests/flowdata_tests.py | import unittest
import os
import io
from flowio import FlowData
class FlowDataTestCase(unittest.TestCase):
def setUp(self):
self.flow_data = FlowData('examples/fcs_files/3FITC_4PE_004.fcs')
self.flow_data_spill = FlowData('examples/fcs_files/100715.fcs')
def test_get_points(self):
... | import unittest
import io
from flowio import FlowData
class FlowDataTestCase(unittest.TestCase):
def setUp(self):
self.flow_data = FlowData('examples/fcs_files/3FITC_4PE_004.fcs')
def test_get_points(self):
self.assertEqual(
len(self.flow_data.events) / self.flow_data.chan... | bsd-3-clause | Python |
c4884a44283855cf32b967721644b5113f00377d | Add __virtual__ function to new apt state module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/apt.py | salt/states/apt.py | # Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def __virtual__():
'''
Only work on apt-based platforms with pkg.get_selections
'''
return 'apt' if 'pkg.get_selections' in __salt__ else False
def held(name):
'''
Set package in 'hol... | # Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def held(name):
'''
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
'''
ret = {'name': name, 'changes': {}, 'result': False... | apache-2.0 | Python |
f0c7d50fc80017a4e203665fb38303194768d3e5 | add note about passing lists to functions | nakednamor/naked-python | samples/methods.py | samples/methods.py | # methods are created using the def keyword and brackets
def first_method ():
print("I'm the first method")
# methods are called as expected
first_method()
# methods can have arguments
def parameter_method(param1, param2, param3):
print("passed param1: " + param1)
print("passed param2: " + param2)
pri... | # methods are created using the def keyword and brackets
def first_method ():
print("I'm the first method")
# methods are called as expected
first_method()
# methods can have arguments
def parameter_method(param1, param2, param3):
print("passed param1: " + param1)
print("passed param2: " + param2)
pri... | mit | Python |
e970a8b9b21b70c5348ab7b98efe814341d94f3b | Fix unicode error during the board creation | Lujeni/matterllo,Lujeni/matterllo,Lujeni/matterllo,Lujeni/matterllo | matterllo/core/views/board.py | matterllo/core/views/board.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from trello import T... | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from trello import TrelloClient
from matter... | mit | Python |
31dab2ab0e094f2df74f8b386bd5354989579f25 | Update __init__.py | breznak/nupic,breznak/nupic,breznak/nupic | nupic/__init__.py | nupic/__init__.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python |
b8a2c9477020d7c7b3a654918dc9a9d4ba0d117a | Use raw string for regex | messente/messente-python | messente/api/sms/api/utils.py | messente/api/sms/api/utils.py | # -*- coding: utf-8 -*-
# Copyright 2016 Messente Communications OÜ
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | # -*- coding: utf-8 -*-
# Copyright 2016 Messente Communications OÜ
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 | Python |
9bd5c31fde43fc1f4d6ea2eb39da4b5d1bb66a9e | fix image resizing | opmuse/opmuse,opmuse/opmuse,opmuse/opmuse,opmuse/opmuse | opmuse/image.py | opmuse/image.py | import subprocess
class Image:
FNULL = open('/dev/null', 'w')
def resize(self, source, dest, width, height = None):
if height is None:
height = width
process = subprocess.Popen([
'identify',
'-format',
'%w %h,',
source
], sh... | import subprocess
class Image:
FNULL = open('/dev/null', 'w')
def resize(self, source, dest, width, height = None):
if height is None:
height = width
process = subprocess.Popen([
'identify',
'-format',
'%w %h,',
source
], sh... | agpl-3.0 | Python |
4d199de0cad3ba88ed287c5bbae4857308c3ed76 | Set updating true on software install start | virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool | virtool/api/software.py | virtool/api/software.py | import aiojobs.aiohttp
import virtool.db.hmm
import virtool.db.processes
import virtool.db.software
import virtool.db.status
import virtool.db.utils
import virtool.github
import virtool.http.routes
import virtool.software
import virtool.utils
from virtool.api.utils import json_response, not_found
routes = virtool.htt... | import aiojobs.aiohttp
import virtool.db.hmm
import virtool.db.processes
import virtool.db.software
import virtool.db.status
import virtool.db.utils
import virtool.github
import virtool.http.routes
import virtool.software
import virtool.utils
from virtool.api.utils import json_response, not_found
routes = virtool.htt... | mit | Python |
95d056a7c8c30cfd0dd179c4f450e59217998c63 | remove dependency from south | Andertaker/django-vkontakte-api,ramusus/django-vkontakte-api | vkontakte_api/fields.py | vkontakte_api/fields.py | # -*- coding: utf-8 -*-
from django.db import models
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from annoying.fields import JSONField
from picklefield.fields import PickledObjectField
import re
class CharRangeLengthField(models.CharField):
'''
Char field with max... | # -*- coding: utf-8 -*-
from django.db import models
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from annoying.fields import JSONField
from picklefield.fields import PickledObjectField
from south.modelsinspector import add_introspection_rules
import re
class CharRangeLeng... | bsd-3-clause | Python |
521f74ee8452763917d09179d663816a48da37e9 | Allow guntest to take an adjustable period | IEEERobotics/bot,deepakiam/bot,deepakiam/bot,IEEERobotics/bot,deepakiam/bot,IEEERobotics/bot | scripts/guntest.py | scripts/guntest.py | #!/usr/bin/env python
import os, sys
from pprint import pprint
import pyDMCC
from time import sleep, time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('power', type=int)
parser.add_argument('-l', '--left', action='store_true', default=False)
parser.add_argument('-r', '--right', action='store... | #!/usr/bin/env python
import os, sys
from pprint import pprint
import pyDMCC
from time import sleep, time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('power', type=int)
parser.add_argument('-l', '--left', action='store_true', default=False)
parser.add_argument('-r', '--right', action='store... | bsd-2-clause | Python |
cdc3c75607b50189eb1e741617baa300daef6a3c | Add operating system check to install script | kolanos/pypanel,kolanos/pypanel,kolanos/pypanel | scripts/install.py | scripts/install.py | #!/usr/bin/env python
from __future__ import with_statement
from fabric.api import *
from fabric.colors import green, red, white, yellow
from fabric.network import prompt_for_password
def main():
"""Installation main menu"""
local('clear')
print("Welcome to the %s installation!\n" % white("PyPanel", True)... | #!/usr/bin/env python
from fabric.api import *
from fabric.colors import white, red
from fabric.network import prompt_for_password
def main():
"""Installation main menu"""
local('clear')
print "Welcome to the %s installation!\n" % white("PyPanel", True)
print "%s Ensure that your system is a clean ins... | mit | Python |
223f248a1d1791b1a098876317905f4930330487 | Comment about the directory structure | django-salesforce/django-salesforce,chromakey/django-salesforce,django-salesforce/django-salesforce,philchristensen/django-salesforce,chromakey/django-salesforce,philchristensen/django-salesforce,chromakey/django-salesforce,hynekcer/django-salesforce,philchristensen/django-salesforce,hynekcer/django-salesforce,hynekcer... | salesforce/backend/__init__.py | salesforce/backend/__init__.py | # django-salesforce
#
# by Phil Christensen
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
"""
Database backend for the Salesforce API.
No code in this directory is used with standard databases, even if a standard
database is used for running some application tests ... | # django-salesforce
#
# by Phil Christensen
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
"""
Database backend for the Salesforce API.
"""
import socket
from django.conf import settings
import logging
log = logging.getLogger(__name__)
sf_alias = getattr(settings, ... | mit | Python |
0acce835a4675e7b981d0ef97fc1e51b990cd1ac | Update teaching_modules.py | sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs | src/ensae_teaching_cs/automation/teaching_modules.py | src/ensae_teaching_cs/automation/teaching_modules.py | # -*- coding: utf-8 -*-
"""
@file
@brief List of modules to maintain for the teachings.
"""
def get_teaching_modules():
"""
List of teachings modules to maintain (CI + documentation).
.. runpython::
:showcode:
from ensae_teaching_cs.automation import get_teaching_modules
print('\... | # -*- coding: utf-8 -*-
"""
@file
@brief List of modules to maintain for the teachings.
"""
def get_teaching_modules():
"""
List of teachings modules to maintain (CI + documentation).
.. runpython::
:showcode:
from ensae_teaching_cs.automation import get_teaching_modules
print('\... | mit | Python |
b2b8d38670e96d0c8393479f65e96032376f6ce6 | Make deep_cast_to_unicode output easier to diff | YoQuieroSaber/yournextrepresentative,YoQuieroSaber/yournextrepresentative,openstate/yournextrepresentative,openstate/yournextrepresentative,openstate/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mhl/yournextmp-popit,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextm... | candidates/tests/helpers.py | candidates/tests/helpers.py | from __future__ import print_function
import difflib
import json
import sys
def p(*args):
"""A helper for printing to stderr"""
print(file=sys.stderr, *args)
def deep_cast_to_unicode(obj):
"""
>>> deep_cast_to_unicode("Foo")
u'Foo'
>>> deep_cast_to_unicode({'x': 'y'})
{u'x': u'y'}
>>... | from __future__ import print_function
import difflib
import pprint
import sys
def p(*args):
"""A helper for printing to stderr"""
print(file=sys.stderr, *args)
def equal_arg(arg1, arg2):
"""Return True if the args are equal, False otherwise
If the arguments aren't equal under ==, return True, other... | agpl-3.0 | Python |
8257edc2c1330c694cee5ac099ce20ec1f5c6932 | fix issue that won't allow multiple payments to be posted, made it multi records | kittiu/account-payment,kittiu/account-payment | account_check_printing_report_base/models/account_payment.py | account_check_printing_report_base/models/account_payment.py | # Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, api
class AccountRegisterPayments(models.TransientModel):
_inherit = "... | # Copyright 2016 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, api
class AccountRegisterPayments(models.TransientModel):
_inherit = "... | agpl-3.0 | Python |
37f230f1dc71f99187ba740375aefb9b27ea9405 | fix fields order, added verbose names | eellak/ccradio,eellak/ccradio,eellak/ccradio | panel/models.py | panel/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User
class Category(models.Model):
name = models.CharField(max_length=50, verbose_name="κατηγορία")
slug = models.SlugField(help_text="<b>συμπληρώνεται αυτόματα!</b>")
def __unic... | # -*- coding: utf-8 -*-
from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User
class Category(models.Model):
name = models.CharField(max_length=50, verbose_name="κατηγορία")
slug = models.SlugField(help_text="<b>συμπληρώνεται αυτόματα!</b>")
def __unic... | agpl-3.0 | Python |
bb4230d1f850ad155b73e9424fdb4f0cc87cf13e | Update Adafruit16CServoDriver.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/Adafruit16CServoDriver.py | service/Adafruit16CServoDriver.py | # Start the Adafruit16CServodriver that can be used for all PCA9685 devices
adaFruit16c = Runtime.createAndStart("AdaFruit16C","Adafruit16CServoDriver")
#
# This part of the script is for the Arduino
# Comment it out or delete it if you use the GPIO pins of the Raspberry PI
# Change COM4 to the port where your Arduino ... | # The Adafruit16CServoDriver API is supported through Jython
servo1 = Runtime.createAndStart("servo1", "Servo")
pwm = Runtime.createAndStart("pwm", "Adafruit16CServoDriver")
pwm.connect("COM12")
# attach servo1 to pin 0 on the servo driver
pwm.attach(servo1, 0)
servo1.broadcastState()
servo1.moveTo(0)
sleep(1... | apache-2.0 | Python |
085f30f9a9181d62ea183d76cdad047a62cffd38 | Fix arg handling in dr.contrib.processing | schwa-lab/libschwa-python,schwa-lab/libschwa-python,schwa-lab/libschwa-python,schwa-lab/libschwa-python | schwa/dr/contrib/processing.py | schwa/dr/contrib/processing.py | # vim: set ts=2 et:
import argparse
import io
import sys
import threading
try:
import zmq
except ImportError:
zmq = None
from ..reader import Reader
from ..writer import Writer
def stream_coroutine(istream, ostream, doc_class=None, automagic=False):
reader = Reader(istream, doc_class, automagic)
writer = Wri... | # vim: set ts=2 et:
import argparse
import StringIO
import sys
import threading
try:
import zmq
except ImportError:
zmq = None
from ..reader import Reader
from ..writer import Writer
def stream_coroutine(istream, ostream, doc_class=None, automagic=False):
reader = Reader(istream, doc_class, automagic)
writer... | mit | Python |
46995ea0ae9d34c3c3565264076441e276f171ef | Add api blueprint | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | scoring_engine/web/__init__.py | scoring_engine/web/__init__.py | import os
from flask import Flask
app = Flask(__name__)
app.config.from_pyfile('settings.cfg')
app.secret_key = os.urandom(128)
from scoring_engine.web.views import welcome, scoreboard, overview, services, admin, auth, profile, api
app.register_blueprint(welcome.mod)
app.register_blueprint(scoreboard.mod)
app.regis... | import os
from flask import Flask
app = Flask(__name__)
app.config.from_pyfile('settings.cfg')
app.secret_key = os.urandom(128)
from scoring_engine.web.views import welcome, scoreboard, overview, services, admin, auth, profile
app.register_blueprint(welcome.mod)
app.register_blueprint(scoreboard.mod)
app.register_b... | mit | Python |
4be060592ebd24a31f6be67804578f0f88c916f3 | Add check for Windows-style path commands to __init__.py | astropy/montage-wrapper | montage_wrapper/__init__.py | montage_wrapper/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | bsd-3-clause | Python |
e941c8c1575fbdda344441507b7e116ed5340bb9 | Add destroy container | andyfangdz/librarian | drivers/sidomo_driver.py | drivers/sidomo_driver.py | from sidomo import Container
from constants import CODE_TARGET, INPUT_TARGET, OUTPUT_TARGET
class SidomoDriver(object):
def __init__(self, container, code_dir, input_dir, output_dir, script):
self.volumes = [
'%s:%s' % (code_dir, CODE_TARGET),
'%s:%s' % (output_dir, OUTPUT_TARGET)
... | from sidomo import Container
from constants import CODE_TARGET, INPUT_TARGET, OUTPUT_TARGET
class SidomoDriver(object):
def __init__(self, container, code_dir, input_dir, output_dir, script):
self.volumes = [
'%s:%s' % (code_dir, CODE_TARGET),
'%s:%s' % (output_dir, OUTPUT_TARGET)
... | mit | Python |
a920ef5cfd4615a5dce032676c7392c2d2117664 | enable cog | FallenWarrior2k/cardinal.py,FallenWarrior2k/cardinal.py | src/cardinal/cogs/__init__.py | src/cardinal/cogs/__init__.py | from logging import getLogger
from dependency_injector.containers import DeclarativeContainer
from dependency_injector.providers import Configuration, DependenciesContainer, Singleton
from .anilist import Anilist
from .botadmin import BotAdmin
from .channels import Channels
from .jisho import Jisho
from .moderation i... | from logging import getLogger
from dependency_injector.containers import DeclarativeContainer
from dependency_injector.providers import Configuration, DependenciesContainer, Singleton
from .anilist import Anilist
from .botadmin import BotAdmin
from .channels import Channels
from .jisho import Jisho
from .moderation i... | mit | Python |
6f4e68406387569ec70f6989d680a6c4e9b11490 | bump version to 0.4.7 | briney/abstar | abstar/version.py | abstar/version.py | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.4.7' | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.4.6' | mit | Python |
21567a20fca8477468ce9a3da9ca6f05b73a5cbc | Ajoute reversion aux utilisateurs. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | accounts/admin.py | accounts/admin.py | # coding: utf-8
from __future__ import unicode_literals
from django.contrib.admin import site
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import UserChangeForm
from reversion import VersionAdmin
from cache_tools.utils import cached_ugettext_lazy as _
from .models import HierarchicUse... | # coding: utf-8
from __future__ import unicode_literals
from django.contrib.admin import site
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import UserChangeForm
from cache_tools.utils import cached_ugettext_lazy as _
from .models import HierarchicUser
class HierarchicUserChangeForm(... | bsd-3-clause | Python |
22538eada197462ec8f2045004f7d71bc8948cec | Support json errors in parameters file reading | ucoin-io/cutecoin,ucoin-io/cutecoin,ucoin-io/cutecoin | src/sakia/data/files/user_parameters.py | src/sakia/data/files/user_parameters.py | import attr
import json
import os
import logging
from ..entities import UserParameters
@attr.s(frozen=True)
class UserParametersFile:
"""
The repository for UserParameters
"""
_file = attr.ib()
_logger = attr.ib(default=attr.Factory(lambda: logging.getLogger('sakia')))
filename = "parameters.j... | import attr
import json
import os
import logging
from ..entities import UserParameters
@attr.s(frozen=True)
class UserParametersFile:
"""
The repository for UserParameters
"""
_file = attr.ib()
_logger = attr.ib(default=attr.Factory(lambda: logging.getLogger('sakia')))
filename = "parameters.j... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.