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 |
|---|---|---|---|---|---|---|---|
57d9d4fe1b46d9dd45629dc5fc461c0b8c51c5ec | Fix music helper | src/helpers/musicHelper.py | src/helpers/musicHelper.py | import pygame
import os
import sys
sys.path.append(os.path.dirname(__file__) + "/../audios/letters")
pygame.mixer.init()
def play_word(word):
for letter in word:
_play_letter(letter)
def _play_letter(letter):
pygame.mixer.music.load("audios/letters/" + letter.lower() + ".mp3")
pygame.mixer.music... | #import pygame
import os
import sys
import pyglet
sys.path.append(os.path.dirname(__file__) + "/../audios/letters")
pyglet.options['audio'] = ('openal', 'pulse', 'silent')
player = pyglet.media.Player()
#pygame.mixer.init()
def play_file(file_path):
pass
#pygame.mixer.music.load(file_path)
# playAudioLoa... | Python | 0.000003 |
38d96e4ddbe44af8f028dfb29eca17dc8ecd478d | test case for clean module | src/html2latex/__init__.py | src/html2latex/__init__.py | from .html2latex import html2latex
html2latex
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| from .html2latex import html2latex
html2latex
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| Python | 0 |
46f15a00d2324da4b9f12c9168ddda8dddb1b607 | use notebook-style for plot_logistic_path.py (#22536) | examples/linear_model/plot_logistic_path.py | examples/linear_model/plot_logistic_path.py | """
==============================================
Regularization path of L1- Logistic Regression
==============================================
Train l1-penalized logistic regression models on a binary classification
problem derived from the Iris dataset.
The models are ordered from strongest regularized to least r... | """
==============================================
Regularization path of L1- Logistic Regression
==============================================
Train l1-penalized logistic regression models on a binary classification
problem derived from the Iris dataset.
The models are ordered from strongest regularized to least r... | Python | 0 |
fd6899578bc8e6149921998d42be383f21adbe9a | add plots | examples/tf/bench_run_times/plot_results.py | examples/tf/bench_run_times/plot_results.py | import numpy as np
import matplotlib.pyplot as plt
# factor for 90% coverage with 90% confidence using Normal distribution
# with 10 samples from table XII in [1]
# [1] Montgomery, D. C., & Runger, G. C. (2014). Applied statistics and
# probability for engineers. Sixth edition. John Wiley & Sons.
k = 2.535
amd_fx_run... | import numpy as np
import matplotlib.pyplot as plt
amd_fx_run_times = np.load('amd_fx_8350_titanXP/6_break_times.npy')
n = np.load('amd_fx_8350_titanXP/n.npy') | Python | 0.000001 |
d1a69904ba1d8072988aeb330157dbff20d0c5de | Remove unneeded self.client. | cred/test/util.py | cred/test/util.py | import os
import tempfile
import json
from functools import wraps
import flask.ext.testing
import flask.ext.sqlalchemy
import cred.database
from cred.app import app, api
from cred.routes import create_api_resources
# Constants used throughout the test suites
DEVICE = 'Thermostat'
LOCATION = 'Living Room'
EVENTS = ['T... | import os
import tempfile
import json
from functools import wraps
import flask.ext.testing
import flask.ext.sqlalchemy
import cred.database
from cred.app import app, api
from cred.routes import create_api_resources
# Constants used throughout the test suites
DEVICE = 'Thermostat'
LOCATION = 'Living Room'
EVENTS = ['T... | Python | 0 |
064802e0354cd9d27a7ea0d1c69a45baf0587c63 | add pool example | redisext/pool.py | redisext/pool.py | '''
Pool
----
.. autoclass:: Pool
:members:
The simpliest example of pool usage is token pool::
class TokenPool(Connection, redisext.pool.Pool):
SERIALIZER = redisext.serializer.String
and this pool could be used like::
>>> facebook = TokenPool('facebook')
>>> facebook.push('fb1')
True
>>> ... | '''
Pool
^^^^
.. autoclass:: Pool
:members:
SortedSet
^^^^^^^^^
.. autoclass:: SortedSet
:members:
'''
from __future__ import absolute_import
import redisext.models.abc
class Pool(redisext.models.abc.Model):
def pop(self):
item = self.connect_to_master().spop(self.key)
return self.decod... | Python | 0 |
e5ed6ef0c201d9a29c5934e3687abec7e13ae551 | update models to use a hashids for naming files | api/models.py | api/models.py | """
This file represents the models for the api app.
"""
from django.db import models
from .utils import get_file_upload_path, generate_uid
class DateMixin(models.Model):
"""A model mixin for date creation."""
created = models.DateField(auto_now_add=True)
class File(DateMixin):
"""This class represents... | """
This file represents the models for the api app.
"""
from django.db import models
class DateMixin(models.Model):
"""A model mixin for date creation."""
created = models.DateField(auto_now_add=True)
class File(DateMixin):
"""This class represents the file model."""
name = models.CharField(max_l... | Python | 0 |
9e82515ca1eeb6376947ae653ee375146c95016c | Fix EE API interface | dcos_test_utils/enterprise.py | dcos_test_utils/enterprise.py | import logging
import os
from dcos_test_utils import dcos_api_session, helpers, iam
log = logging.getLogger(__name__)
class MesosNodeClientMixin:
""" This Mixin allows any request to be made against a master or agent
mesos HTTP port by providing the keyword 'mesos_node'. Thus, the user
does not have to ... | import logging
import os
from dcos_test_utils import dcos_api_session, helpers, iam
log = logging.getLogger(__name__)
class MesosNodeClientMixin:
""" This Mixin allows any request to be made against a master or agent
mesos HTTP port by providing the keyword 'mesos_node'. Thus, the user
does not have to ... | Python | 0.000143 |
6e2515f4db3b6b9913e252cd52237574002637f2 | Add missing user_id in revoke_certs_by_user_and_project() | nova/cert/manager.py | nova/cert/manager.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | Python | 0.999994 |
b45ce22e0d688e5c2a9a56f5eb87744cea87a263 | Fix scimath.power for negative integer input. | numpy/lib/scimath.py | numpy/lib/scimath.py | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
"""
__all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
'arcsin', 'arctanh']
import numpy.core.numeric as nx
import nu... | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
"""
__all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
'arcsin', 'arctanh']
import numpy.core.numeric as nx
import nu... | Python | 0.999999 |
3c299bf2682a9b8d5be2c9c8f308720182935d12 | Add missing username to log statement | accounts/tasks.py | accounts/tasks.py | import logging
from celery import task
from django.db import IntegrityError
from django.utils.text import slugify
import games.models
from accounts.models import User
from emails.messages import send_daily_mod_mail
from games.util.steam import create_game
LOGGER = logging.getLogger()
@task
def sync_steam_library(u... | import logging
from celery import task
from django.db import IntegrityError
from django.utils.text import slugify
import games.models
from accounts.models import User
from emails.messages import send_daily_mod_mail
from games.util.steam import create_game
LOGGER = logging.getLogger()
@task
def sync_steam_library(u... | Python | 0.000006 |
3b6d5fd80eb4d95679b969e8809b154d6254de8d | Replace get_user_profile_by_email with get_user. | zerver/management/commands/bankrupt_users.py | zerver/management/commands/bankrupt_users.py | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import CommandError
from zerver.lib.actions import do_update_message_flags
from zerver.lib.management import ZulipBaseCommand
from zerver.models imp... | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_update_message_flags
from zerver.models import UserProfile, Message, get_user_profile_by_email
... | Python | 0.000007 |
3135bda8970a2fdefa92b932c15cf5c559392c9c | allow to specify db session callable directly | ziggurat_foundations/ext/pyramid/get_user.py | ziggurat_foundations/ext/pyramid/get_user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import importlib
import logging
from ziggurat_foundations.models.base import get_db_session
from ziggurat_foundations.models.services.user import UserService
CONFIG_KEY = "ziggurat_foundations"
log = logging.getLogger(__name__)
def includeme(config):
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import importlib
import logging
from ziggurat_foundations.models.base import get_db_session
from ziggurat_foundations.models.services.user import UserService
CONFIG_KEY = "ziggurat_foundations"
log = logging.getLogger(__name__)
def includeme(config):
... | Python | 0 |
07def114287bc3488e76e2516ca7682954ba4a09 | Use default alphabet | APITaxi/extensions.py | APITaxi/extensions.py | #coding: utf-8
from flask_sqlalchemy import SQLAlchemy as BaseSQLAlchemy
from sqlalchemy.pool import QueuePool as BaseQueuePool
class SQLAlchemy(BaseSQLAlchemy):
def apply_driver_hacks(self, app, info, options):
BaseSQLAlchemy.apply_driver_hacks(self, app, info, options)
class QueuePool(BaseQueueP... | #coding: utf-8
from flask_sqlalchemy import SQLAlchemy as BaseSQLAlchemy
from sqlalchemy.pool import QueuePool as BaseQueuePool
class SQLAlchemy(BaseSQLAlchemy):
def apply_driver_hacks(self, app, info, options):
BaseSQLAlchemy.apply_driver_hacks(self, app, info, options)
class QueuePool(BaseQueueP... | Python | 0.000652 |
9f500668555292add5d87c942e0cd804aefa6df2 | Replace cat usage for fgrep | fuel_health/tests/cloudvalidation/test_disk_space_db.py | fuel_health/tests/cloudvalidation/test_disk_space_db.py | # Copyright 2015 Mirantis, 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 agreed to in writing, s... | # Copyright 2015 Mirantis, 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 agreed to in writing, s... | Python | 0.000003 |
2284f9f944ef72c7e2f6c9a4e93e395b09196719 | modify initial config | golive/management/commands/create_config.py | golive/management/commands/create_config.py | from django.core.management import BaseCommand
from fabric.state import output
import sys
from golive.stacks.stack import StackFactory, Stack
import yaml
class Command(BaseCommand):
help = 'Creates a basic exampe configuration file'
output['stdout'] = False
example = """CONFIG:
PLATFORM: DEDICATED
... | from django.core.management import BaseCommand
from fabric.state import output
import sys
from golive.stacks.stack import StackFactory, Stack
import yaml
class Command(BaseCommand):
help = 'Creates a basic exampe configuration file'
output['stdout'] = False
example = """CONFIG:
PLATFORM: DEDICATED
... | Python | 0.000002 |
bc85dffa594c292094d2aa1f5a456e0a0690ea79 | Remove debug code | grumpy-tools-src/tests/test_grumpy_tools.py | grumpy-tools-src/tests/test_grumpy_tools.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `grumpy_tools` package."""
import tempfile
import unittest
import pytest
from click.testing import CliRunner
from grumpy_tools import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixt... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `grumpy_tools` package."""
import tempfile
import unittest
import pytest
from click.testing import CliRunner
from grumpy_tools import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixt... | Python | 0.000299 |
dc9c5021c022108fd9ca2c87e9064b385abd26cf | Fix style | didyoumean/readme_examples.py | didyoumean/readme_examples.py | # -*- coding: utf-8
"""Code to generate examples in README.md."""
from didyoumean import add_suggestions_to_exception
import sys
def get_exception(code):
"""Helper function to run code and get what it throws."""
try:
exec(code)
except:
return sys.exc_info()
assert False
def main():
... | # -*- coding: utf-8
"""Code to generate examples in README.md."""
from didyoumean import add_suggestions_to_exception
import sys
def get_exception(code):
"""Helper function to run code and get what it throws."""
try:
exec(code)
except:
return sys.exc_info()
assert False
def main():
... | Python | 0.000001 |
f42fdde5404c3025236ad7dcade4b08529e7ce36 | repair Noneuser_bug | app/delete.py | app/delete.py | from .models import User
from . import db
def deletenone():
noneuser=User.query.filter_by(username=None).all()
for user in noneuser:
db.session.delete(user)
db.session.commit()
| from .models import User
from . import db
def deletenone():
noneuser=User.query.filter_by(username=None).all()
for user in noneuser:
db.session.delete(user)
db.session.commit()
| Python | 0.000003 |
9ac03fa54f0134905033f615f6e02804f704b1a0 | Add User and Items | app/models.py | app/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
class User(UserMixin, db.Model):
"""This class represents the user table."""
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.Str... | from app import db
class Bucketlist(db.Model):
"""This class represents the bucketlist table."""
__tablename__ = 'bucketlists'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
date_modifie... | Python | 0 |
c12df9f8f0c73577c122fc65bd11314b7231179c | Add type | test_runner/environments.py | test_runner/environments.py | import logging
import re
import sys
from glanceclient.v1.client import Client as glance_client
from keystoneclient.v2_0.client import Client as keystone_client
from neutronclient.v2_0.client import Client as neutron_client
from novaclient.v1_1 import client as nova_client
from .utils import rand_name
LOG = logging.g... | import logging
import re
import sys
from glanceclient.v1.client import Client as glance_client
from keystoneclient.v2_0.client import Client as keystone_client
from neutronclient.v2_0.client import Client as neutron_client
from novaclient.v1_1 import client as nova_client
from .utils import rand_name
LOG = logging.g... | Python | 0.000003 |
06d71ede1c1feaa597b442f4ead63d2b2e31e715 | fix `trigger` -> `__call__` | chainer/training/triggers/once_trigger.py | chainer/training/triggers/once_trigger.py | class OnceTrigger(object):
"""Trigger based on the starting point of the iteration.
This trigger accepts only once at starting point of the iteration. There
are two ways to specify the starting point: only starting point in whole
iteration or called again when training resumed.
Args:
call... | class OnceTrigger(object):
"""Trigger based on the starting point of the iteration.
This trigger accepts only once at starting point of the iteration. There
are two ways to specify the starting point: only starting point in whole
iteration or called again when training resumed.
Args:
call... | Python | 0.000003 |
ddec6067054cc4408ac174e3ea4ffeca2a962201 | Remove unnecessary assert from view for Notice home. | regulations/views/notice_home.py | regulations/views/notice_home.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from operator import itemgetter
import logging
from django.http import Http404
from django.template.response import TemplateResponse
from django.views.generic.base import View
from regulations.generator.api_reader import ApiReader
from regulations.vie... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from operator import itemgetter
import logging
from django.http import Http404
from django.template.response import TemplateResponse
from django.views.generic.base import View
from regulations.generator.api_reader import ApiReader
from regulations.vie... | Python | 0 |
91946410f14b21e510a104b105a6f5036cc8944f | build updated | python/common/core/globalVariables.py | python/common/core/globalVariables.py | '''
Author: Jason Parks
Created: Apr 22, 2012
Module: common.core.globalVariables
Purpose: to import globalVariables
'''
# Location of Toolset
toolsLocation = 'C:/Users/jason/git/PipelineConstructionSet'
# NOTE!: It is necessary to manually add the above location's
# python directory, i.e-
#
# PYTHONPATH = 'C:/Us... | '''
Author: Jason Parks
Created: Apr 22, 2012
Module: common.core.globalVariables
Purpose: to import globalVariables
'''
# Location of Toolset
toolsLocation = 'C:/Users/jason/git/PipelineConstructionSet'
# NOTE!: It is necessary to manually add the above location's
# python directory, i.e-
#
# PYTHONPATH = 'C:/Us... | Python | 0 |
b0e91b820913c7b46d04f946267903d9785fc2ca | Fix test | experiments/tests/test_counter.py | experiments/tests/test_counter.py | from __future__ import absolute_import
from unittest import TestCase
from experiments import counters
from mock import patch
TEST_KEY = 'CounterTestCase'
class CounterTestCase(TestCase):
def setUp(self):
self.counters = counters.Counters()
self.counters.reset(TEST_KEY)
self.assertEqual(... | from __future__ import absolute_import
from unittest import TestCase
from experiments import counters
from mock import patch
TEST_KEY = 'CounterTestCase'
class CounterTestCase(TestCase):
def setUp(self):
self.counters = counters.Counters()
self.counters.reset(TEST_KEY)
self.assertEqual(... | Python | 0.000004 |
c573263511bcbf0ffe37f538142aedd9064f8ae0 | Remove copying devdata.env as it's only used for the Google API key we've removed | bin/devdata.py | bin/devdata.py | """Download .devdata from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory() as... | """Download .devdata.env from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory(... | Python | 0 |
81b5961cdf4b9ca7e20920eda3c7f76f96a35a9b | Bump version | filer/__init__.py | filer/__init__.py | #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.105' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.105.dev1' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| Python | 0 |
eef9d75a7d019a397d2026612ece76d217747e5b | mark oddity | src/zeit/edit/browser/tests/test_form.py | src/zeit/edit/browser/tests/test_form.py | # Copyright (c) 2012 gocept gmbh & co. kg
# See also LICENSE.txt
from mock import Mock
import zeit.cms.testing
import zeit.edit.browser.form
import zope.formlib.form
import zope.interface
import zope.publisher.browser
import zope.schema
class IExample(zope.interface.Interface):
foo = zope.schema.TextLine(title=... | # Copyright (c) 2012 gocept gmbh & co. kg
# See also LICENSE.txt
from mock import Mock
import zeit.cms.testing
import zeit.edit.browser.form
import zope.formlib.form
import zope.interface
import zope.publisher.browser
import zope.schema
class IExample(zope.interface.Interface):
foo = zope.schema.TextLine(title=... | Python | 0.00151 |
1b94e5564b7940139e56310f18c58999f0c598b2 | validate by casting | filestore/core.py | filestore/core.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from document import Document
from jsonschema import validate as js_validate
from bson import ObjectId
class DatumNotFound(Exception):
pass
def get_datum(col, eid, _DATUM_CACHE, get_spec_hand... | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from document import Document
from jsonschema import validate as js_validate
class DatumNotFound(Exception):
pass
def get_datum(col, eid, _DATUM_CACHE, get_spec_handler, logger):
try:
... | Python | 0.000001 |
0f41838d07c15bb22861e884949306a8498ead58 | Support move | archive_images.py | archive_images.py | #!/usr/bin/env python
"""
Sorts image files by time - copies them into folders by year and month.
Written by Friedrich C. Kischkel.
"""
import os
import re
import shutil
import time
import argparse
IMAGE_FILE = re.compile(r"""\.(jpe?g)|(png)|(tiff?)$""", re.IGNORECASE)
EXIF_TIME_FORMAT = "%Y:%m:%d %H:%M:%S"
def tim... | #!/usr/bin/env python
"""
Sorts image files by time - copies them into folders by year and month.
Written by Friedrich C. Kischkel.
"""
import os
import re
import shutil
import time
import argparse
IMAGE_FILE = re.compile(r"""\.(jpe?g)|(png)|(tiff?)$""", re.IGNORECASE)
EXIF_TIME_FORMAT = "%Y:%m:%d %H:%M:%S"
def tim... | Python | 0 |
22c727e0e38953f3647a8a825b01fcf142c06c64 | Bump version. | armet/_version.py | armet/_version.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 17)
__version__ = '.'.join(map(str, __version_info__))
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 16)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0 |
7a1ddf38db725f0696482a271c32fa297d629316 | Set the version to the next patch release number (in dev mode) | backlog/__init__.py | backlog/__init__.py | __version__ = (0, 2, 2, 'dev', 0)
def get_version():
version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version
| __version__ = (0, 2, 1, '', 0)
def get_version():
version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version
| Python | 0 |
b808784711242099d8fbf9f0f1c7d13ca5a5a1d7 | Bump the version to 0.3.2 | backlog/__init__.py | backlog/__init__.py | """A Simple Note Manager"""
from __future__ import absolute_import
from backlog.backlog import Backlog
__version__ = '0.3.2'
| """A Simple Note Manager"""
from __future__ import absolute_import
from backlog.backlog import Backlog
__version__ = '0.3.1'
| Python | 0.999999 |
d0c6ae0dbb68fad31c5f3e51d934b8c7f5e8534f | Add ability to override issue JQL in runner | jzb/runner.py | jzb/runner.py | from argparse import ArgumentParser
import logging
import sys
import jira
from redis import StrictRedis
import yaml
import zendesk
from jzb import LOG
from jzb.bridge import Bridge
from jzb.util import objectize
def configure_logger(level):
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | from argparse import ArgumentParser
import logging
import sys
import jira
from redis import StrictRedis
import yaml
import zendesk
from jzb import LOG
from jzb.bridge import Bridge
from jzb.util import objectize
def configure_logger(level):
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | Python | 0 |
122b0982d1e10aada383bbd373518d049e54b906 | Prepare for release 0.9pbs.107 | filer/__init__.py | filer/__init__.py | #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.107' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.107.dev1' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| Python | 0 |
fc6694686b5b928580c3e8d682b3b6496b12d006 | Refactor pop method | binary_heap.py | binary_heap.py | from __future__ import unicode_literals
class BinaryHeap(object):
"""A class for a binary heap."""
def __init__(self, iterable=()):
self.tree = []
for val in iterable:
self.push(val)
def __repr__(self):
return repr(self.tree)
def __len__(self):
return len(... | from __future__ import unicode_literals
class BinaryHeap(object):
"""A class for a binary heap."""
def __init__(self, iterable=()):
self.tree = []
for val in iterable:
self.push(val)
def __repr__(self):
return repr(self.tree)
def __len__(self):
return len(... | Python | 0.000001 |
40fc5d12d93d9c258e615b6001070b4fbd04f119 | Add sharding checks | cogs/utils/checks.py | cogs/utils/checks.py | import discord
from discord.ext import commands
# noinspection PyUnresolvedReferences
import __main__
def owner_check(ctx):
return str(ctx.message.author.id) in __main__.liara.owners
def is_owner():
return commands.check(owner_check)
def is_bot_account():
def predicate(ctx):
return ctx.bot.use... | import discord
from discord.ext import commands
# noinspection PyUnresolvedReferences
import __main__
def owner_check(ctx):
return str(ctx.message.author.id) in __main__.liara.owners
def is_owner():
return commands.check(owner_check)
def is_bot_account():
def predicate(ctx):
return ctx.bot.use... | Python | 0 |
4dedbc15c835d02ccde99fb9fad00ed9a590c69e | Add private field to posts | blog/models.py | blog/models.py | import hashlib, random
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import UserMixin, AnonymousUserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from geoalchemy2 import Geometry
db = SQLAlchemy()
class User(db.Model, UserMixin):
__... | import hashlib, random
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import UserMixin, AnonymousUserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from geoalchemy2 import Geometry
db = SQLAlchemy()
class User(db.Model, UserMixin):
__... | Python | 0 |
0b452dca8c517b180df037fafc52f6e2b09811c1 | fix class name | books/forms.py | books/forms.py | from django.forms import ModelForm
from .models import BookReader, User
class UserForm(ModelForm):
class Meta:
model = User
class BookReaderForm(ModelForm):
class Meta:
model = BookReader
excluse = ['user']
| from django.forms import ModelForm
from .models import BookReader, User
class UserForm(ModelForm):
class Meta:
model = User
class BookReader(ModelForm):
class Meta:
model = BookReader
excluse = ['user']
| Python | 0.999994 |
7f4cd4f88656863f0c6976911407b0d8ae9f0a3b | complete explain html file | src/handle_html_file.py | src/handle_html_file.py | #-*_coding:utf8-*-
import inspect
import os
import shutil
from bs4 import BeautifulSoup
#Get test file path
def get_file_path():
test_file_path = ''
# the test dirs
test_dir = os.path.join(os.getcwd(), 'test_file')
# traverse the test dirs
list_dirs = os.walk(test_dir)
is_find_file = False
... | #-*_coding:utf8-*-
import inspect
import os
import shutil
from bs4 import BeautifulSoup
#Get test file path
def get_file_path():
test_file_path = ''
# the test dirs
test_dir = os.path.join(os.getcwd(), 'test_file')
# traverse the test dirs
list_dirs = os.walk(test_dir)
is_find_file = False
... | Python | 0.000003 |
77d26064694e89d30ea4d62a7a9de9fb7d4038a0 | Fix typo secounds => seconds (#743) | common/util/debug.py | common/util/debug.py | import functools
import json
import pprint as _pprint
import sublime
from contextlib import contextmanager
_log = []
enabled = False
ENCODING_NOT_UTF8 = "{} was sent as binaries and we dont know the encoding, not utf-8"
def start_logging():
global _log
global enabled
_log = []
enabled = True
def s... | import functools
import json
import pprint as _pprint
import sublime
from contextlib import contextmanager
_log = []
enabled = False
ENCODING_NOT_UTF8 = "{} was sent as binaries and we dont know the encoding, not utf-8"
def start_logging():
global _log
global enabled
_log = []
enabled = True
def s... | Python | 0.000001 |
396a217ad725e25c8761edf3678dea349d06e023 | Reorganize imports | setuptools/__init__.py | setuptools/__init__.py | """Extensions to the 'distutils' for large or complex distributions"""
import os
import sys
import distutils.core
from distutils.core import Command as _Command
from distutils.util import convert_path
import setuptools.version
from setuptools.extension import Extension
from setuptools.dist import Distribution, Featur... | """Extensions to the 'distutils' for large or complex distributions"""
from setuptools.extension import Extension
from setuptools.dist import Distribution, Feature, _get_unpatched
import distutils.core
from setuptools.depends import Require
from distutils.core import Command as _Command
from distutils.util import conve... | Python | 0.000001 |
390bcb4be27012794ceb927e3ab2e384c2909daf | Add retries | conf/celeryconfig.py | conf/celeryconfig.py | from datetime import timedelta
import os
from ast import literal_eval
from celery.schedules import crontab
from kombu import Queue
CLUSTER_NAME = os.getenv('CLUSTER_NAME', 'local')
MESSAGES_TTL = 7200
# Broker and Queue Settings
BROKER_URL = os.getenv('BROKER_URL',
'amqp://guest:guest@localho... | from datetime import timedelta
import os
from ast import literal_eval
from celery.schedules import crontab
from kombu import Queue
CLUSTER_NAME = os.getenv('CLUSTER_NAME', 'local')
MESSAGES_TTL = 7200
# Broker and Queue Settings
BROKER_URL = os.getenv('BROKER_URL',
'amqp://guest:guest@localho... | Python | 0.000539 |
f78ef9ff6094b23316a170cf8ae33056ba358aae | Remove a TODO | feedreader/handlers.py | feedreader/handlers.py | """APIRequestHandler subclasses for API endpoints."""
from tornado.web import HTTPError
from feedreader.api_request_handler import APIRequestHandler
class MainHandler(APIRequestHandler):
def get(self):
username = self.require_auth()
self.write({"message": "Hello world!"})
class UsersHandler(A... | """APIRequestHandler subclasses for API endpoints."""
from tornado.web import HTTPError
from feedreader.api_request_handler import APIRequestHandler
class MainHandler(APIRequestHandler):
def get(self):
username = self.require_auth()
self.write({"message": "Hello world!"})
class UsersHandler(A... | Python | 0.998852 |
3595db808230f579a2410bf57eac054d779aaf4a | printmetadata STABLE | src/amiens/printmetadata.py | src/amiens/printmetadata.py | #!/usr/bin/python3
# Copyright 2015 Nathan Ross
#
# 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... | #!/usr/bin/python3
# Copyright 2015 Nathan Ross
#
# 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... | Python | 0.999738 |
cd37746924a6b6b94afd044688c4a2554d0f50d1 | fix variable name for id | import.py | import.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, db, Request
from glob import glob
from sqlalchemy.exc import IntegrityError
from OpenSSL import crypto
from datetime import datetime
for path in glob("{}/freifunk_*.crt".format(app.config['DIRECTORY'])):
with open(path) as certfile:
print(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, db, Request
from glob import glob
from sqlalchemy.exc import IntegrityError
from OpenSSL import crypto
from datetime import datetime
for path in glob("{}/freifunk_*.crt".format(app.config['DIRECTORY'])):
with open(path) as certfile:
print(... | Python | 0.999789 |
d4da07688c0b1244bad24c26483a0f1b94a8fab0 | remove that filtering option | src/apps/calendar/schema.py | src/apps/calendar/schema.py | from graphene import relay, AbstractType, String
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from .models import Calendar, Day
class CalendarNode(DjangoObjectType):
"""
how does this work?
"""
class Meta:
model = Calendar
... | from graphene import relay, AbstractType, String
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from .models import Calendar, Day
class CalendarNode(DjangoObjectType):
"""
how does this work?
"""
class Meta:
model = Calendar
... | Python | 0.000045 |
4a30762680fd3ee9b95795f39e10e15faf4279e8 | remove language intolerance | src/boarbot/modules/echo.py | src/boarbot/modules/echo.py | import discord
from boarbot.common.botmodule import BotModule
from boarbot.common.events import EventType
class EchoModule(BotModule):
async def handle_event(self, event_type, args):
if event_type == EventType.MESSAGE:
await self.echo(args[0])
async def echo(self, message: discord.Message... | import discord
from boarbot.common.botmodule import BotModule
from boarbot.common.events import EventType
class EchoModule(BotModule):
async def handle_event(self, event_type, args):
if event_type == EventType.MESSAGE:
await self.echo(args[0])
async def echo(self, message: discord.Message... | Python | 0.999939 |
e8d0c7f678689c15049186360c08922be493587a | Remove non-existant flask.current_app.debug doc ref. | flask_nav/renderers.py | flask_nav/renderers.py | from flask import current_app
from dominate import tags
from visitor import Visitor
class Renderer(Visitor):
"""Base interface for navigation renderers.
Visiting a node should return a string or an object that converts to a
string containing HTML."""
def visit_object(self, node):
"""Fallbac... | from flask import current_app
from dominate import tags
from visitor import Visitor
class Renderer(Visitor):
"""Base interface for navigation renderers.
Visiting a node should return a string or an object that converts to a
string containing HTML."""
def visit_object(self, node):
"""Fallbac... | Python | 0 |
f6df8c05d247650f4899d1101c553230a60ccc70 | Improve registration response messages | fogeybot/cogs/users.py | fogeybot/cogs/users.py | from discord.ext.commands import command
class UserCommands(object):
def __init__(self, bot, api, db):
self.bot = bot
self.api = api
self.db = db
@command(description="Registers/updates your battle tag", pass_context=True)
async def register(self, ctx, battletag: str):
if '... | from discord.ext.commands import command
class UserCommands(object):
def __init__(self, bot, api, db):
self.bot = bot
self.api = api
self.db = db
@command(description="Registers/updates your battle tag", pass_context=True)
async def register(self, ctx, battletag: str):
if '... | Python | 0.000002 |
db711fe24ffff78d21db3af8e437dc2f2f1b48a7 | Add space at top of class bruteforce_ssh_pyes | alerts/bruteforce_ssh_pyes.py | alerts/bruteforce_ssh_pyes.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
# Je... | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
# Je... | Python | 0.000003 |
dfe531a481e2e753e755f8877bc747147deb7840 | Set optional port as proper Channel attribute. (#1163) | parsl/channels/oauth_ssh/oauth_ssh.py | parsl/channels/oauth_ssh/oauth_ssh.py | import logging
import paramiko
import socket
from parsl.errors import OptionalModuleMissing
from parsl.channels.ssh.ssh import SSHChannel
try:
from oauth_ssh.ssh_service import SSHService
from oauth_ssh.oauth_ssh_token import find_access_token
_oauth_ssh_enabled = True
except (ImportError, NameError):
... | import logging
import paramiko
import socket
from parsl.errors import OptionalModuleMissing
from parsl.channels.ssh.ssh import SSHChannel
try:
from oauth_ssh.ssh_service import SSHService
from oauth_ssh.oauth_ssh_token import find_access_token
_oauth_ssh_enabled = True
except (ImportError, NameError):
... | Python | 0 |
b1b33a778d7abca2aa29e9612b6a75ff4aa7d64f | add UnboundError to actionAngle | galpy/actionAngle_src/actionAngle.py | galpy/actionAngle_src/actionAngle.py | import math as m
class actionAngle:
"""Top-level class for actionAngle classes"""
def __init__(self,*args,**kwargs):
"""
NAME:
__init__
PURPOSE:
initialize an actionAngle object
INPUT:
OUTPUT:
HISTORY:
2010-07-11 - Written - Bovy (... | import math as m
class actionAngle:
"""Top-level class for actionAngle classes"""
def __init__(self,*args,**kwargs):
"""
NAME:
__init__
PURPOSE:
initialize an actionAngle object
INPUT:
OUTPUT:
HISTORY:
2010-07-11 - Written - Bovy (... | Python | 0.000001 |
400788fac8b91206521feaea800e37dd183c2f4f | Make sure coverage is at 100% for ref_validator_test.py | tests/swagger20_validator/ref_validator_test.py | tests/swagger20_validator/ref_validator_test.py | import pytest
from jsonschema.validators import Draft4Validator
from jsonschema.validators import RefResolver
from mock import Mock, MagicMock
from bravado_core.swagger20_validator import ref_validator
@pytest.fixture
def address_target():
return {
'type': 'object',
'properties': {
's... | import pytest
from jsonschema.validators import Draft4Validator
from jsonschema.validators import RefResolver
from mock import Mock, MagicMock
from bravado_core.swagger20_validator import ref_validator
@pytest.fixture
def address_target():
return {
'type': 'object',
'properties': {
's... | Python | 0 |
0662ab1773b835b447dd71ad53fa595f490cbcc8 | Add proper encoding support to ftp_list | flexget/plugins/input/ftp_list.py | flexget/plugins/input/ftp_list.py | import logging
import ftplib
import os
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
log = logging.getLogger('ftp_list')
class InputFtpList(object):
"""
Generate entries from a ftp listing
Configuration:
ftp_list:
config:
use-ssl: no
... | import logging
import ftplib
import os
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
log = logging.getLogger('ftp_list')
class InputFtpList(object):
"""
Generate entries from a ftp listing
Configuration:
ftp_list:
config:
use-ssl: no
... | Python | 0.000001 |
a0af5dc1478fe8b639cc5a37898ad180f1f20a89 | Add --midi option to CLI | src/twelve_tone/cli.py | src/twelve_tone/cli.py | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mtwelve_tone` python will execute
``__main__.py`` as ... | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mtwelve_tone` python will execute
``__main__.py`` as ... | Python | 0 |
910b1cc171de18cc844abe912130541234b23c7f | Add auth support. | flamyngo/views.py | flamyngo/views.py | import json
import re
import os
from pymongo import MongoClient
from monty.serialization import loadfn
from monty.json import jsanitize
from flask import render_template, request, make_response, Response
from flamyngo import app
from functools import wraps
from flask import request, Response
module_path = os.path... | import json
import re
import os
from pymongo import MongoClient
from monty.serialization import loadfn
from monty.json import jsanitize
from flask import render_template, request, make_response
from flamyngo import app
module_path = os.path.dirname(os.path.abspath(__file__))
SETTINGS = loadfn(os.environ["FLAMYNG... | Python | 0 |
81612e20e327b4b4eabb4c77201dd6b8d2d21e93 | Add get_default getter to config. | law/config.py | law/config.py | # -*- coding: utf-8 -*-
"""
law Config interface.
"""
__all__ = ["Config"]
import os
import tempfile
import six
from six.moves.configparser import ConfigParser
class Config(ConfigParser):
_instance = None
_default_config = {
"core": {
"db_file": os.environ.get("LAW_DB_FILE", os.pat... | # -*- coding: utf-8 -*-
"""
law Config interface.
"""
__all__ = ["Config"]
import os
import tempfile
import six
from six.moves.configparser import ConfigParser
class Config(ConfigParser):
_instance = None
_default_config = {
"core": {
"db_file": os.environ.get("LAW_DB_FILE", os.pat... | Python | 0 |
67444868b1c7c50da6d490893d72991b65b2aa7b | Add superlance supervisord plugin | frontend/setup.py | frontend/setup.py | import sys
from setuptools import setup, find_packages
requires = (
'flask',
'Flask-Script',
'flask_sockets',
'gunicorn',
'cassandra-driver',
'google-api-python-client',
'ecdsa',
'daemonize',
'websocket-client',
'pyzmq',
'fabric',
'pyyaml',
'supervisor',
'pexpect... | import sys
from setuptools import setup, find_packages
requires = (
'flask',
'Flask-Script',
'flask_sockets',
'gunicorn',
'cassandra-driver',
'google-api-python-client',
'ecdsa',
'daemonize',
'websocket-client',
'pyzmq',
'fabric',
'pyyaml',
'supervisor',
'pexpect... | Python | 0 |
a16cda69c2ec0e96bf5b5a558e288d22b353f28f | change work folder before build | build/build.py | build/build.py | #!/usr/bin/env python2.7
# coding=utf-8
import subprocess
import platform
import os
import sys
def build(platform):
print("[Start Build] Target Platform: " + platform)
build_folder = os.path.split(os.path.realpath(__file__))[0]
#change folder
os.chdir(build_folder)
build_script = ""
if platfo... | #!/usr/bin/env python2.7
# coding=utf-8
import subprocess
import platform
import os
import sys
def build(platform):
print("[Start Build] Target Platform: " + platform)
build_script = ""
if platform == "windows":
build_script = "make_win_with_2015_static.bat"
subprocess.Popen(["cmd.exe","/C"... | Python | 0 |
e4b9463dcbe5700c5a9089188e1f3caca5a206ab | Add hierarchy walker | avalon/tools/cbsceneinventory/lib.py | avalon/tools/cbsceneinventory/lib.py | from avalon import io, api
def switch_item(container,
asset_name=None,
subset_name=None,
representation_name=None):
"""Switch container asset, subset or representation of a container by name.
It'll always switch to the latest version - of course a different
... | from avalon import io, api
def switch_item(container,
asset_name=None,
subset_name=None,
representation_name=None):
"""Switch container asset, subset or representation of a container by name.
It'll always switch to the latest version - of course a different
... | Python | 0.000008 |
6c004827c642c3aee4166dd8689dc40104be6346 | Stop hard-coding satellites, and make the tester easy to run on any notebook path. Allow specifying output and error files as args rather than just on command line. | src/verify_notebook.py | src/verify_notebook.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | Python | 0 |
a9f6432288f74b9f590a91649de1e475ed523806 | Correct data format | restclients/test/library/mylibinfo.py | restclients/test/library/mylibinfo.py | from datetime import date
from django.test import TestCase
from django.conf import settings
from restclients.library.mylibinfo import get_account, get_account_html
from restclients.exceptions import DataFailureException
class MyLibInfoTest(TestCase):
def test_get_account(self):
with self.settings(
... | from datetime import date
from django.test import TestCase
from django.conf import settings
from restclients.library.mylibinfo import get_account, get_account_html
from restclients.exceptions import DataFailureException
class MyLibInfoTest(TestCase):
def test_get_account(self):
with self.settings(
... | Python | 0.999995 |
b70d3c2c75befe747079697a66b1bb417749e786 | Update Workflow: add abstract method .on_failure() | simpleflow/workflow.py | simpleflow/workflow.py | from __future__ import absolute_import
class Workflow(object):
"""
Main interface to define a workflow by submitting tasks for asynchronous
execution.
The actual behavior depends on the executor backend.
"""
def __init__(self, executor):
self._executor = executor
def submit(self... | from __future__ import absolute_import
class Workflow(object):
"""
Main interface to define a workflow by submitting tasks for asynchronous
execution.
The actual behavior depends on the executor backend.
"""
def __init__(self, executor):
self._executor = executor
def submit(self... | Python | 0.000002 |
6a67c22a9843517ece1ee5e890ea38873b44648b | Teste html_to_latex. | libretto/templatetags/extras.py | libretto/templatetags/extras.py | # coding: utf-8
from __future__ import unicode_literals
import re
from bs4 import BeautifulSoup, Comment
from django.template import Library
from django.utils.encoding import smart_text
from ..utils import abbreviate as abbreviate_func
register = Library()
@register.filter
def stripchars(text):
return smart_te... | # coding: utf-8
from __future__ import unicode_literals
import re
from bs4 import BeautifulSoup, Comment
from django.template import Library
from django.utils.encoding import smart_text
from ..utils import abbreviate as abbreviate_func
register = Library()
@register.filter
def stripchars(text):
return smart_te... | Python | 0 |
268c577acd07bce4eb7e63bab6a38a7b436bc2e5 | Include request ip in monitored data | frappe/monitor.py | frappe/monitor.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from datetime import datetime
import json
import traceback
import frappe
import os
import uuid
MONITOR_REDIS_KEY = "monitor-transactions"
def start(tr... | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from datetime import datetime
import json
import traceback
import frappe
import os
import uuid
MONITOR_REDIS_KEY = "monitor-transactions"
def start(tr... | Python | 0 |
7a5cb953f64dce841d88b9c8b45be7719c617ba2 | Fix games init file | games/__init__.py | games/__init__.py | import Game
import Mancala
import Player
import TicTacToe | __all__ = ['Game', 'Mancala', 'Player', 'TicTacToe'] | Python | 0.000001 |
147c85aff3e93ebb39d984a05cec970b3dc7edc0 | Add expires_at field to jwt that was removed accidentally (#242) | frontstage/jwt.py | frontstage/jwt.py | """
Module to create jwt token.
"""
from datetime import datetime, timedelta
from jose import jwt
from frontstage import app
def timestamp_token(token):
"""Time stamp the expires_in argument of the OAuth2 token. And replace with an expires_in UTC timestamp"""
current_time = datetime.now()
expires_in = ... | """
Module to create jwt token.
"""
from datetime import datetime, timedelta
from jose import jwt
from frontstage import app
def timestamp_token(token):
"""Time stamp the expires_in argument of the OAuth2 token. And replace with an expires_in UTC timestamp"""
current_time = datetime.now()
expires_in = ... | Python | 0 |
a23e385d5de4ae3c36eb7e5e37b7bfcc6ed5d129 | Add bat file suffix for invoking dart2js. | site/try/build_try.gyp | site/try/build_try.gyp | # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE
{
'variables' : {
'script_suffix%': '',
},
'conditions' : [
['OS=="win"', {
'variables' : {
... | # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE
{
'targets': [
{
'target_name': 'try_site',
'type': 'none',
'dependencies': [
'.... | Python | 0.005184 |
2c870ee5b3d4df5a2f628350b7d4897f301c34de | Delete commented out urlparams code | badger/helpers.py | badger/helpers.py | import hashlib
import urllib
import urlparse
from django.conf import settings
from django.contrib.auth.models import SiteProfileNotAvailable
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import conditional_escape
try:
from commons.urlresolvers import reverse
except ImportError, e:
... | import hashlib
import urllib
import urlparse
from django.conf import settings
from django.contrib.auth.models import SiteProfileNotAvailable
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import conditional_escape
try:
from commons.urlresolvers import reverse
except ImportError, e:
... | Python | 0 |
e8b49384d3e9e23485199ef131f0cb8f818a2a02 | edit default port | get-image-part.py | get-image-part.py | import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os
from PIL import Image
N = 20
class MainHandler(tornado.web.RequestHandler):
def get(self):
n = int(random.uniform(0,N))
img = int(self.get_argument("img"))
fn = os.path.join(os.path.d... | import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os
from PIL import Image
N = 20
class MainHandler(tornado.web.RequestHandler):
def get(self):
n = int(random.uniform(0,N))
img = int(self.get_argument("img"))
fn = os.path.join(os.path.d... | Python | 0.000001 |
37e1eb093eb29044930cb90a049f471aa2caad8b | Update publicip.py | apps/tinyosGW/publicip.py | apps/tinyosGW/publicip.py | #-*- coding: utf-8 -*-
#!/usr/bin/python
# Author : jeonghoonkang, https://github.com/jeonghoonkang
from __future__ import print_function
from subprocess import *
from types import *
import platform
import sys
import os
def run_cmd(cmd):
p = Popen(cmd, shell=True, stdout=PIPE)
output = p.communicate()[0]
... |
#!/usr/bin/python
# Author : jeonghoonkang, https://github.com/jeonghoonkang
#-*- coding: utf-8 -*-
from __future__ import print_function
from subprocess import *
from types import *
import platform
import sys
import os
def run_cmd(cmd):
p = Popen(cmd, shell=True, stdout=PIPE)
output = p.communicate()[0]
... | Python | 0.000001 |
4b46b9b92ec3d2ed0016d9994708bfaa2a90bca3 | fix BramPortAgent timing | hwt/interfaces/agents/bramPort.py | hwt/interfaces/agents/bramPort.py | from hwt.hdlObjects.constants import READ, WRITE, NOP
from hwt.simulator.agentBase import SyncAgentBase
from hwt.simulator.shortcuts import oscilate
class BramPort_withoutClkAgent(SyncAgentBase):
"""
:ivar requests: list of tuples (request type, address, [write data]) - used for driver
:ivar data: list of... | from hwt.hdlObjects.constants import READ, WRITE, NOP
from hwt.simulator.agentBase import SyncAgentBase
from hwt.simulator.shortcuts import oscilate
class BramPort_withoutClkAgent(SyncAgentBase):
"""
:ivar requests: list of tuples (request type, address, [write data]) - used for driver
:ivar data: list of... | Python | 0.000001 |
3e33a94580d386be71298bcc7fb2d4a4bc19dd34 | apply only the unified diff instead of the whole file | gitmagic/fixup.py | gitmagic/fixup.py | import gitmagic
from git.cmd import Git
from io import import StringIO
def fixup(repo, destination_picker, change_finder, args={}):
repo.index.reset()
for change in change_finder(repo):
_apply_change(repo, change)
destination_commits = destination_picker.pick(change)
if not destination_... | import gitmagic
def fixup(repo, destination_picker, change_finder, args={}):
repo.index.reset()
for change in change_finder(repo):
_apply_change(repo, change)
destination_commits = destination_picker.pick(change)
if not destination_commits:
repo.index.commit( message = "WARN... | Python | 0.000001 |
eb642e63cd32b972ccdec4f487b9a7e2e7cb17b5 | make product_change_type template filter work with hidden plans | billing/templatetags/billing_tags.py | billing/templatetags/billing_tags.py | from django import template
import billing.loading
from pricing.products import Product
register = template.Library()
@register.filter
def product_change_type(product, user):
upc = user.billing_account.get_current_product_class()
if isinstance(product, Product):
product = type(product)
if upc:
... | from django import template
import billing.loading
from pricing.products import Product
register = template.Library()
@register.filter
def product_change_type(product, user):
upc = user.billing_account.get_current_product_class()
if isinstance(product, Product):
product = type(product)
if upc:
... | Python | 0 |
58c685aa03c51a96a25af9dd7d6792035b1f167e | fix update_firebase_installation | plugins/tff_backend/bizz/dashboard.py | plugins/tff_backend/bizz/dashboard.py | # -*- coding: utf-8 -*-
# Copyright 2018 GIG Technology NV
#
# 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... | # -*- coding: utf-8 -*-
# Copyright 2018 GIG Technology NV
#
# 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.000001 |
dca5bd7d16866c0badf6c9d4ae69335aacef9f6d | Add sleep-and-try-again when getting MB info | audio_pipeline/util/MBInfo.py | audio_pipeline/util/MBInfo.py | __author__ = 'cephalopodblue'
import musicbrainzngs as ngs
from . import Util
import time
class MBInfo():
default_server = ngs.hostname
def __init__(self, server=None, backup_server=None, useragent=("hidat_audio_pipeline", "0.1")):
if server is not None and server != self.default_server:
... | __author__ = 'cephalopodblue'
import musicbrainzngs as ngs
from . import Util
class MBInfo():
default_server = ngs.hostname
def __init__(self, server=None, backup_server=None, useragent=("hidat_audio_pipeline", "0.1")):
if server is not None and server != self.default_server:
ngs.set_host... | Python | 0 |
bf188dfae49ab23c8f5dd7eeb105951f6c068b7f | Add filtering by is_circle to Role admin. | backend/feedbag/role/admin.py | backend/feedbag/role/admin.py | from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import Role
class IsCircleListFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _('Is Circle')
# Parameter... | from django.contrib import admin
from .models import Role
@admin.register(Role)
class RoleAdmin(admin.ModelAdmin):
list_display = ('name',
'is_circle',
'parent',
'purpose',
'archived',
)
list_filter = ('archiv... | Python | 0 |
0fac23c22307ca598e0cc6712280903c2a7d559d | Improve auto battle module | gbf_bot/auto_battle.py | gbf_bot/auto_battle.py | import logging
import random
import time
import pyautogui
from . import top_left, window_size
from . import auto_battle_config as config
from . import utility
from .components import Button
logger = logging.getLogger(__name__)
attack = Button('attack.png', config['attack'])
auto = Button('auto.png', config['auto'])
... | import logging
import random
import time
import pyautogui
from . import auto_battle_config as config
from .components import Button
logger = logging.getLogger(__name__)
attack = Button('attack.png', config['attack'])
auto = Button('auto.png', config['auto'])
def activate(battle_time):
pyautogui.PAUSE = 1.3
... | Python | 0.000001 |
d37c2328a8ed58778f4c39091add317878831b4e | increment version | grizli/version.py | grizli/version.py | # git describe --tags
__version__ = "0.7.0-47-g6450ea1"
| # git describe --tags
__version__ = "0.7.0-41-g39ad8ff"
| Python | 0.000004 |
d30d10a477f0b46fa73da76cb1b010e1376c3ff2 | Update version for a new PYPI package. | gtable/version.py | gtable/version.py | __version__ = '0.7'
| __version__ = '0.6.2'
| Python | 0 |
311be8c11b513fd2b3d2bb4427b5bc0b43c2539c | Move reverse along with geometry | caminae/core/forms.py | caminae/core/forms.py | from math import isnan
from django.forms import ModelForm
from django.contrib.gis.geos import LineString
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
import floppyforms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, F... | from math import isnan
from django.forms import ModelForm
from django.contrib.gis.geos import LineString
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
import floppyforms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, F... | Python | 0.000001 |
f9dadd363d9f370d884c0b127e1f63df8916f3c8 | Rename some functions | calculation.py | calculation.py | """Calculation functions."""
from __future__ import division
import numpy as np
from . import plotting
import matplotlib.pyplot as plt
from scipy.signal import butter, freqz
def deconv_process(excitation, system_response, fs):
"""Deconvolution.
It is a necessity to zeropadd the excitation signal
to avoid... | """Calculation functions."""
from __future__ import division
import numpy as np
from scipy.signal import butter, freqz
def deconv_process(excitation, system_response, fs):
"""Deconvolution.
It is a necessity to zeropadd the excitation signal
to avoid zircular artifacts, if the system response is longer
... | Python | 0.00292 |
88f36912de48a84e4e3778889948f85655ba9064 | Remove token logging | canis/oauth.py | canis/oauth.py | from os import environ
from urllib import urlencode
from datetime import datetime, timedelta
from flask import Flask, request, redirect
import requests
app = Flask(__name__)
SPOTIFY_CLIENT_ID = environ['CANIS_SPOTIFY_API_CLIENT_ID']
SPOTIFY_SECRET = environ['CANIS_SPOTIFY_API_SECRET']
SPOTIFY_CALLBACK = environ.get(... | from os import environ
from urllib import urlencode
from datetime import datetime, timedelta
from flask import Flask, request, redirect
import requests
app = Flask(__name__)
SPOTIFY_CLIENT_ID = environ['CANIS_SPOTIFY_API_CLIENT_ID']
SPOTIFY_SECRET = environ['CANIS_SPOTIFY_API_SECRET']
SPOTIFY_CALLBACK = environ.get(... | Python | 0.000001 |
4556add4d9c3645559e51005129dcc65bd0b00ca | __VERSION__ changed | stop_words/__init__.py | stop_words/__init__.py | import json
import os
__VERSION__ = (2015, 2, 23)
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
STOP_WORDS_DIR = os.path.join(CURRENT_DIR, 'stop-words')
STOP_WORDS_CACHE = {}
with open(os.path.join(STOP_WORDS_DIR, 'languages.json'), 'rb') as map_file:
buffer = map_file.read()
buffer = buffer.decod... | import json
import os
__VERSION__ = (2015, 2, 21)
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
STOP_WORDS_DIR = os.path.join(CURRENT_DIR, 'stop-words')
STOP_WORDS_CACHE = {}
with open(os.path.join(STOP_WORDS_DIR, 'languages.json'), 'rb') as map_file:
buffer = map_file.read()
buffer = buffer.decod... | Python | 0.999994 |
1391dd0b084f2c26fd5d0afceb81ffb5daab5dcf | Remove path and user filter from admin | rest_framework_tracking/admin.py | rest_framework_tracking/admin.py | from django.contrib import admin
from .models import APIRequestLog
class APIRequestLogAdmin(admin.ModelAdmin):
date_hierarchy = 'requested_at'
list_display = ('id', 'requested_at', 'response_ms', 'status_code',
'user', 'method',
'path', 'remote_addr', 'host',
... | from django.contrib import admin
from .models import APIRequestLog
class APIRequestLogAdmin(admin.ModelAdmin):
date_hierarchy = 'requested_at'
list_display = ('id', 'requested_at', 'response_ms', 'status_code',
'user', 'method',
'path', 'remote_addr', 'host',
... | Python | 0 |
6051ef3a68db15b220e939240f7bfcb34db1c7c8 | Check if cache value is not None, not truthy | tunigo/api.py | tunigo/api.py | from __future__ import unicode_literals
import time
import requests
from tunigo.cache import Cache
from tunigo.genre import Genre, SubGenre
from tunigo.playlist import Playlist
from tunigo.release import Release
BASE_URL = 'https://api.tunigo.com/v3/space'
BASE_QUERY = 'locale=en&product=premium&version=6.38.31&pl... | from __future__ import unicode_literals
import time
import requests
from tunigo.cache import Cache
from tunigo.genre import Genre, SubGenre
from tunigo.playlist import Playlist
from tunigo.release import Release
BASE_URL = 'https://api.tunigo.com/v3/space'
BASE_QUERY = 'locale=en&product=premium&version=6.38.31&pl... | Python | 0 |
a4cb47b928f6cd7f62780eb620e66a9494b17302 | Generate a full graph and a graph without age restricted content | generate_graph.py | generate_graph.py | from graphviz import Digraph
import math
import pymongo
def main():
client = pymongo.MongoClient()
db = client.reddit
related_subs = {}
subscribers = {}
adult = {}
subreddits = db.subreddits.find({'type': 'subreddit'})
if subreddits:
for subreddit in subreddits:
title ... | from graphviz import Digraph
import math
import pymongo
def main():
client = pymongo.MongoClient()
db = client.reddit
related_subs = {}
subscribers = {}
adult = {}
subreddits = db.subreddits.find({'type': 'subreddit'})
if subreddits:
for subreddit in subreddits:
title ... | Python | 0.998926 |
ad4b5ccf7c89fa67e69d065c47edaa9e18c009ee | add docstrings add if __name__ == '__main__': to make pydoc work | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | Python | 0.000254 |
214b1882a0eaf00bdd5dedbb02a28bba7f8d247b | update version to 1.1.7 | cartoview/__init__.py | cartoview/__init__.py | __version__ = (1, 1, 7, 'alpha', 0)
| __version__ = (1, 1, 5, 'alpha', 0)
| Python | 0 |
74a25caa15d0ab32d83355bc90cc415f5ff8cd1b | Remove unused imports. | exp/viroscopy/model/HIVEpidemicModelABC.py | exp/viroscopy/model/HIVEpidemicModelABC.py | """
A script to estimate the HIV epidemic model parameters using ABC.
"""
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVABCParameters import HIVABCParameters
from exp.viroscopy.model.HIVEpidemicModel import HIVEpidemicModel
from exp.viroscopy.model.HIVRates impor... | """
A script to estimate the HIV epidemic model parameters using ABC.
"""
from apgl.graph.SparseGraph import SparseGraph
from apgl.graph.GraphStatistics import GraphStatistics
from apgl.util import *
from exp.viroscopy.model.HIVGraph import HIVGraph
from exp.viroscopy.model.HIVABCParameters import HIVABCParameters
from... | Python | 0 |
eb5ab4abdc18f56ac21524225d5c1168ece35def | allow for category based link | generic/models.py | generic/models.py | from django.core.urlresolvers import reverse, Resolver404
from django.db import models
from preferences.models import Preferences
from snippetscream import resolve_to_name
class Link(models.Model):
title = models.CharField(
max_length=256,
help_text='A short descriptive title.',
)
view_n... | from django.core.urlresolvers import reverse, Resolver404
from django.db import models
from preferences.models import Preferences
from snippetscream import resolve_to_name
class Link(models.Model):
title = models.CharField(
max_length=256,
help_text='A short descriptive title.',
)
view_n... | Python | 0 |
455e1fe93b612c7049059cf217652862c995fe97 | Replace dict(<list_comprehension>) pattern with dict comprehension | import_export/instance_loaders.py | import_export/instance_loaders.py | from __future__ import unicode_literals
class BaseInstanceLoader(object):
"""
Base abstract implementation of instance loader.
"""
def __init__(self, resource, dataset=None):
self.resource = resource
self.dataset = dataset
def get_instance(self, row):
raise NotImplemented... | from __future__ import unicode_literals
class BaseInstanceLoader(object):
"""
Base abstract implementation of instance loader.
"""
def __init__(self, resource, dataset=None):
self.resource = resource
self.dataset = dataset
def get_instance(self, row):
raise NotImplemented... | Python | 0.000003 |
ac8c1b6849c490c776636e3771e80344e6b0fb2e | Update github3.search.user for consistency | github3/search/user.py | github3/search/user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import users
from ..models import GitHubCore
class UserSearchResult(GitHubCore):
"""Representation of a search result for a user.
This object has the following attributes:
.. attribute:: score
The confidence score of this ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import users
from ..models import GitHubCore
class UserSearchResult(GitHubCore):
def _update_attributes(self, data):
result = data.copy()
#: Score of the result
self.score = self._get_attribute(result, 'score')
... | Python | 0 |
b15f401fe270b69e46fb3009c4d55c917736fb27 | Bump version | guild/__init__.py | guild/__init__.py | # Copyright 2017 TensorHub, 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 agreed to in writing, ... | # Copyright 2017 TensorHub, 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 agreed to in writing, ... | Python | 0 |
156817ee4e11c6a363511d915a9ea5cf96e41fb5 | add statistics tracking | benchbuild/experiments/mse.py | benchbuild/experiments/mse.py | """
Test Maximal Static Expansion.
This tests the maximal static expansion implementation by
Nicholas Bonfante (implemented in LLVM/Polly).
"""
from benchbuild.extensions import ExtractCompileStats
from benchbuild.experiment import RuntimeExperiment
from benchbuild.extensions import RunWithTime, RuntimeExtension
from ... | """
Test Maximal Static Expansion.
This tests the maximal static expansion implementation by
Nicholas Bonfante (implemented in LLVM/Polly).
"""
from benchbuild.experiment import RuntimeExperiment
from benchbuild.extensions import RunWithTime, RuntimeExtension
from benchbuild.settings import CFG
class PollyMSE(Runtim... | Python | 0.000005 |
8a178f1249b968e315b8492ed15c033aca119033 | Reset closed site property | bluebottle/clients/tests/test_api.py | bluebottle/clients/tests/test_api.py | from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from rest_framework import status
from bluebottle.clients import properties
from bluebottle.test.utils import BluebottleTestCase
class ClientSettingsTestCase(BluebottleTestCase):
def setUp(self):
super(ClientSet... | from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from rest_framework import status
from bluebottle.clients import properties
from bluebottle.test.utils import BluebottleTestCase
class ClientSettingsTestCase(BluebottleTestCase):
def setUp(self):
super(ClientSet... | Python | 0 |
e469163c5b103483b294f9c1f37c918177e7dbce | Make prsync.py really useful | admin/prsync.py | admin/prsync.py | #!/usr/bin/env python
import os
import sys
import subprocess
import urlparse
import pygithub3
try:
import angr
angr_dir = os.path.realpath(os.path.join(os.path.dirname(angr.__file__), '../..'))
except ImportError:
print 'Please run this script in the angr virtualenv!'
sys.exit(1)
def main(branch_nam... | #!/usr/bin/env python
import os
import sys
import subprocess
import urlparse
import pygithub3
try:
import angr
angr_dir = os.path.realpath(os.path.join(os.path.dirname(angr.__file__), '../..'))
except ImportError:
print 'Please run this script in the angr virtualenv!'
sys.exit(1)
def main(branch_nam... | Python | 0.000006 |
9f32fee9da5ccffec9a86f62ab9a55625eb65ff7 | Fix menu user input | admin/wakeup.py | admin/wakeup.py | #!/bin/env python3
from pathlib import Path
import subprocess
import logging
import sys
logger = logging.getLogger(__name__)
wol_path = "~/.config/wol.cfg"
# TODO query list from database when available
def main():
global wol_path
wol_path = Path(wol_path).expanduser()
# iterate wake on lan list, wollist
... | #!/bin/env python3
from pathlib import Path
import subprocess
def main():
main.path = Path(".config/wol.cfg")
main.path = main.path.home().joinpath(main.path)
# iterate wake on lan list, wollist
menu = generate_menulist(main.path)
if display_menu(menu):
hostname, hwadress = menu[main.user_c... | Python | 0.002013 |
3a3a8217bd5ff63c77eb4d386bda042cfd7a1196 | delete the depency to sale_order_extend | sale_order_report/__openerp__.py | sale_order_report/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Sale Order Report',
'summary': 'Sale order report in Qweb',
'version': '8.0.1.0',
'category': 'Sales',
'website': 'http://clearcorp.cr',
'author': 'ClearCorp',
'license'... | # -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Sale Order Report',
'summary': 'Sale order report in Qweb',
'version': '8.0.1.0',
'category': 'Sales',
'website': 'http://clearcorp.cr',
'author': 'ClearCorp',
'license'... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.