commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
2683219a40382687f2bd09f14aab763afe6d97a6
Update bb-runtime branch for GNAT Community 2019
scripts/install_dependencies.py
scripts/install_dependencies.py
#! /usr/bin/env python2 import argparse import os import os.path import subprocess import sys ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../')) def run_program(argv, cwd=os.path.dirname(os.path.realpath(__file__))): print "$ %s" % " ".join(argv) p = subprocess.Popen( argv, ...
#! /usr/bin/env python2 import argparse import os import os.path import subprocess import sys ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../')) def run_program(argv, cwd=os.path.dirname(os.path.realpath(__file__))): print "$ %s" % " ".join(argv) p = subprocess.Popen( argv, ...
Python
0
d11478f1ad2d6caf16aeff087f2399297eec83d2
Improve qrcode generation, add proper error message to generate_uri assertion about secret length
src/keybar/utils/totp.py
src/keybar/utils/totp.py
import io import urllib import time from base64 import b32encode from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.twofactor.totp import TOTP from cryptography.hazmat.primitives.hashes import SHA1 from django.http import HttpResponse from django.utils.encoding import force_by...
import io import urllib import time from base64 import b32encode from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.twofactor.totp import TOTP from cryptography.hazmat.primitives.hashes import SHA1 from django.http import HttpResponse from django.utils.encoding import force_by...
Python
0.000001
fb7e5039033530f1e6064ea54fe952f0781f4da2
Bump version number for release.
coredata.py
coredata.py
#!/usr/bin/python3 -tt # Copyright 2012 Jussi Pakkanen # 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 o...
#!/usr/bin/python3 -tt # Copyright 2012 Jussi Pakkanen # 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 o...
Python
0
8e880fe763a063f2bd24e9787cb2d7308bbed453
Output debug not info
panoptes/environment/camera_enclosure.py
panoptes/environment/camera_enclosure.py
import datetime import zmq import json from . import monitor from panoptes.utils import logger, config, messaging, threads, serial @logger.has_logger @config.has_config class CameraEnclosure(monitor.EnvironmentalMonitor): """ Listens to the sensors inside the camera enclosure Args: messaging (p...
import datetime import zmq import json from . import monitor from panoptes.utils import logger, config, messaging, threads, serial @logger.has_logger @config.has_config class CameraEnclosure(monitor.EnvironmentalMonitor): """ Listens to the sensors inside the camera enclosure Args: messaging (p...
Python
0.999802
0a1700b64a2e496217dd0531ebe8326410fd6cdc
Update yamldumper.py
salt/utils/yamldumper.py
salt/utils/yamldumper.py
# -*- coding: utf-8 -*- ''' salt.utils.yamldumper ~~~~~~~~~~~~~~~~~~~~~ ''' from __future__ import absolute_import try: from yaml import CDumper as Dumper except ImportError: from yaml import Dumper from salt.utils.odict import OrderedDict class OrderedDumper(Dumper): ''' A YAML dumper that...
# -*- coding: utf-8 -*- ''' salt.utils.yamldumper ~~~~~~~~~~~~~~~~~~~~~ ''' from __future__ import absolute_import try: from yaml import CDumper as Dumper except ImportError: from yaml import CDumper as Dumper from salt.utils.odict import OrderedDict class OrderedDumper(Dumper): ''' A YAML ...
Python
0
91f54451fd149506abe57e31f45bc841f9e031ca
Fix unstoppable streaming
camerav4.py
camerav4.py
import picamera from picamera import PiCamera import time from datetime import datetime import os.path from subprocess32 import Popen print "\nSecurity Camera Logger v4 | Ben Broce & William Hampton\n" print "Streams video to rtsp://pi-ip:8554/ | Captures to pics/[timestamp].jpg" print "Ctrl-C quits.\n" stream = raw_...
import picamera from picamera import PiCamera import time from datetime import datetime import os.path from subprocess32 import Popen print "\nSecurity Camera Logger v4 | Ben Broce & William Hampton\n" print "Streams video to rtsp://pi-ip:8554/ | Captures to pics/[timestamp].jpg" print "Ctrl-C quits.\n" stream = raw_...
Python
0.000013
59c193cdffa46a247e918a93b86c16fe050e27e9
migrate method to new api
l10n_br_delivery/sale.py
l10n_br_delivery/sale.py
# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2009 Renato Lima - Akretion # # ...
# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2009 Renato Lima - Akretion # # ...
Python
0.000001
643b8e034f6bdcc2d863f0dda99fa91b1eecb54c
Update __init__.py
corner/__init__.py
corner/__init__.py
# -*- coding: utf-8 -*- __version__ = "2.0.2.dev0" __author__ = "Dan Foreman-Mackey (foreman.mackey@gmail.com)" __copyright__ = "Copyright 2013-2016 Daniel Foreman-Mackey and contributors" __contributors__ = [ # Alphabetical by first name. "Adrian Price-Whelan @adrn", "Brendon Brewer @eggplantbren", "B...
# -*- coding: utf-8 -*- __version__ = "2.0.2.dev0" __author__ = "Dan Foreman-Mackey (foreman.mackey@gmail.com)" __copyright__ = "Copyright 2013-2016 Daniel Foreman-Mackey and contributors" __contributors__ = [ # Alphabetical by first name. "Adrian Price-Whelan @adrn", "Brendon Brewer @eggplantbren", "B...
Python
0.000072
14efcc349a3b524345808eaf925399bede34c7c6
make file pep8 compliant
binstar_client/errors.py
binstar_client/errors.py
from clyent.errors import ClyentError class BinstarError(ClyentError): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) if not hasattr(self, 'message'): self.message = args[0] if args else None class Unauthorized(BinstarError): pass class Conflict...
from clyent.errors import ClyentError class BinstarError(ClyentError): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) if not hasattr(self, 'message'): self.message = args[0] if args else None class Unauthorized(BinstarError): pass class Conflict(B...
Python
0
600fbdaff54206aaed93e775011b5dcfb054b83c
use url() for /apps urls so we can link to them
apps/marketplace/urls.py
apps/marketplace/urls.py
from django.conf.urls.defaults import * import views urlpatterns = patterns('', url(r'^$', views.marketplace, name='marketplace'), url(r'^partners/$', views.partners, name='partners') )
from django.conf.urls.defaults import * from views import marketplace, partners urlpatterns = patterns('', (r'^$', marketplace), (r'^partners/$', partners), )
Python
0
38db6404a7f40bc86585c614fc8cbe6691eafb89
update doc
birdy/native/__init__.py
birdy/native/__init__.py
""" The :func:`import_wps` instantiates a class whose methods call WPS processes. The methods are generated at runtime based on the process description provided by the WPS server. Calling a function sends an `execute` request to the server, which returns a response. The response is parsed to convert the outputs in nat...
""" The :func:`import_wps` function *imports* on the fly a python module whose functions call WPS processes. The module is generated at runtime based on the process description provided by the WPS server. Calling a function sends an `execute` request to the server, which returns a response. The response is parsed to c...
Python
0
270812e89e8e0870bfea01367cf645cf5194a806
Add sql constraint identation fixed
openacademy/model/openacademy_course.py
openacademy/model/openacademy_course.py
# -*- coding: utf-8 -*- from openerp import models, fields, api ''' This module create model of Course ''' class Course(models.Model): '''This class create model of Course''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # field reserved to identified re...
# -*- coding: utf-8 -*- from openerp import models, fields, api ''' This module create model of Course ''' class Course(models.Model): '''This class create model of Course''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # field reserved to identified re...
Python
0
658d37fff628a3efac1e7202416ac7495960d4ad
Add translator in script
scripts/replay_notifications.py
scripts/replay_notifications.py
#!/usr/bin/env python """ Replay all events in order to create Notification entries to the database which do not exist yet. """ # boilerplate code. copy that import os import sys from argparse import ArgumentParser sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) # /end boilerplate code from paste.depl...
#!/usr/bin/env python """ Replay all events in order to create Notification entries to the database which do not exist yet. """ # boilerplate code. copy that import os import sys from argparse import ArgumentParser sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) # /end boilerplate code from paste.depl...
Python
0.000005
6a0ee1d994eaaa563301389295c75fa61999791d
Remove unintended kwarg in mesh class
cubix/core/mesh.py
cubix/core/mesh.py
from cubix.core.pycompat import * from cubix.core import glmath from cubix.core.opengl import gl, pgl def buffer_object(data): vbo = pgl.glGenBuffers(1) gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo) pgl.glBufferData(gl.GL_ARRAY_BUFFER, data, gl.GL_STATIC_DRAW) return vbo def bind_object(dataLoc, vbo): ...
from cubix.core.pycompat import * from cubix.core import glmath from cubix.core.opengl import gl, pgl def buffer_object(data): vbo = pgl.glGenBuffers(1) gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo) pgl.glBufferData(gl.GL_ARRAY_BUFFER, data, gl.GL_STATIC_DRAW) return vbo def bind_object(dataLoc, vbo): ...
Python
0
054e2d98a450b75427a7b06c4549373c2f4bc7a3
Remove default id reosolver from open tracing
saleor/core/tracing.py
saleor/core/tracing.py
from functools import partial from graphene.relay import GlobalID from graphene.types.resolver import default_resolver from graphql import ResolveInfo def should_trace(info: ResolveInfo) -> bool: if info.field_name not in info.parent_type.fields: return False resolver = info.parent_type.fields[info....
from functools import partial from graphene.types.resolver import default_resolver from graphql import ResolveInfo def should_trace(info: ResolveInfo) -> bool: if info.field_name not in info.parent_type.fields: return False resolver = info.parent_type.fields[info.field_name].resolver return not ...
Python
0
984f5cd2d36634de7bd9876c69f6b3e19ae0c1bd
Fix documentation for MySQL instrumentation (#665)
instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/__init__.py
instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/__init__.py
# Copyright The OpenTelemetry 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 applicable law or agreed to in ...
# Copyright The OpenTelemetry 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 applicable law or agreed to in ...
Python
0
91449465489ccc71e4d0b5527f0b4b54526b3c02
update comment
python/parameters_tool/strip_comments.py
python/parameters_tool/strip_comments.py
#!/usr/bin/python ## File : strip_comments.py ## Created : <2017-08-03> ## Updated: Time-stamp: <2017-08-03 18:12:22> ## Description : ## For a block of string, remove useless stuff ## 1. Remove leading whitespace ## 2. Remove tailing whitespace ## 3. Remove any lines start with # ## ## Sample: ## ...
#!/usr/bin/python ## File : strip_comments.py ## Created : <2017-08-03> ## Updated: Time-stamp: <2017-08-03 18:09:41> ## Description : ## For a block of string, remove useless stuff ## 1. Remove leading whitespace ## 2. Remove tailing whitespace ## 3. Remove any lines start with # ## ## Sample: ## ...
Python
0
df6b13a70241b616f49d4dcc25073084c371f5b1
Swap out license with rights
share/models/creative/base.py
share/models/creative/base.py
from django.db import models from share.models.base import ShareObject from share.models.people import Person from share.models.base import TypedShareObjectMeta from share.models.creative.meta import Venue, Institution, Funder, Award, Tag from share.models.fields import ShareForeignKey, ShareManyToManyField class Ab...
from django.db import models from share.models.base import ShareObject from share.models.people import Person from share.models.base import TypedShareObjectMeta from share.models.creative.meta import Venue, Institution, Funder, Award, Tag from share.models.fields import ShareForeignKey, ShareManyToManyField class Ab...
Python
0
a12ed7d9b2517872eef314551481f993a0779f77
Use correct version number in fetch_bnf_codes
openprescribing/pipeline/management/commands/fetch_bnf_codes.py
openprescribing/pipeline/management/commands/fetch_bnf_codes.py
from argparse import RawTextHelpFormatter import datetime import glob import os import zipfile from lxml import html import requests from tqdm import tqdm from django.conf import settings from django.core.management import BaseCommand from openprescribing.utils import mkdir_p class Command(BaseCommand): help =...
from argparse import RawTextHelpFormatter import datetime import glob import os import zipfile from lxml import html import requests from tqdm import tqdm from django.conf import settings from django.core.management import BaseCommand from openprescribing.utils import mkdir_p class Command(BaseCommand): help =...
Python
0.000009
a7cd6209bd1b975fcc26bba337b7d14c7a4749d3
Apply patch for django<1.11
django_elastipymemcache/memcached.py
django_elastipymemcache/memcached.py
""" Backend for django cache """ import socket from functools import wraps from django.core.cache import InvalidCacheBackendError from django.core.cache.backends.memcached import BaseMemcachedCache from . import client as pyMemcache_client from .cluster_utils import get_cluster_info def invalidate_cache_after_error...
""" Backend for django cache """ import socket from functools import wraps from django.core.cache import InvalidCacheBackendError from django.core.cache.backends.memcached import BaseMemcachedCache from . import client as pyMemcache_client from .cluster_utils import get_cluster_info def invalidate_cache_after_error...
Python
0
a8b6e8579ed886fd7f78f6ad8db3f112dac73816
Use self.settings() context manager in tests
arcutils/tests/test_templatetags.py
arcutils/tests/test_templatetags.py
from django.http import HttpRequest from django.template import Context, Template from django.test import TestCase from arcutils.templatetags.arc import cdn_url, google_analytics class TestCDNURLTag(TestCase): def test_cdn_url_has_no_scheme_by_default(self): self.assertEqual(cdn_url('/x/y/z'), '//cdn.re...
from django.conf import settings from django.http import HttpRequest from django.template import Context, Template from django.test import TestCase from arcutils.templatetags.arc import cdn_url, google_analytics class TestCDNURLTag(TestCase): def test_cdn_url_has_no_scheme_by_default(self): self.assertE...
Python
0.000001
b7471d6b1d209c8abe2c4920e5d86d8a542758b4
Remove unused import in StartSliceJob
plugins/CuraEngineBackend/StartSliceJob.py
plugins/CuraEngineBackend/StartSliceJob.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. import numpy from UM.Job import Job from UM.Application import Application from UM.Logger import Logger from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from cu...
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. import time import numpy from UM.Job import Job from UM.Application import Application from UM.Logger import Logger from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.DepthFirstIterator import DepthFirstItera...
Python
0
a2849e7d016c812317fc503dc15f8f3dfec7da0a
use apply_async instead of delay
mrbelvedereci/build/handlers.py
mrbelvedereci/build/handlers.py
from django.db.models.signals import post_save from django.dispatch import receiver from mrbelvedereci.build.models import Build from mrbelvedereci.build.tasks import run_build @receiver(post_save, sender=Build) def create_repo_webhooks(sender, **kwargs): build = kwargs['instance'] created = kwargs['created'] ...
from django.db.models.signals import post_save from django.dispatch import receiver from mrbelvedereci.build.models import Build from mrbelvedereci.build.tasks import run_build @receiver(post_save, sender=Build) def create_repo_webhooks(sender, **kwargs): build = kwargs['instance'] created = kwargs['created'] ...
Python
0.000001
1bb90728d9ef6c08452d2094e9930b6aa916389e
Remove use of girder.events in queue adapter
cumulus/queue/__init__.py
cumulus/queue/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2015 Kitware Inc. # # 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 cop...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2015 Kitware Inc. # # 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 cop...
Python
0
e8ea3fb530b26adbcf3fa2ba602e3e96a91c5736
Create a method to render duration in "H:m:s" format.
base/components/social/youtube/models.py
base/components/social/youtube/models.py
# -*- coding: utf-8 -*- import datetime import dateutil from django.db import models from django.utils.encoding import smart_unicode from components.people.models import Group, Idol from .api import Api class Channel(models.Model): username = models.CharField(max_length=60) # Optional relationships. i...
# -*- coding: utf-8 -*- import datetime import dateutil from django.db import models from django.utils.encoding import smart_unicode from components.people.models import Group, Idol from .api import Api class Channel(models.Model): username = models.CharField(max_length=60) # Optional relationships. i...
Python
0
39cedb77312faa5afe46409d996b8dec587e6cf7
use simplier gridder
scripts/iemre/grid_p01d_12z_pre1997.py
scripts/iemre/grid_p01d_12z_pre1997.py
"""Make a gridded analysis of p01d_12z based on obs.""" import sys import subprocess import datetime import numpy as np import verde as vd import pyproj from metpy.units import units as mpunits from metpy.units import masked_array from pandas.io.sql import read_sql from pyiem.iemre import get_grids, XAXIS, YAXIS, set_...
"""Make a gridded analysis of p01d_12z based on obs.""" import sys import subprocess import datetime import numpy as np import verde as vd import pyproj from metpy.units import units as mpunits from metpy.units import masked_array from pandas.io.sql import read_sql from pyiem.iemre import get_grids, XAXIS, YAXIS, set_...
Python
0.000001
707c4c801a0c35a1503575a6bd8c82fed6c589b6
Update tv example to use data module. Rewrap some text.
doc/examples/plot_lena_tv_denoise.py
doc/examples/plot_lena_tv_denoise.py
""" ==================================================== Denoising the picture of Lena using total variation ==================================================== In this example, we denoise a noisy version of the picture of Lena using the total variation denoising filter. The result of this filter is an image that has...
""" ==================================================== Denoising the picture of Lena using total variation ==================================================== In this example, we denoise a noisy version of the picture of Lena using the total variation denoising filter. The result of this filter is an image that has...
Python
0
584317c7b5e8536eb0aa4203cd7ff0287d581367
Refactor configuration parsing
blimp/commands/launch.py
blimp/commands/launch.py
import time import boto3 from clint.textui import indent, puts, puts_err from helpers.aws import json_serialize_instance def _get_launch_args_and_tags(args, config): launch_args = { 'MinCount': 1, 'MaxCount': 1, 'KeyName': config['key_pair'], 'SubnetId': config['network']['availa...
import time import boto3 from clint.textui import indent, puts, puts_err from helpers.aws import json_serialize_instance def _get_launch_args_and_tags(args, config): role_config = config['roles'][args.role] launch_args = { 'ImageId': role_config['ami_id'], 'MinCount': 1, 'MaxCount':...
Python
0
507cdda01f9208127f8ce5f1ecadc6d5d521fe4d
fix for flake8
cupy/manipulation/kind.py
cupy/manipulation/kind.py
from cupy import core # TODO(okuta): Implement asfarray def asfortranarray(a, dtype=None): """Return an array laid out in Fortran order in memory. Args: a (~cupy.ndarray): The input array. dtype (str or dtype object, optional): By default, the data-type is inferred from the inpu...
import numpy import cupy from cupy import core # TODO(okuta): Implement asfarray def asfortranarray(a, dtype=None): """Return an array laid out in Fortran order in memory. Args: a (~cupy.ndarray): The input array. dtype (str or dtype object, optional): By default, the data-type is ...
Python
0
e157cfbf85bab3373ef7b4e5e76da20bd572bebb
modify method name: get_by_name_or_all to get_artist_by_name refactoring methods
art_archive_api/utils.py
art_archive_api/utils.py
from flask import abort def get_artist_by_name(model, name): objects = [] if name: objects = model.query.filter_by(name=name) else: objects = model.query objects_count = objects.count() return objects, objects_count def slice_query_set(offset, count, objects_count, objects): ...
from flask import abort def get_by_name_or_all(model, name): objects = [] objects_count = 0 if name: objects = model.query.filter_by(name=name) objects_count = objects.count() else: objects = model.query.all() objects_count = model.query.count() return objects, obj...
Python
0.000002
9f44888c00d29bd1d1a53eb09ab90b61f33c5e05
Update existing settings migration with minor field change.
awx/main/migrations/0002_v300_changes.py
awx/main/migrations/0002_v300_changes.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 Ansible, Inc. # All Rights Reserved. from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER...
# -*- coding: utf-8 -*- # Copyright (c) 2016 Ansible, Inc. # All Rights Reserved. from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER...
Python
0
e225f443a68b5c25bc55ecdec3a162f11c230fa6
Update tests
tests/run.py
tests/run.py
from __future__ import print_function import datetime from pprint import pprint import voxjar if __name__ == "__main__": metadata = { "identifier": "test_call_identifier", "timestamp": datetime.datetime.now(), # 'company': { # 'id': 'b87cc8ea-6820-11e7-891e-4f389aefc782' ...
from __future__ import print_function import datetime from pprint import pprint # import json import voxjar if __name__ == '__main__': now = datetime.datetime.now() metadata = { 'identifier': 'test_call_identifier', 'timestamp': now, 'company': { 'id': 'b87cc8ea-6820-11e7-8...
Python
0.000001
f3999c68e0494a08678f1bd6b4fb9e6ad031df92
Fix Flakes Errors: openspending/test/unit/model/helpers.py
openspending/test/unit/model/helpers.py
openspending/test/unit/model/helpers.py
SIMPLE_MODEL = { 'dataset': { 'name': 'test', 'label': 'Test Case Model', 'description': 'I\'m a banana!' }, 'mapping': { 'amount': { 'type': 'value', 'label': 'Amount', 'column': 'amount', 'datatype': 'float' }, ...
from tempfile import mkdtemp SIMPLE_MODEL = { 'dataset': { 'name': 'test', 'label': 'Test Case Model', 'description': 'I\'m a banana!' }, 'mapping': { 'amount': { 'type': 'value', 'label': 'Amount', 'column': 'amount', 'datatyp...
Python
0.000078
7893695348a23472835e6d6c2d57b8ac4dea2dc3
Document test intention.
test/broker/03-publish-timeout-qos2.py
test/broker/03-publish-timeout-qos2.py
#!/usr/bin/python # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet # flow. This test introduces delays into the flow in order to force the broker # to send duplicate PUBREC and PUBCOMP messages. import subprocess import socket import time from struct import * rc = 0 keepalive = 600 connec...
#!/usr/bin/python # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet # flow. This test introduces delays into the flow in order to force the broker # to send duplicate PUBREC and PUBCOMP messages. import subprocess import socket import time from struct import * rc = 0 keepalive = 600 connec...
Python
0
b82c783b573493a92f166181898c4122a1f2aef6
Add docstring to hadoop module
salt/modules/hadoop.py
salt/modules/hadoop.py
# -*- coding: utf-8 -*- ''' Support for hadoop :maintainer: Yann Jouanin <yann.jouanin@intelunix.fr> :maturity: new :depends: :platform: linux ''' # Import python libs import os import sys import shlex # Import salt libs import salt.utils from salt.state import STATE_INTERNAL_KEYWORDS as _STATE_INTERNAL_KEYWORDS f...
# -*- coding: utf-8 -*- ''' Support for hadoop :maintainer: Yann Jouanin <yann.jouanin@intelunix.fr> :maturity: new :depends: :platform: linux ''' # Import python libs import os import sys import shlex # Import salt libs import salt.utils from salt.state import STATE_INTERNAL_KEYWORDS as _STATE_INTERNAL_KEYWORDS f...
Python
0
c546192a83dce300ad46193e351229a5969e979d
Remove warming up from TestBase._test_jitted() (#571)
sdc/tests/tests_perf/test_perf_base.py
sdc/tests/tests_perf/test_perf_base.py
import os import unittest import numba from sdc.tests.tests_perf.test_perf_utils import * class TestBase(unittest.TestCase): iter_number = 5 results_class = TestResults @classmethod def create_test_results(cls): drivers = [] if is_true(os.environ.get('SDC_TEST_PERF_EXCEL', True)): ...
import os import unittest import numba from sdc.tests.tests_perf.test_perf_utils import * class TestBase(unittest.TestCase): iter_number = 5 results_class = TestResults @classmethod def create_test_results(cls): drivers = [] if is_true(os.environ.get('SDC_TEST_PERF_EXCEL', True)): ...
Python
0.000001
ad74ac75f6fea996a2ffb6efd62b0628ff8ccc3e
check if executor and loop are running before close
bndl/compute/executor.py
bndl/compute/executor.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
Python
0.000001
d6cfc95c436b7eb4be372795948a8f9097d60015
Remove unused import
astropy_helpers/sphinx/ext/__init__.py
astropy_helpers/sphinx/ext/__init__.py
from __future__ import division, absolute_import, print_function
from __future__ import division, absolute_import, print_function from .numpydoc import setup
Python
0.000001
abb870fff0a4bdad84486f7786654604ee23d6ce
allow for Decimal and other types not inherently addable to float in SMA calculator.
cubes/statutils.py
cubes/statutils.py
from collections import deque from cubes.model import Attribute def _wma(values): n = len(values) denom = n * (n + 1) / 2 total = 0.0 idx = 1 for val in values: total += float(idx) * float(val) idx += 1 return round(total / denom, 4) def _sma(values): # use all the values ...
from collections import deque from cubes.model import Attribute def _wma(values): n = len(values) denom = n * (n + 1) / 2 total = 0.0 idx = 1 for val in values: total += float(idx) * float(val) idx += 1 return round(total / denom, 4) def _sma(values): # use all the values ...
Python
0
57a913f2808ce1525746714e4284355df0510d03
FIX simpler fix of BS4 bug with tags
lyricstagger/helpers/wikia.py
lyricstagger/helpers/wikia.py
""" Helper to download lyrics from lyrics.wikia.com """ from __future__ import unicode_literals import re import requests from bs4 import BeautifulSoup, NavigableString, Tag import logging class Wikia: """Lyrics Downloader for lyrics.wikia.com""" url = "http://lyrics.wikia.com/api.php" def __init__(self)...
""" Helper to download lyrics from lyrics.wikia.com """ from __future__ import unicode_literals import re import requests from bs4 import BeautifulSoup, NavigableString, Tag import logging class Wikia: """Lyrics Downloader for lyrics.wikia.com""" url = "http://lyrics.wikia.com/api.php" def __init__(self)...
Python
0
add62d6fddb5e71ce565ddbbb0da33098c311cef
Add ImageMetrics to the -multimedia channel
channels.py
channels.py
channels = { "#huggle": lambda x: x.get("X-Bugzilla-Product", None) == "Huggle", "#pywikibot": lambda x: x.get("X-Bugzilla-Product", None) == "Pywikibot", "#wikimedia-corefeatures": lambda x: (x.get("X-Bugzilla-Product", None) == "MediaWiki extensions") and \ (x.get...
channels = { "#huggle": lambda x: x.get("X-Bugzilla-Product", None) == "Huggle", "#pywikibot": lambda x: x.get("X-Bugzilla-Product", None) == "Pywikibot", "#wikimedia-corefeatures": lambda x: (x.get("X-Bugzilla-Product", None) == "MediaWiki extensions") and \ (x.get...
Python
0.000005
403c9fe403a722449ff22d4ac989db00cff4010e
fix AdminExportMixin
leprikon/admin/export.py
leprikon/admin/export.py
import csv from datetime import datetime from functools import partial import django_excel from django.http import HttpResponse from django.utils.encoding import force_text from django.utils.translation import ugettext_lazy as _ def lookup_attr(obj, name): for n in name.split('__'): obj = getattr(obj, n)...
import csv from datetime import datetime from functools import partial import django_excel from django.http import HttpResponse from django.utils.encoding import force_text from django.utils.translation import ugettext_lazy as _ def lookup_attr(obj, name): for n in name.split('__'): obj = getattr(obj, n)...
Python
0
bd45223f8606948936d2c0fa1c104a0c2f13d630
Update 8x8 generator
test/environments/instances/8x8/gen.py
test/environments/instances/8x8/gen.py
#!/usr/bin/python import random import os import errno for i in range(100): s=set() g=set() while len(s) < 20: s.add((random.randint(0,7),random.randint(0,7))) while len(g) < 20: g.add((random.randint(0,7),random.randint(0,7))) start=list(s) goal=list(g) for size in range(1,21): if not os....
#!/usr/bin/python import random import os import errno for i in range(100): s=set() g=set() while len(s) < 20: s.add((random.randint(0,7),random.randint(0,7))) while len(g) < 20: g.add((random.randint(0,7),random.randint(0,7))) start=list(s) goal=list(g) for size in range(2,22,2): if not o...
Python
0
1a8c06e655b622e7504a615c902ddb9b278f6470
add urdu mapping [skip ci]
custom/icds/translations/integrations/const.py
custom/icds/translations/integrations/const.py
from __future__ import absolute_import from __future__ import unicode_literals API_USER = "api" SOURCE_LANGUAGE_MAPPING = { # 'hq_code' : 'transifex_code' 'hin': 'hi', # hindi 'ori': 'or', # oriya 'tam': 'ta', # tamil 'pan': 'pa', # punjabi 'asm': 'as', # assamese 'ben': 'bn', # bengal...
from __future__ import absolute_import from __future__ import unicode_literals API_USER = "api" SOURCE_LANGUAGE_MAPPING = { # 'hq_code' : 'transifex_code' 'hin': 'hi', # hindi 'ori': 'or', # oriya 'tam': 'ta', # tamil 'pan': 'pa', # punjabi 'asm': 'as', # assamese 'ben': 'bn', # bengal...
Python
0.000014
e98d141a281aaaa5af9e03afdd7a9543cf7e795a
Fix salt.states.selinux._refine_value()
salt/states/selinux.py
salt/states/selinux.py
''' Management of SELinux rules. ============================ If SELinux is available for the running system, the mode can be managed and booleans can be set. .. code-block:: yaml enforcing: selinux.mode samba_create_home_dirs: selinux.boolean: - value: True - persist: Tr...
''' Management of SELinux rules. ============================ If SELinux is available for the running system, the mode can be managed and booleans can be set. .. code-block:: yaml enforcing: selinux.mode samba_create_home_dirs: selinux.boolean: - value: True - persist: Tr...
Python
0
d9304cd7c19e29fc24ba474a5c7983ce3bb88a2b
Fix benchmark name
lib/node_modules/@stdlib/types/ndarray/ind2sub/benchmark/python/numpy/benchmark.py
lib/node_modules/@stdlib/types/ndarray/ind2sub/benchmark/python/numpy/benchmark.py
#!/usr/bin/env python """Benchmark numpy.unravel_index.""" from __future__ import print_function import timeit NAME = "ind2sub" REPEATS = 3 ITERATIONS = 1000000 def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark summary. ...
#!/usr/bin/env python """Benchmark numpy.unravel_index.""" from __future__ import print_function import timeit NAME = "unravel_index" REPEATS = 3 ITERATIONS = 1000000 def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark sum...
Python
0.001182
deb749252a83f59c0bfee3b14abafc5582fb3986
fix 500 - closes #20
letsmeet/events/views.py
letsmeet/events/views.py
from rules.contrib.views import PermissionRequiredMixin from django.shortcuts import redirect, get_object_or_404 from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import ( CreateView, DetailView, UpdateView, ) from .models import Event, EventRSVP, EventComment from .forms...
from rules.contrib.views import PermissionRequiredMixin from django.shortcuts import redirect from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import ( CreateView, DetailView, UpdateView, ) from .models import Event, EventRSVP, EventComment from .forms import EventUpdate...
Python
0.000001
9b46fc08cafeef07ffba6569a1a30b730490dd83
Improve pole.py day change calculation
bot/action/extra/pole.py
bot/action/extra/pole.py
from bot.action.core.action import Action from bot.api.domain import Message, Chat SECONDS_IN_A_DAY = 86400 OFFSET_FROM_UTC_IN_SECONDS = 2 * 3600 class PoleAction(Action): def process(self, event): if event.global_gap_detected: # reset everything event.state.last_message_timestamp = None ...
from bot.action.core.action import Action from bot.api.domain import Message, Chat SECONDS_IN_A_DAY = 86400 OFFSET_FROM_UTC_IN_SECONDS = 2 * 3600 class PoleAction(Action): def process(self, event): if event.global_gap_detected: # reset everything event.state.last_message_timestamp = None ...
Python
0.000001
420118a9e238c744040e72937bd7cacae728f74b
update ilsgateway location type test
custom/ilsgateway/tests/test_locations_sync.py
custom/ilsgateway/tests/test_locations_sync.py
from datetime import datetime import json import os from django.test import TestCase from corehq.apps.commtrack.tests.util import bootstrap_domain as initial_bootstrap from corehq.apps.locations.models import Location, SQLLocation from custom.ilsgateway.api import Location as Loc, ILSGatewayAPI from custom.ilsgateway.t...
from datetime import datetime import json import os from django.test import TestCase from corehq.apps.commtrack.tests.util import bootstrap_domain as initial_bootstrap from corehq.apps.locations.models import Location, SQLLocation from custom.ilsgateway.api import Location as Loc, ILSGatewayAPI from custom.ilsgateway.t...
Python
0
7f49672497104455d0276ac863f4b2791ee4c7bd
Replace Video constructor with generic class of subclasses.
mr/video/opencv.py
mr/video/opencv.py
import os import cv2 import numpy as np class Frame(object): """Iterable object that returns frames of video as numpy arrays of integers 0-255. Parameters ---------- filename : string gray : Convert color image to grayscale. True by default. invert : Invert black and white. True by default...
import os import cv2 import numpy as np class Frame(object): """Iterable object that returns frames of video as numpy arrays of integers 0-255. Parameters ---------- filename : string gray : Convert color image to grayscale. True by default. invert : Invert black and white. True by default...
Python
0
72da5e5a0137215c7a7ea72496a6fdfe5d830f68
set extend_existing on redefined usershub models
backend/geonature/core/users/models.py
backend/geonature/core/users/models.py
from sqlalchemy import ForeignKey from pypnusershub.db.models import User from utils_flask_sqla.serializers import serializable from sqlalchemy.sql import select, func from sqlalchemy.dialects.postgresql import UUID from geonature.utils.env import DB @serializable class VUserslistForallMenu(DB.Model): __tablenam...
from sqlalchemy import ForeignKey from pypnusershub.db.models import User from utils_flask_sqla.serializers import serializable from sqlalchemy.sql import select, func from sqlalchemy.dialects.postgresql import UUID from geonature.utils.env import DB @serializable class VUserslistForallMenu(DB.Model): __tablenam...
Python
0
c4ea2d360ebf0fc9b9d9494ed43e540eaf2282d8
add compatibility import
dask/array/into.py
dask/array/into.py
from __future__ import absolute_import, division, print_function import numpy as np from toolz import merge, accumulate from into import discover, convert, append, into from datashape.dispatch import dispatch from datashape import DataShape from operator import add import itertools from .core import rec_concatenate, A...
from __future__ import absolute_import, division, print_function import numpy as np from toolz import merge, accumulate from into import discover, convert, append, into from datashape.dispatch import dispatch from datashape import DataShape from operator import add import itertools from .core import rec_concatenate, A...
Python
0
f346daeb6d75c3235d52a98f54b91e03999e228f
Configure CORS to accept requests form web application
backend/restapp/restapp/settings.py
backend/restapp/restapp/settings.py
""" Django settings for restapp project. Generated by 'django-admin startproject' using Django 1.9.4. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os #...
""" Django settings for restapp project. Generated by 'django-admin startproject' using Django 1.9.4. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os #...
Python
0.000001
83a1ccd0cd657b08fd6bd43b212d1b526f466474
Use unicodecode instead of unaccent postgresql because this extension is not in postgresql 8.4
server/localfinance/views.py
server/localfinance/views.py
# -*- coding: utf-8 -*- import os import json import unidecode from sqlalchemy import func from pyramid.view import view_config from pyramid.response import FileResponse from cornice import Service from cornice.resource import resource, view from .models import AdminZoneFinance, DBSession, AdminZone, Stats as StatsMod...
# -*- coding: utf-8 -*- import os import json from sqlalchemy import func from pyramid.view import view_config from pyramid.response import FileResponse from cornice import Service from cornice.resource import resource, view from .models import AdminZoneFinance, DBSession, AdminZone, Stats as StatsModel, ADMIN_LEVEL_C...
Python
0.000002
c1d73206436389f27187f3b52ff0daf6e106918c
Fix serialization of Marathon Constraints
marathon/models/constraint.py
marathon/models/constraint.py
from ..exceptions import InvalidOperatorError from .base import MarathonObject class MarathonConstraint(MarathonObject): """Marathon placement constraint. See https://mesosphere.github.io/marathon/docs/constraints.html :param str field: constraint operator target :param str operator: must be one of ...
from ..exceptions import InvalidOperatorError from .base import MarathonObject class MarathonConstraint(MarathonObject): """Marathon placement constraint. See https://mesosphere.github.io/marathon/docs/constraints.html :param str field: constraint operator target :param str operator: must be one of ...
Python
0.002336
381dc5a1f92916d8ce66c7eef95e2237ff20b044
fix tests
astropy/coordinates/tests/test_sites.py
astropy/coordinates/tests/test_sites.py
from __future__ import (absolute_import, division, print_function, unicode_literals) from ...tests.helper import pytest, assert_quantity_allclose from ... import units as u from .. import Latitude, Longitude, EarthLocation, get_site, add_site, remove_site def test_get_site(): # Compare to ...
from __future__ import (absolute_import, division, print_function, unicode_literals) from ...tests.helper import pytest, assert_quantity_allclose from ... import units as u from .. import Latitude, Longitude, EarthLocation, get_site, add_site, remove_site def test_get_site(): # Compare to ...
Python
0.000001
e82cfc45585268b5942c169b8a0a61f8110ac832
Change exception handling
ysniff.py
ysniff.py
#!/usr/bin/env python import boto.rds import fileinput import sys import os from subprocess import call mac_index = 12 time_index = 1 start_t_us = 0 start_u_us = 0 MAC_LEN = 17 SAMPLE_PERIOD = 30 # Seconds. PUSH_TO_AWS_PERIOD = 300 # Seconds. maclist = set() buffer = {} # Function to re-associate with YaleGuest for ...
#!/usr/bin/env python import boto.rds import fileinput import sys import os from subprocess import call mac_index = 12 time_index = 1 start_t_us = 0 start_u_us = 0 MAC_LEN = 17 SAMPLE_PERIOD = 30 # Seconds. PUSH_TO_AWS_PERIOD = 300 # Seconds. maclist = set() buffer = {} # Function to re-associate with YaleGuest for ...
Python
0.000001
bdb8d48e0030474a616ec2e7e6d5f19132bb18e7
Fix account init
module/plugins/accounts/XFileSharingPro.py
module/plugins/accounts/XFileSharingPro.py
# -*- coding: utf-8 -*- from module.plugins.internal.XFSPAccount import XFSPAccount class XFileSharingPro(XFSPAccount): __name__ = "XFileSharingPro" __type__ = "account" __version__ = "0.04" __description__ = """XFileSharingPro multi-purpose account plugin""" __license__ = "GPLv3" ...
# -*- coding: utf-8 -*- import re from module.plugins.internal.XFSPAccount import XFSPAccount class XFileSharingPro(XFSPAccount): __name__ = "XFileSharingPro" __type__ = "account" __version__ = "0.03" __description__ = """XFileSharingPro multi-purpose account plugin""" __license__ = "...
Python
0
ee931a528a1483bedc2951dd202f369460c0fec4
Update version
bottle_utils/__init__.py
bottle_utils/__init__.py
__version__ = '0.3.5' __author__ = 'Outernet Inc <hello@outernet.is>'
__version__ = '0.3.4' __author__ = 'Outernet Inc <hello@outernet.is>'
Python
0
595f2dfab6841555df27bd145a871b717a4c4c49
handle not having any siblings
cvserver.py
cvserver.py
# coding: utf-8 from __future__ import print_function from __future__ import unicode_literals import requests import bs4 import re DEBUG = False def response_for_image(image_url, client_name): base_url = 'http://deeplearning.cs.toronto.edu/api/url.php' files = { 'urllink': ('', image_url), 'u...
# coding: utf-8 from __future__ import print_function from __future__ import unicode_literals import requests import bs4 import re DEBUG = False def response_for_image(image_url, client_name): base_url = 'http://deeplearning.cs.toronto.edu/api/url.php' files = { 'urllink': ('', image_url), 'u...
Python
0.000003
a806272275fa0071abf038ceed913995c5e99bb5
add support of IAM roles
z3/get.py
z3/get.py
import argparse import sys, re import boto3 import botocore from boto3.s3.transfer import TransferConfig from z3.config import get_config MB = 1024 ** 2 def main(): cfg = get_config() parser = argparse.ArgumentParser( description='Read a key from s3 and write the content to stdout', ) parser.a...
import argparse import sys import boto.s3 from z3.config import get_config def download(bucket, name): key = bucket.get_key(name) key.get_contents_to_file(sys.stdout) def main(): cfg = get_config() parser = argparse.ArgumentParser( description='Read a key from s3 and write the content to s...
Python
0
d4b1852bcbdbfd458209f4e69c5cb7a5c3d9b9c4
Fix schema
marshmallow_peewee/convert.py
marshmallow_peewee/convert.py
import peewee as pw from marshmallow import fields, validate as ma_validate from marshmallow.compat import OrderedDict class Related(fields.Nested): def __init__(self, nested=None, meta=None, **kwargs): self.meta = meta or {} return super(Related, self).__init__(nested, **kwargs) def init_mo...
import peewee as pw from marshmallow import fields, validate as ma_validate from marshmallow.compat import OrderedDict class Related(fields.Nested): def __init__(self, nested=None, meta=None, **kwargs): self.meta = meta or {} return super(Related, self).__init__(nested, **kwargs) def init_mo...
Python
0.000004
d29f175ce5a410044130569ba765bc7c9829c0a6
Add missing import
salt/wheel/__init__.py
salt/wheel/__init__.py
# -*- coding: utf-8 -*- ''' Modules used to control the master itself ''' from __future__ import absolute_import #import python libs import os import collections # Import salt libs from salt import syspaths import salt.config import salt.loader from salt.client import mixins from salt.utils.error import raise_error ...
# -*- coding: utf-8 -*- ''' Modules used to control the master itself ''' from __future__ import absolute_import #import python libs import os import collections # Import salt libs from salt import syspaths import salt.config import salt.loader from salt.client import mixins class WheelClient(mixins.SyncClientMixin,...
Python
0.000466
3a177a48b1e8f51eb9f13b874879b7fa47216897
Add comments to multimission-simulation
grizli/version.py
grizli/version.py
# Should be one commit behind latest __version__ = "0.1.1-29-gac73d73"
# Should be one commit behind latest __version__ = "0.1.1-25-g3109f16"
Python
0
6934ba49ff6f594910843d951606f80db67d9b4b
return to older return
hyml/ext.py
hyml/ext.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Copyright (c) Marko Manninen <elonmedia@gmail.com>, 2017 import hy, hy.importer as hyi from jinja2.ext import extract_from_ast import itertools def extract_from_ast(source, keywords): d = None def filter_hy(e): # basicly we are searching for babel keyword e...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Copyright (c) Marko Manninen <elonmedia@gmail.com>, 2017 import hy, hy.importer as hyi from jinja2.ext import extract_from_ast import itertools def extract_from_ast(source, keywords): d = None def filter_hy(e): # basicly we are searching for babel keyword e...
Python
0.999999
2a63c3cc4a795e23ff00d7c2273ee40939ec3dea
mark string literal as regex to avoid runtime warning in python 3
custom/aaa/urls.py
custom/aaa/urls.py
from __future__ import absolute_import from __future__ import unicode_literals from django.conf.urls import url, include from custom.aaa.views import ( AggregationScriptPage, LocationFilterAPI, ProgramOverviewReport, ProgramOverviewReportAPI, UnifiedBeneficiaryReport, UnifiedBeneficiaryReportAP...
from __future__ import absolute_import from __future__ import unicode_literals from django.conf.urls import url, include from custom.aaa.views import ( AggregationScriptPage, LocationFilterAPI, ProgramOverviewReport, ProgramOverviewReportAPI, UnifiedBeneficiaryReport, UnifiedBeneficiaryReportAP...
Python
0.000008
e7ae8140beb50e3091c0bd7ad1db4535540c95df
remove copyright
cwready/cwready.py
cwready/cwready.py
""" Clan War Readiness """ import argparse import itertools import os from collections import defaultdict from random import choice import discord from cogs.utils import checks from cogs.utils.chat_formatting import box from cogs.utils.chat_formatting import pagify from cogs.utils.dataIO import dataIO from discord.ex...
""" Clan War Readiness """ # -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2017 SML 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 limita...
Python
0
a8339f5a1393745f17eae5d287a85c7212d47789
Remove break in def
tictactoe.py
tictactoe.py
from logishort import * from getch import * from logipy import logi_led from logimap import logimap import time class TicTacToe: def __init__(self): init() time.sleep(1) self.accepted_keys = { 't':[0x14, 0, 0], 'y':[0x15, 0, 1], 'u':[0x16, 0, 2], ...
from logishort import * from getch import * from logipy import logi_led from logimap import logimap import time class TicTacToe: def __init__(self): init() time.sleep(1) self.accepted_keys = { 't':[0x14, 0, 0], 'y':[0x15, 0, 1], 'u':[0x16, 0, 2], ...
Python
0.00005
48e66346dd12faa5cbecc052b877a847b5285e43
disable a unit test for python 2.7
_unittests/ut_pycode/test_pip_helper.py
_unittests/ut_pycode/test_pip_helper.py
""" @brief test tree node (time=2s) """ import sys import os import unittest import re import shutil import warnings import pandas try: import src except ImportError: path = os.path.normpath( os.path.abspath( os.path.join( os.path.split(__file__)[0], "....
""" @brief test tree node (time=2s) """ import sys import os import unittest import re import shutil import warnings import pandas try: import src except ImportError: path = os.path.normpath( os.path.abspath( os.path.join( os.path.split(__file__)[0], "....
Python
0.000003
0e13bf2b23df3584109fcf9b62710efbb81b2226
exit with help if no subcommand is supplied.
iacli/ia.py
iacli/ia.py
#!/usr/bin/env python """A command line interface for Archive.org. usage: ia [--debug | --help | --version] [<command>] [<args>...] options: -h, --help -v, --version -d, --debug [default: True] commands: help Retrieve help for subcommands. configure Configure `ia`. metadata Retriev...
#!/usr/bin/env python """A command line interface for Archive.org. usage: ia [--debug] <command> [<args>...] ia --help ia --version options: -h, --help -v, --version -d, --debug [default: True] commands: help Retrieve help for subcommands. configure Configure `ia`. metadata ...
Python
0
f46731c1bfd3be6e7d66b4a1078ca09460d25af5
Add OCA as author of OCA addons
account_partner_required/__openerp__.py
account_partner_required/__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # Account partner required module for OpenERP # Copyright (C) 2014 Acsone (http://acsone.eu). # @author Stéphane Bidoul <stephane.bidoul@acsone.eu> # # This program is free software: you can redistribu...
# -*- encoding: utf-8 -*- ############################################################################## # # Account partner required module for OpenERP # Copyright (C) 2014 Acsone (http://acsone.eu). # @author Stéphane Bidoul <stephane.bidoul@acsone.eu> # # This program is free software: you can redistribu...
Python
0
8660650210eee8e7b2784cff5aad4e14c1edd4fc
Rename _apply_validator_chain argument
chassis/util/params.py
chassis/util/params.py
"""Utility Parameter Tools for Chassis Applications.""" import six from tornado import web from chassis.util import decorators from chassis.util import validators def _fetch_arguments(handler, method): """Get the arguments depending on the type of HTTP method.""" if method.__name__ == 'get': argume...
"""Utility Parameter Tools for Chassis Applications.""" import six from tornado import web from chassis.util import decorators from chassis.util import validators def _fetch_arguments(handler, method): """Get the arguments depending on the type of HTTP method.""" if method.__name__ == 'get': argume...
Python
0.000065
8bcc13c082fd366b3e4f7e93d4cf31a99846418d
Add comment about folsom compatibility change
ceilometer/service.py
ceilometer/service.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright © 2012 eNovance <licensing@enovance.com> # # Author: Julien Danjou <julien@danjou.info> # # 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 Lice...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright © 2012 eNovance <licensing@enovance.com> # # Author: Julien Danjou <julien@danjou.info> # # 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 Lice...
Python
0.000001
15785b306557bb81643270415944ca1bda3ae0a8
Remove database_project_name from api
dbaas_zabbix/dbaas_api.py
dbaas_zabbix/dbaas_api.py
# -*- coding: utf-8 -*- class DatabaseAsAServiceApi(object): def __init__(self, databaseinfra, credentials): self.databaseinfra = databaseinfra self.credentials = credentials @property def user(self): return self.credentials.user @property def password(self): retu...
# -*- coding: utf-8 -*- class DatabaseAsAServiceApi(object): def __init__(self, databaseinfra, credentials): self.databaseinfra = databaseinfra self.credentials = credentials @property def user(self): return self.credentials.user @property def password(self): retu...
Python
0.000019
8fb8dc0734e91f2a2037c6446e36174e9878a4b6
fix EndOfInfo
merc/features/rfc1459/info.py
merc/features/rfc1459/info.py
import collections import datetime from merc import util from merc import feature from merc import message INFO_TEMPLATE = """\ ____ __/ / /___ _ ___ ________ /_ . __/ ' \/ -_) __/ __/ /_ __/_/_/_/\__/_/ \__/ /_/_/ The Modern Extensible Relay Chat daemon, version {version}. Copyright (C) {year}, #me...
import collections import datetime from merc import util from merc import feature from merc import message INFO_TEMPLATE = """\ ____ __/ / /___ _ ___ ________ /_ . __/ ' \/ -_) __/ __/ /_ __/_/_/_/\__/_/ \__/ /_/_/ The Modern Extensible Relay Chat daemon, version {version}. Copyright (C) {year}, #me...
Python
0.000001
085cee90d03c69d3664de69831fbc18a1412a162
Update scadabr_database_to_kairosdb.py
bin/scadabr_database_to_kairosdb.py
bin/scadabr_database_to_kairosdb.py
#!/usr/bin/env python3 import requests import gzip import json import sys import pymysql as mariadb # Creating the connection with MySQL/MariaDB database. # # Attributes: # sys.argv[1] = database name, that was sent by the caller script. # sys.argv[2] = username of the MySQL/MariaDB server. # sys.argv[3] = if ...
#!/usr/bin/env python3 import requests import gzip import json import sys import mysql.connector as mariadb # Creating the connection with MySQL/MariaDB database. # # Attributes: # sys.argv[1] = database name, that was sent by the caller script. # sys.argv[2] = username of the MySQL/MariaDB server. # sys.argv[3] ...
Python
0.000001
3b89f8df57fd345e873d87df7f342fe6a01b49ce
Fix config import from __init__
darwin/__init__.py
darwin/__init__.py
from .utils.logger import setup_logging setup_logging()
from .logger import setup_logging setup_logging()
Python
0
75a2c762ac9714363955530c6908efcc1df95567
Improve consistency in the python example
bindings/python/test-integration.py
bindings/python/test-integration.py
#!/usr/bin/env python import gtk from igemacintegration import * class MainWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self) self.set_default_size(400, 300) vbox = gtk.VBox(False, 0) self.add(vbox) vbox.pack_start(gtk.Label("Some content here"), True, Tru...
#!/usr/bin/env python import gtk from igemacintegration import * class MainWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self) self.set_default_size(400, 300) vbox = gtk.VBox(False, 0) self.add(vbox) vbox.pack_start(gtk.Label("Some content here"), True, Tru...
Python
0.000008
e972a2436807ff0f5af4282a7842451e07807e5e
bump to 0.0.8
chacractl/__init__.py
chacractl/__init__.py
config = {'verbosity': 'info'} __version__ = '0.0.8'
config = {'verbosity': 'info'} __version__ = '0.0.7'
Python
0
fe47ba3a235f5b7e265e1e7cb3f1769467ca29db
Handle configuration better
cog/config.py
cog/config.py
# -*- coding: utf-8 -*- # Copyright (c) 2013, Activision Publishing, Inc. # the cog project is free software under 3-clause BSD licence # see the LICENCE file in the project root for copying terms # process configuration files import os, sys import yaml import cog.util as util user_config_dir = os.environ['HOME'] ...
# -*- coding: utf-8 -*- # Copyright (c) 2013, Activision Publishing, Inc. # the cog project is free software under 3-clause BSD licence # see the LICENCE file in the project root for copying terms # process configuration files import os, sys import yaml import cog.util as util user_settings_dir = os.environ['HOME'...
Python
0.000001
d88dcaa6e1256452715aa5071cbe326233f03195
format model args
rest_framework_tracking/base_models.py
rest_framework_tracking/base_models.py
from django.db import models from django.conf import settings from django.utils.six import python_2_unicode_compatible from .managers import PrefetchUserManager @python_2_unicode_compatible class BaseAPIRequestLog(models.Model): """ Logs Django rest framework API requests """ user = models.ForeignKey( ...
from django.db import models from django.conf import settings from django.utils.six import python_2_unicode_compatible from .managers import PrefetchUserManager @python_2_unicode_compatible class BaseAPIRequestLog(models.Model): """ Logs Django rest framework API requests """ user = models.ForeignKey( ...
Python
0.000001
1b0b96d78d03af813b10359e1ee7d7dd47045307
Correct URL to include entire base for API client
changes/api/client.py
changes/api/client.py
import json from flask import current_app class APIError(Exception): pass class APIClient(object): """ An internal API client. >>> client = APIClient(version=0) >>> response = client.get('/projects/') >>> print response """ def __init__(self, version): self.version = versio...
import json from flask import current_app class APIError(Exception): pass class APIClient(object): """ An internal API client. >>> client = APIClient(version=0) >>> response = client.get('/projects/') >>> print response """ def __init__(self, version): self.version = versio...
Python
0
2ab57fd58150d9416986eb089430fcd090c9cc31
Fix ipynb tests
binstar_client/inspect_package/ipynb.py
binstar_client/inspect_package/ipynb.py
import os import re import time from ..utils.notebook.inflection import parameterize from ..utils.notebook.data_uri import data_uri_from class IPythonNotebook(object): _name = None _version = None thumbnail_file = None def __init__(self, filename, fileobj, *args, **kwargs): self.filename = fi...
import os import re import time from ..utils.notebook.inflection import parameterize from ..utils.notebook.data_uri import data_uri_from class IPythonNotebook(object): _name = None _version = None thumbnail_file = None def __init__(self, filename, fileobj, *args, **kwargs): self.filename = fi...
Python
0.000002
9cdd74a6f94ec2f7272cc66c5f5e9ff3e0999b40
Extend bb_component test
bluebottle/common/tests/templatetags.py
bluebottle/common/tests/templatetags.py
from django.template import Template, Context, TemplateSyntaxError import unittest class BlockVerbatimTestCase(unittest.TestCase): """ Testcase testing the block_verbatim template tag. block_verbatim parses other template tags while leaving {{foo}} structures untouched. {% block %} inside block_ver...
from django.template import Template, Context, TemplateSyntaxError import unittest class BlockVerbatimTestCase(unittest.TestCase): """ Testcase testing the block_verbatim template tag. block_verbatim parses other template tags while leaving {{foo}} structures untouched. {% block %} inside block_ver...
Python
0.000001
b85b2da345be12be400ebbdd33c7f04aaf3e51cf
Fix processing script to handle compound nodes with ports
scripts/graph-process.py
scripts/graph-process.py
#!/usr/bin/env python3 import sys import re import collections import argparse import json parser = argparse.ArgumentParser(description='Merge connection graph and forest data.') parser.add_argument('forest', type=str, help='json file containing forest') parser.add_argument('graph', type=str, help='graphviz dot file c...
#!/usr/bin/env python3 import sys import re import collections import argparse import json parser = argparse.ArgumentParser(description='Merge connection graph and forest data.') parser.add_argument('forest', type=str, help='json file containing forest') parser.add_argument('graph', type=str, help='graphviz dot file c...
Python
0.000021
acc0cf7a9e44ca11384d7d2b0dcd743af6e99ef9
Update version to 1.0.3
chatterbot/__init__.py
chatterbot/__init__.py
""" ChatterBot is a machine learning, conversational dialog engine. """ from .chatterbot import ChatBot __version__ = '1.0.3' __author__ = 'Gunther Cox' __email__ = 'gunthercx@gmail.com' __url__ = 'https://github.com/gunthercox/ChatterBot' __all__ = ( 'ChatBot', )
""" ChatterBot is a machine learning, conversational dialog engine. """ from .chatterbot import ChatBot __version__ = '1.0.2' __author__ = 'Gunther Cox' __email__ = 'gunthercx@gmail.com' __url__ = 'https://github.com/gunthercox/ChatterBot' __all__ = ( 'ChatBot', )
Python
0
52ab9eeaca097890e58c89acb4d85e5e0be2e86b
Refactor a method to perform only one functionality
sqlitebiter/_table_creator.py
sqlitebiter/_table_creator.py
#!/usr/bin/env python # encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import import simplesqlite from sqliteschema import SqliteSchemaExtractor class TableCreator(object): def __init__(self, logger, dst_con): self.__logger = log...
#!/usr/bin/env python # encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import import simplesqlite from sqliteschema import SqliteSchemaExtractor class TableCreator(object): def __init__(self, logger, dst_con): self.__logger = log...
Python
0.000007
287b7b57056201d1d68c6d3cc963f1b2af2f7e83
Update scripts/alerts/validate_alerts_format.py
scripts/alerts/validate_alerts_format.py
scripts/alerts/validate_alerts_format.py
import json import sys import yaml from google.cloud import monitoring_v3 def check_json_in_metadata(path, file_id, file_version): metadata_path = "/".join(path.split("/")[:-1]) + "/metadata.yaml" check_metadata_entries(metadata_path) f = open(metadata_path) data = yaml.safe_load(f) templates_metadata = data...
import sys import yaml import json from google.cloud import monitoring_v3 def check_json_in_metadata(path, file_id, file_version): metadata_path = "/".join(path.split("/")[:-1]) + "/metadata.yaml" check_metadata_entries(metadata_path) f = open(metadata_path) data = yaml.safe_load(f) templates_metadata = data...
Python
0
fac1e1bbe26e0fb7b82d65e48619cacc742ea747
Update default path
notebooks/utils/data_loading.py
notebooks/utils/data_loading.py
"""Wrappers to simplify data loading.""" import pandas as pd # Set default path DEFAULT_PATH = '../data/raw/' def load_users_data(path=DEFAULT_PATH, preprocessed=False): """Load users data into train and test users. Parameters ---------- path: str Path of the folder containing the data. ...
"""Wrappers to simplify data loading.""" import pandas as pd # Set default path DEFAULT_PATH = '../datasets/raw/' def load_users_data(path=DEFAULT_PATH, preprocessed=False): """Load users data into train and test users. Parameters ---------- path: str Path of the folder containing the data....
Python
0.000001
95c1b7bb737db7ded2980ce2a378d3e5d3d5ed4f
Test admin create new user
billjobs/tests/tests_user_admin_api.py
billjobs/tests/tests_user_admin_api.py
from django.test import TestCase from django.contrib.auth.models import User from rest_framework import status from rest_framework.test import APIClient, APIRequestFactory, \ force_authenticate from billjobs.views import UserAdmin, UserAdminDetail import json class UserAdminAPI(TestCase): """ Test User Adm...
from django.test import TestCase from django.contrib.auth.models import User from rest_framework import status from rest_framework.test import APIClient, APIRequestFactory, \ force_authenticate from billjobs.views import UserAdmin, UserAdminDetail class UserAdminAPI(TestCase): """ Test User Admin API REST ...
Python
0
d03571b523ba125be94d68bc50cda74a9a934d6f
fix documents
chainer/functions/evaluation/r2_score.py
chainer/functions/evaluation/r2_score.py
from chainer import cuda from chainer import function from chainer.utils import type_check class R2_score(function.Function): def __init__(self, sample_weight, multioutput): if sample_weight is not None: raise NotImplementedError() if multioutput in ['uniform_average', 'raw_values']: ...
from chainer import cuda from chainer import function from chainer.utils import type_check class R2_score(function.Function): def __init__(self, sample_weight, multioutput): if sample_weight is not None: raise NotImplementedError() if multioutput in ['uniform_average', 'raw_values']: ...
Python
0.000086
d6c20476bebed1265ccd0ac46e3020fdb3804bdd
Add type to command serialization
changes/api/serializer/models/command.py
changes/api/serializer/models/command.py
from changes.api.serializer import Serializer, register from changes.models import Command @register(Command) class CommandSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'name': instance.label, 'status': instance.status, ...
from changes.api.serializer import Serializer, register from changes.models import Command @register(Command) class CommandSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'name': instance.label, 'status': instance.status, ...
Python
0.000002
e6300cc22369811f02ef59d2a71da8df31fe8221
Add zlib.dll to Windows wheels
ci/bundle_hdf5_whl.py
ci/bundle_hdf5_whl.py
"""Bundle HDF5 DLLs into an h5py wheel on Windows This is meant to do something like auditwheel on Linux & delocate on Mac, but h5py-specific. """ from base64 import urlsafe_b64encode from contextlib import contextmanager from glob import glob import hashlib import os import os.path as osp import shutil import sys imp...
"""Bundle HDF5 DLLs into an h5py wheel on Windows This is meant to do something like auditwheel on Linux & delocate on Mac, but h5py-specific. """ from base64 import urlsafe_b64encode from contextlib import contextmanager from glob import glob import hashlib import os import os.path as osp import shutil import sys imp...
Python
0.000001
7f4ae6e2973ccdd305ebac91c761050a4f9c1727
add return_tuple parameter to get_one_row
database.py
database.py
""" Database Manager. """ import MySQLdb import MySQLdb.cursors class DatabaseManager(object): def __init__(self, host, user, passwd, database, charset='utf8', large_scale=False): """Be careful using large_scale=True, SSDictCursor seems not reliable.""" self.conn = MySQLdb.connect(host=host, user=...
""" Database Manager. """ import MySQLdb import MySQLdb.cursors class DatabaseManager(object): def __init__(self, host, user, passwd, database, charset='utf8', large_scale=False): """Be careful using large_scale=True, SSDictCursor seems not reliable.""" self.conn = MySQLdb.connect(host=host, user=...
Python
0.000002
76e1f2db2fe3763e1b8638c9044afa341e4d39bf
Fix fileno method in ReactorTransport.
sheared/reactor/transport.py
sheared/reactor/transport.py
# vim:nowrap:textwidth=0 import random, os, types class StringTransport: def __init__(self): self.input = '' self.output = '' self.closed = 0 def read(self, cnt=4096): cnt = min(cnt, 1 + int(random.random() * (len(self.input) - 1))) data = self.input[:cnt] self...
# vim:nowrap:textwidth=0 import random, os, types class StringTransport: def __init__(self): self.input = '' self.output = '' self.closed = 0 def read(self, cnt=4096): cnt = min(cnt, 1 + int(random.random() * (len(self.input) - 1))) data = self.input[:cnt] self...
Python
0.006964
c64d7ba394e1f185b2ebb14cdcc58f5b329e130d
Translate "Images" word.
shop/products/admin/forms.py
shop/products/admin/forms.py
from django.apps import apps from django import forms from django.utils.translation import ugettext_lazy as _ from suit.sortables import SortableTabularInline from multiupload.fields import MultiFileField class ProductForm(forms.ModelForm): images = MultiFileField( label=_('Images'), max_num=100, min_n...
from django.apps import apps from django import forms from suit.sortables import SortableTabularInline from multiupload.fields import MultiFileField class ProductForm(forms.ModelForm): images = MultiFileField(max_num=100, min_num=1, required=False) def save(self, commit=True): product = super(Pro...
Python
0.999996
e6f9cd49a57dfc5fd0acbcf757fd6e80c3749b4f
Support complex comparison (Issue #121)
numba/specialize/comparisons.py
numba/specialize/comparisons.py
import ast from functools import reduce import numba from numba import * from numba import error from numba import visitors, nodes from numba import function_util from numba.symtab import Variable from numba import pyconsts logger = logging.getLogger(__name__) opmap = { ast.Eq : pyconsts.Py_EQ, ast.No...
import ast from functools import reduce import numba from numba import * from numba import error from numba import visitors, nodes from numba import function_util from numba.symtab import Variable from numba import pyconsts logger = logging.getLogger(__name__) opmap = { ast.Eq : pyconsts.Py_EQ, ast.No...
Python
0
faf5facbefc02d5c5144d036ff53fcaab40667f4
fix pylint
anyway/parsers/news_flash_db_adapter.py
anyway/parsers/news_flash_db_adapter.py
import datetime import logging import pandas as pd from flask_sqlalchemy import SQLAlchemy from anyway.parsers import infographics_data_cache_updater from anyway.parsers import timezones from anyway.models import NewsFlash # fmt: off def init_db() -> "DBAdapter": from anyway.app_and_db import db return DBAda...
import datetime import logging import pandas as pd from flask_sqlalchemy import SQLAlchemy from anyway.parsers import infographics_data_cache_updater from anyway.parsers import timezones from anyway.models import NewsFlash # fmt: off def init_db() -> "DBAdapter": from anyway.app_and_db import db return DBAda...
Python
0.000003
67ff8c30d07f54c89d8072f480ded59e144d8463
Update range test after reporting change
numba/tests/builtins/test_builtin_range.py
numba/tests/builtins/test_builtin_range.py
""" >>> range_ret1() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range_ret2() [1, 2, 3, 4] >>> range_ret3() [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4] >>> forward1() 0 1 2 3 4 5 6 7 8 9 done >>> forward2() 1 2 3 4 done >>> forward3() 5 8 11 14 done >>> backward1() 10 7 4 done >>> backward2() done >>> backward3() -5 -8...
""" >>> range_ret1() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range_ret2() [1, 2, 3, 4] >>> range_ret3() [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4] >>> forward1() 0 1 2 3 4 5 6 7 8 9 done >>> forward2() 1 2 3 4 done >>> forward3() 5 8 11 14 done >>> backward1() 10 7 4 done >>> backward2() done >>> backward3() -5 -8...
Python
0
ca326b3bfaf642b3fde430241350c62578899a81
Add add_method delegate on extension types type
numba/typesystem/exttypes/extensiontype.py
numba/typesystem/exttypes/extensiontype.py
# -*- coding: utf-8 -*- """ Extension type types. """ from numba.minivect import minitypes from numba.traits import traits, Delegate from numba.typesystem import NumbaType @traits class ExtensionType(NumbaType, minitypes.ObjectType): """ Extension type Numba type. Available to users through MyExtension...
# -*- coding: utf-8 -*- """ Extension type types. """ from numba.traits import traits, Delegate from numba.typesystem import * @traits class ExtensionType(NumbaType, minitypes.ObjectType): """ Extension type Numba type. Available to users through MyExtensionType.exttype (or numba.typeof(MyExtensionT...
Python
0