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 |
|---|---|---|---|---|---|---|---|
cd5053ac36e13b57e95eeb1241032c97b48a4a85 | Drop try/catch that causes uncaught errors in the Observer to be silently ignored | planetstack/openstack_observer/backend.py | planetstack/openstack_observer/backend.py | import threading
import time
from observer.event_loop import PlanetStackObserver
from observer.event_manager import EventListener
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
class Backend:
def run(self):
# start the openstack observer
observer = PlanetS... | import threading
import time
from observer.event_loop import PlanetStackObserver
from observer.event_manager import EventListener
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
class Backend:
def run(self):
try:
# start the openstack observer
obser... | Python | 0 |
b725ef74f8e6f0887737e13783062b987fb3dd77 | bump to 7.0.3 final | device_inventory/__init__.py | device_inventory/__init__.py | VERSION = (7, 0, 3, 'final', 0)
def get_version():
"Returns a PEP 386-compliant version number from VERSION."
assert len(VERSION) == 5
assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha rele... | VERSION = (7, 0, 3, 'beta', 6)
def get_version():
"Returns a PEP 386-compliant version number from VERSION."
assert len(VERSION) == 5
assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha relea... | Python | 0.000002 |
584c2f69df66bd08ace0652da7337e8e71a72099 | Use bool for zero_mask. Requires pytorch 1.7+ | projects/transformers/models/sparse_embedding.py | projects/transformers/models/sparse_embedding.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | Python | 0.000001 |
3587c608cde4f273d33a572c0bf44dbe2b003250 | better initial negative rate | python/alpenglow/experiments/FactorExperiment.py | python/alpenglow/experiments/FactorExperiment.py | import alpenglow.Getter as rs
import alpenglow as prs
class FactorExperiment(prs.OnlineExperiment):
"""FactorExperiment(dimension=10,begin_min=-0.01,begin_max=0.01,learning_rate=0.05,regularization_rate=0.0,negative_rate=0.0)
This class implements an online version of the well-known matrix factorization reco... | import alpenglow.Getter as rs
import alpenglow as prs
class FactorExperiment(prs.OnlineExperiment):
"""FactorExperiment(dimension=10,begin_min=-0.01,begin_max=0.01,learning_rate=0.05,regularization_rate=0.0,negative_rate=0.0)
This class implements an online version of the well-known matrix factorization reco... | Python | 0.998618 |
37fa40a9b5260f8090adaa8c15d3767c0867574f | Create a list of messages that contain system time. | python/fusion_engine_client/messages/__init__.py | python/fusion_engine_client/messages/__init__.py | from .core import *
from . import ros
message_type_to_class = {
# Navigation solution messages.
PoseMessage.MESSAGE_TYPE: PoseMessage,
PoseAuxMessage.MESSAGE_TYPE: PoseAuxMessage,
GNSSInfoMessage.MESSAGE_TYPE: GNSSInfoMessage,
GNSSSatelliteMessage.MESSAGE_TYPE: GNSSSatelliteMessage,
# Sensor m... | from .core import *
from . import ros
message_type_to_class = {
# Navigation solution messages.
PoseMessage.MESSAGE_TYPE: PoseMessage,
PoseAuxMessage.MESSAGE_TYPE: PoseAuxMessage,
GNSSInfoMessage.MESSAGE_TYPE: GNSSInfoMessage,
GNSSSatelliteMessage.MESSAGE_TYPE: GNSSSatelliteMessage,
# Sensor m... | Python | 0.00003 |
82f68c3a0bd734dc9a639d9c257b26f5720c0d9c | add prepare_dir | decorators.py | decorators.py | import os
from functools import wraps
from requests import Timeout, ConnectionError
from socket import timeout as socket_timeout
import logging
from .models import ArbitraryAccessObject
from shutil import get_terminal_size
timeouts = (Timeout, socket_timeout, ConnectionError)
__author__ = 'zz'
def threading_lock(l... | __author__ = 'zz'
from functools import wraps
from requests import Timeout, ConnectionError
from socket import timeout as socket_timeout
import logging
from .models import ArbitraryAccessObject
from shutil import get_terminal_size
timeouts = (Timeout, socket_timeout, ConnectionError)
def threading_lock(lock):
... | Python | 0.000001 |
9ff314c9481605e174769416dec1b71e16936b83 | Fix unicode error when creating SHA1 sum for ical UID | demo/utils.py | demo/utils.py | from datetime import datetime, time, timedelta
import hashlib
def export_event(event, format='ical'):
# Only ical format supported at the moment
if format != 'ical':
return
# Begin event
# VEVENT format: http://www.kanzaki.com/docs/ical/vevent.html
ical_components = [
'BEGIN:VCALE... | from datetime import datetime, time, timedelta
import hashlib
def export_event(event, format='ical'):
# Only ical format supported at the moment
if format != 'ical':
return
# Begin event
# VEVENT format: http://www.kanzaki.com/docs/ical/vevent.html
ical_components = [
'BEGIN:VCALE... | Python | 0.000184 |
d99dfa94a42d70900e31c36023602bea3e5efdfb | Bump forgotten version to 3.2 | debinterface/__init__.py | debinterface/__init__.py | # -*- coding: utf-8 -*-
"""Imports for easier use"""
from .adapter import NetworkAdapter
from .adapterValidation import NetworkAdapterValidation
from .dnsmasqRange import (DnsmasqRange,
DEFAULT_CONFIG as DNSMASQ_DEFAULT_CONFIG)
from .hostapd import Hostapd
from .interfaces import Interfaces
f... | # -*- coding: utf-8 -*-
"""Imports for easier use"""
from .adapter import NetworkAdapter
from .adapterValidation import NetworkAdapterValidation
from .dnsmasqRange import (DnsmasqRange,
DEFAULT_CONFIG as DNSMASQ_DEFAULT_CONFIG)
from .hostapd import Hostapd
from .interfaces import Interfaces
f... | Python | 0 |
e9e6d5a6c42ff1522010f003fbed2cd324eab48e | Update cluster config | configs/config_cluster.py | configs/config_cluster.py | CDNA = '/home/cmb-panasas2/skchoudh/genomes/hg19/kallisto/hg19'
GENOMES_DIR='/home/cmb-panasas2/skchoudh/genomes'
OUT_DIR = '/home/cmb-panasas2/skchoudh/HuR_results/human/rna_seq_star_hg38_annotated'
SRC_DIR = '/home/cmb-panasas2/skchoudh/github_projects/clip_seq_pipeline/scripts'
RAWDATA_DIR ='/home/cmb-06/as/skchoudh... | CDNA = '/home/cmb-panasas2/skchoudh/genomes/hg19/kallisto/hg19'
GENOMES_DIR='/home/cmb-panasas2/skchoudh/genomes'
OUT_DIR = '/home/cmb-panasas2/skchoudh/HuR_results/analysis/rna_seq_star_hg38_annotated'
RAWDATA_DIR ='/home/cmb-06/as/skchoudh/data/HuR_Mouse_Human_liver/rna-seq/Penalva_L_08182016'
SAMPLES=['HepG2_CTRL1_S... | Python | 0.000001 |
79eb9241ac8ce36b14512287bc473a426db50cf1 | Use elif to make it faster. | Example/Pluton/Plugins/Example/Example.py | Example/Pluton/Plugins/Example/Example.py | import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton
from Pluton import InvItem
from System import *
from UnityEngine import *
class Example:
def On_PlayerConnected(self, player):
for p in Server.ActivePlayers:
if(p.Name != p... | import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton
from Pluton import InvItem
from System import *
from UnityEngine import *
class Example:
def On_PlayerConnected(self, player):
for p in Server.ActivePlayers:
if(p.Name != p... | Python | 0 |
9af1cbe0676ca71edecfa6d44c66690a5a583b01 | Rewrite for clarity | constructive_hierarchy.py | constructive_hierarchy.py | '''Reason about a directed graph in which the (non-)existence of some edges
must be inferred by the disconnectedness of certain vertices. Collect (truthy)
evidence for boolean function return values.'''
def transitive_closure_dict(known_vertices, edges):
'''Find the transitive closure of a dict mapping vertices to... | '''Reason about a directed graph in which the (non-)existence of some edges
must be inferred by the disconnectedness of certain vertices. Collect (truthy)
evidence for boolean function return values.'''
def transitive_closure_dict(vertices, edges):
'''Find the transitive closure of a dict mapping vertices to their... | Python | 0.000008 |
7760d75bb5ca38d2c96924e0ea1d65485cdc5c6f | Update version 0.12.2 -> 0.12.3 | dimod/__init__.py | dimod/__init__.py | # Copyright 2018 D-Wave Systems 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2018 D-Wave Systems 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Python | 0.000001 |
8d72c58ac607f75c0a10ca9b79be9da59907cc7a | Update dev setting | src/server/settings.py | src/server/settings.py | """
Django settings for server project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | """
Django settings for server project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | Python | 0 |
4d983708981029f0c0c5d103f8329427ff824b1f | add user output when generating key pair | conda_build/main_sign.py | conda_build/main_sign.py | # (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... | # (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... | Python | 0.000004 |
00b7cf15877dc17d07d591c893671decb6b869e2 | Enable touch events for smoothness tests. | tools/perf/measurements/smoothness.py | tools/perf/measurements/smoothness.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from metrics import power
from measurements import smoothness_controller
from telemetry.page import page_measurement
class Smoothness(page_measurement.... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from metrics import power
from measurements import smoothness_controller
from telemetry.page import page_measurement
class Smoothness(page_measurement.... | Python | 0.00001 |
afb37f495f32ab03ea1a2b2dff566ae3d20eff5b | fix exception raising in svg2pdf | IPython/nbconvert/transformers/svg2pdf.py | IPython/nbconvert/transformers/svg2pdf.py | """Module containing a transformer that converts outputs in the notebook from
one format to another.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license i... | """Module containing a transformer that converts outputs in the notebook from
one format to another.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license i... | Python | 0.000001 |
cf2004cec6e84cbec213f9e70dd8245327af541d | Update api.py | example/services/api.py | example/services/api.py | # external imports
from nautilus import APIGateway
from graphene import Schema, ObjectType, String, Mutation, Boolean
from nautilus.api import ServiceObjectType
from nautilus.api.fields import Connection
from nautilus.network import dispatchAction
from nautilus.conventions import getCRUDAction
# local imports
from .rec... | # external imports
from nautilus import APIGateway
from graphene import Schema, ObjectType, String, Mutation, Boolean
from nautilus.api import ServiceObjectType
from nautilus.api.fields import Connection
from nautilus.network import dispatchAction
from nautilus.conventions import getCRUDAction
# local imports
from .rec... | Python | 0.000001 |
c4b83c9554ca0f501ac42c63a53394ff8b90c2af | bump version to 20190807 | acbs/__init__.py | acbs/__init__.py | __version__ = '20190807'
| __version__ = '20181007'
| Python | 0 |
ec831928b9e065b523eae2621f51091a8e332c71 | Be more verbose | pissuu/api.py | pissuu/api.py | import requests
import md5
import json
class IssuuAPI(object):
def __init__(self, key, secret):
"""
Initialize an API client with the given ``key`` and ``secret``.
"""
self.key = key
self.secret = secret
def add_bookmark(self):
"""
Add a bookmark.
... | import requests
import md5
import json
class IssuuAPI(object):
def __init__(self, key, secret):
"""
Initialize an API client with the given ``key`` and ``secret``.
"""
self.key = key
self.secret = secret
def add_bookmark(self):
"""
Add a bookmark.
... | Python | 0.999847 |
2b20e803733db09ad4643be00b2af11ecea1eeb8 | Increase version to 0.11.0 (#394) | opsdroid/const.py | opsdroid/const.py | """Constants used by OpsDroid."""
import os
__version__ = "0.11.0"
DEFAULT_GIT_URL = "https://github.com/opsdroid/"
MODULES_DIRECTORY = "opsdroid-modules"
DEFAULT_ROOT_PATH = os.path.expanduser("~/.opsdroid")
DEFAULT_LOG_FILENAME = os.path.join(DEFAULT_ROOT_PATH, 'output.log')
DEFAULT_MODULES_PATH = os.path.join(DEFA... | """Constants used by OpsDroid."""
import os
__version__ = "0.10.0"
DEFAULT_GIT_URL = "https://github.com/opsdroid/"
MODULES_DIRECTORY = "opsdroid-modules"
DEFAULT_ROOT_PATH = os.path.expanduser("~/.opsdroid")
DEFAULT_LOG_FILENAME = os.path.join(DEFAULT_ROOT_PATH, 'output.log')
DEFAULT_MODULES_PATH = os.path.join(DEFA... | Python | 0 |
5f43ac2dbca1caba21b2d6f4afbc798323a0d79f | Clear memory more actively | osmhm/__init__.py | osmhm/__init__.py | import fetch
import filters
import inserts
import tables
import config
import send_notification
def run(time_type='hour', history=False, suspicious=False, monitor=True,
notification=False, notifier=send_notification.send_mail):
"""
"""
import osmhm
import osmdt
import datetime
import t... | import fetch
import filters
import inserts
import tables
import config
import send_notification
def run(time_type='hour', history=False, suspicious=False, monitor=True,
notification=False, notifier=send_notification.send_mail):
"""
"""
import osmhm
import osmdt
import datetime
import t... | Python | 0 |
8f4f1e8cc45daa8cf49f050200ce17a48f008e5a | Fix process entity migration | resolwe/flow/migrations/0023_process_entity_2.py | resolwe/flow/migrations/0023_process_entity_2.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-01 03:15
from __future__ import unicode_literals
from django.db import migrations
def migrate_flow_collection(apps, schema_editor):
"""Migrate 'flow_collection' field to 'entity_type'."""
Process = apps.get_model('flow', 'Process')
Descript... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-01 03:15
from __future__ import unicode_literals
from django.db import migrations
def migrate_flow_collection(apps, schema_editor):
"""Migrate 'flow_collection' field to 'entity_type'."""
Process = apps.get_model('flow', 'Process')
Descript... | Python | 0.000006 |
21b453946bfa35c7730d5ab15e62b48d299170ed | Update password loading test | osfclient/tests/test_listing.py | osfclient/tests/test_listing.py | """Test `osf ls` command"""
from unittest import mock
from unittest.mock import patch, MagicMock, PropertyMock, mock_open
from osfclient import OSF
from osfclient.cli import list_
from osfclient.tests.mocks import MockProject
@patch('osfclient.cli.OSF')
def test_anonymous_doesnt_use_password(MockOSF):
args = M... | """Test `osf ls` command"""
from unittest import mock
from unittest.mock import patch, MagicMock, PropertyMock, mock_open
from osfclient import OSF
from osfclient.cli import list_
from osfclient.tests.mocks import MockProject
@patch('osfclient.cli.OSF')
def test_anonymous_doesnt_use_password(MockOSF):
args = M... | Python | 0 |
e9060c166987a18aa9faf3b790b80135b319ecca | Update example.py | libs/python/example.py | libs/python/example.py | #!/usr/bin/env python
import postscriptbarcode
c=postscriptbarcode.BWIPP("../../build/monolithic_package/barcode.ps")
c.get_version()
| #!/usr/bin/env python
import postscriptbarcode
c=postscriptbarcode.BWIPP("../barcode.ps")
c.get_version()
| Python | 0.000001 |
068a94a455448b3fc2ee552616658d9f980104ea | Add comment. | numpy/distutils/command/bdist_rpm.py | numpy/distutils/command/bdist_rpm.py | import os
import sys
from distutils.command.bdist_rpm import bdist_rpm as old_bdist_rpm
class bdist_rpm(old_bdist_rpm):
def _make_spec_file(self):
spec_file = old_bdist_rpm._make_spec_file(self)
# Replace hardcoded setup.py script name
# with the real setup script name.
setup_py =... | import os
import sys
from distutils.command.bdist_rpm import bdist_rpm as old_bdist_rpm
class bdist_rpm(old_bdist_rpm):
def _make_spec_file(self):
spec_file = old_bdist_rpm._make_spec_file(self)
setup_py = os.path.basename(sys.argv[0])
if setup_py == 'setup.py':
return spec_fil... | Python | 0.000001 |
6af3eacec303abfe6f260581687a38d89f7b7474 | Fix wavelength issue for QE65000 | oceanoptics/spectrometers/QE65xxx.py | oceanoptics/spectrometers/QE65xxx.py | # tested
# ----------------------------------------------------------
from oceanoptics.base import OceanOpticsBase as _OOBase
from oceanoptics.base import OceanOpticsTEC as _OOTEC
import struct
#----------------------------------------------------------
class _QE65xxx(_OOBase, _OOTEC):
def _set_integration_time(... | # tested
# ----------------------------------------------------------
from oceanoptics.base import OceanOpticsBase as _OOBase
from oceanoptics.base import OceanOpticsTEC as _OOTEC
import struct
#----------------------------------------------------------
class _QE65xxx(_OOBase, _OOTEC):
def _set_integration_time(... | Python | 0.000001 |
7655ba80da745ef2491a7ef872683620d6328304 | Disable verbose logging by default | designateclient/shell.py | designateclient/shell.py | # Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | Python | 0.000001 |
ba81c1d04a9896f1e24ca43592b93b26047705ef | Clean up command output | openstackclient/compute/v2/server.py | openstackclient/compute/v2/server.py | # Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | # Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | Python | 0.999995 |
56ac633029c9d7ef40415e1881d2cb3c18c83d7b | Bump to version 0.17.1 | ckanny/__init__.py | ckanny/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanny
~~~~~~
Miscellaneous CKAN utility scripts
Examples:
literal blocks::
python example_google.py
Attributes:
module_level_variable1 (int): Module level variables may be documented in
"""
from __future__ import (
absolute_import, divisi... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanny
~~~~~~
Miscellaneous CKAN utility scripts
Examples:
literal blocks::
python example_google.py
Attributes:
module_level_variable1 (int): Module level variables may be documented in
"""
from __future__ import (
absolute_import, divisi... | Python | 0 |
20ffbab08c244ec788e8a6114ccdbf38e39d97b6 | Fix unclassifiable problem | classifier/demo.py | classifier/demo.py | """
This is a demo about how to use LibLINEAR to do the prediction
==============================================================
Usage: python demo.py
Author: Wenjun Wang
Date: June 18, 2015
"""
import pickle
import datetime
from liblinearutil import *
from feature import convert_query
# Read training file
#y, x ... | """
This is a demo about how to use LibLINEAR to do the prediction
==============================================================
Usage: python demo.py
Author: Wenjun Wang
Date: June 18, 2015
"""
import pickle
import datetime
from liblinearutil import *
from feature import convert_query
# Read training file
#y, x ... | Python | 0.999999 |
6c1f487aa7ac472fc7f726b21d26c841625b176d | Edit feed content | routes.py | routes.py | from flask import Flask, render_template, redirect, url_for, request, session,\
flash, jsonify
from werkzeug.contrib.atom import AtomFeed
import os
import psycopg2
from functools import wraps
import urlparse
import datetime
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
def connectDB(wrapped):
... | from flask import Flask, render_template, redirect, url_for, request, session,\
flash, jsonify
from werkzeug.contrib.atom import AtomFeed
import os
import psycopg2
from functools import wraps
import urlparse
import datetime
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
def connectDB(wrapped):
... | Python | 0.000001 |
da31be1c27c7568fa50c89f28b04ad763481f541 | Remove unused import | rparse.py | rparse.py | #!/usr/bin/env python
# Copyright 2015, Dmitry Veselov
from plyplus import Grammar, STransformer, \
ParseError, TokenizeError
try:
# Python 2.x and pypy
from itertools import imap as map
from itertools import ifilter as filter
except ImportError:
# Python 3.x already have lazy map
... | #!/usr/bin/env python
# Copyright 2015, Dmitry Veselov
from re import sub
from plyplus import Grammar, STransformer, \
ParseError, TokenizeError
try:
# Python 2.x and pypy
from itertools import imap as map
from itertools import ifilter as filter
except ImportError:
# Python 3.x alrea... | Python | 0.000001 |
c3951f942633438e91e43b523a814bf1a3528295 | Add impl to analyzer. | analyze.py | analyze.py | #!/bin/python
from __future__ import print_function, division
import cv
import cv2
import argparse
import preprocess
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="""Analyze shogi board state in a photo""",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parse... | #!/bin/python
from __future__ import print_function, division
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="""Analyze shogi board state in a photo""",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
args = parser.parse_args()
| Python | 0 |
6c2adf0ff9f5026a4280b3e374429dcb7ef48dce | Enable using script directly | openfisca_web_api_preview/scripts/serve.py | openfisca_web_api_preview/scripts/serve.py | # -*- coding: utf-8 -*-
import sys
import imp
import os.path
import logging
import argparse
from gunicorn.app.base import BaseApplication
from gunicorn.six import iteritems
from gunicorn import config
from openfisca_core.scripts import add_minimal_tax_benefit_system_arguments
from openfisca_web_api_preview.app impor... | # -*- coding: utf-8 -*-
import sys
import imp
import os.path
import logging
import argparse
from gunicorn.app.base import BaseApplication
from gunicorn.six import iteritems
from gunicorn import config
from openfisca_core.scripts import add_minimal_tax_benefit_system_arguments
from ..app import create_app
from imp im... | Python | 0 |
b5b40dc232b04a2cfa75438bb5143ffdb103a57c | split a method | AlphaTwirl/EventReader/ProgressReporter.py | AlphaTwirl/EventReader/ProgressReporter.py | # Tai Sakuma <sakuma@fnal.gov>
import multiprocessing
import time
from ProgressReport import ProgressReport
##____________________________________________________________________________||
class ProgressReporter(object):
def __init__(self, queue, pernevents = 1000):
self.queue = queue
self.perneve... | # Tai Sakuma <sakuma@fnal.gov>
import multiprocessing
import time
from ProgressReport import ProgressReport
##____________________________________________________________________________||
class ProgressReporter(object):
def __init__(self, queue, pernevents = 1000):
self.queue = queue
self.perneve... | Python | 0.999953 |
6cc803f68876689629fa2c2bae1413d46a0d2002 | Update different-ways-to-add-parentheses.py | Python/different-ways-to-add-parentheses.py | Python/different-ways-to-add-parentheses.py | # Time: O(4^n / n^(3/2)) ~= Catalan numbers = C(2n, n) - C(2n, n - 1)
# Space: O(n^2 * 4^n / n^(3/2))
#
# Given a string of numbers and operators, return all possible
# results from computing all the different possible ways to
# group numbers and operators. The valid operators are +, - and *.
#
#
# Example 1
# Input: ... | # Time: O(n * 4^n / n^(3/2)) ~= n * (Catalan numbers) = n * (C(2n, n) - C(2n, n - 1))
# Space: O(n^2 * 4^n / n^(3/2))
#
# Given a string of numbers and operators, return all possible
# results from computing all the different possible ways to
# group numbers and operators. The valid operators are +, - and *.
#
#
# Exa... | Python | 0.000014 |
ec013d194e2b26155949bf89a5cd03ef4a013cc5 | Add import unicode on csv_importer | passpie/importers/csv_importer.py | passpie/importers/csv_importer.py | import csv
from passpie.importers import BaseImporter
from passpie._compat import is_python2, unicode
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
for row in csv_reader:
if is_python2():
yield [unicode(cell, '... | import csv
from passpie.importers import BaseImporter
from passpie._compat import is_python2
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
for row in csv_reader:
if is_python2():
yield [unicode(cell, 'utf-8') f... | Python | 0.000004 |
8e536e4911ab18a5ac6e2e018fa041425a57a14b | Update serializers.py | website/serializers.py | website/serializers.py | from website.models import Issue, User , UserProfile,Points, Domain
from rest_framework import routers, serializers, viewsets, filters
import django_filters
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id','username')
class IssueSerializer(serializers.Mode... | from website.models import Issue, User , UserProfile,Points, Domain
from rest_framework import routers, serializers, viewsets, filters
import django_filters
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id','username')
class IssueSerializer(serializers.Mode... | Python | 0 |
936d16449ae8e40435258f79bbb14f4d47c96f02 | Fix bug in neonlogger using stdout for stderr. | src/opencmiss/neon/core/neonlogger.py | src/opencmiss/neon/core/neonlogger.py | '''
Copyright 2015 University of Auckland
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 agre... | '''
Copyright 2015 University of Auckland
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 agre... | Python | 0 |
6f0c05ee4743528550dd083d9290b5be0074ff0e | Add commands args to runner and improve docs in it | runner.py | runner.py | import argparse
import sys
from vsut.unit import CSVFormatter, TableFormatter, Unit
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Runs unit tests.")
parser.add_argument('units', metavar='Unit', type=str, nargs='+')
parser.add_argument(
'--format', help="Default: table; De... | import sys
from vsut.unit import CSVFormatter, TableFormatter
if __name__ == "__main__":
for i in range(1, len(sys.argv)):
try:
modName = sys.argv[i].split(".")[0:-1]
modName = ".".join(modName)
className = sys.argv[i].split(".")[-1]
module = __import__(modN... | Python | 0 |
553cd68fb5d54be6ecbf3ca93c6d6c6be75afdb5 | Add EveLinkCache to evelink.appengine | evelink/appengine/__init__.py | evelink/appengine/__init__.py | from evelink.appengine.api import AppEngineAPI
from evelink.appengine.api import AppEngineCache
from evelink.appengine.api import AppEngineDatastoreCache
from evelink.appengine.api import EveLinkCache
from evelink.appengine import account
from evelink.appengine import char
from evelink.appengine import corp
from evelin... | from evelink.appengine.api import AppEngineAPI
from evelink.appengine.api import AppEngineCache
from evelink.appengine.api import AppEngineDatastoreCache
from evelink.appengine import account
from evelink.appengine import char
from evelink.appengine import corp
from evelink.appengine import eve
from evelink.appengine i... | Python | 0.000001 |
68c4f723f5eea2802209862d323825f33a445154 | Fix url id to pk. | eventex/subscriptions/urls.py | eventex/subscriptions/urls.py | from django.urls import path
import eventex.subscriptions.views as s
app_name = 'subscriptions'
urlpatterns = [
path('', s.new, name='new'),
path('<int:pk>/', s.detail, name='detail'),
path('json/donut/', s.paid_list_json, name='paid_list_json'),
path('json/column/', s.paid_column_json, name='paid_c... | from django.urls import path
import eventex.subscriptions.views as s
app_name = 'subscriptions'
urlpatterns = [
path('', s.new, name='new'),
path('<int:id>/', s.detail, name='detail'),
path('json/donut/', s.paid_list_json, name='paid_list_json'),
path('json/column/', s.paid_column_json, name='paid_c... | Python | 0.000001 |
127e5ae02932af67c6157939cff6ab388c89c677 | convert process_attr to a parameter in contructor so extending the class is not needed | scrapy/trunk/scrapy/contrib_exp/link/__init__.py | scrapy/trunk/scrapy/contrib_exp/link/__init__.py | from HTMLParser import HTMLParser
from scrapy.link import Link
from scrapy.utils.python import unique as unique_list
from scrapy.utils.url import safe_url_string, urljoin_rfc as urljoin
class LinkExtractor(HTMLParser):
"""LinkExtractor are used to extract links from web pages. They are
instantiated and later... | from HTMLParser import HTMLParser
from scrapy.link import Link
from scrapy.utils.python import unique as unique_list
from scrapy.utils.url import safe_url_string, urljoin_rfc as urljoin
class LinkExtractor(HTMLParser):
"""LinkExtractor are used to extract links from web pages. They are
instantiated and later... | Python | 0.000002 |
ca625e22cb397905f859c826c6507b3977665a51 | Fix import | examples/cifar10_ror.py | examples/cifar10_ror.py | '''
Trains a Residual-of-Residual Network (WRN-40-2) model on the CIFAR-10 Dataset.
Gets a 94.53% accuracy score after 150 epochs.
'''
import numpy as np
import sklearn.metrics as metrics
import keras.callbacks as callbacks
import keras.utils.np_utils as kutils
from keras.datasets import cifar10
from keras.preprocess... | '''
Trains a Residual-of-Residual Network (WRN-40-2) model on the CIFAR-10 Dataset.
Gets a 94.53% accuracy score after 150 epochs.
'''
import numpy as np
import sklearn.metrics as metrics
import keras.callbacks as callbacks
import keras.utils.np_utils as kutils
from keras.datasets import cifar10
from keras.preprocess... | Python | 0 |
d458fb855df77dfb553ee3e95a8201f58aba169e | Increment version number | clippercard/__init__.py | clippercard/__init__.py | """
Copyright (c) 2012-2017 (https://github.com/clippercard/clippercard-python)
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,... | """
Copyright (c) 2012-2017 (https://github.com/clippercard/clippercard-python)
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,... | Python | 0.000021 |
6e663d4010f9a79d2816a212e504773a1745a8e6 | Fix project name! | src/txkube/__init__.py | src/txkube/__init__.py | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
A Kubernetes client.
"""
__all__ = [
"version",
"IKubernetesClient",
"network_client", "memory_client",
]
from incremental import Version
from ._metadata import version_tuple as _version_tuple
version = Version("txkube", *_version_t... | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
A Kubernetes client.
"""
__all__ = [
"version",
"IKubernetesClient",
"network_client", "memory_client",
]
from incremental import Version
from ._metadata import version_tuple as _version_tuple
version = Version("pykube", *_version_t... | Python | 0 |
15faef8beb415211a04fd6dca976158343d8f77f | add abc to guid, fixed issues | user_profile/models.py | user_profile/models.py | from django.db import models
from django.contrib.auth.models import User
import uuid
# Create your models here.
# using the guid model
from framework.models import GUIDModel
class Profile(GUIDModel):
author = models.ForeignKey(User)
display_name = models.CharField(max_length=55)
def as_dict(self):
... | from django.db import models
from django.contrib.auth.models import User
import uuid
# Create your models here.
# using the guid model
from framework.models import GUIDModel
class Profile(GUIDModel):
author = models.ForeignKey(User)
display_name = models.CharField(max_length=55)
# guid
guid = models... | Python | 0.000231 |
127ad982617c2376c9378d1ef7e50b716a077428 | Replace imp with __import__ | dm_root.py | dm_root.py | #!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# TR-069 has mandatory attribute names that don't comply with policy
#pylint: disable-msg=C6409
#pylint: disable-msg=W0404
#
"""The Device Model root, allowing specific platforms to populate it."""
__author__ = 'dgentry@google.com (Denton Gentry)'
... | #!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# TR-069 has mandatory attribute names that don't comply with policy
#pylint: disable-msg=C6409
#pylint: disable-msg=W0404
#
"""The Device Model root, allowing specific platforms to populate it."""
__author__ = 'dgentry@google.com (Denton Gentry)'
... | Python | 0.000617 |
8233f9c312955d56dff2fc80aed71dae6af910be | Check for None repos, in case of bad configuration file | do/main.py | do/main.py | # -*- coding: utf-8 -*-
""" DO!
I can do things thanks to Python, YAML configurations and Docker
NOTE: the command check does nothing
"""
from do.project import project_configuration, apply_variables
from do.gitter import clone, upstream
from do.builds import find_and_build
from do.utils.logs import get_logger
log... | # -*- coding: utf-8 -*-
""" DO!
I can do things thanks to Python, YAML configurations and Docker
NOTE: the command check does nothing
"""
from do.project import project_configuration, apply_variables
from do.gitter import clone, upstream
from do.builds import find_and_build
from do.utils.logs import get_logger
log... | Python | 0 |
e784227ae5da242d474bc02209289e1dabd2d3a2 | Test Spectral Reconstruction on Sin Wave | utils/spectral_test.py | utils/spectral_test.py | # Lint as: python3
"""Tests for spectral."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import os
import spectral
class SpectralTest(tf.test.TestCase):
def test_waveform_to_spectogram_shape(self):
... | # Lint as: python3
"""Tests for spectral."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import os
import spectral
class SpectralTest(tf.test.TestCase):
def test_waveform_to_spectogram_shape(self):
... | Python | 0 |
05939b0b797780ac1d265c8415f72f1ca44be53d | Modify return tag search data with tag_name | coco/dashboard/views.py | coco/dashboard/views.py | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from posts.models import Post, Tag
@login_required
def index(request):
context = {'posts': Post.objects.all()}
return render(request, 'dashboard/index.html', context)
@login_required
def tagg... | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from posts.models import Post, Tag
@login_required
def index(request):
context = {'posts': Post.objects.all()}
return render(request, 'dashboard/index.html', context)
@login_required
def tagg... | Python | 0.000001 |
d0de5476580b466d7b13cfc7668c267e62cb15f0 | create 32 bit integer var, not 64 (to allow test with NETCDF4_CLASSIC) | examples/mpi_example.py | examples/mpi_example.py | # to run: mpirun -np 4 python mpi_example.py
from mpi4py import MPI
import numpy as np
from netCDF4 import Dataset
rank = MPI.COMM_WORLD.rank # The process ID (integer 0-3 for 4-process run)
nc = Dataset('parallel_test.nc', 'w', parallel=True, comm=MPI.COMM_WORLD,
info=MPI.Info(),format='NETCDF4_CLASSIC')
# be... | # to run: mpirun -np 4 python mpi_example.py
from mpi4py import MPI
import numpy as np
from netCDF4 import Dataset
rank = MPI.COMM_WORLD.rank # The process ID (integer 0-3 for 4-process run)
nc = Dataset('parallel_test.nc', 'w', parallel=True, comm=MPI.COMM_WORLD,
info=MPI.Info(),format='NETCDF4_CLASSIC')
# be... | Python | 0 |
a53fae5b42e9b33774650e017967b865552870e9 | tag v0.7.4 | unihan_tabular/__about__.py | unihan_tabular/__about__.py | __title__ = 'unihan-tabular'
__package_name__ = 'unihan_tabular'
__description__ = 'Export UNIHAN to Python, Data Package, CSV, JSON and YAML'
__version__ = '0.7.4'
__author__ = 'Tony Narlock'
__email__ = 'cihai@git-pull.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013-2017 Tony Narlock'
| __title__ = 'unihan-tabular'
__package_name__ = 'unihan_tabular'
__description__ = 'Export UNIHAN to Python, Data Package, CSV, JSON and YAML'
__version__ = '0.7.3'
__author__ = 'Tony Narlock'
__email__ = 'cihai@git-pull.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013-2017 Tony Narlock'
| Python | 0.000001 |
4420892ad3e8c1797753e7893772e53785efb570 | add logfile handling | updatebot/cmdline/simple.py | updatebot/cmdline/simple.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | Python | 0.000001 |
4ffa2483021b360eb7460bfcf1d845712806390b | Move motor ports because our retail EV3 brick's port A doesn't work. | app/ev3.py | app/ev3.py | # See http://ev3dev-lang.readthedocs.org/projects/python-ev3dev/en/stable/index.html
# for API details -- specific Sensor/Motor docs http://www.ev3dev.org/docs/
from time import sleep
from ev3dev.auto import *
# Connect two large motors on output ports A and C
lmotor, rmotor = [LargeMotor(address) for address in (OUTP... | # See http://ev3dev-lang.readthedocs.org/projects/python-ev3dev/en/stable/index.html
# for API details -- specific Sensor/Motor docs http://www.ev3dev.org/docs/
from time import sleep
from ev3dev.auto import *
# Connect two large motors on output ports A and C
lmotor, rmotor = [LargeMotor(address) for address in (OUTP... | Python | 0 |
98cb673b358671211a0aa7fed0725dbb732200d0 | Fix edge cases due to artworkUrl100 being missing | coverpy/coverpy.py | coverpy/coverpy.py | import os
import requests
from . import exceptions
class Result:
""" Parse an API result into an object format. """
def __init__(self, item):
""" Call the list parser. """
self.parse(item)
def parse(self, item):
""" Parse the given list into self variables. """
try:
self.artworkThumb = item['artworkUrl... | import os
import requests
from . import exceptions
class Result:
""" Parse an API result into an object format. """
def __init__(self, item):
""" Call the list parser. """
self.parse(item)
def parse(self, item):
""" Parse the given list into self variables. """
self.artworkThumb = item['artworkUrl100']
... | Python | 0 |
7f0b530db953698e6e923366be6d0d98033e4afb | add description | prontopull.py | prontopull.py | # -*- coding: utf-8 -*-
'''
Pulls data from pronto cycle share. Combine with cron job to
get data over time
'''
from urllib2 import Request, urlopen
import json
from pandas.io.json import json_normalize
import time
url = "https://secure.prontocycleshare.com/data/stations.json"
request = Request(url)
response = urlope... | # -*- coding: utf-8 -*-
from urllib2 import Request, urlopen
import json
from pandas.io.json import json_normalize
import time
#from datetime import datetime
url = "https://secure.prontocycleshare.com/data/stations.json"
request = Request(url)
response = urlopen(request)
data = json.loads(response.read())
df=json_nor... | Python | 0.000004 |
d016e9f2620688bc1059977a12df638393c3fff1 | Bump version | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.1.2'
| __version__ = '2.1.1'
| Python | 0 |
c86e7107d2f9d8079b0010ac100f627f1c34d127 | Update ipc_lista1.2.py | lista1/ipc_lista1.2.py | lista1/ipc_lista1.2.py | #ipc_lista1.2
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número].
number = input("Digite um número: ")
print "O número digitado foi ",number
| #ipc_lista1.2
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número].
number = input("Digite um número: ")
print "O número digitado foi ",number
| Python | 0.000001 |
85432b9509744eadc47c73a21b49f9ea93172c78 | Update ipc_lista1.8.py | lista1/ipc_lista1.8.py | lista1/ipc_lista1.8.py | #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 161531
| #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615
| Python | 0 |
9cad93eb5f04e9f455cec679089d8c8787ce3b04 | Enable appsembler reporting settings | lms/envs/appsembler.py | lms/envs/appsembler.py | import os
import json
from path import path
SERVICE_VARIANT = os.environ.get('SERVICE_VARIANT', None)
CONFIG_ROOT = path('/edx/app/edxapp/') #don't hardcode this in the future
CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else ""
with open(CONFIG_ROOT / CONFIG_PREFIX + 'env.json') as env_file:
ENV_TOK... | import os
import json
from path import path
SERVICE_VARIANT = os.environ.get('SERVICE_VARIANT', None)
CONFIG_ROOT = path('/edx/app/edxapp/') #don't hardcode this in the future
CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else ""
with open(CONFIG_ROOT / CONFIG_PREFIX + 'env.json') as env_file:
ENV_TOK... | Python | 0.000474 |
4315d028f114ae1005f57d33df964be05b2fb8a6 | use bin/penchy_test_job instead of running it directly | docs/commented_sample_job.py | docs/commented_sample_job.py | # A job description is two part: part 1 introduces the involved elements and
# part 2 joins them in a job
# part 1: introduce the elements
# setup job environment
from penchy.jobs import *
# import the configuration file (if needed)
import config
# define a node
node = NodeConfiguratio... | # A job description is two part: part 1 introduces the involved elements and
# part 2 joins them in a job
# part 1: introduce the elements
# setup job environment
from penchy.jobs import *
# define a node
node = NodeConfiguration(
# that is the localhost
'localhost',
# ssh p... | Python | 0 |
927de70d3212c5106846b6f6f6333b93eceacea5 | add python 脚本 | pub-python.py | pub-python.py | # coding=utf8
import paramiko
import datetime
import telnetlib
HOSTS = [
{
'HOST':'hive1_host',
'PORT':9092,
'USER':'root'
},
{
'HOST':'hive2_host',
'PORT':9092,
'USER':'root'
}
]
BASEPATH = '/root/mpush'
class SSH():
def __init__(self):
... | # coding=utf8
import paramiko
import datetime
HOSTS = [
{
'HOST':'hive1_host',
'PORT':9092,
'USER':'root'
},
{
'HOST':'hive2_host',
'PORT':9092,
'USER':'root'
}
]
class SSH():
def __init__(self):
self.client = None
def connect(self,host... | Python | 0.000245 |
9f699f66c1ff14d884157cee358793d715b1e702 | delete print | tests/test_apiserver.py | tests/test_apiserver.py | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
# 测试完成需要手动关闭 API server 和扫描进... | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
# 测试完成需要手动关闭 API server 和扫描进... | Python | 0.000195 |
17d79c5ec4584ea2f1f8b7fe52b157b3988bb7fc | test gap score | tests/test_gap_score.py | tests/test_gap_score.py | """
Using gap score to determine optimal cluster number
"""
import unittest
from unittest import TestCase
from flaky import flaky
import numpy as np
import scipy
from uncurl import gap_score
class GapScoreTest(TestCase):
def setUp(self):
pass
def test_gap_score(self):
data_mat = scipy.io.l... | """
Using gap score to determine optimal cluster number
"""
import unittest
from unittest import TestCase
from flaky import flaky
import numpy as np
import scipy
from uncurl import gap_score
class GapScoreTest(TestCase):
def setUp(self):
pass
def test_gap_score(self):
data_mat = scipy.io.l... | Python | 0.000004 |
3ce54da38119987c2e23089cca3e14a1664cd0c9 | remove dots at the end of description | python2nix.py | python2nix.py | #!/usr/bin/env python2.7
import sys
import requests
import pip_deps
PACKAGE = """\
{name_only} = pythonPackages.buildPythonPackage rec {{
name = "{name}";
propagatedBuildInputs = [ {inputs} ];
src = fetchurl {{
url = "{url}";
md5 = "{md5}";
}};
meta = with stdenv.lib; {{
desc... | #!/usr/bin/env python2.7
import sys
import requests
import pip_deps
PACKAGE = """\
{name_only} = pythonPackages.buildPythonPackage rec {{
name = "{name}";
propagatedBuildInputs = [ {inputs} ];
src = fetchurl {{
url = "{url}";
md5 = "{md5}";
}};
meta = with stdenv.lib; {{
desc... | Python | 0.001447 |
3f0ab3d63ad0a602b3332b9c83c742caae47289a | Fix test for invalid queue class | tests/test_lib_queue.py | tests/test_lib_queue.py | """
This file contains the tests for the job queue modules.
In particular, this tests
lib/queue/*.py
"""
from huey import RedisHuey
import mock
from privacyidea.app import create_app
from privacyidea.config import TestingConfig
from privacyidea.lib.error import ServerError
from privacyidea.lib.queue import job, JOB_C... | """
This file contains the tests for the job queue modules.
In particular, this tests
lib/queue/*.py
"""
from huey import RedisHuey
import mock
from privacyidea.app import create_app
from privacyidea.config import TestingConfig
from privacyidea.lib.error import ServerError
from privacyidea.lib.queue import job, JOB_C... | Python | 0.000001 |
04f7b8aa85bf2bb2c16eb246ee7c9d7ae5fc8cff | check contents | tests/test_roundtrip.py | tests/test_roundtrip.py | import json
import bitjws
def test_encode_decode():
key = bitjws.PrivateKey()
ser = bitjws.sign_serialize(key)
header, payload = bitjws.validate_deserialize(ser)
rawheader, rawpayload = ser.rsplit('.', 1)[0].split('.')
origheader = bitjws.base64url_decode(rawheader.encode('utf8'))
origpayload... | import json
import bitjws
def test_encode_decode():
key = bitjws.PrivateKey()
ser = bitjws.sign_serialize(key)
header, payload = bitjws.validate_deserialize(ser)
rawheader, rawpayload = ser.rsplit('.', 1)[0].split('.')
origheader = bitjws.base64url_decode(rawheader.encode('utf8'))
origpayload... | Python | 0 |
3059e2cf76e2e7bfb90c6c03afc5ee372294de94 | use with_setup instead of setUp/tearDown | tests/test_spotifile.py | tests/test_spotifile.py | from nose import with_setup
import os
from os import path
from subprocess import check_call
from sh import ls, cat
mountpoint = '/tmp/spotifile_test_mount'
def fs_mount():
if not path.exists(mountpoint):
os.mkdir(mountpoint)
check_call(['./spotifile', mountpoint])
def fs_unmount():
check_call(['fusermount', '-... | import unittest
import os
from subprocess import check_call
from sh import ls
mountpoint = '/tmp/spotifile_test_mount'
class SpotifileTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(mountpoint):
os.mkdir(mountpoint)
@classmethod
def tearDownClass(cls):
if os.path.exis... | Python | 0 |
c74faacfc91c8925ced63abda00e7e097903e0f7 | Remove stray print statements. | tests/test_table_xls.py | tests/test_table_xls.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import agate
import agateexcel
class TestXLS(agate.AgateTestCase):
def setUp(self):
self.rows = (
(1, 'a', True, '11/4/2015', '11/4/2015 12:22 PM'),
(2, u'👍'... | #!/usr/bin/env python
# -*- coding: utf8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import agate
import agateexcel
class TestXLS(agate.AgateTestCase):
def setUp(self):
self.rows = (
(1, 'a', True, '11/4/2015', '11/4/2015 12:22 PM'),
(2, u'👍'... | Python | 0.000022 |
7fb5b04bb4054f60cefc79efabcef07979628285 | add directory encoding test in test_conf | tests/unit/test_conf.py | tests/unit/test_conf.py | import os
from twisted.trial import unittest
from lbrynet import conf
class SettingsTest(unittest.TestCase):
def setUp(self):
os.environ['LBRY_TEST'] = 'test_string'
def tearDown(self):
del os.environ['LBRY_TEST']
@staticmethod
def get_mock_config_instance():
settings = {'te... | import os
from twisted.trial import unittest
from lbrynet import conf
class SettingsTest(unittest.TestCase):
def setUp(self):
os.environ['LBRY_TEST'] = 'test_string'
def tearDown(self):
del os.environ['LBRY_TEST']
@staticmethod
def get_mock_config_instance():
settings = {'t... | Python | 0.000001 |
c81393a8de27595f61cffc09fa6fa8352bb54b9c | Return a random set of factors | palindrome-products/palindrome_products.py | palindrome-products/palindrome_products.py | import random
from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pal... | from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pals = defaultdic... | Python | 0.999999 |
a1a261a88667c3066fd9e11e7af4673c1fca1b44 | Add tags! Task name and owner to start. | teuthology/run_tasks.py | teuthology/run_tasks.py | import sys
import logging
from teuthology.sentry import get_client as get_sentry_client
from .config import config as teuth_config
log = logging.getLogger(__name__)
def run_one_task(taskname, **kwargs):
submod = taskname
subtask = 'task'
if '.' in taskname:
(submod, subtask) = taskname.rsplit('.'... | import sys
import logging
from teuthology.sentry import get_client as get_sentry_client
from .config import config as teuth_config
log = logging.getLogger(__name__)
def run_one_task(taskname, **kwargs):
submod = taskname
subtask = 'task'
if '.' in taskname:
(submod, subtask) = taskname.rsplit('.'... | Python | 0 |
45c1446779cbce050573264101b1afe3d7fe42b4 | Update BaseSearchCommand | elasticsearch_django/management/commands/__init__.py | elasticsearch_django/management/commands/__init__.py | # -*- coding: utf-8 -*-
"""Base command for search-related management commands."""
import logging
from django.core.management.base import BaseCommand
from elasticsearch.exceptions import TransportError
logger = logging.getLogger(__name__)
class BaseSearchCommand(BaseCommand):
"""Base class for commands that i... | # -*- coding: utf-8 -*-
"""Base command for search-related management commands."""
import logging
from django.core.management.base import BaseCommand
from elasticsearch.exceptions import TransportError
logger = logging.getLogger(__name__)
class BaseSearchCommand(BaseCommand):
"""Base class for commands that i... | Python | 0.000001 |
15a32b91b36c9deba5a4fc1d8c843a5e044b62c3 | remove unnecessary comments and print statements | tdp_core/mapping_table.py | tdp_core/mapping_table.py | import logging
from . import db
import itertools
_log = logging.getLogger(__name__)
class SQLMappingTable(object):
def __init__(self, mapping, engine):
self.from_idtype = mapping.from_idtype
self.to_idtype = mapping.to_idtype
self._engine = engine
self._query = mapping.query
self._integer_ids =... | import logging
from . import db
import itertools
_log = logging.getLogger(__name__)
class SQLMappingTable(object):
def __init__(self, mapping, engine):
self.from_idtype = mapping.from_idtype
self.to_idtype = mapping.to_idtype
self._engine = engine
self._query = mapping.query
self._integer_ids =... | Python | 0 |
1ce24bd04f4b217e560707bd699bbeb6fe14fe09 | username should be case insensitive | timed/authentication.py | timed/authentication.py | import base64
import functools
import hashlib
import requests
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import SuspiciousOperation
from django.utils.encoding import force_bytes
from mozilla_django_oidc.auth import LOGGER, OIDCAuthenticationBackend
class TimedOID... | import base64
import functools
import hashlib
import requests
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import SuspiciousOperation
from django.utils.encoding import force_bytes
from mozilla_django_oidc.auth import LOGGER, OIDCAuthenticationBackend
class TimedOID... | Python | 0.999949 |
f14c5c9e4a3c7d196421ce3d60ec64fdee4749dd | make arguments consistent | src/redditquery/parse.py | src/redditquery/parse.py | #!/usr/bin/python3
import os
import argparse
def parser():
"""Parses arguments from comman line using argparse.
Parameters"""
# default directory for reddit files
default_directory = os.path.join(os.getcwd(), "data")
parser = argparse.ArgumentParser()
# obligatory
parser.add_argument("mod... | #!/usr/bin/python3
import os
import argparse
def parser():
"""Parses arguments from comman line using argparse.
Parameters"""
# default directory for reddit files
default_directory = os.path.join(os.getcwd(), "data")
parser = argparse.ArgumentParser()
# obligatory
parser.add_argument("mod... | Python | 0.999824 |
60202e6a4b51fb68045ee1df859c0827f5b770e4 | debug info | src/zeit/content/article/edit/body.py | src/zeit/content/article/edit/body.py | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
import gocept.lxml.interfaces
import grokcore.component
import lxml.objectify
import uuid
import z3c.traverser.interfaces
import zeit.content.article.edit.interfaces
import zeit.content.article.interfaces
import zeit.edit.container
import zope.publisher.... | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
import gocept.lxml.interfaces
import grokcore.component
import lxml.objectify
import uuid
import z3c.traverser.interfaces
import zeit.content.article.edit.interfaces
import zeit.content.article.interfaces
import zeit.edit.container
import zope.publisher.... | Python | 0.000001 |
deeb9a1cc773e7af4c539d3f451ab927ecea29ed | Check for uploader | whippersnapper/whippersnapper.py | whippersnapper/whippersnapper.py | #!/usr/bin/env python
import logging
import os
import subprocess
import sys
import time
import yaml
import screenshotter
import uploader
class WhipperSnapper(object):
"""
Implements all screenshot-related logic.
"""
def __init__(self):
if len(sys.argv) != 2:
self.usage()
... | #!/usr/bin/env python
import logging
import os
import subprocess
import sys
import time
import yaml
import screenshotter
import uploader
class WhipperSnapper(object):
"""
Implements all screenshot-related logic.
"""
def __init__(self):
if len(sys.argv) != 2:
self.usage()
... | Python | 0 |
2797797497f4f5ad606764815b334321732bef3b | Rename fibonacci() to fibonacci_recur() | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get nth number of Fibonacci series by recursion."""
if n <= 1... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import print_function
def fibonacci(n):
"""Get nth number of Fibonacci series by recursion."""
if n == 0:
return 0
elif n == 1 or n == 2:
return 1
else:
... | Python | 0.999999 |
0d7dc04a4e0c31924e64f8e2b8ed9da25e2b64ce | Fix PEP8 issues | wikidataeditor/wikidataeditor.py | wikidataeditor/wikidataeditor.py | # encoding=utf8
# @author Dan Michael O. Heggø <danmichaelo@gmail.com>
import requests
import logging
import time
import re
import json
from item import Item
__ver__ = '0.0.1'
logger = logging.getLogger('wikidataeditor')
class Repo:
def __init__(self, user_agent,
api_url='https://www.wikidata.... | # encoding=utf8
# @author Dan Michael O. Heggø <danmichaelo@gmail.com>
__ver__ = '0.0.1'
import requests
import logging
import time
import re
import json
from item import Item
logger = logging.getLogger('wikidataeditor')
class Repo:
def __init__(self, user_agent,
api_url='https://www.wikidata... | Python | 0.000001 |
ec1d0b5673ef0eca398715eb1f48f1a99f427cca | Format detect_targets.py | tools/detect_targets.py | tools/detect_targets.py | #! /usr/bin/env python2
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 applicabl... | #! /usr/bin/env python2
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 applicabl... | Python | 0.000002 |
ebbcce590483a5970268db0c59bae0cec81648ad | Add example commands for the User Preferences api | storyboard/api/v1/user_preferences.py | storyboard/api/v1/user_preferences.py | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 0.000002 |
839ff975b9d3cf29acd9c921e1b7c3722290d98a | Use np.nan_to_num instead of 'if x == 0' in _xlog2x | antropy/utils.py | antropy/utils.py | """Helper functions"""
import numpy as np
from numba import jit
from math import log, floor
all = ['_embed', '_linear_regression', '_log_n', '_xlog2x']
def _embed(x, order=3, delay=1):
"""Time-delay embedding.
Parameters
----------
x : 1d-array
Time series, of shape (n_times)
order : int... | """Helper functions"""
import numpy as np
from numba import jit
from math import log, floor
all = ['_embed', '_linear_regression', '_log_n', '_xlog2x']
def _embed(x, order=3, delay=1):
"""Time-delay embedding.
Parameters
----------
x : 1d-array
Time series, of shape (n_times)
order : int... | Python | 0.000628 |
f0ab4ecbc2e385dd69d644b6f8e4e41cdaa48423 | Add note. | software_engineering/problem_solving/design_patterns/grasp/pattern_pure_fabrication.py | software_engineering/problem_solving/design_patterns/grasp/pattern_pure_fabrication.py | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from helpers.display import Section
from uuid import uuid1
from random import choice
from random import randrange as rr
DEBUG = True ... | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from helpers.display import Section
from uuid import uuid1
from random import choice
from random import randrange as rr
DEBUG = True ... | Python | 0 |
705e7f1d68e4fb6bf37db623869a2c6d623dd9ae | use a pytest fixture for the CommandManager related tests | sunpy/tests/database/test_commands.py | sunpy/tests/database/test_commands.py | from __future__ import absolute_import
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pytest
from sunpy.database.commands import AddEntry, RemoveEntry, EditEntry,\
NoSuchEntryError, CommandManager
from sunpy.database.tables import DatabaseEntry
@pytest.fixture
def session():... | from __future__ import absolute_import
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pytest
from sunpy.database.commands import AddEntry, RemoveEntry, EditEntry,\
NoSuchEntryError, CommandManager
from sunpy.database.tables import DatabaseEntry
@pytest.fixture
def session():... | Python | 0 |
aa278487b4e65da413a217729b852a9c08a090cf | create function headers and change request structure | pagarme/resources/handler_request.py | pagarme/resources/handler_request.py | import requests
TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
def validate_response(pagarme_response):
if pagarme_response.status_code == 200:
return pagarme_response.json()
else:
return error(pagarme_response.json())
def create_temporary_company():
company = request... | import requests
import json
TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
def validate_response(pagarme_response):
if pagarme_response.status_code == 200:
return pagarme_response.json()
else:
return error(pagarme_response.json())
def create_temporary_company():
compan... | Python | 0 |
ca076bbd397edd87fd1a26ee119ac29622868f03 | Fix test | paystackapi/tests/test_bulkcharge.py | paystackapi/tests/test_bulkcharge.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.bulkcharge import BulkCharge
class TestBulkCharge(BaseTestCase):
@httpretty.activate
def test_initiate_bulk_charge(self):
""" Method for testing the initiation of a bulk charge"""
httpretty.register_u... | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.bulkcharge import BulkCharge
class TestBulkCharge(BaseTestCase):
@httpretty.activate
def test_initiate_bulk_charge(self):
""" Method for testing the initiation of a bulk charge"""
httpretty.register_u... | Python | 0.000004 |
c838bee36ac1e68afd5f00630b98f806289f89c8 | Update fetch_metrics.py | perfmetrics/scripts/fetch_metrics.py | perfmetrics/scripts/fetch_metrics.py | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
from gsheet import gsheet
INSTANCE = socket.gethostname()
PERIOD_SEC = 120
# Google sheet worksheets
FIO_WORKSHEET_NAME = 'fio_metrics'
... | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
from gsheet import gsheet
INSTANCE = socket.gethostname()
PERIOD = 120
# Google sheet worksheets
FIO_WORKSHEET_NAME = 'fio_metrics'
VM_W... | Python | 0.000001 |
597ea6bd20c9c1dbca46891d8c2aa12c625da555 | Fix unit tests | Tests/ConsoleWorkerTest.py | Tests/ConsoleWorkerTest.py | from Tank.ConsoleWorker import ConsoleTank
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin
from Tank.Plugins.DataUploader import DataUploaderPlugin
from Tests.ConsoleOnlinePluginTest import FakeConsoleMarkup
from Tests.DataUploaderTest import FakeAPICLient
from Tests.TankTests import FakeOptions
import TankT... | import TankTests
import os
import unittest
from Tank.ConsoleWorker import ConsoleTank
from Tests.TankTests import FakeOptions
from Tank.Plugins.DataUploader import DataUploaderPlugin
from Tests.DataUploaderTest import FakeAPICLient
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin
from Tests.ConsoleOnlinePlugi... | Python | 0.000005 |
8a4d259df272a65f95bacf233dc8654c68f5f54f | add identity coordinate mapping to ToUint8 and ToFloat32 augmentors (#339) | tensorpack/dataflow/imgaug/convert.py | tensorpack/dataflow/imgaug/convert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: convert.py
from .base import ImageAugmentor
from .meta import MapImage
import numpy as np
import cv2
__all__ = ['ColorSpace', 'Grayscale', 'ToUint8', 'ToFloat32']
class ColorSpace(ImageAugmentor):
""" Convert into another colorspace. """
def __init__(se... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: convert.py
from .base import ImageAugmentor
from .meta import MapImage
import numpy as np
import cv2
__all__ = ['ColorSpace', 'Grayscale', 'ToUint8', 'ToFloat32']
class ColorSpace(ImageAugmentor):
""" Convert into another colorspace. """
def __init__(se... | Python | 0 |
1e7a6b0fbbdb57053d3510b67c95c5d7e2fb6b81 | Enable to display accuracy graph | floppy/report_widget.py | floppy/report_widget.py | from floppy.train_configuration import TrainParamServer
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QTabWidget
from PyQt5.QtGui import QPixmap
from PyQt5.QtGui import QPainter
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QPoint
class ReportWidget(QTabWidget):
def __init__(self, *args... | from floppy.train_configuration import TrainParamServer
from PyQt5.QtWidgets import QWidget
from PyQt5.QtGui import QPixmap
from PyQt5.QtGui import QPainter
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QPoint
class ReportWidget(QWidget):
def __init__(self, *args, **kwargs):
super(ReportWidget, s... | Python | 0.000001 |
ec82c7d7181803f577adb1a697ed53fbc42476ca | add goliad health check | plugins/bongo/check-goliad-health.py | plugins/bongo/check-goliad-health.py | #!/usr/bin/env python
from optparse import OptionParser
import socket
import sys
import httplib
import json
PASS = 0
WARNING = 1
FAIL = 2
def get_bongo_host(server, app):
try:
con = httplib.HTTPConnection(server, timeout=45)
con.request("GET","/v2/apps/" + app)
data = con.getresponse()
... | #!/usr/bin/env python
from optparse import OptionParser
import socket
import sys
import httplib
import json
PASS = 0
WARNING = 1
FAIL = 2
def get_bongo_host(server, app):
try:
con = httplib.HTTPConnection(server, timeout=45)
con.request("GET","/v2/apps/" + app)
data = con.getresponse()
... | Python | 0 |
335abb7a4ddeabf9175b522d9336b94b7e32acc0 | Fix incorrect FAIL data. | test/broker/01-connect-anon-denied.py | test/broker/01-connect-anon-denied.py | #!/usr/bin/python
# Test whether an anonymous connection is correctly denied.
import subprocess
import socket
import time
from struct import *
rc = 1
keepalive = 10
connect_packet = pack('!BBH6sBBHH17s', 16, 12+2+17,6,"MQIsdp",3,2,keepalive,17,"connect-anon-test")
connack_packet = pack('!BBBB', 32, 2, 0, 5);
broker... | #!/usr/bin/python
# Test whether an anonymous connection is correctly denied.
import subprocess
import socket
import time
from struct import *
rc = 1
keepalive = 10
connect_packet = pack('!BBH6sBBHH17s', 16, 12+2+17,6,"MQIsdp",3,2,keepalive,17,"connect-anon-test")
connack_packet = pack('!BBBB', 32, 2, 0, 5);
broker... | Python | 0.002419 |
19b6207f6ec2cefa28e79fb10639d1d1f5602d2c | clean up test | app/app/tests.py | app/app/tests.py | import unittest
import transaction
import os
import app
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from pyramid import testing
from .models import DBSession
DEFAULT_WAIT = 5
SCREEN_DUMP_LOCATION = os.path.join(
os.path.dirname(os.path.abspath(__file__)),... | import unittest
import transaction
import os
import app
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from pyramid import testing
from .models import DBSession
DEFAULT_WAIT = 5
SCREEN_DUMP_LOCATION = os.path.join(
os.path.dirname(os.path.abspath(__file__)),... | Python | 0.000001 |
9de0a05d28c83742224c0e708e80b8add198a8a8 | Add user data export for comments | froide/comments/apps.py | froide/comments/apps.py | import json
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
from froide.account.export import regis... | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
account_canceled.connect(cancel_user)
def cancel_... | Python | 0 |
4a201a37318d5eea1e50e0619580a23f37e2e7da | Fix path for boringssl | libwebsockets.gyp | libwebsockets.gyp | {
'targets': [
{
'target_name': 'libwebsockets',
'type': 'static_library',
'standalone_static_library': 1,
'sources': [
'lib/base64-decode.c',
'lib/handshake.c',
'lib/libwebsockets.c',
'lib/service.c',
'lib/pollfd.c',
'lib/output.c',
... | {
'targets': [
{
'target_name': 'libwebsockets',
'type': 'static_library',
'standalone_static_library': 1,
'sources': [
'lib/base64-decode.c',
'lib/handshake.c',
'lib/libwebsockets.c',
'lib/service.c',
'lib/pollfd.c',
'lib/output.c',
... | Python | 0.000013 |
eed4faf3bfe670421e7dc9c3065adbfceef0d2b6 | fix test for heapify | linear_heapify.py | linear_heapify.py | # Building hash in O(n) time and O(1) additional space. Inspired by https://www.youtube.com/watch?v=MiyLo8adrWw
def heapify(a):
for i in range(len(a) // 2, -1, -1):
parent = i
while True:
candidates = [parent, 2 * parent + 1, 2 * parent + 2]
candidates = [e for e in candid... | # Building hash in O(n) time and O(1) additional space. Inspired by https://www.youtube.com/watch?v=MiyLo8adrWw
def heapify(a):
for i in range(len(a) // 2, -1, -1):
parent = i
while True:
candidates = [parent, 2 * parent + 1, 2 * parent + 2]
candidates = [e for e in candid... | Python | 0.000005 |
b113cf82004b608b371d1a249801340f57195587 | add __str__. | linguist/cache.py | linguist/cache.py | # -*- coding: utf-8 -*-
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class CachedTranslation(object):
def __init__(self, **kwargs):
from .models import Translation
self.instances = ['instance', 'translation']
self.fields = Translation._meta.... | # -*- coding: utf-8 -*-
class CachedTranslation(object):
def __init__(self, **kwargs):
from .models import Translation
self.instances = ['instance', 'translation']
self.fields = Translation._meta.get_all_field_names()
self.fields.remove('id')
attrs = self.fields + self.... | Python | 0.000011 |
2466ca9839aaf1b5cfe98312c015a2defea71971 | to 0.1.0 | loris/__init__.py | loris/__init__.py | # __init__.py
__version__ = '0.1.0'
| # __init__.py
__version__ = '0.1.0dev'
| Python | 0.999999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.