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 |
|---|---|---|---|---|---|---|---|
2e382c8bff2d0c3733b9b525168254971ca1175e | Update atexit function to avoid issues with late binding | python/pyspark/shell.py | python/pyspark/shell.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Python | 0.99902 |
10e6c53a39d3ee57d855ada1aa6e9d620f094465 | add 'save' command | track-cli.py | track-cli.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import zmq
import logging
log = logging.getLogger('track_cli')
def print_info():
log.info("zeromq version: %s" % zmq.zmq_version())
log.info("pyzmq version: %s" % zmq.pyzmq_version())
def send_request(request):
context = zmq.Context()
req_so... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import zmq
import logging
log = logging.getLogger('track_cli')
def print_info():
log.info("zeromq version: %s" % zmq.zmq_version())
log.info("pyzmq version: %s" % zmq.pyzmq_version())
def send_request(request):
context = zmq.Context()
req_so... | Python | 0.000009 |
0dea5f2b6a2e6d702167c3415d10a47275e30601 | update the version to 0.6.0 | zignal/__init__.py | zignal/__init__.py | """
This is the zignal library
@author: Ronny Andersson (ronny@andersson.tk)
@copyright: (c) 2013 Ronny Andersson
@license: MIT
"""
__version__ = "0.6.0"
from .audio import *
from . import filters
from . import measure
from . import music
from . import sndcard
__all__ = [
'filters',
'measure',... | """
This is the zignal library
@author: Ronny Andersson (ronny@andersson.tk)
@copyright: (c) 2013 Ronny Andersson
@license: MIT
"""
__version__ = "0.5.0"
from .audio import *
from . import filters
from . import measure
from . import music
from . import sndcard
__all__ = [
'filters',
'measure',... | Python | 0.000005 |
c91240cd43c4f714a404cf5f2ce566dad290c0c5 | Add url mapping for ProjectEntrySumsAPIView | trex/urls.py | trex/urls.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from trex.views import project
urlpatterns = patterns(
'',
url(r"^$",
Te... | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from trex.views import project
urlpatterns = patterns(
'',
url(r"^$",
Te... | Python | 0 |
7cbee5e817b6d2bbf4fbcbf8cf1cf327bdbabc9c | rename locator_string to package_id | cms/djangoapps/contentstore/management/commands/migrate_to_split.py | cms/djangoapps/contentstore/management/commands/migrate_to_split.py | """
Django management command to migrate a course from the old Mongo modulestore
to the new split-Mongo modulestore.
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from xmodule.modulestore import Location
from xmodule.modulestore.django import modulesto... | """
Django management command to migrate a course from the old Mongo modulestore
to the new split-Mongo modulestore.
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from xmodule.modulestore import Location
from xmodule.modulestore.django import modulesto... | Python | 0.000355 |
c61187382c968c3018f88637806874ddd0b63b71 | add log for debug | web/views.py | web/views.py | import requests
from django.http import Http404
from django.shortcuts import render, render_to_response, redirect
# Create your views here.
from django.template import RequestContext
from web.fetch import Fetcher
from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET
import leancloud
# @api_view(('GET',)... | import requests
from django.http import Http404
from django.shortcuts import render, render_to_response, redirect
# Create your views here.
from django.template import RequestContext
from web.fetch import Fetcher
from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET
import leancloud
# @api_view(('GET',)... | Python | 0.000001 |
547c8c6a1aef80ce43451479e0b79b51db5b717a | Fix headers types | pyshop/views/credentials.py | pyshop/views/credentials.py | # -*- coding: utf-8 -*-
"""
PyShop Credentials Views.
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import base64
from pyramid.httpexceptions import HTTPFound
from pyramid.url import resource_url, route_url
from pyramid.security import remember, forget
from pyramid.respons... | # -*- coding: utf-8 -*-
"""
PyShop Credentials Views.
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import base64
from pyramid.httpexceptions import HTTPFound
from pyramid.url import resource_url, route_url
from pyramid.security import remember, forget
from pyramid.respons... | Python | 0.000002 |
42dfb6850be83ba17b9e649a499926d31f1afa95 | Fixing command. | windmill/browser/chrome.py | windmill/browser/chrome.py | import commands
import tempfile
import logging
import signal
import subprocess
import sys, os
import urlparse
import windmill
logger = logging.getLogger(__name__)
import safari
class Chrome(safari.Safari):
def __init__(self):
self.chrome_binary = windmill.settings['CHROME_BINARY']
self.test_url = wind... | import commands
import tempfile
import logging
import signal
import subprocess
import sys, os
import urlparse
import windmill
logger = logging.getLogger(__name__)
import safari
class Chrome(safari.Safari):
def __init__(self):
self.chrome_binary = windmill.settings['CHROME_BINARY']
self.test_url = wind... | Python | 0.999753 |
0921f78660b7b0784ebe2fa586dd54551704699e | Fix fix_gir.py to work with ginterfaces and to support delegates. | tools/fix_gir.py | tools/fix_gir.py | #!/usr/bin/python
from xml.dom import minidom
def purge_white_space_and_fix_namespace(node, indent=0):
if getattr(node, "tagName", None) == "namespace":
name = node.getAttribute("name")
node.setAttribute("name", name.lstrip('_'))
for child in [c for c in node.childNodes]:
if child.node... | #!/usr/bin/python
from xml.dom import minidom
def purge_white_space_and_fix_namespace(node, indent=0):
if getattr(node, "tagName", None) == "namespace":
name = node.getAttribute("name")
node.setAttribute("name", name.lstrip('_'))
for child in [c for c in node.childNodes]:
if child.node... | Python | 0 |
2c4cf38b7251ddffaba954f71bbca9632123777c | Add start_wizbit_server function that registers and publishes a wizbit server. | wizd/wizd.py | wizd/wizd.py | #! /usr/bin/env python
import sys
import socket
import os
import SimpleXMLRPCServer
import gobject
from wizbit import ServicePublisher, ServiceBrowser
WIZBIT_SERVER_PORT = 3492
from wizbit import Shares, Directory
from wizbit import *
class WizbitServer():
def getShares(self):
shares = Shares.getShares()
retur... | #! /usr/bin/env python
import sys
import socket
import os
import SimpleXMLRPCServer
import gobject
from wizbit import ServicePublisher, ServiceBrowser
WIZBIT_SERVER_PORT = 3492
from wizbit import Shares, Directory
from wizbit import *
class WizbitServer():
def getShares(self):
shares = Shares.getShares()
retur... | Python | 0 |
5258c7d70796a03361ad865a15fd3896bb7a95f1 | Fix tests | pypeman/tests/test_nodes.py | pypeman/tests/test_nodes.py | import unittest
import asyncio
import logging
class FakeChannel():
def __init__(self):
self.logger = logging.getLogger()
self.uuid = 'fakeChannel'
class NodesTests(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
#asyncio.set_event_loop(None)
def test_l... | import unittest
import asyncio
class FakeChannel():
def __init__(self):
self.uuid = 'fakeChannel'
class NodesTests(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
#asyncio.set_event_loop(None)
def test_log_node(self):
""" if Log() node is functionnal "... | Python | 0.000003 |
175cfe45aba554d1544be3ee71bdb8a7b499d879 | add radius in request | wtm/views.py | wtm/views.py | import urllib2
from lxml import etree
from deform import Form
from pyramid.view import view_config
from wtm.schemas.home import HomeSchema
@view_config(route_name='home', renderer='templates/home.pt')
def home(request):
"""
home page
"""
homeForm = Form(HomeSchema(), buttons=('submit',), action=req... | import urllib2
from lxml import etree
from deform import Form
from pyramid.view import view_config
from wtm.schemas.home import HomeSchema
@view_config(route_name='home', renderer='templates/home.pt')
def home(request):
"""
home page
"""
homeForm = Form(HomeSchema(), buttons=('submit',), action=req... | Python | 0 |
2313a796842cbe65563a62fe12edec06c4112531 | Add YEARS_PEY_DAY. | pyrate/core/ifgconstants.py | pyrate/core/ifgconstants.py | # This Python module is part of the PyRate software package.
#
# Copyright 2017 Geoscience Australia
#
# 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/... | # This Python module is part of the PyRate software package.
#
# Copyright 2017 Geoscience Australia
#
# 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/... | Python | 0.999045 |
d43cf2adeb5bc5e5546dbf58532bfc283fc94ea8 | fix sort order of combined citation information | python/citation_vim/item.py | python/citation_vim/item.py | # -*- coding:utf-8 -*-
import collections
from citation_vim.utils import compat_str, is_current
class Item(object):
"""
Intermediary object between bibtex/zotero and unite source output.
"""
def combine(self):
pairs = collections.OrderedDict([
('Key', self.key),
('Tit... | # -*- coding:utf-8 -*-
from citation_vim.utils import compat_str, is_current
class Item(object):
"""
Intermediary object between bibtex/zotero and unite source output.
"""
def combine(self):
pairs = {
'Key': self.key,
'Title': self.title,
'Author(s)': self... | Python | 0.000497 |
7c787829b9c894f5c0de6dd50d6144e423d70f5c | uses ancient M2Crypto | python/cvmfs/certificate.py | python/cvmfs/certificate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
import M2Crypto
from M2Crypto import EVP, X509, m2, util
from distutils.version import LooseVersion, StrictVersion
from _common import CompressedObject
class Certificate(Compresse... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
from M2Crypto import X509
from _common import CompressedObject
class Certificate(CompressedObject):
""" Wraps an X.509 certificate object as stored in CVMFS repositories """
... | Python | 0.999944 |
92762566c0e80e24d8954b9a4b2f7d148a3c89da | Use google-hosted jquery for admin page | python/ecep/portal/admin.py | python/ecep/portal/admin.py | # Copyright (c) 2012 Azavea, Inc.
# See LICENSE in the project root for copying permission
from portal.models import Location
from django.contrib.gis import admin
from django import forms
from portal.widgets import MapWidget
from django.contrib.gis.geos import Point
import re
from django.conf import settings
class Lo... | # Copyright (c) 2012 Azavea, Inc.
# See LICENSE in the project root for copying permission
from portal.models import Location
from django.contrib.gis import admin
from django import forms
from portal.widgets import MapWidget
from django.contrib.gis.geos import Point
import re
from django.conf import settings
class Lo... | Python | 0 |
7fa8db8b52f6d066dc369912b0f9b227d71fa939 | Fix wex.value docsring | wex/value.py | wex/value.py | """ Extracted data values are represented with tab-separated fields.
The right-most field on each line is the value, all preceding fields
are labels that describe the value.
The labels and the value are all JSON encoded.
So for example, a value 9.99 with a labels ``product`` and ``price`` would
look like::
"prod... | """ Extracted data values are represented with tab-separated fields.
The right-most field on each line is the value, all preceding fields
are labels that describe the value.
The labels and the value are all JSON encoded.
So for example, a value 9.99 with a labels ``product`` and ``price`` would
look like::
"prod... | Python | 0.000017 |
fb786e6fa254bf9b041b58ae3ba524257892bea8 | Make payloads larger for tests. | timelines.py | timelines.py | from sentry.utils.runner import configure
configure()
import contextlib
import functools
import logging
import random
import sys
import time
import uuid
from sentry.app import timelines
from sentry.timelines.redis import Record
logging.basicConfig(level=logging.DEBUG)
@contextlib.contextmanager
def timer(preambl... | from sentry.utils.runner import configure
configure()
import contextlib
import functools
import logging
import random
import sys
import time
import uuid
from sentry.app import timelines
from sentry.timelines.redis import Record
logging.basicConfig(level=logging.DEBUG)
@contextlib.contextmanager
def timer(preambl... | Python | 0.000001 |
4e3ebcf98e2bfb2cea1f92b66e5205194744482a | add level 11 | pythonchallenge/level_11.py | pythonchallenge/level_11.py | import unittest
import urllib
import requests
import logging
import re
import urllib
import os
import os.path
import Image
import ImageDraw
from StringIO import StringIO
# Default is warning, it's to suppress requests INFO log
logging.basicConfig(format='%(message)s')
def solution():
url = 'http://www.pythonchal... | import unittest
import urllib
import requests
import logging
import re
import urllib
import os
import os.path
import Image
import ImageDraw
# Default is warning, it's to suppress requests INFO log
logging.basicConfig(format='%(message)s')
def solution():
url = 'http://www.pythonchallenge.com/pc/return/cave.jpg'
... | Python | 0.000496 |
fb5ad293c34387b1ab7b7b7df3aed3942fdd9282 | Add default to max_places in proposal form | src/webapp/activities/forms.py | src/webapp/activities/forms.py | # -*- encoding: utf-8 -*-
from django import forms
class ActivitySubscribeForm(forms.Form):
id = forms.IntegerField(
min_value = 0, required=True,
widget = forms.HiddenInput,
)
title = forms.CharField(
max_length=100, required=True,
widget = forms.HiddenInput,
)
clas... | # -*- encoding: utf-8 -*-
from django import forms
class ActivitySubscribeForm(forms.Form):
id = forms.IntegerField(
min_value = 0, required=True,
widget = forms.HiddenInput,
)
title = forms.CharField(
max_length=100, required=True,
widget = forms.HiddenInput,
)
clas... | Python | 0.000001 |
ac629293c43841817ca81073a28b683a6ec2a2ec | fix webshots support | src/webilder/webshots/utils.py | src/webilder/webshots/utils.py | import httplib
import urllib, urllib2
import cookielib
import re
import wbz
class WBZLoginException(Exception):
pass
class LeechPremiumOnlyPhotoError(Exception):
pass
class LeechHighQualityForPremiumOnlyError(Exception):
pass
def get_cookie(user, password):
"""Returns a webshots daily cookie given a... | import httplib
import urllib, urllib2
import cookielib
import re
import wbz
class WBZLoginException(Exception):
pass
class LeechPremiumOnlyPhotoError(Exception):
pass
class LeechHighQualityForPremiumOnlyError(Exception):
pass
def get_cookie(user, password):
"""Returns a webshots daily cookie given a... | Python | 0 |
3b5f322d8fe76251b322b2d81cecf6abbee5e4bd | rename python class method | python/dllib/src/bigdl/dllib/feature/image/imagePreprocessing.py | python/dllib/src/bigdl/dllib/feature/image/imagePreprocessing.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Python | 0.99888 |
6a84b885be67e8a9f424c2b36f50e8fe9347dbc9 | Remove duplicate constant in ipmi.py | rackattack/physical/ipmi.py | rackattack/physical/ipmi.py | import subprocess
import time
import logging
import multiprocessing.pool
class IPMI:
IPMITOOL_FILENAME = "ipmitool"
_CONCURRENCY = 4
_pool = None
def __init__(self, hostname, username, password):
self._hostname = hostname
self._username = username
self._password = password
... | import subprocess
import time
import logging
import multiprocessing.pool
class IPMI:
IPMITOOL_FILENAME = "ipmitool"
_CONCURRENCY = 4
IPMITOOL_FILENAME = "ipmitool"
_pool = None
def __init__(self, hostname, username, password):
self._hostname = hostname
self._username = username
... | Python | 0.002215 |
356a7c4d83a5289e7b30a07b0f76829e274b7481 | Fix Eventlet transport on Python 3 | raven/transport/eventlet.py | raven/transport/eventlet.py | """
raven.transport.eventlet
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sys
from raven.transport.http import HTTPTransport
try:
import eventlet
try:
... | """
raven.transport.eventlet
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sys
from raven.transport.http import HTTPTransport
try:
import eventlet
from eventl... | Python | 0.000002 |
b30befbf39009ed566dbb7ff725de05bad2be990 | Add link to permissions management doc for ExportTables. (#520) | rdr_client/export_tables.py | rdr_client/export_tables.py | # Exports the entire contents of database tables to Unicode CSV files stored in GCS.
# Used instead of Cloud SQL export because it handles newlines and null characters properly.
#
# Documentation of permissions management:
# https://docs.google.com/document/d/1vKiu2zcSy97DQTIuSezr030kTyeDthome9XzNy98B6M
#
# Usage: ./ru... | # Exports the entire contents of database tables to Unicode CSV files stored in GCS.
# Used instead of Cloud SQL export because it handles newlines and null characters properly.
#
# Usage: ./run_client.sh --project <PROJECT> --account <ACCOUNT> \
# --service_account exporter@<PROJECT>.iam.gserviceaccount.com export_tab... | Python | 0 |
f210ef3e6b4122c75b4df9eee6be6ee4ac81efa4 | Remove a useless table from the db | www/scripts/generate_db.py | www/scripts/generate_db.py | #!/usr/bin/python
# This script has to generate the sqlite database
#
# Requirements (import from):
# - sqlite3
#
# Syntax:
# ./generate_db.py
import sqlite3
import sys
from os import path
SCRIPT_PATH = path.dirname(__file__)
DEFAULT_DB = path.join(SCRIPT_PATH, "../mymoney.db")
def generate_tables(db=DEFAULT_D... | #!/usr/bin/python
# This script has to generate the sqlite database
#
# Requirements (import from):
# - sqlite3
#
# Syntax:
# ./generate_db.py
import sqlite3
import sys
from os import path
SCRIPT_PATH = path.dirname(__file__)
DEFAULT_DB = path.join(SCRIPT_PATH, "../mymoney.db")
def generate_tables(db=DEFAULT_D... | Python | 0.000001 |
4c88b3f5daa1e8e147dedfa4a103216565469f93 | Fix timezone-naive datetime being compared to aware datetime. | zerver/lib/logging_util.py | zerver/lib/logging_util.py | from __future__ import absolute_import
from django.utils import timezone
import hashlib
import logging
import traceback
from datetime import datetime, timedelta
from zerver.lib.str_utils import force_bytes
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)
class _RateLimitFilter(objec... | from __future__ import absolute_import
from django.utils import timezone
import hashlib
import logging
import traceback
from datetime import datetime, timedelta
from zerver.lib.str_utils import force_bytes
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)
class _RateLimitFilter(objec... | Python | 0 |
c02036f26bfd1eb6b1fed2dc10c73c91e97dae0b | Update __init__.py | tendrl/node_agent/objects/cluster_message/__init__.py | tendrl/node_agent/objects/cluster_message/__init__.py | from tendrl.commons import etcdobj
from tendrl.commons.message import Message as message
from tendrl.commons import objects
class ClusterMessage(objects.BaseObject, message):
internal = True
def __init__(self, **cluster_message):
self._defs = {}
message.__init__(self, **cluster_message)
... | from tendrl.commons import etcdobj
from tendrl.commons.message import Message as message
from tendrl.commons import objects
class ClusterMessage(message, objects.BaseObject):
internal = True
def __init__(self, **cluster_message):
self._defs = {}
super(ClusterMessage, self).__init__(**cluster_m... | Python | 0.000072 |
551dddbb80d512ec49d8a422b52c24e98c97b38c | Add waiting for new data to parse | tsparser/main.py | tsparser/main.py | from time import sleep
from tsparser import config
from tsparser.parser import BaseParser, ParseException
from tsparser.parser.gps import GPSParser
from tsparser.parser.imu import IMUParser
from tsparser.sender import Sender
def parse(input_file=None):
"""
Parse the file specified as input.
:param input_... | from tsparser import config
from tsparser.parser import BaseParser, ParseException
from tsparser.parser.gps import GPSParser
from tsparser.parser.imu import IMUParser
from tsparser.sender import Sender
def parse(input_file=None):
"""
Parse the file specified as input.
:param input_file: file to read inpu... | Python | 0 |
d2a0c928b9cdb693ca75731e1ae2cefb4c7ae722 | fix Episode JSON export | tvd/core/json.py | tvd/core/json.py | #!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2013-2014 CNRS (Hervé BREDIN -- http://herve.niderb.fr/)
#
# 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... | #!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2013-2014 CNRS (Hervé BREDIN -- http://herve.niderb.fr/)
#
# 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... | Python | 0.000008 |
cd4da2e0fbed7bbadd4b110f45b7356795075aeb | add min_level to Logger | twiggy/Logger.py | twiggy/Logger.py | from Message import Message
import Levels
class Logger(object):
__slots__ = ['_fields', 'emitters', 'min_level']
def __init__(self, fields = None, emitters = None, min_level = Levels.DEBUG):
self._fields = fields if fields is not None else {}
self.emitters = emitters if emitters is not None el... | from Message import Message
import Levels
class Logger(object):
__slots__ = ['_fields', 'emitters']
def __init__(self, fields = None, emitters = None):
self._fields = fields if fields is not None else {}
self.emitters = emitters if emitters is not None else {}
def fields(self, **kwargs):
... | Python | 0.000001 |
a50c7c32f28d6f6e0ba369fc91f67f90edda7a66 | Add a processing function to the server to simplify end of burst | txircd/server.py | txircd/server.py | from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.internet.task import LoopingCall
from twisted.words.protocols.irc import IRC
class IRCServer(IRC):
def __init__(self, ircd, ip, received):
self.ircd = ircd
self.serverID = None
self.name = None
... | from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.internet.task import LoopingCall
from twisted.words.protocols.irc import IRC
class IRCServer(IRC):
def __init__(self, ircd, ip, received):
self.ircd = ircd
self.serverID = None
self.name = None
... | Python | 0.000001 |
04f2c9005a04559a48ad0919b840d709c0f4eeaa | Update version. | neupy/__init__.py | neupy/__init__.py | """
NeuPy is the Artificial Neural Network library implemented in Python.
"""
__version__ = '0.1.1'
| """
NeuPy is the Artificial Neural Network library implemented in Python.
"""
__version__ = '0.1.1a'
| Python | 0 |
b2859bfde66d7d91f98e3cfb61e205c1d2f5dbfe | Make CommentFactory use fuzzy attrs | hackernews_scraper/test/factories.py | hackernews_scraper/test/factories.py | from datetime import datetime, timedelta
import factory
from factory.fuzzy import FuzzyText, FuzzyInteger
import time
class ItemFactory(factory.Factory):
FACTORY_FOR = dict
objectID = 21
created_at_i = 42
title = "Test item"
class CommentFactory(factory.Factory):
FACTORY_FOR = dict
@factor... | import factory
class ItemFactory(factory.Factory):
FACTORY_FOR = dict
objectID = 21
created_at_i = 42
title = "Test item"
class CommentFactory(factory.Factory):
FACTORY_FOR = dict
created_at = "2014-04-03T10:17:28.000Z"
title = "Test comment"
url = "www.google.com"
comment_text... | Python | 0 |
8039e38ae806bc3aecfa2cb9824ebfd1c9fdc10e | Revert "Potential fix for cell caching issue" | powershell_kernel/powershell_proxy.py | powershell_kernel/powershell_proxy.py | import threading
try:
import queue
except ImportError:
import Queue as queue
from threading import Timer
from time import sleep
class ReplReader(threading.Thread):
def __init__(self, repl):
super(ReplReader, self).__init__()
self.repl = repl
self.daemon = True
self.queue = q... | import threading
try:
import queue
except ImportError:
import Queue as queue
from threading import Timer
from time import sleep
class ReplReader(threading.Thread):
def __init__(self, repl):
super(ReplReader, self).__init__()
self.repl = repl
self.daemon = True
self.queue = q... | Python | 0 |
5e1e0ba1dca301eb597fb319c68280f7ee761037 | Add twopeasandtheirpod and simplyrecipes to __init__ | recipe_scrapers/__init__.py | recipe_scrapers/__init__.py | import re
from .allrecipes import AllRecipes
from .simplyrecipes import SimplyRecipes
from .twopeasandtheirpod import TwoPeasAndTheirPod
SCRAPERS = {
AllRecipes.host(): AllRecipes,
SimplyRecipes.host(): SimplyRecipes,
TwoPeasAndTheirPod.host(): TwoPeasAndTheirPod,
}
def url_path_to_dict(path):
patt... | import re
from .allrecipes import AllRecipes
SCRAPERS = {
AllRecipes.host(): AllRecipes,
}
def url_path_to_dict(path):
pattern = (r'^'
r'((?P<schema>.+?)://)?'
r'((?P<user>.+?)(:(?P<password>.*?))?@)?'
r'(?P<host>.*?)'
r'(:(?P<port>\d+?))?'
... | Python | 0.000004 |
5fd70e01f648da6dfc994bfe0e5c666c69fa9e45 | return None (null) in preference to empty string when recipe yield is unavailable | recipe_scrapers/vegolosi.py | recipe_scrapers/vegolosi.py | from ._abstract import AbstractScraper
from ._utils import get_minutes, get_yields, normalize_string
class Vegolosi(AbstractScraper):
@classmethod
def host(cls):
return "vegolosi.it"
def title(self):
return self.soup.find("h1").get_text().strip()
def preparation_time(self):
p... | from ._abstract import AbstractScraper
from ._utils import get_minutes, get_yields, normalize_string
class Vegolosi(AbstractScraper):
@classmethod
def host(cls):
return "vegolosi.it"
def title(self):
return self.soup.find("h1").get_text().strip()
def preparation_time(self):
p... | Python | 0.000089 |
c88b7d5fa934e25ae426d8b918d6eb8de414682d | Add missing _ssl constant. Close PyCQA/pylint#2629 | astroid/brain/brain_ssl.py | astroid/brain/brain_ssl.py | # Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016 Ceridwen <ceridwenv@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""Astroid hooks for the ssl library."""
from ... | # Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016 Ceridwen <ceridwenv@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""Astroid hooks for the ssl library."""
from ... | Python | 0.000006 |
631270eeafad8fd6b20973673f6d6e8b733e9029 | enable email | quant/tool/email_box.py | quant/tool/email_box.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from email.mime.text import MIMEText
from quant import config
import smtplib
mail_to = ["aiai373824745_wy@163.com"]
mail_host = "smtp.163.com"
mail_user = "aiai373824745_wy@163.com"
'''163邮箱smtp生成的密码'''
mail_pass = config.EMAIL_PASSWORD_163
mail_subject = 'logging'
def ... | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from email.mime.text import MIMEText
from quant import config
import smtplib
mail_to = ["aiai373824745_wy@163.com"]
mail_host = "smtp.163.com"
mail_user = "aiai373824745_wy@163.com"
'''163邮箱smtp生成的密码'''
mail_pass = config.EMAIL_PASSWORD_163
mail_subject = 'logging'
def ... | Python | 0.00004 |
0caec903579e4cf3f22ea3e5ea1df3ecd8ad0fe3 | remove nigthly test hgemm_asm | test/nightly.py | test/nightly.py | #
# These nightly tests are slow but have good coverage. Fast tests with less coverage are in pre_checkin.py.
#
# To execute this test file, apt-get install python-pytest, then
# PYTHONPATH=. py.test -v test/nightly.py
#
# To run test directly, with complete output:
# mkdir build && cd build
# python ../Tensile/T... | #
# These nightly tests are slow but have good coverage. Fast tests with less coverage are in pre_checkin.py.
#
# To execute this test file, apt-get install python-pytest, then
# PYTHONPATH=. py.test -v test/nightly.py
#
# To run test directly, with complete output:
# mkdir build && cd build
# python ../Tensile/T... | Python | 0.016036 |
931cfb8025f45535b3bb839ebfa5191074a76b15 | Fix log capture on py3 | test/service.py | test/service.py | import logging
import re
import select
import subprocess
import threading
import time
__all__ = [
'ExternalService',
'SpawnedService',
]
class ExternalService(object):
def __init__(self, host, port):
logging.info("Using already running service at %s:%d", host, port)
self.host = host
... | import logging
import re
import select
import subprocess
import threading
import time
__all__ = [
'ExternalService',
'SpawnedService',
]
class ExternalService(object):
def __init__(self, host, port):
logging.info("Using already running service at %s:%d", host, port)
self.host = host
... | Python | 0 |
94fc7881052fea4e7d83f35e41fab4f5ed108f34 | fix styling | spectate/utils.py | spectate/utils.py | class Sentinel:
__slots__ = "_name"
def __init__(self, name):
self._name = name
def __repr__(self):
return self._name # pragma: no cover
| from collections.abc import Mapping
class Sentinel:
__slots__ = "_name"
def __init__(self, name):
self._name = name
def __repr__(self):
return self._name # pragma: no cover
| Python | 0.000001 |
800ef1d1305f125695073732f4b6155d6f0cb445 | Update rasa/cli/interactive.py | rasa/cli/interactive.py | rasa/cli/interactive.py | import argparse
import os
from typing import List, Text
import rasa.cli.train as train
from rasa.cli.arguments import interactive as arguments
from rasa import data, model
# noinspection PyProtectedMember
from rasa.cli.utils import get_validated_path, print_error
from rasa.constants import (
DEFAULT_DATA_PATH,
... | import argparse
import os
from typing import List, Text
import rasa.cli.train as train
from rasa.cli.arguments import interactive as arguments
from rasa import data, model
# noinspection PyProtectedMember
from rasa.cli.utils import get_validated_path, print_error
from rasa.constants import (
DEFAULT_DATA_PATH,
... | Python | 0 |
7329757e1ad30e327c1ae823a8302c79482d6b9c | Update BUILD_OSS to 4632 | src/data/version/mozc_version_template.bzl | src/data/version/mozc_version_template.bzl | # Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | # Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | Python | 0 |
e243e907e58047e18c0a16e061f7aa718e3b5854 | Remove unavailable imports | statsmodels/compat/__init__.py | statsmodels/compat/__init__.py | from .python import ( # noqa:F401
PY3, PY37,
bytes, str, unicode, string_types,
asunicode, asbytes, asstr, asstr2,
range, zip, filter, map,
lrange, lzip, lmap, lfilter,
cStringIO, StringIO, BytesIO,
cPickle, pickle,
iteritems, iterkeys, itervalues,
urlopen, urljoin, urlencode, HTTPE... | from .python import ( # noqa:F401
PY3, PY37,
bytes, str, unicode, string_types,
asunicode, asbytes, asstr, asstr2, asunicode_nested, asbytes_nested,
range, zip, filter, map,
lrange, lzip, lmap, lfilter,
cStringIO, StringIO, BytesIO,
cPickle, pickle,
iteritems, iterkeys, itervalues,
... | Python | 0 |
0629b30ade8b619697e8cc28d651904e742cd70e | Correct inst method names in system info, add Docker version (#36360) | homeassistant/helpers/system_info.py | homeassistant/helpers/system_info.py | """Helper to gather system info."""
import os
import platform
from typing import Dict
from homeassistant.const import __version__ as current_version
from homeassistant.loader import bind_hass
from homeassistant.util.package import is_virtual_env
from .typing import HomeAssistantType
@bind_hass
async def async_get_s... | """Helper to gather system info."""
import os
import platform
from typing import Dict
from homeassistant.const import __version__ as current_version
from homeassistant.loader import bind_hass
from homeassistant.util.package import is_virtual_env
from .typing import HomeAssistantType
@bind_hass
async def async_get_s... | Python | 0 |
bc638d11be50f8480d1f103d3a25484c6ccb52b7 | clean code in disocvery_json_view.py and add comments | hs_core/views/discovery_json_view.py | hs_core/views/discovery_json_view.py | import simplejson as json
from django.http import HttpResponse
from haystack.generic_views import FacetedSearchView
from hs_core.discovery_form import DiscoveryForm
# View class for generating JSON data format from Haystack
# returned JSON objects array is used for building the map view
class DiscoveryJsonView(Faceted... | import simplejson as json
from django.http import HttpResponse
from haystack.query import SearchQuerySet
from django import forms
from haystack.forms import FacetedSearchForm
from haystack.generic_views import FacetedSearchView
from django.core import serializers
from hs_core.discovery_form import DiscoveryForm
class ... | Python | 0 |
c1b19af7229d582f7bd474a05a679cf45e3c9bf8 | add proxy + fix import modules | tests/basics.py | tests/basics.py | # -*- coding: utf-8 -*-
"""
@author: Nicolas Rivet
test the connection to IG API
do some basic operations
"""
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'ig')))
import ig_service as igs
import ig_tools as igt
def main():
"""Main module for... | # -*- coding: utf-8 -*-
"""
@author: Nicolas Rivet
test the connection to IG API
do some basic operations
"""
from ig.ig_service import IGservice as igs
import ig.ig_tools as igt
def main():
"""Main module for testing."""
#get config for demo API
proxy_user, proxy_password, api_key, use... | Python | 0 |
d23a68d464c62cdefb76dbe5855110374680ae61 | Add coverage metrics to python code | regulations/settings/dev.py | regulations/settings/dev.py | from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
STATICFILES_DIRS = (
root('static'),
)
OFFLINE_OUTPUT_DIR = '/tmp/'
INSTALLED_APPS += (
'django_nose',
)
NOSE_ARGS = [
'--with-coverage',
'--cover-package=regulations',
'--exclude-dir=regulations/uitests'
]
try:
from local_settings i... | from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
STATICFILES_DIRS = (
root('static'),
)
OFFLINE_OUTPUT_DIR = '/tmp/'
INSTALLED_APPS += (
'django_nose',
)
NOSE_ARGS = [
'--exclude-dir=regulations/uitests'
]
try:
from local_settings import *
except ImportError:
pass
| Python | 0.000004 |
6b5d4f43b5d22f70db6d08f8093f88785359a404 | Implement DirectoryTarget | streaming_form_data/targets.py | streaming_form_data/targets.py | import hashlib
from typing import Callable, Optional
class BaseTarget:
"""
Targets determine what to do with some input once the parser is done
processing it. Any new Target should inherit from this base class and
override the :code:`data_received` function.
Attributes:
multipart_filename... | import hashlib
from typing import Callable, Optional
class BaseTarget:
"""
Targets determine what to do with some input once the parser is done
processing it. Any new Target should inherit from this base class and
override the :code:`data_received` function.
Attributes:
multipart_filename... | Python | 0 |
2bb57c932f3337fe5df24040523920f399a88fb2 | The function apply_template has been renamed to display. | trac/File.py | trac/File.py | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2003, 2004 Edgewall Software
# Copyright (C) 2003, 2004 Jonas Borgstrm <jonas@edgewall.com>
#
# Trac 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... | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2003, 2004 Edgewall Software
# Copyright (C) 2003, 2004 Jonas Borgstrm <jonas@edgewall.com>
#
# Trac 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... | Python | 0.999875 |
8cc36a325e8bedb7894f31fe049aee1aef903811 | remove unused code | examples/glyphs/buttons_server.py | examples/glyphs/buttons_server.py | from __future__ import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.plotting import curdoc
from bokeh.models.widgets import (
VBox, Icon,
Button, Toggle, Dropdown,
CheckboxGroup, RadioGroup,
CheckboxButtonGroup, RadioButtonGroup,
)
from bokeh.client i... | from __future__ import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.plotting import curdoc
from bokeh.models.widgets import (
VBox, Icon,
Button, Toggle, Dropdown,
CheckboxGroup, RadioGroup,
CheckboxButtonGroup, RadioButtonGroup,
)
from bokeh.models i... | Python | 0.000017 |
5a582564e3fcf97aba0e9595807e1cdecb408210 | add data integration to sync sequence | frappe/model/sync.py | frappe/model/sync.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
"""
Sync's doctype and docfields from txt files to database
perms will get synced only if none exist
"""
import frappe
import os
from frappe.modules.import_file ... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
"""
Sync's doctype and docfields from txt files to database
perms will get synced only if none exist
"""
import frappe
import os
from frappe.modules.import_file ... | Python | 0 |
3a85eff683f9d717958d06faca71c2fb7aaa8394 | fix encoding issues by decoding html before Souping it | trunc/web.py | trunc/web.py | # -*- coding: utf-8 -*-
"""
*********
trunc.web
*********
This module provides classes for accessing web pages."""
from __future__ import absolute_import, print_function
import codecs
import time
from bs4 import BeautifulSoup as Soup
from urllib import FancyURLopener
from .util import fibonacci_number
class MyOp... | # -*- coding: utf-8 -*-
"""
*********
trunc.web
*********
This module provides classes for accessing web pages."""
from __future__ import absolute_import, print_function
import time
from bs4 import BeautifulSoup as Soup
from urllib import FancyURLopener
from .util import fibonacci_number
class MyOpener(FancyURLo... | Python | 0.000002 |
93cab6327aef7386dba6f293a22099272af6af10 | create resouce only if not exist | src/infrastructure/annotations/requires.py | src/infrastructure/annotations/requires.py | '''
Created on Jun 19, 2013
@author: mpastern
'''
from src.resource.resourcemanager import ResourceManager
from src.errors.resourcemanagernotfounderror import ResourceManagerNotFoundError
class resources(object):
def __init__(self, params):
self.params = params
def __call__(self, original_func):
... | '''
Created on Jun 19, 2013
@author: mpastern
'''
from src.resource.resourcemanager import ResourceManager
from src.errors.resourcemanagernotfounderror import ResourceManagerNotFoundError
class resources(object):
def __init__(self, params):
self.params = params
def __call__(self, original_func):
... | Python | 0 |
71b4c326e18ce7e3d0b6aaab5203b3a403a85810 | Update solution_2.py | Problem033/Python/solution_2.py | Problem033/Python/solution_2.py | import math
frac=1.0
for b in range(1,10):
for a in range(1,b):
for c in range(1,10):
if (a*10+b)/(b*10+c)==a/c:
frac*=(a/c)
print(math.ceil(1/frac))
| import math
frac=1.0
for b in range(1,10):
for a in range(1,b):
for c in range(1,10):
if (a*10+b)/(b*10+c)==a/c:
frac*=(a/c)
print(math.ceil(1/frac))
| Python | 0.000002 |
6d7e597ce216093d52ecdcb7db5c087dc6040bb1 | Fix initiation of settings object | fullcalendar/conf.py | fullcalendar/conf.py | from datetime import timedelta
from django.conf import settings as django_settings
default = {
'FULLCALENDAR_FIRST_WEEKDAY': 0,
'FULLCALENDAR_OCCURRENCE_DURATION': timedelta(hours=1),
'FULLCALENDAR_SITE_COLORS': {}
}
settings = type('SettingsDummy', (), default)
for key, value in default.items():
se... | from datetime import timedelta
from django.conf import settings as django_settings
default = {
'FULLCALENDAR_FIRST_WEEKDAY': 0,
'FULLCALENDAR_OCCURRENCE_DURATION': timedelta(hours=1),
'FULLCALENDAR_SITE_COLORS': {}
}
settings = object()
for key, value in default.items():
setattr(settings, key,
... | Python | 0.000004 |
52e614f811fb9dfcd0dde46de43f13731a3717a5 | Reformat doc string for txStatHat.__init__ | txstathat.py | txstathat.py | # -*- coding: utf-8 -*-
"""StatHat bindings"""
from __future__ import division, print_function, unicode_literals
import urllib
from twisted.web.client import getPage
try:
from OpenSSL import SSL # noqa
have_ssl = True
except:
have_ssl = False
API_URI = b'http{}://api.stathat.com/ez'.format(b's' if h... | # -*- coding: utf-8 -*-
"""StatHat bindings"""
from __future__ import division, print_function, unicode_literals
import urllib
from twisted.web.client import getPage
try:
from OpenSSL import SSL # noqa
have_ssl = True
except:
have_ssl = False
API_URI = b'http{}://api.stathat.com/ez'.format(b's' if h... | Python | 0 |
74d5f5c1fe49d0f574a923fc490cd064f3cd52c5 | allow specifying random state | galstreams/random.py | galstreams/random.py |
import astropy.coordinates as coord
import astropy.units as u
import numpy as np
__all__ = ['get_uniform_spherical_angles', 'get_uniform_sphere']
@u.quantity_input(lon_lim=u.deg, lat_lim=u.deg)
def get_uniform_spherical_angles(size=1,
lon_lim=[0., 360]*u.deg,
... |
import astropy.coordinates as coord
import astropy.units as u
import numpy as np
__all__ = ['get_uniform_spherical_angles', 'get_uniform_sphere']
@u.quantity_input(lon_lim=u.deg, lat_lim=u.deg)
def get_uniform_spherical_angles(size=1,
lon_lim=[0., 360]*u.deg,
... | Python | 0.000001 |
c7a4bfdeb8e20d4469dac85370f640cb944db0d9 | Remove python2 support | src/chattymarkov/database/__init__.py | src/chattymarkov/database/__init__.py | """Chattymarkov database submodule.
This submodule gathers all the supported database formats.
"""
from .databases import JSONFileDatabase, MemoryDatabase, RedisDatabase
class ChattymarkovDatabaseError(Exception):
"""Base exception class for chattymarkov.database related errors."""
class UnknownDatabasePrefixE... | """Chattymarkov database submodule.
This submodule gathers all the supported database formats.
"""
import six
from .databases import JSONFileDatabase, MemoryDatabase, RedisDatabase
class ChattymarkovDatabaseError(Exception):
"""Base exception class for chattymarkov.database related errors."""
class UnknownData... | Python | 0.000011 |
b2b123b15f178e81737127a4dda399a31ebb5240 | Update Dice_Probability.py | Week2-Python-Libraries-and-Concepts-Used-in-Research/Dice_Probability.py | Week2-Python-Libraries-and-Concepts-Used-in-Research/Dice_Probability.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 17 16:26:48 2017
@author: lamahamadeh
"""
#First: Python-based implementation
#------------------------------------
'''
source:
-------
Video 2.4.2: Examples Involving Randomness
Week 2 Overview/Python Libraries and Concepts Used in Research
Using... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 17 16:26:48 2017
@author: lamahamadeh
source:
-------
Video 2.4.2: Examples Involving Randomness
Week 2 Overview/Python Libraries and Concepts Used in Research
Using python for research
Harvard
online course provided by edx.org
url: https://courses... | Python | 0.000001 |
67c4d077ee4693290bf9883e90e4ed381b3cd227 | Fix a mistake. | python/matplotlib/hist_logscale_xy.py | python/matplotlib/hist_logscale_xy.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See:
# -
import numpy as np
import matplotlib.pyplot as plt
# SETUP #######################################################################
# histtype : [‘bar’ | ‘barstacked’ | ‘step’ | ‘stepfilled’]
HIST_TYPE='bar'
ALPHA=0.5
# MAKE DATA ###########################... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See:
# -
import numpy as np
import matplotlib.pyplot as plt
# SETUP #######################################################################
# histtype : [‘bar’ | ‘barstacked’ | ‘step’ | ‘stepfilled’]
HIST_TYPE='bar'
ALPHA=0.5
# MAKE DATA ###########################... | Python | 0.003448 |
e300d739bf0040b76a0deee75cc01b1410ba8953 | change image field to name in CatalogoLandsat serializer | indicarprocess/tmsapi/serializers.py | indicarprocess/tmsapi/serializers.py | # -*- coding: utf-8 -*-
from rest_framework.serializers import ModelSerializer, SerializerMethodField
from catalogo.models import CatalogoLandsat
class LandsatSerializer(ModelSerializer):
southwest = SerializerMethodField()
northeast = SerializerMethodField()
name = SerializerMethodField()
class Met... | # -*- coding: utf-8 -*-
from rest_framework.serializers import ModelSerializer, SerializerMethodField
from catalogo.models import CatalogoLandsat
class LandsatSerializer(ModelSerializer):
southwest = SerializerMethodField()
northeast = SerializerMethodField()
class Meta:
model = CatalogoLandsat
... | Python | 0 |
05a8f2a2e499b25472fbaf1b06e899f589a7101f | fix migration | editor/migrations/0003_auto_20150125_0430.py | editor/migrations/0003_auto_20150125_0430.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from editor.models import Source, Category, Format
# add root data for Source and Category model
def add_root_data(apps, schema_editor):
cat = Category(name ="root", parent=None)
cat.save()
source = S... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from editor.models import Source, Category
# add root data for Source and Category model
def add_root_data(apps, schema_editor):
cat = Category(name ="root", parent=None)
cat.save()
source = Source(
... | Python | 0.000001 |
1cfd11d1a6aa1d949067e5b24b5bfb2cca10ad09 | add index | requestspool/paction/all.py | requestspool/paction/all.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014 windpro
Author : windpro
E-mail : windprog@gmail.com
Date : 14/12/26
Desc :
"""
from httpappengine.decorator import url
from httpappengine.helper import not_found
from httplib import responses
from requestspool.util import get_route
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014 windpro
Author : windpro
E-mail : windprog@gmail.com
Date : 14/12/26
Desc :
"""
from httpappengine.decorator import url
from httpappengine.helper import not_found
from httplib import responses
from requestspool.util import get_route
... | Python | 0.000607 |
53df723a1574e62b4a74d56667c131793cf6c506 | add retrieve all users and one user queries | users_handler.py | users_handler.py | from models.users import User
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
class UsersHandler:
def __init__(self, DB):
self.db = DB
def create_user(self, user_data):
collection = self.db.users
user = collection.find_one({"username": user... | from models.users import User
class UsersHandler:
def __init__(self, DB):
self.db = DB
def create_user(self, user_data):
collection = self.db.users
new_user = User(user_data)
collection.insert_one(new_user.__dict__)
| Python | 0.000001 |
efdf57f4f688c66402c5b18152f2448a100a55a9 | Generate departures region by region | busstops/management/commands/generate_departures.py | busstops/management/commands/generate_departures.py | from datetime import date, timedelta
from django.core.management.base import BaseCommand
from django.db import transaction
from txc import txc
from ...models import Region, Service, Journey, StopUsageUsage, StopPoint
from ...utils import get_files_from_zipfile
ONE_DAY = timedelta(days=1)
def handle_timetable(servic... | from datetime import date, timedelta
from django.core.management.base import BaseCommand
from django.db import transaction
from txc import txc
from ...models import Service, Journey, StopUsageUsage, StopPoint
from ...utils import get_files_from_zipfile
ONE_DAY = timedelta(days=1)
def handle_timetable(service, timet... | Python | 0.999999 |
0d5d1263af2fca0955c4db0f603af11c321fe624 | Fix the class name for del_dynamic_range | lib/python2.6/aquilon/server/commands/del_dynamic_range.py | lib/python2.6/aquilon/server/commands/del_dynamic_range.py | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2009,2010 Contributor
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the EU DataGrid Software License. You should
# have received a copy of the license... | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2009,2010 Contributor
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the EU DataGrid Software License. You should
# have received a copy of the license... | Python | 0.999991 |
d809c3cef9761edbf984ea9a8cf066a2f474c58d | fix integration tests | test/integration/013_context_var_tests/test_context_vars.py | test/integration/013_context_var_tests/test_context_vars.py | from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
import dbt.flags
class TestContextVars(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.fields = [
'this',
'this.name',
'this.schema',
... | from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
import dbt.flags
class TestContextVars(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.fields = [
'this',
'this.name',
'this.schema',
... | Python | 0 |
7674437d752be0791688533dd1409fa083672bb2 | Switch from dictionary to namedtuple | genes/java/config.py | genes/java/config.py | #!/usr/bin/env python
from collections import namedtuple
JavaConfig = namedtuple('JavaConfig', ['is_oracle', 'version'])
def config():
return JavaConfig(
is_oracle=True,
version='oracle-java8',
)
| #!/usr/bin/env python
def config():
return {
'is-oracle': True,
'version': 'oracle-java8',
}
| Python | 0.000003 |
becf684fc06890679f4c0cdfed1761962e16a343 | Make extra_context at browse_repository view not overriding provided variables | vcs/web/simplevcs/views/repository.py | vcs/web/simplevcs/views/repository.py | from django.contrib import messages
from django.template import RequestContext
from django.shortcuts import render_to_response
from vcs.exceptions import VCSError
def browse_repository(request, repository, template_name, revision=None,
node_path='', extra_context={}):
"""
Generic repository browser.
... | from django.contrib import messages
from django.template import RequestContext
from django.shortcuts import render_to_response
from vcs.exceptions import VCSError
def browse_repository(request, repository, template_name, revision=None,
node_path='', extra_context={}):
"""
Generic repository browser.
... | Python | 0.00001 |
7ecaeba33a4fe559f6122953581e533720cb2404 | Add select mkl libs (#22580) | var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py | var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from sys import platform
from spack import *
class IntelOneapiMkl(IntelOneApiLibraryPackage):
"""Intel oneAPI MKL.... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from sys import platform
from spack import *
class IntelOneapiMkl(IntelOneApiLibraryPackage):
"""Intel oneAPI MKL.... | Python | 0 |
67cea85323195440330580cc3731447956a4ad32 | add default user settings packet | litecord/managers/user_settings.py | litecord/managers/user_settings.py |
class SettingsManager:
"""User settings manager.
Provides functions for users to change their settings and retrieve them back.
Attributes
----------
server: :class:`LitecordServer`
Litecord server instance.
settings_coll: `mongo collection`
User settings MongoDB collection... |
class SettingsManager:
"""User settings manager.
Provides functions for users to change their settings and retrieve them back.
Attributes
----------
server: :class:`LitecordServer`
Litecord server instance.
settings_coll: `mongo collection`
User settings MongoDB collection... | Python | 0.000009 |
f5838692d711e6c8d0b8f0dc7716ea28707df4f2 | Add default for playlist_dir | beetsplug/smartplaylist.py | beetsplug/smartplaylist.py | # This file is part of beets.
# Copyright 2013, Dang Mai <contact@dangmai.net>.
#
# 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 right... | # This file is part of beets.
# Copyright 2013, Dang Mai <contact@dangmai.net>.
#
# 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 right... | Python | 0.000001 |
603a59785f24aa98662e72d954b3aa0521ad0629 | Make repeatability tests for severities specified by CLI | test/unit/vint/linting/config/test_config_cmdargs_source.py | test/unit/vint/linting/config/test_config_cmdargs_source.py | import unittest
from test.asserting.config_source import ConfigSourceAssertion
from vint.linting.config.config_cmdargs_source import ConfigCmdargsSource
from vint.linting.level import Level
class TestConfigFileSource(ConfigSourceAssertion, unittest.TestCase):
def test_get_config_dict(self):
env = {
... | import unittest
from test.asserting.config_source import ConfigSourceAssertion
from vint.linting.config.config_cmdargs_source import ConfigCmdargsSource
from vint.linting.level import Level
class TestConfigFileSource(ConfigSourceAssertion, unittest.TestCase):
def test_get_config_dict(self):
expected_conf... | Python | 0.000001 |
54cea5e302820c35025e1afc64b2058a48c5b174 | Implement pop in the data storage module | desertbot/datastore.py | desertbot/datastore.py | import json
import os
class DataStore(object):
def __init__(self, storagePath, defaultsPath):
self.storagePath = storagePath
self.defaultsPath = defaultsPath
self.data = {}
self.load()
def load(self):
# if a file data/defaults/<module>.json exists, it has priority on l... | import json
import os
class DataStore(object):
def __init__(self, storagePath, defaultsPath):
self.storagePath = storagePath
self.defaultsPath = defaultsPath
self.data = {}
self.load()
def load(self):
# if a file data/defaults/<module>.json exists, it has priority on l... | Python | 0.000001 |
9f4fbb1db8e96a798bca1ae72d8cae8b90ba7d60 | Add Message.fields() shortcut to iterating message fields | venom/message.py | venom/message.py | from abc import ABCMeta
from collections import MutableMapping
from collections import OrderedDict
from typing import Any, Dict, Type, Iterable
from venom.fields import FieldDescriptor
from venom.util import meta
class OneOf(object):
def __init__(self, *choices):
self.choices = choices
# TODO helper... | from abc import ABCMeta
from collections import MutableMapping
from collections import OrderedDict
from typing import Any, Dict, Type
from venom.fields import Field, FieldDescriptor
from venom.util import meta
class OneOf(object):
def __init__(self, *choices):
self.choices = choices
# TODO helper fu... | Python | 0.000003 |
e3753ac4b2c24c43014aab8121a34b9ad76d6b7a | update tests to v2.1.1 (#1597) (#1597) | exercises/hamming/hamming_test.py | exercises/hamming/hamming_test.py | import unittest
import hamming
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.1.1
class HammingTest(unittest.TestCase):
def test_empty_strands(self):
self.assertEqual(hamming.distance("", ""), 0)
def test_identical_strands(self):
self.assertEqual(hamming.distance("... | import unittest
import hamming
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.1.0
class HammingTest(unittest.TestCase):
def test_empty_strands(self):
self.assertEqual(hamming.distance("", ""), 0)
def test_identical_strands(self):
self.assertEqual(hamming.distance("... | Python | 0 |
d47cfd7c1a4dd22ab175539dcb0e3702a21f8bb7 | Move scaling factors to constant and explain | ynr/apps/moderation_queue/management/commands/moderation_queue_detect_faces_in_queued_images.py | ynr/apps/moderation_queue/management/commands/moderation_queue_detect_faces_in_queued_images.py | import json
import boto3
from django.core.management.base import BaseCommand, CommandError
from moderation_queue.models import QueuedImage
# These magic values are because the AWS API crops faces quite tightly by
# default, meaning we literally just get the face. These values are about
# right or, they are more ri... | import json
import boto3
from django.core.management.base import BaseCommand, CommandError
from moderation_queue.models import QueuedImage
class Command(BaseCommand):
def handle(self, **options):
rekognition = boto3.client("rekognition", "eu-west-1")
attributes = ["ALL"]
any_failed = ... | Python | 0 |
a0e0f7867e8e9805fb035a8db75e9d187fc06f3b | fix merge | rest_framework_social_oauth2/views.py | rest_framework_social_oauth2/views.py | # -*- coding: utf-8 -*-
import json
from braces.views import CsrfExemptMixin
from oauth2_provider.ext.rest_framework import OAuth2Authentication
from oauth2_provider.models import Application, AccessToken
from oauth2_provider.settings import oauth2_settings
from oauth2_provider.views.mixins import OAuthLibMixin
from r... | # -*- coding: utf-8 -*-
import json
from braces.views import CsrfExemptMixin
from oauth2_provider.ext.rest_framework import OAuth2Authentication
from oauth2_provider.models import Application, AccessToken
from oauth2_provider.settings import oauth2_settings
from oauth2_provider.views.mixins import OAuthLibMixin
from r... | Python | 0.000001 |
e13a74ae4e1884017593143e01e8882d7e802d7b | clean up imports | src/compas_rhino/geometry/__init__.py | src/compas_rhino/geometry/__init__.py | """
********************************************************************************
geometry
********************************************************************************
.. currentmodule:: compas_rhino.geometry
"""
from __future__ import absolute_import
__all__ = []
| """
********************************************************************************
geometry
********************************************************************************
.. currentmodule:: compas_rhino.geometry
Classes
=======
.. autosummary::
:toctree: generated/
:nosignatures:
RhinoGeometry
R... | Python | 0.000001 |
3fb93c4b839457430180f65f1feae4c7abdba0ac | tag celery syslog messages | dbaas/dbaas/celery.py | dbaas/dbaas/celery.py | from __future__ import absolute_import
import os
import logging
from datetime import timedelta
from celery import Celery
from django.conf import settings
from dbaas import celeryconfig
from logging.handlers import SysLogHandler
from celery.log import redirect_stdouts_to_logger
from celery.signals import after_setu... | from __future__ import absolute_import
import os
import logging
from datetime import timedelta
from celery import Celery
from django.conf import settings
from dbaas import celeryconfig
from logging.handlers import SysLogHandler
from celery.log import redirect_stdouts_to_logger
from celery.signals import after_setu... | Python | 0 |
c0f917c6098b18479a69fe129a0fd19d11f67df7 | Fix startup | src/btsoot.py | src/btsoot.py | #!/usr/bin/env python3.5
#MIT License
#
#Copyright (c) 2016 Paul Kramme
#
#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, co... | Python | 0.000004 | |
a468ad4a8f28fb7c88f56869ae68de7b4b55ff39 | Fix 'ResultSet has no len' bug in delete_insert_test | delete_insert_test.py | delete_insert_test.py | import random
import threading
import uuid
from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement
from dtest import Tester
class DeleteInsertTest(Tester):
"""
Examines scenarios around deleting data and adding data back with the same key
"""
def __init__(self, *args, **k... | import random
import threading
import uuid
from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement
from dtest import Tester
class DeleteInsertTest(Tester):
"""
Examines scenarios around deleting data and adding data back with the same key
"""
def __init__(self, *args, **k... | Python | 0.000002 |
21620653125f33fd0d19c1bb2f16b51ec3c853f9 | fix tmin/tmax | ASC/SkyPie.py | ASC/SkyPie.py | #! /usr/bin/env python
#
# Takes about 15" for 1400 images on laptop with a local fast disk (100% cpu)
# But 60" on the Xeon, but at 300% cpu
#
import matplotlib.pyplot as plt
import numpy as np
import sys
table = sys.argv[1]
png = table + '.png'
twopi = 2*np.pi
# table of decimal hour time and median sky brightn... | #! /usr/bin/env python
#
# Takes about 15" fpr 1400 images on laptop with a local fast disk
#
import matplotlib.pyplot as plt
import numpy as np
import sys
date = ''
table = sys.argv[1]
png = table + '.png'
twopi = 2*np.pi
# table of time index (1...N) and median sky brightness (50,000 is very bright)
(t,s) = np.... | Python | 0.00001 |
d84034db71abac46ef765f1640f3efa6712f5c42 | Update RegisterHandler.py | Handlers/RegisterHandler.py | Handlers/RegisterHandler.py | # -*- coding: utf-8 -*-
import logging
from Handlers.BaseHandler import BaseHandler
from Tools import PostgreSQL, VerifyFields
logger = logging.getLogger(__name__)
class RegisterHandler(BaseHandler):
"""handle / endpoint"""
def get(self):
"""Serve Get and return main page"""
self.render('re... | # -*- coding: utf-8 -*-
import logging
from Handlers.BaseHandler import BaseHandler
from Tools import PostgreSQL, VerifyFields
logger = logging.getLogger(__name__)
class RegisterHandler(BaseHandler):
"""handle / endpoint"""
def initialize(self):
self.conn = PostgreSQL.get_session()
def get(sel... | Python | 0.000001 |
a7160ce9345b14e656ce702b187048347b843811 | update test_with_count_combination.py | tests/unit/selection/modules/test_with_count_combination.py | tests/unit/selection/modules/test_with_count_combination.py | # Tai Sakuma <tai.sakuma@gmail.com>
import itertools
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.selection.modules import AllwCount, AnywCount, NotwCount
##__________________________________________________________________||
class MockEventSelection(object)... | # Tai Sakuma <tai.sakuma@gmail.com>
import itertools
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.selection.modules import AllwCount, AnywCount, NotwCount
##__________________________________________________________________||
class MockEventSelection(object)... | Python | 0.000002 |
19b251a41ad26d7dabaf571b9bb90b82b9108d4b | fix hostname config issue | vint/cerf_api.py | vint/cerf_api.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import json
from urlparse import urljoin
import requests
__author__ = 'tchen'
logger = logging.getLogger(__name__)
DEFAULT_HOSTNAME = 'http://exam.tchen.me'
#DEFAULT_HOSTNAME = 'http://localhost:8000'
class Request(object):
hostname ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import json
from urlparse import urljoin
import requests
__author__ = 'tchen'
logger = logging.getLogger(__name__)
DEFAULT_HOSTNAME = 'http://exam.tchen.me'
#DEFAULT_HOSTNAME = 'http://localhost:8000'
class Request(object):
hostname ... | Python | 0.000004 |
98d0e2d5aaff184afc598bef67491632c0eab066 | Add save_load and get_load to mongo returner | salt/returners/mongo_future_return.py | salt/returners/mongo_future_return.py | '''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files::
mongo.db: <database name>
mongo.host: <server ip address>
mongo... | '''
Return data to a mongodb server
Required python modules: pymongo
This returner will send data from the minions to a MongoDB server. To
configure the settings for your MongoDB server, add the following lines
to the minion config files::
mongo.db: <database name>
mongo.host: <server ip address>
mongo... | Python | 0 |
0aaa9000f8cf545bd5bfa41b6538d56c91dbde97 | Update base box in sample config too | sampleconfigs/makebs.config.sample.py | sampleconfigs/makebs.config.sample.py | #!/usr/bin/env python2
# You will need to alter these before running ./makebuildserver
# Name of the base box to use...
basebox = "testing32"
# Location where raring32.box can be found, if you don't already have
# it. For security reasons, it's recommended that you make your own
# in a secure environment using trust... | #!/usr/bin/env python2
# You will need to alter these before running ./makebuildserver
# Name of the base box to use...
basebox = "raring32"
# Location where raring32.box can be found, if you don't already have
# it. Could be set to https://f-droid.org/raring32.box if you like...
baseboxurl = "/shares/software/OS an... | Python | 0 |
f5ea4c44480b0beafd7d22b50228d50d3130e7a2 | support for deleting files when using utils-process in auto-mode | utils/process.py | utils/process.py | #!/usr/bin/env python
# Copyright (C) 2010-2014 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
import time
import logging
import argparse
import multiprocessing
logging.basicConfig(level=logging.INFO)
l... | #!/usr/bin/env python
# Copyright (C) 2010-2014 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
import time
import logging
import argparse
import multiprocessing
logging.basicConfig(level=logging.INFO)
l... | Python | 0 |
bcf6e41b489b5447186c063193d32714856bdfc7 | Add some example docs | InvenTree/plugin/samples/integration/custom_panel_sample.py | InvenTree/plugin/samples/integration/custom_panel_sample.py | """
Sample plugin which renders custom panels on certain pages
"""
from plugin import IntegrationPluginBase
from plugin.mixins import PanelMixin
from part.views import PartDetail
from stock.views import StockLocationDetail
class CustomPanelSample(PanelMixin, IntegrationPluginBase):
"""
A sample plugin which... | """
Sample plugin which renders custom panels on certain pages
"""
from plugin import IntegrationPluginBase
from plugin.mixins import PanelMixin
from part.views import PartDetail
from stock.views import StockLocationDetail
class CustomPanelSample(PanelMixin, IntegrationPluginBase):
"""
A sample plugin which... | Python | 0.000001 |
e267bf384a33e17c48101e4726975dae31a88563 | Fix docstring for correlations. | scikits/talkbox/tools/correlations.py | scikits/talkbox/tools/correlations.py | import numpy as np
from scipy.fftpack import fft, ifft
__all__ = ['nextpow2', 'acorr']
def nextpow2(n):
"""Return the next power of 2 such as 2^p >= n.
Notes
-----
Infinite and nan are left untouched, negative values are not allowed."""
if np.any(n < 0):
raise ValueError("n should be > 0"... | import numpy as np
from scipy.fftpack import fft, ifft
__all__ = ['nextpow2', 'acorr']
def nextpow2(n):
"""Return the next power of 2 such as 2^p >= n.
Notes
-----
Infinite and nan are left untouched, negative values are not allowed."""
if np.any(n < 0):
raise ValueError("n should be > 0... | Python | 0 |
45918f696ff43815a15640b080b68b007c27b2f8 | Clean-up query | scripts/analytics/preprint_summary.py | scripts/analytics/preprint_summary.py | import pytz
import logging
from dateutil.parser import parse
from datetime import datetime, timedelta
from django.db.models import Q
from website.app import init_app
from scripts.analytics.base import SummaryAnalytics
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
LOG_THRESHOLD = 11
... | import pytz
import logging
from dateutil.parser import parse
from datetime import datetime, timedelta
from django.db.models import Q
from website.app import init_app
from scripts.analytics.base import SummaryAnalytics
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
LOG_THRESHOLD = 11
... | Python | 0.999883 |
32aec3e5595fe0868b77260cb64be718d4e7f3b8 | Update Keras.py | Momentum/Keras.py | Momentum/Keras.py | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
batch_size = 128
epochs = 30
learning_rate = 0.1
momentum = 0.9
num_classes = 10
(x_trai... | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
batch_size = 128
epochs = 30
learning_rate = 0.1
momentum = 0.9
num_classes = 10
(x_trai... | Python | 0 |
aa6090b69f64721391dec38de04e8d01d23c48bf | Add tests for differential calculus methods | sympy/calculus/tests/test_singularities.py | sympy/calculus/tests/test_singularities.py | from sympy import Symbol, exp, log
from sympy.calculus.singularities import (singularities, is_increasing,
is_strictly_increasing, is_decreasing,
is_strictly_decreasing)
from sympy.sets import Interval
from sympy import oo, S
from symp... | from sympy import Symbol, exp, log
from sympy.calculus.singularities import singularities
from sympy.utilities.pytest import XFAIL
def test_singularities():
x = Symbol('x', real=True)
assert singularities(x**2, x) == ()
assert singularities(x/(x**2 + 3*x + 2), x) == (-2, -1)
@XFAIL
def test_singularit... | Python | 0.000003 |
f84f7e9091725d638e93d1dc14b830118a1833c8 | add returns for views | gps_tracker/views.py | gps_tracker/views.py | from pyramid.view import view_config
points_list = [
{"_id": 'ObjectId("52e3eb56a7cade5d0898e012")', "latitude": "45.215",
"longitude": "14.131", "gas_station": "Lukoil", "odometer": "24100",
"description": "Bad coffee"},
{"_id": 'ObjectId("52e3eb79a7cade5d0898e013")', "latitude": "47.412",
"lon... | from pyramid.view import view_config
points_list = [
{"_id": 'ObjectId("52e3eb56a7cade5d0898e012")', "latitude": "45.215",
"longitude": "14.131", "gas_station": "Lukoil", "odometer": "24100",
"description": "Bad coffee"},
{"_id": 'ObjectId("52e3eb79a7cade5d0898e013")', "latitude": "47.412",
"lon... | Python | 0 |
d5f84783c376906dd5733391593ceae792b5edda | Bump version to 0.1.0 | vcli/__init__.py | vcli/__init__.py | __version__ = '0.1.0'
| __version__ = '0.0.1'
| Python | 0.000001 |
7c09e8cad8892aa2a491297618b6091e7286c6d3 | move get model code to method | exportdata/management/commands/exportdata.py | exportdata/management/commands/exportdata.py | import os
import csv
import sys
from optparse import make_option
from collections import Callable
from django.contrib.sites.models import Site
from django.db.models.loading import get_model
from django.core.management.base import LabelCommand, CommandError
DOMAIN = Site.objects.get_current().domain
class Command(L... | import os
import csv
import sys
from optparse import make_option
from collections import Callable
from django.contrib.sites.models import Site
from django.db.models.loading import get_model
from django.core.management.base import LabelCommand, CommandError
DOMAIN = Site.objects.get_current().domain
class Command(L... | Python | 0 |
680122f69c5aab9be4dc1965024ac882326d1c5b | Add license to watched.py | derpibooru/watched.py | derpibooru/watched.py | # Copyright (c) 2014, Joshua Stone
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the ... |
class Watched(object):
def __init__(self, key, page=1, perpage=15, comments=False, fav=False):
self.__parameters = {}
self.key = key
self.page = page
self.perpage = perpage
self.comments = comments
self.fav = fav
@property
def hostname(self):
return("https://derpiboo.ru")
@propert... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.