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 |
|---|---|---|---|---|---|---|---|---|
33328f7d6c3fbab4a7ae968103828ac40463543b | Set default logger to file | jawsper/modularirc | __main__.py | __main__.py | #!/usr/bin/env python
# MAKE IT UNICODE OK
import sys
reload( sys )
sys.setdefaultencoding( 'utf-8' )
import os, sys
import Bot
import logging
if __name__ == '__main__':
logging.basicConfig( filename = 'ircbot.log', level = logging.DEBUG, format = '[%(asctime)s] %(levelname)s: %(message)s' )
logging.info( "Welcom... | #!/usr/bin/env python
# MAKE IT UNICODE OK
import sys
reload( sys )
sys.setdefaultencoding( 'utf-8' )
import os, sys
import Bot
import logging
if __name__ == '__main__':
logging.basicConfig( level = logging.DEBUG, format = '[%(asctime)s] %(levelname)s: %(message)s' )
logging.getLogger().addHandler( logging.FileHa... | mit | Python |
cc857044462fcd3d49aaa047e30b88789145f838 | add search in list using search_line, when the table is created or cleared the signal are now blocked | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/roomslistwidget.py | trunk/editor/roomslistwidget.py | #!/usr/bin/env python
from contextlib import contextmanager
from PyQt4.QtGui import *
from PyQt4.QtCore import *
@contextmanager
def blockedSignals(widget):
widget.blockSignals(True)
try:
yield
finally:
widget.blockSignals(False)
class RoomsListWidget(QWidget):
"""
classe base ut... | #!/usr/bin/env python
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class RoomsListWidget(QWidget):
"""
classe base utilizzata per mostare elementi del modello in una tabella
alcune funzioni devono essere reimplementate dalle classi che la ereditano
a seconda di cosa si vuole mostrare
I par... | mit | Python |
3f5418365309f1794f89ad2536ae826ee367a31d | update dev version after 0.16.1 tag [skip ci] | desihub/desitarget,desihub/desitarget | py/desitarget/_version.py | py/desitarget/_version.py | __version__ = '0.16.1.dev1335'
| __version__ = '0.16.1'
| bsd-3-clause | Python |
47e44ab6234923b1160debb5bb64f26314402ad9 | make generated command more explicit | valdur55/py3status,guiniol/py3status,tobes/py3status,valdur55/py3status,guiniol/py3status,ultrabug/py3status,tobes/py3status,ultrabug/py3status,Andrwe/py3status,Andrwe/py3status,valdur55/py3status,ultrabug/py3status | py3status/modules/taskwarrior.py | py3status/modules/taskwarrior.py | # -*- coding: utf-8 -*-
"""
Display tasks currently running in taskwarrior.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
filter: arguments passed to the command
(default 'start.before:today status:pending')
format: display format for this module (default '{t... | # -*- coding: utf-8 -*-
"""
Display tasks currently running in taskwarrior.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
filter: arguments passed to the command
(default 'start.before:today status:pending')
format: display format for this module (default '{t... | bsd-3-clause | Python |
d1c852c0441232f7cbd479d101385e8e5c1ed906 | Replace molequeueid with packet_id | OpenChemistry/molequeue,OpenChemistry/molequeue,OpenChemistry/molequeue | python/molequeue/utils.py | python/molequeue/utils.py | import json
class JsonRpc:
@staticmethod
def generate_request(packet_id, method, parameters):
request = {}
request['jsonrpc'] = "2.0"
request['id'] = packet_id
request['method'] = method
request['params'] = parameters
return json.dumps(request)
def underscore_to_camelcase(value):
def ... | import json
class JsonRpc:
@staticmethod
def generate_request(molequeueid, method, parameters):
request = {}
request['jsonrpc'] = "2.0"
request['id'] = molequeueid
request['method'] = method
request['params'] = parameters
return json.dumps(request)
def underscore_to_camelcase(value):
... | bsd-3-clause | Python |
c549d2e71a2cea1506ec95b100252f52e3fe3ab0 | Use new xbee based flow. | kalail/queen,kalail/queen | queen/helpers/__init__.py | queen/helpers/__init__.py | import communication
import serial
import time
from xbee import XBee
from .process import initialize_worker
def simple_ping():
port = serial.Serial('/dev/ttyUSB0', 9600, timeout=2)
send_msg = '0\n'
port.write(send_msg)
print 'Sent: %s' % send_msg
messages = []
while True:
msg = port.readline()
if not msg:
... | import communication
import serial
from xbee import XBee
from .process import initialize_worker
def simple_ping():
port = serial.Serial('/dev/ttyUSB0', 9600, timeout=2)
send_msg = '0\n'
port.write(send_msg)
print 'Sent: %s' % send_msg
messages = []
while True:
msg = port.readline()
if not msg:
print 'Ti... | mit | Python |
52daf7f41681237e2b8a162fa3a6b725326f8dd4 | Use curl instead of wget in package.py to increase compatibility | mattock/fabric,mattock/fabric | package.py | package.py | from fabric.api import *
from vars import *
from urlparse import urlparse
from vars import *
import os
import re
@task
def is_installed(package):
"""Check if package is installed"""
vars = Vars()
# This will work with "package.<extension> and "package"
package_name = os.path.splitext(package)[0]
wi... | from fabric.api import *
from vars import *
from urlparse import urlparse
from vars import *
import os
import re
@task
def is_installed(package):
"""Check if package is installed"""
vars = Vars()
# This will work with "package.<extension> and "package"
package_name = os.path.splitext(package)[0]
wi... | bsd-2-clause | Python |
5102beec928921f71ea732b32ca29690c9d25bed | Remove security temporarily | ben174/bart-crime,ben174/bart-crime | reports/views.py | reports/views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from crime import settings
from reports.models import Report, Incident, Comment
from reports import scraper
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorator... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from crime import settings
from reports.models import Report, Incident, Comment
from reports import scraper
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorator... | mit | Python |
2f619f7adb2d152002d6243c7b8532ae94fcf607 | Update dependency com_github_bazelbuild_rules_go to v0.21.0 (#331) | bazelbuild/bazel-watcher,bazelbuild/bazel-watcher,bazelbuild/bazel-watcher,bazelbuild/bazel-watcher | repositories.bzl | repositories.bzl | load("@bazel_gazelle//:deps.bzl", "go_repository")
# bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
def go_repositories():
go_repository(
name = "com_github_fsnotify_fsnotify",
importpath = "github.com/fsnotify/fsnotify",
sum = "h1:IXs+QLm... | load("@bazel_gazelle//:deps.bzl", "go_repository")
# bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
def go_repositories():
go_repository(
name = "com_github_fsnotify_fsnotify",
importpath = "github.com/fsnotify/fsnotify",
sum = "h1:IXs+QLm... | apache-2.0 | Python |
07ba1b43a305f4ad006e320dd4197a4cf85f5227 | Fix a bug of gt_draw_hierarchy | idekerlab/graph-services | services/gt_draw_hierarchy/service/service.py | services/gt_draw_hierarchy/service/service.py | import cxmate
import logging
import numpy as np
from graph_tool import all as gt
logger = logging.getLogger('graph_tool_service')
logger.setLevel(logging.INFO)
from Adapter import Adapter
class GtDrawHierarchyService(cxmate.Service):
def __init__(self):
self.parameter = ["layout"]
def propagate_la... | import cxmate
import logging
import numpy as np
from graph_tool import all as gt
logger = logging.getLogger('graph_tool_service')
logger.setLevel(logging.INFO)
from Adapter import Adapter
class GtDrawHierarchyService(cxmate.Service):
def __init__(self):
self.parameter = ["layout"]
def propagate_la... | mit | Python |
1d9120d3bd63495fe5381c3ee104f36d453a2d52 | Use loop instead of list comprehension | mociepka/saleor,tfroehlich82/saleor,maferelo/saleor,tfroehlich82/saleor,car3oon/saleor,maferelo/saleor,itbabu/saleor,KenMutemi/saleor,maferelo/saleor,HyperManTT/ECommerceSaleor,jreigel/saleor,jreigel/saleor,mociepka/saleor,mociepka/saleor,car3oon/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,car3oon/saleor,UITools/s... | saleor/cart/utils.py | saleor/cart/utils.py | from __future__ import unicode_literals
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from satchless.item import InsufficientStock
def contains_unavailable_variants(cart):
try:
for line in cart.lines.all():
line.variant.check_quantity(line.quantit... | from __future__ import unicode_literals
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from satchless.item import InsufficientStock
def contains_unavailable_variants(cart):
try:
[line.variant.check_quantity(line.quantity)
for line in cart.lines.all()]... | bsd-3-clause | Python |
55f42f8f972ab3940711fc7b5e39335bc35445b5 | Move import to the top of the page. | genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,pjotr... | test/requests/main_web_functionality.py | test/requests/main_web_functionality.py | from __future__ import print_function
import re
import requests
from lxml.html import parse
from link_checker import check_page
from requests.exceptions import ConnectionError
def check_home(url):
doc = parse(url).getroot()
search_button = doc.cssselect("#btsearch")
assert(search_button[0].value == "Search... | from __future__ import print_function
import re
import requests
from lxml.html import parse
from requests.exceptions import ConnectionError
def check_home(url):
doc = parse(url).getroot()
search_button = doc.cssselect("#btsearch")
assert(search_button[0].value == "Search")
print("OK")
def check_search... | agpl-3.0 | Python |
848f7ddb4a8459affc2ddbfbb4a519d62f483c4a | Fix merge conflicts in typecheck_test.py | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | tests/syft/decorators/typecheck_test.py | tests/syft/decorators/typecheck_test.py | import pytest
from typing import List, Union, Optional, Dict
from syft.decorators.syft_decorator_impl import syft_decorator
def test_typecheck_basic_dtypes():
@syft_decorator(typechecking=True)
def func(x: int, y: int) -> int:
return x + y
func(x=1, y=2)
with pytest.raises(TypeError) as e:
... | import pytest
from typing import List, Union, Optional, Dict
<<<<<<< HEAD
from syft.decorators.syft_decorator_impl import syft_decorator
=======
from syft.decorators import type_hints
>>>>>>> 5b873b8432ad761286679c8eb2ab9fbafc605ef4
def test_typecheck_basic_dtypes():
@syft_decorator(typechecking=True)
def fun... | apache-2.0 | Python |
fa787918c8a671b2a55749614f72670e138ae87c | Fix minor spelling issue | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/pecl.py | salt/modules/pecl.py | '''
Manage PHP pecl extensions.
'''
# Import python libs
import re
__opts__ = {}
__pillar__ = {}
def _pecl(command):
'''
Execute the command passed with pecl
'''
cmdline = 'pecl {0}'.format(command)
ret = __salt__['cmd.run_all'](cmdline)
if ret['retcode'] == 0:
return ret['stdout'... | '''
Manage PHP pecl extensions.
'''
# Import python libs
import re
__opts__ = {}
__pillar__ = {}
def _pecl(command):
'''
Execute the command passed with pecl
'''
cmdline = 'pecl {0}'.format(command)
ret = __salt__['cmd.run_all'](cmdline)
if ret['retcode'] == 0:
return ret['stdout'... | apache-2.0 | Python |
3357dfa2ff586ef7d39e43c7c414139258e3bc63 | add support for renamed files | phate/jive,phate/jive,phate/jive | scripts/lint.py | scripts/lint.py | import annotator
import getopt
import os
import sys
options_seq, filenames = getopt.getopt(sys.argv[1:], "", ("all", "summary"))
options = {}
options.update(options_seq)
if "--all" in options:
filenames = [f for f in os.popen("git ls-files").read().split("\n") if f]
elif not filenames:
# by default, lint files touc... | import annotator
import getopt
import os
import sys
options_seq, filenames = getopt.getopt(sys.argv[1:], "", ("all", "summary"))
options = {}
options.update(options_seq)
if "--all" in options:
filenames = [f for f in os.popen("git ls-files").read().split("\n") if f]
elif not filenames:
# by default, lint files touc... | lgpl-2.1 | Python |
aa046c91d8d4ca8f0a3d3a5d62cc1582c30508b8 | refactor duplicate code in upload handling | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | squad/api/views.py | squad/api/views.py | from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponseForbidden
from django.http import HttpResponse
from squad.core.models import Group
from squad.core.models import Project... | from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponseForbidden
from django.http import HttpResponse
from squad.core.models import Group
from squad.core.models import Project... | agpl-3.0 | Python |
3caff2865ac255e8d8627aaca35434d7d1a258f1 | Fix typo. | pmaigutyak/mp-shop,pmaigutyak/mp-shop,pmaigutyak/mp-shop | shop/comparison/views.py | shop/comparison/views.py |
from django.apps import apps
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib import messages
from django.utils.translation import ugettext as _
from shop.comparison import Comparison
MAX_NUMBER_OF_COMPARISON_PRODUCTS = 4
def index(request, template_name='comparison/index.html'... |
from django.apps import apps
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib import messages
from django.utils.translation import ugettext as _
from shop.comparison import Comparison
MAX_NUMBER_OF_COMPARISON_PRODUCTS = 4
def index(request, template_name='comparison/index.html'... | isc | Python |
8643de001fc3d3e395675d299b20d18f5462bd2c | make it py2.7 compatible | potfur/lcom | src/lcom.py | src/lcom.py | from collections import defaultdict
class LCOM4(object):
def calculate(self, cls_ref):
paths = self.__call_paths(cls_ref)
groups = self.__match_groups(paths.values())
groups = self.__match_groups(groups)
return len(groups)
def __call_paths(self, ref):
result = defaul... | from collections import defaultdict
class LCOM4:
def calculate(self, cls_ref):
paths = self.__call_paths(cls_ref)
groups = self.__match_groups(paths.values())
groups = self.__match_groups(groups)
return len(groups)
def __call_paths(self, ref):
result = defaultdict(se... | mit | Python |
16ec2eb1cde5b4878205c1435799d22f78b7c99b | Add iterating code | paulkramme/mc-package-manager,paulkramme/mc-package-manager,paulkramme/mc-package-manager | src/main.py | src/main.py | #!/usr/bin/python3
import sys
import json
import os.path
print("MC Package Manager")
if len(sys.argv) > 1 and len(sys.argv) < 5:
if sys.argv[1] == "install":
#iterating through mod list
print("Installing...")
if os.path.isfile("pkglist.json") == True:
pass
else:
print("Package list not found. Run digged... | #!/usr/bin/python3
import sys
import json
import os.path
#from pprint import pprint
print("MC Package Manager")
if len(sys.argv) > 1 and len(sys.argv) < 5:
if sys.argv[1] == "install":
#iterating through mod list
print("Installing...")
if os.path.isfile("pkglist.json") == True:
pass
else:
print("Package... | mit | Python |
13da7a62f6cc0cd611d31cbfa18749e5f0236afd | Add url parameter to setup.py. | mk23/nurly,mk23/nurly,mk23/nurly,mk23/nurly | server/setup.py | server/setup.py | #!/usr/bin/env python2.7
from nurly.version import VERSION
from distutils.core import setup
if __name__ == '__main__':
setup(
author='Max Kalika',
author_email='max@topsy.com',
url='http://potato.georx.net/cgit/cgit.cgi/nurly/',
name='nurly-server',
version=VERSION,
... | #!/usr/bin/env python2.7
from nurly.version import VERSION
from distutils.core import setup
if __name__ == '__main__':
setup(
author='Max Kalika',
author_email='max@topsy.com',
name='nurly-server',
version=VERSION,
scripts=['nurly_server.py', 'check_command.py'],
p... | mit | Python |
0bd84e74a30806f1e317288aa5dee87b4c669790 | Use output stream's encoding (if any). Blindly using UTF-8 would break output on Windows terminals. | seblin/shcol | shcol/config.py | shcol/config.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, Sebastian Linke
# Released under the Simplified BSD license
# (see LICENSE file for details).
"""
Constants that are used by `shcol` in many places. This is meant to modified (if
needed) only *before* running `shcol`, since most of these constants are only
read durin... | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, Sebastian Linke
# Released under the Simplified BSD license
# (see LICENSE file for details).
"""
Constants that are used by `shcol` in many places. This is meant to modified (if
needed) only *before* running `shcol`, since most of these constants are only
read durin... | bsd-2-clause | Python |
491a476d504f351191a43a0858cc4f95480aee88 | Resolve cherry picking conflicts | p2pu/mechanical-mooc,p2pu/mechanical-mooc,p2pu/mechanical-mooc,p2pu/mechanical-mooc | signup/views.py | signup/views.py | # Create your views here.
from django import http
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.http import require_http_methods
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
import json
fr... | # Create your views here.
from django import http
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.http import require_http_methods
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
import json
fr... | mit | Python |
957e188b06d0bd5692b45f0b46bed9088aaebc32 | fix resize_keypoint | pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv,chainer/chainercv,yuyu2172/chainercv | chainercv/transforms/keypoint/resize_keypoint.py | chainercv/transforms/keypoint/resize_keypoint.py | def resize_keypoint(keypoint, input_shape, output_shape):
"""Change values of keypoint according to paramters for resizing an image.
Args:
keypoint (~numpy.ndarray): Keypoints in the image.
The shape of this array is :math:`(K, 2)`. :math:`K` is the number
of keypoint in the ima... | def resize_keypoint(keypoint, input_shape, output_shape):
"""Change values of keypoint according to paramters for resizing an image.
Args:
keypoint (~numpy.ndarray): Keypoints in the image.
The shape of this array is :math:`(K, 2)`. :math:`K` is the number
of keypoint in the ima... | mit | Python |
dd25fdfeab75dd449a66eb26c16548580a49ce1c | Fix an import error in gae_current_user_services. | zgchizi/oppia-uc,dippatel1994/oppia,dippatel1994/oppia,jestapinski/oppia,sbhowmik89/oppia,leandrotoledo/oppia,oppia/oppia,zgchizi/oppia-uc,gale320/oppia,sbhowmik89/oppia,sunu/oppia,google-code-export/oppia,himanshu-dixit/oppia,jestapinski/oppia,kevinlee12/oppia,Atlas-Sailed-Co/oppia,himanshu-dixit/oppia,prasanna08/oppi... | core/platform/users/gae_current_user_services.py | core/platform/users/gae_current_user_services.py | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | apache-2.0 | Python |
bbc960aaf95569d4cafcbae7e4b1c638973f3797 | Bump version 0.17.0 --> 0.17.1rc1 | lbryio/lbry,lbryio/lbry,lbryio/lbry | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.17.1rc1"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
__version__ = "0.17.0"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| mit | Python |
03e943519f21f8700cbea25cda6d96fe40b12d63 | Refactor to make instance members | dodgyrabbit/midi-light-py | lib/Mock_DotStar.py | lib/Mock_DotStar.py | """
A drop in replacment for the Adafruit_DotStar module.
It allows me to to visualize what the LED strip may look like, without actually having one.
"""
from lib.graphics import GraphWin, Circle, Point, color_rgb
class Adafruit_DotStar:
"A mock implementation of the Adafruit_DotStart that simulates LEDs in the U... | """
A drop in replacment for the Adafruit_DotStar module.
It allows me to to visualize what the LED strip may look like, without actually having one.
"""
from lib.graphics import GraphWin, Circle, Point, color_rgb
class Adafruit_DotStar:
"A mock implementation of the Adafruit_DotStart that simulates LEDs in the U... | mit | Python |
49a275a268fba520252ee864c39934699c053d13 | Update barcode resource to new resource specification | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/resources/views/barcode_checksum_poster.py | csunplugged/resources/views/barcode_checksum_poster.py | """Module for generating Barcode Checksum Poster resource."""
from PIL import Image
from utils.retrieve_query_parameter import retrieve_query_parameter
def resource(request, resource):
"""Create a image for Barcode Checksum Poster resource.
Args:
request: HTTP request object (QueryDict).
res... | """Module for generating Barcode Checksum Poster resource."""
from PIL import Image
from utils.retrieve_query_parameter import retrieve_query_parameter
def resource_image(request, resource):
"""Create a image for Barcode Checksum Poster resource.
Args:
request: HTTP request object (QueryDict).
... | mit | Python |
1bc68a17353e631c57f54dc5f18c0343e52b8840 | Include private projects when updating cache | akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr | akvo/rsr/management/commands/populate_project_directory_cache.py | akvo/rsr/management/commands/populate_project_directory_cache.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
"""Popula... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
"""Popula... | agpl-3.0 | Python |
514c7c54f7846210c48eb4e9cf837198bcb33609 | clean up imports in sphinxcontrib.spelling | sphinx-contrib/spelling,sphinx-contrib/spelling | sphinxcontrib/spelling/__init__.py | sphinxcontrib/spelling/__init__.py | try:
# For Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# For everyone else
import importlib_metadata
from sphinx.util import logging
from . import asset, builder, directive
logger = logging.getLogger(__name__)
def setup(app):
version = importlib_meta... | try:
# For Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# For everyone else
import importlib_metadata
from sphinx.util import logging
from .asset import SpellingCollector
from .builder import SpellingBuilder
from .directive import SpellingDirective
logger =... | bsd-2-clause | Python |
824feb9ed9a7d1a7f00e586f36263ab39833a810 | fix config unused in classifier_bulk example | kmaehashi/jubakit,jubatus/jubakit | example/classifier_bulk.py | example/classifier_bulk.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
"""
Bulk Train-Test Classifier
========================================
This example uses bulk train-test method of Classifier.
"""
import sklearn.metrics
from jubakit.classifier import ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
"""
Bulk Train-Test Classifier
========================================
This example uses bulk train-test method of Classifier.
"""
import sklearn.metrics
from jubakit.classifier import ... | mit | Python |
f50df632e3bac69294d7d33eb332db643f310944 | Add check=True when calling compile_proto. | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/swarming/proto/bb_backend/update_taskbackend_protos.py | appengine/swarming/proto/bb_backend/update_taskbackend_protos.py | #!/usr/bin/env python3
# Copyright 2021 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Updates and compiles proto files needed to use buildbucket/proto.
Proto files are copied over from:
https://chromium.goo... | #!/usr/bin/env python3
# Copyright 2021 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Updates and compiles proto files needed to use buildbucket/proto.
Proto files are copied over from:
https://chromium.goo... | apache-2.0 | Python |
e6222c9586846b553f8f37194d6a4759ea3bec3d | Fix stand with new pathfinding | bit-bots/bitbots_behaviour | bitbots_body_behavior/src/bitbots_body_behavior/actions/stand.py | bitbots_body_behavior/src/bitbots_body_behavior/actions/stand.py | import rospy
from tf2_geometry_msgs import PoseStamped
from dynamic_stack_decider.abstract_action_element import AbstractActionElement
class Stand(AbstractActionElement):
def perform(self, reevaluate=False):
stand_pose = PoseStamped()
stand_pose.header.stamp = rospy.Time.now()
stand_pose.... | import rospy
from geometry_msgs.msg import PoseStamped, Quaternion, Point
from dynamic_stack_decider.abstract_action_element import AbstractActionElement
class Stand(AbstractActionElement):
def perform(self, reevaluate=False):
# TODO evaluate whether we use only move base
if not self.blackboard.c... | bsd-3-clause | Python |
c00b9185fd5936eee8cb95159cfb76e4b8a55f78 | bump 0.3.3 | bouhlelma/smt,relf/smt,relf/smt,SMTorg/smt,bouhlelma/smt,SMTorg/smt | smt/__init__.py | smt/__init__.py | __version__ = "0.3.3"
| __version__ = "0.3.2"
| bsd-3-clause | Python |
9c0d5e3c7f8697e3a588006e8f164942eee7075a | Update Super_calculateur.py | Alumet/Codingame | Difficult/Super_calculateur.py | Difficult/Super_calculateur.py | '''
Author Alumet 2015
https://github.com/Alumet/Codingame
'''
n = int(input())
liste=[]
for i in range(n):
j, d = [int(j) for j in input().split()]
liste.append([j,j+d-1])
liste.sort(key=lambda x: x[0])
liste.sort(key=lambda x: x[1])
J_max=0
count=0
for el in liste:
if el[0]>J_max:
J_ma... |
n = int(input())
liste=[]
for i in range(n):
j, d = [int(j) for j in input().split()]
liste.append([j,j+d-1])
liste.sort(key=lambda x: x[0])
liste.sort(key=lambda x: x[1])
J_max=0
count=0
for el in liste:
if el[0]>J_max:
J_max=el[1]
count+=1
print(count)
| mit | Python |
ee74fa5705fbf276e092b778f5bead9ffcd04b5e | Fix unit test fixtures files | IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet | django_fixmystreet/fixmystreet/tests/__init__.py | django_fixmystreet/fixmystreet/tests/__init__.py | import shutil
import os
from django.core.files.storage import default_storage
from django.test import TestCase
class SampleFilesTestCase(TestCase):
fixtures = ['sample']
@classmethod
def setUpClass(cls):
default_storage.location = 'media' # force using source media folder to avoid real data erasi... | import shutil
import os
from django.core.files.storage import default_storage
from django.test import TestCase
class SampleFilesTestCase(TestCase):
fixtures = ['sample']
@classmethod
def setUpClass(cls):
default_storage.location = 'media' # force using source media folder to avoid real data erasi... | agpl-3.0 | Python |
12f3bb8c82b97496c79948d323f7076b6618293a | Fix parsing attributes filter values in GraphQL API | KenMutemi/saleor,KenMutemi/saleor,jreigel/saleor,itbabu/saleor,maferelo/saleor,maferelo/saleor,jreigel/saleor,jreigel/saleor,HyperManTT/ECommerceSaleor,mociepka/saleor,UITools/saleor,UITools/saleor,maferelo/saleor,car3oon/saleor,itbabu/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,car3oon/saleor,car3oon/saleor,UIToo... | saleor/graphql/scalars.py | saleor/graphql/scalars.py | from graphene.types import Scalar
from graphql.language import ast
class AttributesFilterScalar(Scalar):
@staticmethod
def parse_literal(node):
if isinstance(node, ast.StringValue):
splitted = node.value.split(":")
if len(splitted) == 2:
return tuple(splitted)
... | from graphene.types import Scalar
from graphql.language import ast
class AttributesFilterScalar(Scalar):
@staticmethod
def coerce_filter(value):
if isinstance(value, tuple) and len(value) == 2:
return ":".join(value)
serialize = coerce_filter
parse_value = coerce_filter
@sta... | bsd-3-clause | Python |
5b8ff4276fbe92d5ccd5fa63fecccc5ff7d571a9 | Add more core tests / Rename test | romulocollopy/quokka,felipevolpone/quokka,lnick/quokka,ChengChiongWah/quokka,felipevolpone/quokka,wushuyi/quokka,wushuyi/quokka,cbeloni/quokka,felipevolpone/quokka,CoolCloud/quokka,ChengChiongWah/quokka,lnick/quokka,romulocollopy/quokka,Ckai1991/quokka,cbeloni/quokka,CoolCloud/quokka,alexandre/quokka,felipevolpone/quok... | quokka/core/tests/test_models.py | quokka/core/tests/test_models.py | # coding: utf-8
from . import BaseTestCase
from ..models import Channel
class TestChannel(BaseTestCase):
def setUp(self):
# Create method was not returning the created object with
# the create() method
self.parent, new = Channel.objects.get_or_create(
title=u'Father',
... | # coding: utf-8
from . import BaseTestCase
from ..models import Channel
class TestCoreModels(BaseTestCase):
def setUp(self):
# Create method was not returning the created object with
# the create() method
self.channel, new = Channel.objects.get_or_create(
title=u'Monkey Island... | mit | Python |
2a7163323d69479743fbd597e5f53f2e495816d1 | add urls for roles | avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf | src/python/expedient/clearinghouse/roles/urls.py | src/python/expedient/clearinghouse/roles/urls.py | '''
Created on Jul 29, 2010
@author: jnaous
'''
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns("expedient.clearinghouse.roles.views",
url(r"^confirm/(?P<proj_id>\d+)/(?P<req_id>\d+)/(?P<allow>\d)/(?P<delegate>\d)/$", "confirm_request", name="roles_confirm_request"),
url(r"^create/(... | '''
Created on Jul 29, 2010
@author: jnaous
'''
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns("expedient.clearinghouse.roles.views",
url(r"^confirm/(?P<proj_id>\d+)/(?P<req_id>\d+)/(?P<allow>\d)/(?P<delegate>\d)/$", "confirm_request", name="roles_confirm_request"),
)
| bsd-3-clause | Python |
0c6325a3275be30005cdac161a9f0663830f1b55 | remove extraneous print | AntonOfTheWoods/openemm-patches,AntonOfTheWoods/openemm-patches,AntonOfTheWoods/openemm-patches | full_domain_personalisation/script/process/mailloop.py | full_domain_personalisation/script/process/mailloop.py | #!/usr/bin/env python
import agn
import re
import os
agn.require('2.3.0')
agn.loglevel = agn.LV_INFO
agn.lock()
agn.log(agn.LV_INFO, 'main', 'Starting up')
db = agn.DBaseID()
if db is None:
agn.die(s='Failed to setup database interface')
db.log = lambda a: agn.log(agn.LV_DEBUG, 'db', a)
curs = db.cursor()
i... | #!/usr/bin/env python
import agn
import re
import os
agn.require('2.3.0')
agn.loglevel = agn.LV_INFO
agn.lock()
agn.log(agn.LV_INFO, 'main', 'Starting up')
db = agn.DBaseID()
if db is None:
agn.die(s='Failed to setup database interface')
db.log = lambda a: agn.log(agn.LV_DEBUG, 'db', a)
curs = db.cursor()
i... | mit | Python |
862d44d29e3ba25a46ade13d1d65c5b4db497dca | Update add_new_plugin script with support for xpath | spectresearch/detectem | scripts/add_new_plugin.py | scripts/add_new_plugin.py | import os
import click
ROOT_DIRECTORY = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir)
)
PLUGIN_DIRECTORY = os.path.join(ROOT_DIRECTORY, 'detectem/plugins')
PLUGIN_DIRECTORIES = [
d for d in os.listdir(PLUGIN_DIRECTORY)
if os.path.isdir(os.path.join(PLUGIN_DIRECTORY, d)) and d != '__p... | import os
import click
ROOT_DIRECTORY = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir)
)
PLUGIN_DIRECTORY = os.path.join(ROOT_DIRECTORY, 'detectem/plugins')
PLUGIN_DIRECTORIES = [
d for d in os.listdir(PLUGIN_DIRECTORY) if not d.startswith('_')
]
@click.command()
@click.option(
'--m... | mit | Python |
33a4a059cd8c5d8e5a35a71fefdf3373380df09b | Remove everything from migrations that has nothing to do with `CustomUsernameUser` | lukaszb/django-guardian,benkonrath/django-guardian,rmgorman/django-guardian,lukaszb/django-guardian,benkonrath/django-guardian,benkonrath/django-guardian,lukaszb/django-guardian,rmgorman/django-guardian,rmgorman/django-guardian | guardian/testapp/migrations/0006_auto_20160221_1054.py | guardian/testapp/migrations/0006_auto_20160221_1054.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import guardian.mixins
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('testapp', '0005_auto_20151217_2344'),
]
operations... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import guardian.mixins
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('testapp', '0005_auto_20151217_2344'),
]
operations... | bsd-2-clause | Python |
3037562643bc1ddaf081a6fa9c757aed4101bb53 | Fix warnings about URLconf in Django 1.9 | jezdez/django-robots,jezdez/django-robots,jscott1971/django-robots,jscott1971/django-robots,jazzband/django-robots,jazzband/django-robots | robots/urls.py | robots/urls.py | from django.conf.urls import url
from robots.views import rules_list
urlpatterns = [
url(r'^$', rules_list, name='robots_rule_list'),
]
| try:
from django.conf.urls import patterns, url
except ImportError:
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'robots.views',
url(r'^$', 'rules_list', name='robots_rule_list'),
)
| bsd-3-clause | Python |
e0d740282d1ebc66611f96484561689881b17988 | Add output sanitization | JuEeHa/cockatric3 | botcmd.py | botcmd.py | import urllib
import re
import threading
import HTMLParser
concmd = ['/load_blacklist']
blacklist_lock = threading.Lock()
blacklist = None
html_unescape = HTMLParser.HTMLParser().unescape
def load_blacklist():
global blacklist, blacklist_lock
blacklist_lock.acquire()
blacklist = []
f = open("blacklist.txt", '... | import urllib
import re
import threading
import HTMLParser
concmd = ['/load_blacklist']
blacklist_lock = threading.Lock()
blacklist = None
html_unescape = HTMLParser.HTMLParser().unescape
def load_blacklist():
global blacklist, blacklist_lock
blacklist_lock.acquire()
blacklist = []
f = open("blacklist.txt", '... | unlicense | Python |
640c49608def953f377c5f25f810056de360c3cc | Add unique_rows to util/__init__.py | SamHames/scikit-image,paalge/scikit-image,Midafi/scikit-image,WarrenWeckesser/scikits-image,blink1073/scikit-image,bennlich/scikit-image,ofgulban/scikit-image,oew1v07/scikit-image,Midafi/scikit-image,robintw/scikit-image,juliusbierk/scikit-image,ClinicalGraphics/scikit-image,almarklein/scikit-image,michaelpacer/scikit-... | skimage/util/__init__.py | skimage/util/__init__.py | from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
img_as_bool, dtype_limits)
from .shape import view_as_blocks, view_as_windows
from .noise import random_noise
import numpy
ver = numpy.__version__.split('.')
chk = int(ver[0] + ver[1])
if chk < 18: # Use internal version fo... | from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
img_as_bool, dtype_limits)
from .shape import view_as_blocks, view_as_windows
from .noise import random_noise
import numpy
ver = numpy.__version__.split('.')
chk = int(ver[0] + ver[1])
if chk < 18: # Use internal version fo... | bsd-3-clause | Python |
76243416f36a932c16bee93cc753de3d71168f0b | Add user table to module init | hreeder/ignition,hreeder/ignition,hreeder/ignition | manager/__init__.py | manager/__init__.py | import os
from flask import Flask
from flask.ext.assets import Bundle, Environment
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Load the app config
app.config.from_object("config.Config")
assets = Environment(app)
db= SQLAlchemy(app)
login = LoginMana... | import os
from flask import Flask
from flask.ext.assets import Bundle, Environment
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Load the app config
app.config.from_object("config.Config")
assets = Environment(app)
db= SQLAlchemy(app)
login = LoginMana... | mit | Python |
3f3a896edb67fd3b2da3f88b7022edd216f1d60c | Add test for utils.with_cursor | karenc/db-migrator | dbmigrator/tests/test_utils.py | dbmigrator/tests/test_utils.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import os.path
import unittest
import psycopg2
from . import testing
class UtilsTestCase(unittest.Test... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import os.path
import unittest
from . import testing
class UtilsTestCase(unittest.TestCase):
def te... | agpl-3.0 | Python |
b3d89674b64e816d79d1ec5dc6a4bd5d1e0e6383 | Update __init__.py | cle1109/scot,cbrnr/scot,mbillingr/SCoT,cbrnr/scot,scot-dev/scot,cle1109/scot,mbillingr/SCoT,scot-dev/scot | scot/__init__.py | scot/__init__.py | # Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013 SCoT Development Team
""" SCoT: The Source Connectivity Toolbox
"""
from __future__ import absolute_import
from . import config
# default backend
# TODO: set default backend in config
from . import backend_builtin
from... | # Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013 SCoT Development Team
""" SCoT: The Source Connectivity Toolbox
"""
from __future__ import absolute_import
from . import config
# default backend
# TODO: set default backend in config
from . import backend_builtin
from... | mit | Python |
4683c0b96fd47e571fc9fd42d42d83600c223f38 | Update matrix8x8_test.py | adafruit/Adafruit_Python_LED_Backpack,pro585code/Adafruit_Python_LED_Backpack,lmperez2/Pi-Seven-Segment | examples/matrix8x8_test.py | examples/matrix8x8_test.py | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | mit | Python |
6b3ede3f02c498c056acdaeafda6929b434f1c90 | Remove bogus check for Xen in example program | libvirt/libvirt,zhlcindy/libvirt-1.1.4-maintain,jeckersb/libvirt,novel/fbsd-libvirt,wiedi/libvirt,zippy2/libvirt,siboulet/libvirt-openvz,taget/libvirt,libvirt/libvirt,rbu/libvirt,danwent/libvirt-ovs,iam-TJ/libvirt,cbosdo/libvirt,usc-isi/libvirt,olafhering/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,andreabolognani/li... | examples/python/dominfo.py | examples/python/dominfo.py | #!/usr/bin/env python
# dominfo - print some information about a domain
import libvirt
import sys
import os
import libxml2
import pdb
def usage():
print 'Usage: %s DOMAIN' % sys.argv[0]
print ' Print information about the domain DOMAIN'
def print_section(title):
print "\n%s" % title
print "=" * 6... | #!/usr/bin/env python
# dominfo - print some information about a domain
import libvirt
import sys
import os
import libxml2
import pdb
def usage():
print 'Usage: %s DOMAIN' % sys.argv[0]
print ' Print information about the domain DOMAIN'
def print_section(title):
print "\n%s" % title
print "=" * 6... | lgpl-2.1 | Python |
56635f94a2c7befae49c18ee601e476e41c8ec97 | Tweak run_lpu.py to accept arg. | cerrno/neurokernel | examples/timing/run_lpu.py | examples/timing/run_lpu.py | #!/usr/bin/env python
"""
Run timing test (non-GPU) scaled over number of LPUs.
"""
import csv
import re
import subprocess
import sys
import numpy as np
out_file = sys.argv[1]
script_name = 'timing_demo.py'
trials = 3
f = open(out_file, 'w', 0)
w = csv.writer(f)
for spikes in xrange(250, 7000, 250):
for lpus i... | #!/usr/bin/env python
"""
Run timing test (non-GPU) scaled over number of LPUs.
"""
import csv
import re
import subprocess
import sys
import numpy as np
script_name = 'timing_demo.py'
trials = 3
f = open(out_file, 'w', 0)
w = csv.writer(f)
for spikes in xrange(250, 7000, 250):
for lpus in xrange(2, 9):
... | bsd-3-clause | Python |
86e6490d74936153e5ee5fb8abbded527cbdc18b | refactor of menu code to simplify | toejough/pimento | pimento.py | pimento.py | '''
Make simple python menus with pimento!
'''
# [ Imports ]
# [ -Python ]
import sys
# [ Functions ]
def menu(pre_prompt, items, post_prompt):
'''Prompt with a menu'''
# State
acceptable_response_given = False
selection = None
# Prompt Loop
# - wait until an acceptable response has been giv... | '''
Make simple python menus with pimento!
'''
# [ Imports ]
# [ -Python ]
import sys
# [ Functions ]
def menu(pre_prompt, items, post_prompt):
'''Prompt with a menu'''
# State
acceptable_response_given = False
selection = None
# Prompt Loop
# - wait until an acceptable response has been giv... | mit | Python |
f4d54890b93443eb1bcae5bac5bbcaaa9165433f | Fix last test | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/activities/tests/test_models.py | bluebottle/activities/tests/test_models.py | from django.test import TestCase
from bluebottle.time_based.tests.factories import PeriodActivityFactory
from bluebottle.segments.tests.factories import SegmentFactory, SegmentTypeFactory
from bluebottle.test.factory_models.accounts import BlueBottleUserFactory
class ActivitySegmentsTestCase(TestCase):
def setUp... | from django.test import TestCase
from bluebottle.time_based.tests.factories import DateActivityFactory
from bluebottle.segments.tests.factories import SegmentFactory, SegmentTypeFactory
from bluebottle.test.factory_models.accounts import BlueBottleUserFactory
class ActivitySegmentsTestCase(TestCase):
def setUp(s... | bsd-3-clause | Python |
7d7556ab390e0eec8ddb2f89b30a4dab0df026da | Correct the spelling of "Continuous" | timsnyder/bokeh,schoolie/bokeh,azjps/bokeh,ericmjl/bokeh,justacec/bokeh,KasperPRasmussen/bokeh,azjps/bokeh,phobson/bokeh,dennisobrien/bokeh,timsnyder/bokeh,dennisobrien/bokeh,justacec/bokeh,timsnyder/bokeh,justacec/bokeh,jakirkham/bokeh,KasperPRasmussen/bokeh,msarahan/bokeh,stonebig/bokeh,ericmjl/bokeh,quasiben/bokeh,q... | examples/plotting/file/slider_callback_policy.py | examples/plotting/file/slider_callback_policy.py | from bokeh.io import vform, output_file, show
from bokeh.models import CustomJS, Slider, Paragraph
# NOTE: the JS functions to forvide the format code for strings is found the answer
# from the user fearphage at http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format
callback = CustomJS... | from bokeh.io import vform, output_file, show
from bokeh.models import CustomJS, Slider, Paragraph
# NOTE: the JS functions to forvide the format code for strings is found the answer
# from the user fearphage at http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format
callback = CustomJS... | bsd-3-clause | Python |
48413a03d8e8778c54ce3ba447e45aadcd6f3789 | Update autowrap example to have correct annotations | jongiddy/balcazapy,jongiddy/balcazapy,jongiddy/balcazapy | examples/types/autowrap.py | examples/types/autowrap.py | # -*- coding: utf-8 -*-
from balcaza.t2types import *
from balcaza.t2activity import *
from balcaza.t2flow import *
from balcaza.t2wrapper import WrapperWorkflow
# This example demonstrates validation checks of input ports
flow = Workflow(title='Validation Example')
flow.task.Process = BeanshellCode("output = input... | # -*- coding: utf-8 -*-
from balcaza.t2types import *
from balcaza.t2activity import *
from balcaza.t2flow import *
from balcaza.t2wrapper import WrapperWorkflow
# This example creates a simple nested workflow. First, create the flow nested workflow:
flow = Workflow(title='Projection Matrix')
flow.task.Process = Be... | lgpl-2.1 | Python |
a701289d5873a582464e52d2bd83088231f970ec | Improve the admin site to show the name of the resouce. | uw-it-aca/mdot-rest,uw-it-aca/mdot-rest | mdot_rest/models.py | mdot_rest/models.py | from django.db import models
class Resource(models.Model):
""" Represents metadata about a resource we want to direct users to.
"""
name = models.CharField(max_length=60)
slug = models.SlugField(max_length=60)
feature_desc = models.CharField(max_length=120)
featured = models.BooleanField(defaul... | from django.db import models
class Resource(models.Model):
""" Represents metadata about a resource we want to direct users to.
"""
name = models.CharField(max_length=60)
slug = models.SlugField(max_length=60)
feature_desc = models.CharField(max_length=120)
featured = models.BooleanField(defaul... | apache-2.0 | Python |
aba5ae9736b064fd1e3541de3ef36371d92fc875 | Fix import when using python3.3 | ivoire/RandoAmisSecours,ivoire/RandoAmisSecours | RandoAmisSecours/admin.py | RandoAmisSecours/admin.py | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2013 Rémi Duraffort
# This file is part of RandoAmisSecours.
#
# RandoAmisSecours 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... | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2013 Rémi Duraffort
# This file is part of RandoAmisSecours.
#
# RandoAmisSecours 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... | agpl-3.0 | Python |
ab1370cc8f01b7bedf6bfdbbcb9bb05ef8ca291c | add `--no-cleanup` to integration tests | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | swift/integration-tests/create_database_utils.py | swift/integration-tests/create_database_utils.py | """
recreation of internal `create_database_utils.py` to run the tests locally, with minimal
and swift-specialized functionality
"""
import subprocess
import pathlib
import sys
def run_codeql_database_create(cmds, lang, keep_trap=True):
assert lang == 'swift'
codeql_root = pathlib.Path(__file__).parents[2]
... | """
recreation of internal `create_database_utils.py` to run the tests locally, with minimal
and swift-specialized functionality
"""
import subprocess
import pathlib
import sys
def run_codeql_database_create(cmds, lang, keep_trap=True):
assert lang == 'swift'
codeql_root = pathlib.Path(__file__).parents[2]
... | mit | Python |
8543ec942d36f723fb06bd966daa4e2e187252f6 | Change default host to api.platoai.com | platoai/platoai-python,platoai/platoai | platoai.py | platoai.py | import time
import grpc
from platoai_protos import api_pb2_grpc, api_pb2, phone_call_pb2
class PushRequestIter(object):
"""Wrapper class for api_pb2.PushRequest that conforms to the iterator
protocol to support streaming in the API.
"""
def __init__(self, audio, metadata, chunk_size=1024, callbacks=N... | import time
import grpc
from platoai_protos import api_pb2_grpc, api_pb2, phone_call_pb2
class PushRequestIter(object):
"""Wrapper class for api_pb2.PushRequest that conforms to the iterator
protocol to support streaming in the API.
"""
def __init__(self, audio, metadata, chunk_size=1024, callbacks=N... | apache-2.0 | Python |
f8b4d4f16cf2c988766bc5fb900b8dfc1ed4aa19 | Add another name idea. | tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation | experimental/names/name.py | experimental/names/name.py | #!/usr/bin/python
import json
import urllib2
import itertools
API_KEY = 'AIzaSyAEXLea9UKrZ1UpJ2JJfVEUCN3IhBWnZsw'
LANG_URL = 'https://www.googleapis.com/language/translate/v2/languages?key=%s'
TRANS_URL = 'https://www.googleapis.com/language/translate/v2?key=%s&source=en&target=%s&q=%s'
NAMES = ['home', 'house', 'thi... | #!/usr/bin/python
import json
import urllib2
import itertools
API_KEY = 'AIzaSyAEXLea9UKrZ1UpJ2JJfVEUCN3IhBWnZsw'
LANG_URL = 'https://www.googleapis.com/language/translate/v2/languages?key=%s'
TRANS_URL = 'https://www.googleapis.com/language/translate/v2?key=%s&source=en&target=%s&q=%s'
NAMES = ['home', 'house', 'thi... | mit | Python |
49b0548e153830645f6b8cf2dc41b522d60c8f7a | add cleanup function | PythonSanSebastian/docstamp | docstamp/filenames.py | docstamp/filenames.py | # coding=utf-8
# -------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
# Universidad del Pais Vasco UPV/EHU
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -----... | # coding=utf-8
# -------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
# Universidad del Pais Vasco UPV/EHU
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -----... | apache-2.0 | Python |
b3ef748df9eca585ae3fc77da666ba5ce93bc428 | Replace newlines with spaces for readability | mineo/lala,mineo/lala | lala/plugins/fortune.py | lala/plugins/fortune.py | import logging
from functools import partial
from lala.util import command, msg
from twisted.internet.utils import getProcessOutput
@command
def fortune(user, channel, text):
"""Show a random, hopefully interesting, adage"""
_call_fortune(user, channel)
@command
def ofortune(user, channel, text):
"""Show... | import logging
from functools import partial
from lala.util import command, msg
from twisted.internet.utils import getProcessOutput
@command
def fortune(user, channel, text):
"""Show a random, hopefully interesting, adage"""
_call_fortune(user, channel)
@command
def ofortune(user, channel, text):
"""Show... | mit | Python |
4c445c13be3d3413bca7a9b7f5d83fc48e3c36d4 | add comment about real file path for sqlite db | iDigBio/idigbio-media-appliance,iDigBio/idigbio-media-appliance,iDigBio/idigbio-media-appliance,iDigBio/idigbio-media-appliance | idigbio_media_appliance/config.py | idigbio_media_appliance/config.py | import os
import appdirs
import json
from .version import VERSION
basedir = os.path.abspath(os.path.dirname(__file__))
USER_DATA = appdirs.user_data_dir("media_appliance", "idigbio")
if not os.path.exists(USER_DATA):
os.makedirs(USER_DATA)
# On Windows 7, the db will typically end up in C:\Users\<user>\AppData\... | import os
import appdirs
import json
from .version import VERSION
basedir = os.path.abspath(os.path.dirname(__file__))
USER_DATA = appdirs.user_data_dir("media_appliance", "idigbio")
if not os.path.exists(USER_DATA):
os.makedirs(USER_DATA)
DATABASE_FILE = os.path.join(USER_DATA, "local.db")
SQLALCHEMY_TRACK_MO... | mit | Python |
b9e1b34348444c4c51c8fd30ff7882552e21939b | Change order of operations within migration so breaking schema changes come last | pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro | temba/msgs/migrations/0094_auto_20170501_1641.py | temba/msgs/migrations/0094_auto_20170501_1641.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-01 16:41
from __future__ import unicode_literals
from django.db import migrations, models
import temba.utils.models
class Migration(migrations.Migration):
dependencies = [
('msgs', '0093_populate_translatables'),
]
operations = [
... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-01 16:41
from __future__ import unicode_literals
from django.db import migrations, models
import temba.utils.models
class Migration(migrations.Migration):
dependencies = [
('msgs', '0093_populate_translatables'),
]
operations = [
... | agpl-3.0 | Python |
3c9da01bee3d157e344f3ad317b777b3977b2e4d | Use super() instead of super(classname, self) | OCA/account-closing,OCA/account-closing | account_invoice_start_end_dates/models/account_move.py | account_invoice_start_end_dates/models/account_move.py | # Copyright 2019 Akretion France <https://akretion.com/>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = "account.move"
def ... | # Copyright 2019 Akretion France <https://akretion.com/>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = "account.move"
def ... | agpl-3.0 | Python |
f4078b1516fc2bb40ec1513f7deef29a70eb1cb5 | Adjust setting | willingc/succulent-pups,willingc/succulent-pups,willingc/succulent-pups,willingc/succulent-pups | config/settings/local.py | config/settings/local.py | # -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | # -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | bsd-3-clause | Python |
4c2b1ec4180e327490b7dfadb65c2ac6a3697935 | Clean up test runner. | ubernostrum/django-contact-form,ubernostrum/django-contact-form | contact_form/runtests.py | contact_form/runtests.py | """
A standalone test runner script, configuring the minimum settings
required for django-contact-form' tests to execute.
Re-use at your own risk: many Django applications will require full
settings and/or templates in order to execute their tests, while
django-contact-form does not.
"""
import os
import sys
# Mak... | """
A standalone test runner script, configuring the minimum settings
required for django-contact-form' tests to execute.
Re-use at your own risk: many Django applications will require full
settings and/or templates in order to execute their tests, while
django-contact-form does not.
"""
import os
import sys
# Mak... | bsd-3-clause | Python |
949ce7c65a783288b35208ebb1f8a1bf04b20a0e | fix port | nailgun/seedbox,nailgun/seedbox,nailgun/seedbox | src/seedbox/config.py | src/seedbox/config.py | import os
dev_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
secret_key = '-'
cachedir = os.path.join(dev_root, 'tmp', 'cache')
database_uri = 'sqlite:///' + os.path.join(dev_root, 'test.db')
etcd_client_port = 2379
etcd_peer_port = 2380
k8s_apiserver_lb_port = 443
k8s_apiserver_secure_port = 644... | import os
dev_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
secret_key = '-'
cachedir = os.path.join(dev_root, 'tmp', 'cache')
database_uri = 'sqlite:///' + os.path.join(dev_root, 'test.db')
etcd_client_port = 2379
etcd_peer_port = 2380
k8s_apiserver_lb_port = 433
k8s_apiserver_secure_port = 644... | apache-2.0 | Python |
0c8340c00f105c46cf72c9f5d5d8bb685c8b89c7 | Fix smarkets.lazy tests on Python 3 | smarkets/smk_python_sdk | smarkets/lazy.py | smarkets/lazy.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import xrange # noqa # used in doctest
class LazyCall(object):
"""Encapsulates a computation with defined arguments.
Its main use case at the moment is to pass some relatively expensiv... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import xrange # noqa # used in doctest
class LazyCall(object):
"""Encapsulates a computation with defined arguments.
Its main use case at the moment is to pass some relatively expensiv... | mit | Python |
d19f2935256a7ecad113cedebfe46c1dc8c451cd | Improve path handling | rigdenlab/ample,linucks/ample,rigdenlab/ample,linucks/ample | scripts/pdbEd.py | scripts/pdbEd.py | #!/usr/bin/env python
'''
Created on 30 May 2013
@author: jmht
Useful stuff for PDBs - currently just remove HETATM lines
'''
import os
import sys
inpdb = sys.argv[1]
outpdb=None
if len(sys.argv) == 3:
outpdb = sys.argv[2]
if not outpdb:
name = os.path.splitext( os.path.basename(inpdb) )[0]
dirnam... | '''
Created on 30 May 2013
@author: jmht
Useful stuff for PDBs - currently just remove HETATM lines
'''
import os
import sys
inpdb = sys.argv[1]
outpdb=None
if len(sys.argv) == 3:
outpdb = sys.argv[2]
if not outpdb:
name = os.path.splitext( os.path.basename(inpdb) )[0]
outpdb = name + "_clean.pdb"... | bsd-3-clause | Python |
d0919465239399f1ab6d65bbd8c42b1b9657ddb6 | Allow to override the JSON loading and dumping parameters. | VBChunguk/thcrap,thpatch/thcrap,VBChunguk/thcrap,thpatch/thcrap,thpatch/thcrap,thpatch/thcrap,thpatch/thcrap,VBChunguk/thcrap | scripts/utils.py | scripts/utils.py | #!/usr/bin/env python3
# Touhou Community Reliant Automatic Patcher
# Scripts
#
# ----
#
"""Utility functions shared among all the scripts."""
from collections import OrderedDict
import json
import os
json_load_params = {
'object_pairs_hook': OrderedDict
}
def patch_files_filter(files):
"""Filters all file ... | #!/usr/bin/env python3
# Touhou Community Reliant Automatic Patcher
# Scripts
#
# ----
#
"""Utility functions shared among all the scripts."""
from collections import OrderedDict
import json
import os
json_load_params = {
'object_pairs_hook': OrderedDict
}
def patch_files_filter(files):
"""Filters all file ... | unlicense | Python |
b0254fd4090c0d17f60a87f3fe5fe28c0382310e | Drop old names from v0 | mirnylab/cooler | scripts/v0to1.py | scripts/v0to1.py | #!/usr/bin/env python
import sys
import h5py
infiles = sys.argv[1:]
for infile in infiles:
with h5py.File(infile, 'a') as h5:
print(infile)
if 'format-version' in h5.attrs and h5.attrs['format-version'] < 1:
if 'matrix' in h5 and not 'pixels' in h5:
print('renaming mat... | #!/usr/bin/env python
import sys
import h5py
infiles = sys.argv[1:]
for infile in infiles:
with h5py.File(infile, 'a') as h5:
print(infile)
if 'format-version' in h5.attrs and h5.attrs['format-version'] < 1:
if 'matrix' in h5 and not 'pixels' in h5:
print('renaming mat... | bsd-3-clause | Python |
1acbd85378d51fb9ea3e716da5151eb68ee9cce4 | Make catalog handler take basePath into account | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/web/catalog.py | mint/web/catalog.py | #
# Copyright (c) 2008 rPath, Inc.
#
# All Rights Reserved
#
import os
from mod_python import Cookie
from conary.lib import coveragehook
from mint import maintenance
from mint import shimclient
from mint.session import SqlSession
from catalogService import handler_apache
def getAuthFromSession(req, cfg):
# the ... | #
# Copyright (c) 2008 rPath, Inc.
#
# All Rights Reserved
#
import os
from mod_python import Cookie
from conary.lib import coveragehook
from mint import maintenance
from mint import shimclient
from mint.session import SqlSession
from catalogService import handler_apache
def getAuthFromSession(req, cfg):
# the ... | apache-2.0 | Python |
70ff6dc788666c93bcfa38268906f60efd0e2646 | Store state when force-generated | FundedByMe/django-imagekit,FundedByMe/django-imagekit,tawanda/django-imagekit,tawanda/django-imagekit | imagekit/cachefiles/backends.py | imagekit/cachefiles/backends.py | from ..utils import get_singleton
from django.core.cache import get_cache
from django.core.exceptions import ImproperlyConfigured
class CacheFileState(object):
EXISTS = 'exists'
PENDING = 'pending'
DOES_NOT_EXIST = 'does_not_exist'
def get_default_cachefile_backend():
"""
Get the default file ba... | from ..utils import get_singleton
from django.core.cache import get_cache
from django.core.exceptions import ImproperlyConfigured
class CacheFileState(object):
EXISTS = 'exists'
PENDING = 'pending'
DOES_NOT_EXIST = 'does_not_exist'
def get_default_cachefile_backend():
"""
Get the default file ba... | bsd-3-clause | Python |
3ce0910a697feba5177771528e28855cb79efc2f | Improve notification script to take arguments | Gentux/imap-cli,Gentux/imap-cli | imap_cli/scripts/imap-notify.py | imap_cli/scripts/imap-notify.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Use IMAP CLI to gt a summary of IMAP account state."""
import logging
import os
import sys
import time
import docopt
import pynotify
import imap_cli
from imap_cli import config
app_name = os.path.splitext(os.path.basename(__file__))[0]
usage = """Usage: imap-cli... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Use IMAP CLI to gt a summary of IMAP account state."""
import argparse
import logging
import os
import sys
import time
import pynotify
import imap_cli
from imap_cli import config
app_name = os.path.splitext(os.path.basename(__file__))[0]
keep_alive_timer = 10
lo... | mit | Python |
f6bce63d65a2933c5a9a6abd09fac7c355603552 | Bump version to 0.1.36 | botify-labs/python-simple-workflow,botify-labs/python-simple-workflow | swf/__init__.py | swf/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, 1, 36)
__title__ = "python-simple-workflow"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, 1, 35)
__title__ = "python-simple-workflow"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| mit | Python |
dae4b283a2c45ba38c4796f155ad07fad6db8623 | Use is not == to assert False | mfraezz/osf.io,chrisseto/osf.io,caneruguz/osf.io,felliott/osf.io,brianjgeiger/osf.io,baylee-d/osf.io,aaxelb/osf.io,crcresearch/osf.io,caneruguz/osf.io,aaxelb/osf.io,TomBaxter/osf.io,aaxelb/osf.io,Johnetordoff/osf.io,binoculars/osf.io,mfraezz/osf.io,baylee-d/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,pattisdr/osf.io,... | api_tests/metaschemas/views/test_metaschemas_detail.py | api_tests/metaschemas/views/test_metaschemas_detail.py | import pytest
from api.base.settings.defaults import API_BASE
from osf.models import MetaSchema
from osf_tests.factories import (
AuthUserFactory,
)
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
@pytest.mark.django_db
class TestMetaSchemaDetail:
def test_metaschemas_detail_visibility(sel... | import pytest
from api.base.settings.defaults import API_BASE
from osf.models import MetaSchema
from osf_tests.factories import (
AuthUserFactory,
)
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
@pytest.mark.django_db
class TestMetaSchemaDetail:
def test_metaschemas_detail_visibility(sel... | apache-2.0 | Python |
d1b2f8090211969ce3e13fc06f78dac00769b211 | Fix admin url. | keysona/WeatherServer,keysona/WeatherServer,keysona/WeatherServer,keysona/WeatherServer | WeatherServer/admin/__init__.py | WeatherServer/admin/__init__.py | import flask_login as login
from flask_admin import Admin
from .views import AdminHomeView, ProvinceView, CityView,\
CountryView, WeatherHistoryView
from .models import AdminUser, User
from WeatherServer.api.models import Province, City, Country,\
WeatherHist... | import flask_login as login
from flask_admin import Admin
from .views import AdminHomeView, ProvinceView, CityView,\
CountryView, WeatherHistoryView
from .models import AdminUser, User
from WeatherServer.api.models import Province, City, Country,\
WeatherHist... | mit | Python |
e6f1a5d0a13df8bc84609682aaaade5166612218 | Add unicode declaration | aikramer2/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,recognai/... | spacy/en/lemmatizer/__init__.py | spacy/en/lemmatizer/__init__.py | # coding: utf8
from __future__ import unicode_literals
from .lookup import LOOKUP
from ._adjectives import ADJECTIVES
from ._adjectives_irreg import ADJECTIVES_IRREG
from ._adverbs import ADVERBS
from ._adverbs_irreg import ADVERBS_IRREG
from ._nouns import NOUNS
from ._nouns_irreg import NOUNS_IRREG
from ._verbs impo... |
from .lookup import LOOKUP
from ._adjectives import ADJECTIVES
from ._adjectives_irreg import ADJECTIVES_IRREG
from ._adverbs import ADVERBS
from ._adverbs_irreg import ADVERBS_IRREG
from ._nouns import NOUNS
from ._nouns_irreg import NOUNS_IRREG
from ._verbs import VERBS
from ._verbs_irreg import VERBS_IRREG
from ._l... | mit | Python |
26d1fc2f5300e75c78e813425fb2a943fb08f2e2 | remove scraperSum printout of each tag and just output the total sum. | joeryan/web-data | scraper/scrapeSum.py | scraper/scrapeSum.py | # scrapeSum.py
# simple web scraper to scrape numbers from span tags
# practice assignment using BeautifulSoup to extract data from a page
# Joe Ryan
# 11/19/2015
import urllib
from BeautifulSoup import *
url = raw_input('Enter URL - ')
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
summation = 0
tags ... | # scrapeSum.py
# simple web scraper to scrape numbers from span tags
# practice assignment using BeautifulSoup to extract data from a page
# Joe Ryan
# 11/19/2015
import urllib
from BeautifulSoup import *
url = raw_input('Enter URL - ')
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
summation = 0
tags ... | mit | Python |
cb831b8302f7c5879733af5e2c23d1d2773baa72 | Bump version. | Kami/python-yubico-client | yubico_client/__init__.py | yubico_client/__init__.py | __version__ = (1, 9, 1)
__all__ = [
'Yubico'
]
from yubico_client.yubico import Yubico
| __version__ = (1, 9, 0)
__all__ = [
'Yubico'
]
from yubico_client.yubico import Yubico
| bsd-3-clause | Python |
5fb7ba2bfb83f29231d84a5b81c4bc4ac95cd74b | Add renormalize_tt_cores to init | Bihaqo/t3f | t3f/__init__.py | t3f/__init__.py | from t3f.tensor_train_base import TensorTrainBase
from t3f.tensor_train import TensorTrain
from t3f.tensor_train_batch import TensorTrainBatch
from t3f.variables import assign
from t3f.variables import get_variable
from t3f.ops import add
from t3f.ops import cast
from t3f.ops import flat_inner
from t3f.ops import fro... | from t3f.tensor_train_base import TensorTrainBase
from t3f.tensor_train import TensorTrain
from t3f.tensor_train_batch import TensorTrainBatch
from t3f.variables import assign
from t3f.variables import get_variable
from t3f.ops import add
from t3f.ops import cast
from t3f.ops import flat_inner
from t3f.ops import fro... | mit | Python |
5f2e59dd0a9000f283dfd265e1ed019f0799944e | Remove unused import | ivoire/RandoAmisSecours,ivoire/RandoAmisSecours | RandoAmisSecours/templatetags/timedelta.py | RandoAmisSecours/templatetags/timedelta.py | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2014 Rémi Duraffort
# This file is part of RandoAmisSecours.
#
# RandoAmisSecours 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... | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2014 Rémi Duraffort
# This file is part of RandoAmisSecours.
#
# RandoAmisSecours 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... | agpl-3.0 | Python |
60d23727679971fcd046f2965dda1b17ed354f34 | Determine app id dynamically | tripplet/watch-cat,tripplet/watch-cat,tripplet/watch-cat,tripplet/watch-cat,tripplet/watch-cat | engine/EmailAction.py | engine/EmailAction.py | import logging
from google.appengine.api import app_identity
from google.appengine.api import mail
from google.appengine.ext import db
from datamodels import Action
appengine_mailadress = 'warning@' + app_identity.get_application_id() + '.appspotmail.com'
class EmailAction(Action):
address = db.EmailProperty(requi... | import logging
from google.appengine.api import mail
from google.appengine.ext import db
from datamodels import Action
appengine_mailadress = ''
class EmailAction(Action):
address = db.EmailProperty(required=True)
subject = db.StringProperty(required=True)
def performAction(self):
if not self.enabled:
... | agpl-3.0 | Python |
436aad9d959e47b130f6cd14e22d124637eb9aef | Update button.py | MerbokIT/RaspberryPi-FullStack_new,merbok/RaspberryPi-FullStack,merbok/RaspberryPi-FullStack,futureshocked/RaspberryPi-FullStack,futureshocked/RaspberryPi-FullStack,futureshocked/RaspberryPi-FullStack,futureshocked/RaspberryPi-FullStack,futureshocked/RaspberryPi-FullStack,MerbokIT/RaspberryPi-FullStack_new | button.py | button.py | /*
FILE NAME
button.py
1. WHAT IT DOES
Reads the status of a button using a Raspberry Pi.
2. REQUIRES
* Any Raspberry Pi
* A pushbutton
* A 10kOhm resistor
* Jumper wires
* A breadboard
3. ORIGINAL WORK
Raspberry Full stack 2015, Peter Dalmaris
4. HARDWARE
D08: Button
5. SOFTWARE
Command line terminal
Simple tex... | import RPi.GPIO as GPIO ## Import GPIO Library
inPin = 8 ## Switch connected to pin 8
GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
GPIO.setup(inPin, GPIO.IN) ## Set pin 8 to INPUT
while True: ## Do this forever
value = GPIO.input(inPin) ## Read input from switch
... | mit | Python |
961dfec58636891ea5a511893b7a3ee480df1f33 | Update mask. | jeremydw/image-processor | process.py | process.py | #!/usr/bin/env python
import sys
sys.path.insert(0, 'lib')
from PIL import Image
from psd_tools import PSDImage
import os
import yaml
CONFIG_FILE = 'config.yaml.txt'
CONFIG = yaml.load(open(CONFIG_FILE))
INPUT_PATH = CONFIG['input']
OUT_DIR = CONFIG['out_dir']
def process(rule):
for fmt in rule['formats']:
... | #!/usr/bin/env python
import sys
sys.path.insert(0, 'lib')
from PIL import Image
from psd_tools import PSDImage
import os
import yaml
CONFIG_FILE = 'config.yaml.txt'
CONFIG = yaml.load(open(CONFIG_FILE))
INPUT_PATH = CONFIG['input']
OUT_DIR = CONFIG['out_dir']
def process(rule):
for fmt in rule['formats']:
... | mit | Python |
de82b44979f3e3b1c7e73594cd2138d00add4e47 | Switch console to use tracing-develop | datawire/mdk,datawire/mdk,datawire/mdk,datawire/mdk | test-console.py | test-console.py | import logging
logging.basicConfig(level=logging.DEBUG)
import mdk_tracing
import time
import quark
# tracer = mdk_tracing.Tracer.withURLsAndToken("ws://localhost:52690/ws", None, None)
tracer = mdk_tracing.Tracer.withURLsAndToken("wss://tracing-develop.datawire.io/ws", None, None)
def goodHandler(result):
# loggi... | import logging
logging.basicConfig(level=logging.DEBUG)
import mdk_tracing
import time
import quark
tracer = mdk_tracing.Tracer.withURLsAndToken("ws://localhost:52690/ws", None, None)
# tracer = mdk_tracing.Tracer.withURLsAndToken("wss://tracing-develop.datawire.io/ws", None, None)
def goodHandler(result):
# loggi... | apache-2.0 | Python |
41f6f5c1ec9e9e453d19e73d124ad3a3a8b49668 | bump time to every 30 minutes | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/preindex/tasks.py | corehq/preindex/tasks.py | from celery.schedules import crontab
from celery.task.base import periodic_task
from corehq.preindex.accessors import index_design_doc, get_preindex_designs
from corehq.util.decorators import serial_task
from django.conf import settings
@periodic_task(run_every=crontab(minute='*/30', hour='0-5'), queue=settings.CELE... | from celery.schedules import crontab
from celery.task.base import periodic_task
from corehq.preindex.accessors import index_design_doc, get_preindex_designs
from corehq.util.decorators import serial_task
from django.conf import settings
@periodic_task(run_every=crontab(minute='*/5', hour='0-5'), queue=settings.CELER... | bsd-3-clause | Python |
8f13362399171e7e4f0174f78cc8d4dfcf831ce6 | Add dummy facebook social provider | tbabej/roots,matus-stehlik/roots,rtrembecky/roots,rtrembecky/roots,tbabej/roots,matus-stehlik/roots,rtrembecky/roots,tbabej/roots,matus-stehlik/roots | scripts/bootstrap.py | scripts/bootstrap.py | # Bootstraps the Roots instance with the default
# set of the necessary objects
import datetime
site = Site.objects.get_current()
# Create the admin user
admin = User.objects.create(
username="rootsadmin",
email="rootsadmin@example.com",
is_staff=True,
is_superuser=True,
)
admin.set_password('rootspa... | # Bootstraps the Roots instance with the default
# set of the necessary objects
import datetime
site = Site.objects.get_current()
# Create the admin user
admin = User.objects.create(
username="rootsadmin",
email="rootsadmin@example.com",
is_staff=True,
is_superuser=True,
)
admin.set_password('rootspa... | mit | Python |
63dd1a83d8389429124a2f60db9501b1eaf9bfe7 | allow to pass the xml by content instead of url, keeping backward compatibility | minichiello/PyOpenGraph | PyOpenGraph/PyOpenGraph.py | PyOpenGraph/PyOpenGraph.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#Copyright (c) 2010 Gerson Minichiello
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the righ... | #!/usr/bin/env python
#Copyright (c) 2010 Gerson Minichiello
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify... | mit | Python |
e11b814ea8abb948568d94404d7599a7f13e25ee | Remove default value | SEC-i/ecoControl,SEC-i/ecoControl,SEC-i/ecoControl | server/models.py | server/models.py | from django.db import models
class Device(models.Model):
HS = 0 # HeatStorage(self.env)
PM = 1 # PowerMeter(self.env)
CU = 2 # CogenerationUnit(self.env, self.hs, self.pm)
PLB = 3 # PeakLoadBoiler(self.env, self.hs)
TC = 4 # ThermalConsumer(self.env, self.hs)
EC = 5 # ElectricalConsumer(... | from django.db import models
class Device(models.Model):
HS = 0 # HeatStorage(self.env)
PM = 1 # PowerMeter(self.env)
CU = 2 # CogenerationUnit(self.env, self.hs, self.pm)
PLB = 3 # PeakLoadBoiler(self.env, self.hs)
TC = 4 # ThermalConsumer(self.env, self.hs)
EC = 5 # ElectricalConsumer(... | mit | Python |
eb267d1ab6cfcdb31f7bbde943ef021f46903243 | allow multiple surveys (instances) to be taken | PaluMacil/rootbeer,PaluMacil/rootbeer,PaluMacil/rootbeer | server/models.py | server/models.py | # from flask.ext.login import UserMixin, AnonymousUserMixin
from server import db
from werkzeug.security import generate_password_hash, check_password_hash
# from datetime import datetime
class UserAccount(db.Model):
__tablename__ = 'user_accounts'
id = db.Column(db.Integer, primary_key=True)
username = d... | # from flask.ext.login import UserMixin, AnonymousUserMixin
from server import db
from werkzeug.security import generate_password_hash, check_password_hash
# from datetime import datetime
class UserAccount(db.Model):
__tablename__ = 'user_accounts'
id = db.Column(db.Integer, primary_key=True)
username = d... | mit | Python |
ddecc170915a344970d586c6918c0f864014618e | Add fits | jonathansick/androcmd,jonathansick/androcmd | scripts/dust_grid.py | scripts/dust_grid.py | #!/usr/bin/env python
# encoding: utf-8
"""
Make a grid of synths for a set of attenuations.
2015-04-30 - Created by Jonathan Sick
"""
import argparse
import numpy as np
from starfisher.pipeline import PipelineBase
from androcmd.planes import BasicPhatPlanes
from androcmd.phatpipeline import (
SolarZIsocs, Sola... | #!/usr/bin/env python
# encoding: utf-8
"""
Make a grid of synths for a set of attenuations.
2015-04-30 - Created by Jonathan Sick
"""
import argparse
import numpy as np
from starfisher.pipeline import PipelineBase
from androcmd.planes import BasicPhatPlanes
from androcmd.phatpipeline import (
SolarZIsocs, Sola... | mit | Python |
68fccebfaae8b395dcb8caa40cf65887d87545b4 | Add rough gui | claudemuller/pyzilla | pyzilla.py | pyzilla.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Decode Filezilla locally stored passwords from sitemanager.xml
author: Claude Müller
website: http://unschooled.life
"""
import sys
import base64
from xml.dom.minidom import parse
from tkinter import Tk, Frame, Button, Text, Menu, Label, BOTH, RIGHT, LEFT, END, N
fr... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Decode Filezilla locally stored passwords from sitemanager.xml
author: Claude Müller
website: http://unschooled.life
"""
import sys
import base64
from xml.dom.minidom import parse
# Print usage
if len(sys.argv) < 2:
print('usage: %s <sitemanager.xml>' % sys.arg... | mit | Python |
43350965e171e6a3bfd89af3dd192ab5c9281b3a | Add test for extend method. | TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi | vumi/blinkenlights/tests/test_message20110818.py | vumi/blinkenlights/tests/test_message20110818.py | from twisted.trial.unittest import TestCase
import vumi.blinkenlights.message20110818 as message
import time
class TestMessage(TestCase):
def test_to_dict(self):
now = time.time()
datapoint = ("vumi.w1.a_metric", now, 1.5)
msg = message.MetricMessage()
msg.append(datapoint)
... | from twisted.trial.unittest import TestCase
import vumi.blinkenlights.message20110818 as message
import time
class TestMessage(TestCase):
def test_to_dict(self):
now = time.time()
datapoint = ("vumi.w1.a_metric", now, 1.5)
msg = message.MetricMessage()
msg.append(datapoint)
... | bsd-3-clause | Python |
f5198851aebb000a6107b3f9ce34825da200abff | Use more descriptive variable names | gogoair/foremast,gogoair/foremast | src/foremast/utils/get_template.py | src/foremast/utils/get_template.py | """Render Jinja2 template."""
import logging
import os
import jinja2
LOG = logging.getLogger(__name__)
def get_template(template_file='', **kwargs):
"""Get the Jinja2 template and renders with dict _kwargs_.
Args:
kwargs: Keywords to use for rendering the Jinja2 template.
Returns:
Stri... | """Render Jinja2 template."""
import logging
import os
import jinja2
LOG = logging.getLogger(__name__)
def get_template(template_file='', **kwargs):
"""Get the Jinja2 template and renders with dict _kwargs_.
Args:
kwargs: Keywords to use for rendering the Jinja2 template.
Returns:
Stri... | apache-2.0 | Python |
f6b59b84349209f593b187b3339f1b48d47527c5 | Add UserTests | burningmantech/ranger-ims-server,burningmantech/ranger-ims-server,burningmantech/ranger-ims-server,burningmantech/ranger-ims-server | src/ims/auth/test/test_provider.py | src/ims/auth/test/test_provider.py | ##
# See the file COPYRIGHT for copyright information.
#
# 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... | ##
# See the file COPYRIGHT for copyright information.
#
# 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... | apache-2.0 | Python |
c3da0b931d609c4ee467177b8f2218b04fcf7d50 | Remove unused import | moyogo/fontbakery,graphicore/fontbakery,graphicore/fontbakery,moyogo/fontbakery,googlefonts/fontbakery,graphicore/fontbakery,moyogo/fontbakery,googlefonts/fontbakery,googlefonts/fontbakery | Lib/fontbakery/fonts_spec.py | Lib/fontbakery/fonts_spec.py | # -*- coding: utf-8 -*-
"""
Font Bakery CheckRunner is the driver of a font bakery suite of checks.
"""
from __future__ import absolute_import, print_function, unicode_literals
from fontbakery.checkrunner import Spec
from fontbakery.callable import FontBakeryExpectedValue as ExpectedValue
class FontsSpec(Spec):
... | # -*- coding: utf-8 -*-
"""
Font Bakery CheckRunner is the driver of a font bakery suite of checks.
"""
from __future__ import absolute_import, print_function, unicode_literals
from fontbakery.checkrunner import Spec
from fontbakery.checkrunner import get_module_specification \
... | apache-2.0 | Python |
0fae11d1b9dedf8f0e51a8cb958f73c6f34150d5 | Update all datasets concurrently | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | tensorflow_datasets/scripts/cleanup/url_filename_recorder.py | tensorflow_datasets/scripts/cleanup/url_filename_recorder.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 | Python |
4e8f00c4b6efe889f363ecf32ed15aa07ff69723 | Clear AT-SPI2's cache on switcher object before checking showing and visible | GNOME/orca,GNOME/orca,GNOME/orca,GNOME/orca | src/orca/scripts/switcher/script_utilities.py | src/orca/scripts/switcher/script_utilities.py | # Orca
#
# Copyright 2019 Igalia, S.L.
# Author: Joanmarie Diggs <jdiggs@igalia.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opt... | # Orca
#
# Copyright 2019 Igalia, S.L.
# Author: Joanmarie Diggs <jdiggs@igalia.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opt... | lgpl-2.1 | Python |
12acf49f1520a9792b3de077cd50583ede39c572 | remove _preserve_tag_on_taxes because of no more use in the current version | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/l10n_vn/__init__.py | addons/l10n_vn/__init__.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
from odoo import api, SUPERUSER_ID
def _post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
from odoo import api, SUPERUSER_ID
def _post_init_hook(cr, registry):
_preserve_tag_on_taxes(cr, registry)
env ... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.