commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
5c7ba15d015d0a30f93f5fc68898c76bcba3f7fa | Fix some issues with folders's path | onitu/onitu,onitu/onitu,onitu/onitu | onitu/plug/folder.py | onitu/plug/folder.py | from .exceptions import DriverError
class Folder(object):
def __init__(self, name, path, options=None):
self.name = name
self.path = path
self.options = options if options is not None else {}
def __str__(self):
return self.name
@classmethod
def get_folders(cls, plug)... | from .exceptions import DriverError
class Folder(object):
def __init__(self, name, path, options=None):
self.name = name
self.path = path
self.options = options if options is not None else {}
def __str__(self):
return self.name
@classmethod
def get_folders(cls, plug)... | mit | Python |
37ed18a4ab51bbe6774be90fa22901f6092c6c15 | Add comments | KT12/hands_on_machine_learning | distributing_deep_rnn.py | distributing_deep_rnn.py | # Class for TF distributed deep RNN
import tensorflow as tf
class DeviceCellWrapper(tf.contrib.rnn.RNNCell):
def __init__(self, device, cell):
self._cell = cell
self._device = device
@property
def state_size(self):
return self._cell.state_size
@ property
def output_si... | import tensorflow as tf
class DeviceCellWrapper(tf.contrib.rnn.RNNCell):
def __init__(self, device, cell):
self._cell = cell
self._device = device
@property
def state_size(self):
return self._cell.state_size
@ property
def output_size(self):
return self._cell.o... | mit | Python |
d44c00841f254a208ac5b3720c9c44027abb9bbb | Update login timout=120 | xjsender/haoide,xjsender/SublimeApex,xjsender/haoide,xjsender/haoide | salesforce/login.py | salesforce/login.py | import urllib
try:
# Python 3.x
from .. import requests
from . import soap_bodies
from .util import getUniqueElementValueFromXmlString
except:
# Python 2.x
import requests
import soap_bodies
from util import getUniqueElementValueFromXmlString
# https://github.com/xjsender/simple-salesf... | import urllib
try:
# Python 3.x
from .. import requests
from . import soap_bodies
from .util import getUniqueElementValueFromXmlString
except:
# Python 2.x
import requests
import soap_bodies
from util import getUniqueElementValueFromXmlString
# https://github.com/xjsender/simple-salesf... | mit | Python |
9cffa850a7b7d768105a90c27b2433c55c295ce6 | implement delete function to etcd sdb backend (#32832) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/sdb/etcd_db.py | salt/sdb/etcd_db.py | # -*- coding: utf-8 -*-
'''
etcd Database Module
:maintainer: SaltStack
:maturity: New
:depends: python-etcd
:platform: all
.. versionadded:: 2015.5.0
This module allows access to the etcd database using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-etcd``.
L... | # -*- coding: utf-8 -*-
'''
etcd Database Module
:maintainer: SaltStack
:maturity: New
:depends: python-etcd
:platform: all
.. versionadded:: 2015.5.0
This module allows access to the etcd database using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-etcd``.
L... | apache-2.0 | Python |
3a8ea034e43985d4358b9f3e54c9bfc59ee6e99b | Remove single quote escaping for router js | dreipol/djangocms-spa-vue-js | djangocms_spa_vue_js/templatetags/router_tags.py | djangocms_spa_vue_js/templatetags/router_tags.py | import json
from django import template
from django.utils.safestring import mark_safe
from ..menu_helpers import get_vue_js_router
register = template.Library()
@register.simple_tag(takes_context=True)
def vue_js_router(context):
if 'vue_js_router' in context:
router = context['vue_js_router']
else... | import json
from django import template
from django.utils.safestring import mark_safe
from ..menu_helpers import get_vue_js_router
register = template.Library()
@register.simple_tag(takes_context=True)
def vue_js_router(context):
if 'vue_js_router' in context:
router = context['vue_js_router']
else... | mit | Python |
699d0ce951542af5bf767de37baf7dd2462f6e3d | Update statistics.py | 100stacks/100stacks.github.io,100stacks/100stacks.github.io,100stacks/100stacks.github.io | blog/bits/statistics.py | blog/bits/statistics.py | # Statistics module
import statistics
sample = [3,7,6,2,10,14,9,5,2,1,5,8,2,4]
print('''
The following shows a some of the available methods of the
built-in statistics module.
Our sample list:
''', sample)
q = statistics.mean(sample)
print('mean: ', q)
r = statistics.median(sample)
print('median:', r)
s = statis... | # Statistics module
import statistics
sample = [3,7,6,2,10,14,9,5,2,1,5,8,2,4]
print('''
The following shows a some of the available methods of the
built-in statistics module.
Our sample list:
''', sample)
q = statistics.mean(sample)
print('mean: ', q)
r = statistics.median(sample)
print('median:', r)
'''
Output... | unlicense | Python |
d9a787128acd3bcefc53ca48555232191755c924 | Fix example code for Docker events (#70) | barrachri/aiodocker,barrachri/aiodocker,barrachri/aiodocker,paultag/aiodocker,gaopeiliang/aiodocker,gaopeiliang/aiodocker,gaopeiliang/aiodocker | examples/events.py | examples/events.py | #!/usr/bin/env python3
import asyncio
from aiodocker.docker import Docker
from aiodocker.exceptions import DockerError
async def demo(docker):
try:
await docker.images.get('alpine:latest')
except DockerError as e:
if e.status == 404:
await docker.pull('alpine:latest')
else... | #!/usr/bin/env python3
import asyncio
from aiodocker.docker import Docker
from aiodocker.exceptions import DockerError
async def demo(docker):
try:
await docker.images.get('alpine:latest')
except DockerError as e:
if e.status == 404:
await docker.pull('alpine:latest')
else... | mit | Python |
94dc948f8fdd134adbd75d1ae8140b4e3fe74d23 | Load urls based on configs | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | bluebottle/urls/core.py | bluebottle/urls/core.py | from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
urlpatterns = patterns('',
# The api urls are in the / url namespace so that they're not redirected to /en/.
url(r... | from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
urlpatterns = patterns('',
# The api urls are in the / url namespace so that they're not redirected to /en/.
url(r... | bsd-3-clause | Python |
0de4851e197ac9a8feb74cec7566cf1793334e30 | Allow passing data and json kwargs | timofurrer/ramlient | ramlient/request.py | ramlient/request.py | # -*- coding: utf-8 -*-
"""
ramlient
~~~~~~~~
Access to a RAML API done right, in Python.
:copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import requests
from ramlfications.raml import AVAILABLE_METHODS
from .utils import match_type
from ... | # -*- coding: utf-8 -*-
"""
ramlient
~~~~~~~~
Access to a RAML API done right, in Python.
:copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import requests
from ramlfications.raml import AVAILABLE_METHODS
from .utils import match_type
from ... | mit | Python |
73aa6c35b27b4766dad08ef97839944366d92aa9 | update version to 0.1.4 | rsalmaso/django-reactjs,rsalmaso/django-reactjs | reactjs/__init__.py | reactjs/__init__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2007-2015, Raffaele Salmaso <raffaele@salmaso.org>
#
# 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... | # -*- coding: utf-8 -*-
# Copyright (C) 2007-2015, Raffaele Salmaso <raffaele@salmaso.org>
#
# 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... | mit | Python |
ed2ab272e28fdfe515d2aac1f38a74658e6f3679 | bump version to 0.5.1 | mgedmin/readme,pypa/readme_renderer,pypa/readme,sigmavirus24/readme | readme/__about__.py | readme/__about__.py | # Copyright 2014 Donald Stufft
#
# 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, so... | # Copyright 2014 Donald Stufft
#
# 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, so... | apache-2.0 | Python |
1d80b4563aef041b49411fbd75a7a235cc6ce5b3 | bump version | hhatto/poyonga | poyonga/__init__.py | poyonga/__init__.py | from poyonga.client import Groonga
from poyonga.result import GroongaResult
__version__ = '0.2.3'
__all__ = ['Groonga', 'GroongaResult']
| from poyonga.client import Groonga
from poyonga.result import GroongaResult
__version__ = '0.2.2'
__all__ = ['Groonga', 'GroongaResult']
| mit | Python |
b5073c63ef3181f3f9ccfc4cac3a387d2b245f4b | Bump version to 0.6.0 | welchbj/tt,welchbj/tt,welchbj/tt | tt/version.py | tt/version.py | """Version info for tt."""
__version_info__ = (0, 6, 0)
__version__ = '.'.join(str(i) for i in __version_info__)
| """Version info for tt."""
__version_info__ = (0, 5, 1)
__version__ = '.'.join(str(i) for i in __version_info__)
| mit | Python |
1f8e47a9d815688c913f4885e79214ebe16f7d26 | Remove debug print | smotti/log-broker | log-broker.py | log-broker.py | #!/usr/bin/env python2.7
from os import _exit
from sys import argv, exit
from threading import Thread
from time import sleep
import zmq
FRONTEND_ADDR = "inproc://log-broker-frontend"
BACKEND_ADDR = "ipc:///tmp/log-broker-backend.ipc"
def sub_pub_proxy():
context = zmq.Context.instance()
frontend = context.s... | #!/usr/bin/env python2.7
from os import _exit
from sys import argv, exit
from threading import Thread
from time import sleep
import zmq
FRONTEND_ADDR = "inproc://log-broker-frontend"
BACKEND_ADDR = "ipc:///tmp/log-broker-backend.ipc"
def sub_pub_proxy():
context = zmq.Context.instance()
frontend = context.s... | mit | Python |
f8fd93ea7371dd473d597ac58debb05144ba9c78 | Move multiprocessing import into setup_logger to allow multiprocesing to not be required in the web server. | mitsuhiko/celery,ask/celery,WoLpH/celery,frac/celery,cbrepo/celery,ask/celery,WoLpH/celery,frac/celery,mitsuhiko/celery,cbrepo/celery | celery/log.py | celery/log.py | """celery.log"""
import os
import sys
import time
import logging
from celery.conf import LOG_FORMAT, DAEMON_LOG_LEVEL
def setup_logger(loglevel=DAEMON_LOG_LEVEL, logfile=None, format=LOG_FORMAT,
**kwargs):
"""Setup the ``multiprocessing`` logger. If ``logfile`` is not specified,
``stderr`` is used.
... | """celery.log"""
import multiprocessing
import os
import sys
import time
import logging
from celery.conf import LOG_FORMAT, DAEMON_LOG_LEVEL
def setup_logger(loglevel=DAEMON_LOG_LEVEL, logfile=None, format=LOG_FORMAT,
**kwargs):
"""Setup the ``multiprocessing`` logger. If ``logfile`` is not specified,
... | bsd-3-clause | Python |
78ad965e30509b90b64d30d61a396cfb22a5fe35 | Update version | karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle | prophyle/version.py | prophyle/version.py | VERSION="0.2.2.0"
| VERSION="0.2.1.4" | mit | Python |
75bf8203050e2a989c8a1e5e5f5d35e800fd31ac | Fix up version | aizvorski/scikit-video | skvideo/version.py | skvideo/version.py | __version__ = "0.0.1"
| __version__ = "0.1"
| bsd-3-clause | Python |
d676829f7af8a5afa641f07a9bfbb047e70c44f8 | set new bottle auth version | avelino/bottle-auth | bottle_auth/__init__.py | bottle_auth/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
import inspect
__version__ = '0.2.3'
__author__ = "Thiago Avelino"
__email__ = "thiago@avelino.xxx"
class AuthPlugin(object):
name = 'auth'
def __init__(self, engine, keyword='auth'):
"""
:param engine: Auth engine created function... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
import inspect
__version__ = '0.1.2'
__author__ = "Thiago Avelino"
__email__ = "thiago@avelino.xxx"
class AuthPlugin(object):
name = 'auth'
def __init__(self, engine, keyword='auth'):
"""
:param engine: Auth engine created function... | mit | Python |
d31f4d524ce85d4da1619519f2449d77dddca0b7 | Add necessary file path leading '/' | untergeek/es_stats_zabbix,untergeek/es_stats_zabbix | es_stats_zabbix/defaults/settings.py | es_stats_zabbix/defaults/settings.py | from os import access, path, R_OK
APIS = ['health', 'clusterstate', 'clusterstats', 'nodeinfo', 'nodestats']
FILEPATHS = [
path.join(path.expanduser('~'), '.es_stats_zabbix', 'config.yml'),
path.join('/', 'etc', 'es_stats_zabbix', 'config.yml'),
]
SKIP_THESE = [
'get',
'os',
'update',
'key... | from os import access, path, R_OK
APIS = ['health', 'clusterstate', 'clusterstats', 'nodeinfo', 'nodestats']
FILEPATHS = [
path.join(path.expanduser('~'), '.es_stats_zabbix', 'config.yml'),
path.join('etc', 'es_stats_zabbix', 'config.yml'),
]
SKIP_THESE = [
'get',
'os',
'update',
'keys',
... | apache-2.0 | Python |
24d0b0e08fb3d6d8b9d788ef05a192e74a77317c | Change Volatility binary name (#407) | google/turbinia,google/turbinia,google/turbinia,google/turbinia,google/turbinia | turbinia/workers/volatility.py | turbinia/workers/volatility.py | # -*- coding: utf-8 -*-
# Copyright 2015 Google 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 ... | # -*- coding: utf-8 -*-
# Copyright 2015 Google 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 ... | apache-2.0 | Python |
8514d379ac3a9d75722b3ccccd0a9da40d2c5819 | Add EbicsPy Launchpad repository url | yuntux/l10n_fr_ebics | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementation of the EBICS banking protocol""",
'description': """
This module provides an interface to echanges files with banks. It's curently a beta version.
This module isbased on the library ebicsPy. It maps Odoo with the eb... | # -*- coding: utf-8 -*-
{
'name': "l10n_fr_ebics",
'summary': """Implementation of the EBICS banking protocol""",
'description': """
This module provides an interface to echanges files with banks. It's curently a beta version.
This program is distributed in the hope that it will be useful, b... | agpl-3.0 | Python |
926aae6d674f03803158978e211fe0e9e3c51722 | Correct logging level for messages. | cahirwpz/demoscene,cahirwpz/demoscene,cahirwpz/demoscene,cahirwpz/demoscene | scripts/util/iff.py | scripts/util/iff.py | #!/usr/bin/env python
from chunk import Chunk
import logging
import struct
class Parser(object):
ChunkAliasMap = {}
def __init__(self, kind):
self._kind = kind
self._chunks = []
def loadFile(self, filename):
with open(filename) as iff:
chunk = Chunk(iff)
logging.info('Reading file "%s... | #!/usr/bin/env python
from chunk import Chunk
import logging
import struct
class Parser(object):
ChunkAliasMap = {}
def __init__(self, kind):
self._kind = kind
self._chunks = []
def loadFile(self, filename):
with open(filename) as iff:
chunk = Chunk(iff)
logging.error('Reading file "%... | artistic-2.0 | Python |
439de8288ab84b4344d2474ea3c3c912cd523b99 | Fix tag | bollu/vispy,QuLogic/vispy,jay3sh/vispy,sh4wn/vispy,michaelaye/vispy,jdreaver/vispy,sbtlaarzc/vispy,ghisvail/vispy,Eric89GXL/vispy,kkuunnddaannkk/vispy,hronoses/vispy,Eric89GXL/vispy,dchilds7/Deysha-Star-Formation,srinathv/vispy,julienr/vispy,Eric89GXL/vispy,hronoses/vispy,sbtlaarzc/vispy,srinathv/vispy,inclement/vispy,... | examples/basics/plotting/mpl_plot.py | examples/basics/plotting/mpl_plot.py | # -*- coding: utf-8 -*-
# vispy: testskip
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ----------------------------------------------------------------------------... | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Example demonstrating how to use vispy.pyplot, which uses mplexporter
to convert matplotlib commands to vispy draw commands.
Requires matplotlib.
"""
import numpy as np
i... | bsd-3-clause | Python |
29fb5cc022d7e938e7c464b26ea030bd4df03fa5 | Put size check also in configure.py | whofman/my-pipulate,whofman/my-pipulate,miklevin/pipulate,whofman/my-pipulate,miklevin/pipulate,miklevin/pipulate | configure.py | configure.py | import os, os.path, pickle
def askquestions(filename):
questions = dictofquestions()
answers = {}
previousanswers = showanswers(filename)
sortedquestions = sorted(questions.keys())
for question in sortedquestions:
if isinstance(previousanswers, dict):
answer = raw_input(question + ' (Hit ENTER to k... | def askquestions(filename):
questions = dictofquestions()
answers = {}
previousanswers = showanswers(filename)
sortedquestions = sorted(questions.keys())
for question in sortedquestions:
if isinstance(previousanswers, dict):
answer = raw_input(question + ' (Hit ENTER to keep "' + previousanswers[que... | mit | Python |
96745b4b6b8171af31a38c34d382002626746452 | Remove old debugging code | teddywing/RoboFont-Equalize-Sidebearings-Key,teddywing/RoboFont-Equalize-Sidebearings-Key | equalize_sidebearings.py | equalize_sidebearings.py | from AppKit import NSUserDefaults
from mojo.events import addObserver
from lib.doodleMenus import SpaceCenterMenuForGlyph
class CustomSpaceCenterMenuForGlyph(SpaceCenterMenuForGlyph):
def __init__(self, glyph):
self._glyph = glyph
super(SpaceCenterMenuForGlyph, self).__init__()
class EqualizeS... | from AppKit import NSUserDefaults
from mojo.events import addObserver
from lib.doodleMenus import SpaceCenterMenuForGlyph
class CustomSpaceCenterMenuForGlyph(SpaceCenterMenuForGlyph):
def __init__(self, glyph):
self._glyph = glyph
super(SpaceCenterMenuForGlyph, self).__init__()
class EqualizeS... | mit | Python |
b7ef45f366805e578d7400aa7956551f626bae7a | check for spyder | agogear/corpkit,agogear/corpkit,jamesdavidson/corpkit,jamesdavidson/corpkit | corpkit/tests.py | corpkit/tests.py | def check_pytex():
"""checks for pytex, i hope"""
import inspect
thestack = []
for bit in inspect.stack():
for b in bit:
thestack.append(str(b))
as_string = ' '.join(thestack)
if 'pythontex' in as_string:
return True
else:
return False
def check_spyder():... | def check_pytex():
"""checks for pytex, i hope"""
import inspect
thestack = []
for bit in inspect.stack():
for b in bit:
thestack.append(str(b))
as_string = ' '.join(thestack)
if 'pythontex' in as_string:
return True
else:
return False
def check_dit():
... | mit | Python |
328537ae478a90d18c2483a61ab8432a8d3e1cd2 | Remove debug lines | ligurio/free-software-testing-books,RobbiNespu/free-software-testing-books,honsiorovskyi/free-software-testing-books,adini121/free-software-testing-books | check_urls.py | check_urls.py | #!/usr/bin/env python2.7
import re, sys, markdown, requests, bs4 as BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf8')
def check_url(url):
try:
return bool(requests.head(url, allow_redirects=True))
except Exception as e:
print 'Error checking URL %s: %s' % (url, e)
return False
... | #!/usr/bin/env python2.7
import re, sys, markdown, requests, bs4 as BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf8')
def check_url(url):
try:
return bool(requests.head(url, allow_redirects=True))
except Exception as e:
print 'Error checking URL %s: %s' % (url, e)
return False
... | unlicense | Python |
e571a411497e3308179c1e3c2c60d41fa4aadd1f | Update __init__.py | valentinmk/asynccmd | asynccmd/__init__.py | asynccmd/__init__.py | # Copyright (c) 2016-present Valentin Kazakov
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
from .asynccmd import Cmd
__version__ = '0.2.4'
| # Copyright (c) 2016-present Valentin Kazakov
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
from .asynccmd import Cmd
__version__ = '0.2.3'
| apache-2.0 | Python |
2a72805e3e4f4897bec3bafcc829343e68868ead | Remove unneeded comments | vanhuyz/CycleGAN-TensorFlow,vanhuyz/CycleGAN-TensorFlow | discriminator.py | discriminator.py | import tensorflow as tf
import ops
class Discriminator:
def __init__(self, name, is_training, patch_size=70, use_sigmoid=False):
self.name = name
self.is_training = is_training
self.reuse = False
self.patch_size = 70
self.use_sigmoid = use_sigmoid
def __call__(self, input):
"""
Args:
... | import tensorflow as tf
import ops
class Discriminator:
def __init__(self, name, is_training, patch_size=70, use_sigmoid=False):
self.name = name
self.is_training = is_training
self.reuse = False
self.patch_size = 70
self.use_sigmoid = use_sigmoid
def __call__(self, input):
"""
Args:
... | mit | Python |
6a666c2e472e1337f2d596dbc17f99086fe203c2 | Revert "Add optional timestamp argument to easyrtc.string()" | SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32 | esp32/modules/easyrtc.py | esp32/modules/easyrtc.py | # File: easyrtc.py
# Version: 1
# Description: Wrapper that makes using the clock simple
# License: MIT
# Authors: Renze Nicolai <renze@rnplus.nl>
import machine, time
# Functions
def string(date=False, time=True):
[year, month, mday, wday, hour, min, sec, usec] = machine.RTC().datetime()
monthstr = str(month... | # File: easyrtc.py
# Version: 1
# Description: Wrapper that makes using the clock simple
# License: MIT
# Authors: Renze Nicolai <renze@rnplus.nl>
import machine, time
# Functions
def string(print_date=False, print_time=True, timestamp = -1):
if timestamp<0:
[year, month, mday, wday, hour, minute, sec, us... | mit | Python |
5eaad7f422b5e81f5b322556982337c818b4e9b2 | Set existing Elasticsearch port with env variable that confirms to format of other env variables in Dockerfile/docker-compose.yml. Reason: ELASTICSEARCH_HTTP_PORT is also used in other places. re #1650 | archesproject/arches,archesproject/arches,cvast/arches,cvast/arches,cvast/arches,archesproject/arches,archesproject/arches,cvast/arches | docker/settings_local.py | docker/settings_local.py | import os
from django.core.exceptions import ImproperlyConfigured
import ast
import requests
import sys
from settings import *
def get_env_variable(var_name):
msg = "Set the %s environment variable"
try:
return os.environ[var_name]
except KeyError:
error_msg = msg % var_name
raise I... | import os
from django.core.exceptions import ImproperlyConfigured
import ast
import requests
import sys
from settings import *
def get_env_variable(var_name):
msg = "Set the %s environment variable"
try:
return os.environ[var_name]
except KeyError:
error_msg = msg % var_name
raise I... | agpl-3.0 | Python |
4c5a61d30ba789dbbbee274891a6ad83b300c261 | Switch back to development version | goldmann/docker-scripts,goldmann/docker-squash | docker_squash/version.py | docker_squash/version.py | version = "1.0.6rc1.dev"
| version = "1.0.5"
| mit | Python |
18e1be4f0c53208ebaca39bf1e89a15cc9fd4b19 | print command | hampustagerud/colorconverter | converter.py | converter.py | #
# MIT License
# Copyright (c) 2017 Hampus Tågerud
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, m... | #
# MIT License
# Copyright (c) 2017 Hampus Tågerud
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, m... | mit | Python |
0a1143393d9935cd072f8b0b35d990b62e3ff8da | Add cwd and timeout to misc.run | jachris/cook | cook/misc.py | cook/misc.py | from cook import core
@core.rule
def run(
command, outputs, inputs=None, message=None, env=None, timeout=None,
cwd=None
):
inputs = core.source(inputs or [])
outputs = core.build(outputs)
command[0] = core.which(command[0])
yield core.publish(
inputs=inputs + [command[0]],
out... | from cook import core
@core.rule
def run(command, outputs, inputs=None, message=None, env=None):
inputs = core.source(inputs or [])
outputs = core.build(outputs)
command[0] = core.which(command[0])
yield core.publish(
inputs=inputs + [command[0]],
outputs=outputs,
message=mess... | mit | Python |
5144aeb4dcf1c67ad8097db3182a746e663792dc | add fmin_cg to minimizers | LowinData/pyautodiff | autodiff/optimize.py | autodiff/optimize.py | """
SciPy-based function optimization
"""
import numpy as np
import scipy
from autodiff.symbolic import VectorArg
import autodiff.utils as utils
def fmin_cg(fn,
args,
return_info=False,
**scipy_kwargs):
"""
Minimize a scalar valued function using SciPy's nonlinear conjuga... | """
SciPy-based function optimization
"""
import numpy as np
import scipy
from autodiff.symbolic import VectorArg
import autodiff.utils as utils
def fmin_l_bfgs_b(fn,
args,
scalar_bounds=None,
return_info=False,
**scipy_kwargs):
"""
Min... | bsd-3-clause | Python |
ce5526b06c5a46fa561a47bc14168615d37d3b3d | Add support for direct parsing of Unit from string | merrywhether/autoprotocol-python | autoprotocol/unit.py | autoprotocol/unit.py | from __future__ import division, print_function
from pint import UnitRegistry
from pint.quantity import _Quantity
'''
:copyright: 2016 by The Autoprotocol Development Team, see AUTHORS
for more details.
:license: BSD, see LICENSE for more details
'''
# Preload UnitRegistry
ureg = UnitRegistry("autopr... | from __future__ import division, print_function
from pint import UnitRegistry
from pint.quantity import _Quantity
'''
:copyright: 2016 by The Autoprotocol Development Team, see AUTHORS
for more details.
:license: BSD, see LICENSE for more details
'''
# Preload UnitRegistry
ureg = UnitRegistry("autopr... | bsd-3-clause | Python |
4d38109c4cae2e8bab683e19cfdc157d61d7da46 | Update DisassociateRouteTable | nagyistoce/euca2ools,gholms/euca2ools,jhajek/euca2ools,nagyistoce/euca2ools,jhajek/euca2ools,gholms/euca2ools,vasiliykochergin/euca2ools,vasiliykochergin/euca2ools | euca2ools/commands/ec2/disassociateroutetable.py | euca2ools/commands/ec2/disassociateroutetable.py | # Copyright 2013-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | # Copyright 2009-2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | bsd-2-clause | Python |
b2fff6f6534d4230b88f406c0e790e75734fad68 | fix lambda2 in inverse computation | lorenzo-desantis/mne-python,andyh616/mne-python,Odingod/mne-python,effigies/mne-python,ARudiuk/mne-python,adykstra/mne-python,effigies/mne-python,bloyl/mne-python,drammock/mne-python,ARudiuk/mne-python,kingjr/mne-python,cjayb/mne-python,olafhauk/mne-python,rkmaddox/mne-python,nicproulx/mne-python,Odingod/mne-python,pra... | examples/plot_compute_mne_inverse.py | examples/plot_compute_mne_inverse.py | """
============================
Compute MNE inverse solution
============================
"""
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
print __doc__
import os
import mne
fname_inv = os.environ['MNE_SAMPLE_DATASET_PATH']
fname_inv += '/MEG/sample/sample_audvis-meg-oct-... | """
============================
Compute MNE inverse solution
============================
"""
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
print __doc__
import os
import mne
fname_inv = os.environ['MNE_SAMPLE_DATASET_PATH']
fname_inv += '/MEG/sample/sample_audvis-meg-oct-... | bsd-3-clause | Python |
b558e681ad796aaba6ed000878eec6997069feff | use MethodView | voltaire/website | voltaire/website/views/api/__init__.py | voltaire/website/views/api/__init__.py | from flask import jsonify, render_template
from flask.views import MethodView
from .. import app
class ApiBase(MethodView):
@property
def template(self):
raise NotImplementedError()
def get_objects(self):
raise NotImplementedError()
def render_template(self, context):
return ... | from flask import jsonify, render_template
from flask.views import View
from .. import app
class ApiBase(View):
methods = []
@property
def template(self):
raise NotImplementedError()
def get_objects(self):
raise NotImplementedError()
def render_template(self, context):
r... | mit | Python |
58edbfb3ac6099b2163e0792703446793b8c5aad | add blankline | umyuu/Sample,umyuu/Sample,umyuu/Sample,umyuu/Sample | src/Python3/Q106948/exsample.py | src/Python3/Q106948/exsample.py | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
def main():
base_dir = os.path.dirname(__file__)
chrome_options = Options()
# ヘッドレスモードを使用したい時は以下の行のコメントを解除してくださいな。
#chrome_options.add_argument('headless')
#ref https://stackover... | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
def main():
base_dir = os.path.dirname(__file__)
chrome_options = Options()
# ヘッドレスモードを使用したい時は以下の行のコメントを解除してくださいな。
#chrome_options.add_argument('headless')
#ref https://stack... | mit | Python |
3e91ff11f93e491963f6e38965672a9694ea0786 | Make sure package works even if ipopt is not installed | matthias-k/optpy | optimize/__init__.py | optimize/__init__.py | from __future__ import absolute_import
from .optimization import ParameterManager, minimize
from .jacobian import FunctionWithApproxJacobian, FunctionWithApproxJacobianCentral
try:
from .ipopt_wrapper import minimize_ipopt
except:
import logging
logging.error("Could not import ipopt wrapper. Maybe ipopt i... | from __future__ import absolute_import
from .optimization import ParameterManager, minimize
from .jacobian import FunctionWithApproxJacobian, FunctionWithApproxJacobianCentral
| mit | Python |
b60c3c13f9422b9afdaa94da40cb87eb5f38a9d1 | update to 0.3.0 | mrahnis/orangery | orangery/__init__.py | orangery/__init__.py | from orangery.core.api import *
__version__ = '0.3.0' | from orangery.core.api import *
__version__ = '0.2.0' | bsd-3-clause | Python |
e99855e31c30d0b554d24b14d98ae8b76e1fc0a0 | Fix close connection only when called as script. | sketchturnerr/WaifuSim-backend,sketchturnerr/WaifuSim-backend | create_tables.py | create_tables.py | from models.base_model import db
from models.user_model import UserModel
from models.waifu_model import WaifuModel
from models.waifu_message_model import WaifuMessageModel
def create_tables():
db.connect()
db.create_tables((
UserModel,
WaifuModel,
WaifuMessageModel,
), True)
if __... | from models.base_model import db
from models.user_model import UserModel
from models.waifu_model import WaifuModel
from models.waifu_message_model import WaifuMessageModel
def create_tables():
db.connect()
db.create_tables((
UserModel,
WaifuModel,
WaifuMessageModel,
), True)
db... | cc0-1.0 | Python |
95cb5fc25b3fb1470c4631b93fea11d6172240a4 | Add save as pdf feature. | Txarli/sublimetext-meeting-minutes,Txarli/sublimetext-meeting-minutes | MeetingMinutes.py | MeetingMinutes.py | import sublime, sublime_plugin
import os
import re
from subprocess import call
from .mistune import markdown
HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'
HTML_END = '</body></html>'
class CreateMinuteCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region... | import sublime, sublime_plugin
import os
import re
from .mistune import markdown
HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'
HTML_END = '</body></html>'
class CreateMinuteCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
md_s... | mit | Python |
085bc7787eac2d44fd4c19c8161709b20dc324be | Copy template structure for the create command | hurrycane/finny | finny/commands/generate_structure.py | finny/commands/generate_structure.py | import os
from finny.command import Command
BASE_FOLDER_TEMPLATES = [
".gitignore",
"requirements.txt",
"README.md",
"manage.py"
]
CONFIG_INITIALIZERS_TEMPLATES = [ "app.py" ]
CONFIG_RUNNERS_TEMPLATES = [ "default.py" ]
CONFIG_TEMPLATES = [
"boot.py",
"development.py.sample"
"test.py.sample",
"produc... | import os
from finny.command import Command
class GenerateStructure(Command):
def __init__(self, name, path):
self.name = name
self.path = path
def run(self):
os.mkdir(self.path, 0755)
"""
You need to create:
.gitignore
requirements.txt
README.md
manage.py
{{ app_name... | mit | Python |
4dcca124835655ddbcf34b9d661b63f43eadf4a6 | Fix string layout for readability | jamesblunt/edx-platform,hkawasaki/kawasaki-aio8-0,sameetb-cuelogic/edx-platform-test,zofuthan/edx-platform,mtlchun/edx,zerobatu/edx-platform,carsongee/edx-platform,devs1991/test_edx_docmode,dkarakats/edx-platform,franosincic/edx-platform,Lektorium-LLC/edx-platform,dkarakats/edx-platform,procangroup/edx-platform,gsehub/... | cms/manage.py | cms/manage.py | #!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. "
"It app... | #!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... | agpl-3.0 | Python |
e63fe1e3a224bd58341a7aa08c59b59192e5f062 | Update NumPy intersphinx link. | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | sphinx-doc/conf.py | sphinx-doc/conf.py | """Sphinx configuration."""
import sys
import os
import sphinx
sphinx_ver = tuple(map(int, sphinx.__version__.split('.')))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.ab... | """Sphinx configuration."""
import sys
import os
import sphinx
sphinx_ver = tuple(map(int, sphinx.__version__.split('.')))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.ab... | bsd-3-clause | Python |
cc9a1018ed5e2b82771f56c030834541563c2ec2 | Fix version | Rubenknex/SPI-rack,peendebak/SPI-rack | spirack/version.py | spirack/version.py | __version__ = '0.1.4'
| <<<<<<< HEAD
__version__ = '0.1.4'
=======
__version__ = '0.1.3'
>>>>>>> origin/master
| mit | Python |
df614466bc35f97d3af820a5a1ea2e021560fc00 | clean up | jvpoulos/drnns-prediction | code/utils.py | code/utils.py | def set_trace():
from IPython.core.debugger import Pdb
import sys
Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back)
def plot_ROC(actual, predictions):
# plot the FPR vs TPR and AUC for a two class problem (0,1)
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
false_... | def set_trace():
from IPython.core.debugger import Pdb
import sys
Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back)
def plot_ROC(y_test, y_score):
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
fpr, tpr, _ = roc_curve(y_test, y_score)
roc_auc = auc(fpr, tpr)
plt.f... | mit | Python |
f9e0df4a3e8d08a6c9c486a48701a0f53dde0868 | add missing permissions to error handler | Naught0/qtbot | cogs/error.py | cogs/error.py | #!/bin/env python
import discord.ext
import sys
import traceback
class ErrorHandler:
def __init__(self, bot):
self.bot = bot
async def on_command_error(self, ctx, error):
""" Handle command errors more gracefully """
if isinstance(error, discord.ext.commands.CommandNotFound):
... | #!/bin/env python
import discord.ext
import sys
import traceback
class ErrorHandler:
def __init__(self, bot):
self.bot = bot
async def on_command_error(self, ctx, error):
""" Handle command errors more gracefully """
if isinstance(error, discord.ext.commands.CommandNotFound):
... | mit | Python |
2cfa0c99c776ef8f06ed3459ef06113888bc03c6 | Add error tracking | appu1232/Selfbot-for-Discord | cogs/track.py | cogs/track.py | import aiohttp
import asyncio
import hashlib
from cogs.utils.config import write_config_value
from discord.ext import commands
class Track:
def __init__(self, bot):
self.bot = bot
self.url = "http://115.69.164.101:8080"
if not hasattr(bot, "session"):
bot.session = aiohttp.Clie... | import aiohttp
import asyncio
import hashlib
from cogs.utils.config import write_config_value
from discord.ext import commands
class Track:
def __init__(self, bot):
self.bot = bot
self.url = "http://115.69.164.101:8080"
if not hasattr(bot, "session"):
bot.session = aiohttp.Clie... | mit | Python |
19252c0404a175b93a8a5826892379f241d4863e | Bump version that matters | wdv4758h/flake8,lericson/flake8 | flake8/__init__.py | flake8/__init__.py | __version__ = '2.1.0'
|
__version__ = '2.0'
| mit | Python |
eb94c002c88116d64e22e0564460963fa35bd0c1 | format example data. | zsdonghao/tensorlayer,zsdonghao/tensorlayer | example/data/__init__.py | example/data/__init__.py | from __future__ import absolute_import
from . import imagenet_classes
# from . import
|
from __future__ import absolute_import
from . import imagenet_classes
# from . import
| apache-2.0 | Python |
d27bbf0df2833dc97dfcc2c35115d3140fce665a | Update grpc_example.py | skkumaravel/devnet-1229 | examples/grpc_example.py | examples/grpc_example.py | import sys
sys.path.insert(0, '../')
from lib.cisco_grpc_client import CiscoGRPCClient
import json
def main():
'''
To not use tls we need to do 2 things.
1. Comment the variables creds and options out
2. Remove creds and options CiscoGRPCClient
ex: client = CiscoGRPCClient('11.1.1.10', 57777, 10, ... | import sys
sys.path.insert(0, '../')
from lib.cisco_grpc_client import CiscoGRPCClient
import json
def main():
#creds = open('ems.pem').read()
#options='ems.cisco.com'
client = CiscoGRPCClient('11.1.1.10', 57777, 10, 'vagrant', 'vagrant')
#Test 1: Test Get config json requests
path = '{"Cisco-IOS-X... | apache-2.0 | Python |
dd7bedcd7b72199c8a053c4e6ef4dee690a7e33a | Update KC CTS reference | KhronosGroup/VK-GL-CTS,KhronosGroup/Vulkan-CTS,googlestadia/VK-GL-CTS,googlestadia/VK-GL-CTS,KhronosGroup/VK-GL-CTS,KhronosGroup/Vulkan-CTS,KhronosGroup/Vulkan-CTS,KhronosGroup/Vulkan-CTS,googlestadia/VK-GL-CTS,KhronosGroup/VK-GL-CTS,KhronosGroup/Vulkan-CTS,KhronosGroup/VK-GL-CTS,KhronosGroup/VK-GL-CTS,googlestadia/VK-... | external/fetch_kc_cts.py | external/fetch_kc_cts.py | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# Khronos OpenGL CTS
# ------------------
#
# Copyright (c) 2016 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# Khronos OpenGL CTS
# ------------------
#
# Copyright (c) 2016 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | apache-2.0 | Python |
3345c3c55ab16d5171bb839e8b78965f6b48d5e1 | fix ordering | wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,Lysxia/dissemin,Lysxia/dissemin,Lysxia/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,wetneb/dissemin,Lysxia/dissemin | publishers/forms.py | publishers/forms.py | from django import forms
from django.utils.translation import ugettext_lazy as _
from haystack.query import EmptySearchQuerySet, SearchQuerySet
from haystack.forms import SearchForm
from publishers.models import OA_STATUS_CHOICES_WITHOUT_HELPTEXT as OA_STATUS
class PublisherForm(SearchForm):
SORT_CHOICES = [
... | from django import forms
from django.utils.translation import ugettext_lazy as _
from haystack.query import SearchQuerySet
from haystack.forms import SearchForm
from publishers.models import OA_STATUS_CHOICES_WITHOUT_HELPTEXT as OA_STATUS
class PublisherForm(SearchForm):
SORT_CHOICES = [
('POPULARITY', _(... | agpl-3.0 | Python |
c5a7c3661de1399be2d3f8e6895643dfa03eba78 | Add select_window function | JaviMerino/bart,ARM-software/bart,sinkap/bart | bart/common/Utils.py | bart/common/Utils.py | # Copyright 2015-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | # Copyright 2015-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 | Python |
dcaa3e1ae3c02014b549048fcec93597d4983386 | Add letterbox functions | aevri/mel,aevri/mel | py/mel/lib/image.py | py/mel/lib/image.py | """Image processing routines."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import mel.lib.common
def calc_letterbox(width, height, fit_width, fit_height):
"""Return (x, y, width, height) to fit image into.
Usage example:
... | """Image processing routines."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import mel.lib.common
def calc_montage_horizontal(border_size, *frames):
"""Return total[], pos1[], pos2[], ... for a horizontal montage.
Usage example:
... | apache-2.0 | Python |
f4e1b8e084b68c35010adb05d7a74f052f9adc95 | increment version | thedrow/samsa,thedrow/samsa,jofusa/pykafka,wikimedia/operations-debs-python-pykafka,sontek/pykafka,tempbottle/pykafka,aeroevan/pykafka,jofusa/pykafka,thedrow/samsa,wikimedia/operations-debs-python-pykafka,fortime/pykafka,sammerry/pykafka,tempbottle/pykafka,benauthor/pykafka,yungchin/pykafka,benauthor/pykafka,appsoma/py... | pykafka/__init__.py | pykafka/__init__.py | from broker import Broker
from simpleconsumer import SimpleConsumer
from cluster import Cluster
from partition import Partition
from producer import Producer
from topic import Topic
from client import KafkaClient
from balancedconsumer import BalancedConsumer
__version__ = '1.0.3'
__all__ = ["Broker", "SimpleConsumer... | from broker import Broker
from simpleconsumer import SimpleConsumer
from cluster import Cluster
from partition import Partition
from producer import Producer
from topic import Topic
from client import KafkaClient
from balancedconsumer import BalancedConsumer
__version__ = '1.0.2'
__all__ = ["Broker", "SimpleConsumer... | apache-2.0 | Python |
8a760be062739153a25181978f5afe612489b63a | Fix ffmf_converter | SaTa999/pyPanair | pyPanair/postprocess/ffmf_converter.py | pyPanair/postprocess/ffmf_converter.py | #!/usr/bin/env python
import pandas as pd
def read_ffmf(inpfilepath="ffmf"):
ffmf = list()
columns = ["sol-no", "alpha", "beta", "cl", "cdi", "cy", "fx", "fy", "fz", "mx", "my", "mz", "area"]
sol_num = 1
with open(inpfilepath, "r") as f:
for i in range(30): # force/torque coefficient... | #!/usr/bin/env python
__author__ = "stakanashi"
import pandas as pd
def read_ffmf(inpfilepath="ffmf"):
ffmf = []
columns = ["sol-no", "AoA", "beta", "cl", "cdi", "cy", "fx", "fy", "fz", "mx", "my", "mz", "area"]
sol_num = 1
with open(inpfilepath, "r") as f:
for i in range(30): # forc... | mit | Python |
b4e02d16cc0298c1594a721452873eb13603ad35 | set logging to info temporarily | ironfroggy/django-better-cache,ironfroggy/django-better-cache | bettercache/views.py | bettercache/views.py | from bettercache.utils import CachingMixin, strip_wsgi
from bettercache.tasks import GeneratePage
from bettercache.proxy import proxy
import logging
logger = logging.getLogger()
class BetterView(CachingMixin):
def get(self, request):
response = None
#should this bypass this replicates part of the ... | from bettercache.utils import CachingMixin, strip_wsgi
from bettercache.tasks import GeneratePage
from bettercache.proxy import proxy
import logging
logger = logging.getLogger()
class BetterView(CachingMixin):
def get(self, request):
response = None
#should this bypass this replicates part of the ... | mit | Python |
38ac22c8380e91777c22f7dcb9a5297e9737d522 | Switch output to to use TEST_FILES path | davidwaroquiers/pymatgen,davidwaroquiers/pymatgen,gmatteo/pymatgen,richardtran415/pymatgen,davidwaroquiers/pymatgen,gVallverdu/pymatgen,fraricci/pymatgen,davidwaroquiers/pymatgen,gmatteo/pymatgen,gVallverdu/pymatgen,fraricci/pymatgen,richardtran415/pymatgen,vorwerkc/pymatgen,gVallverdu/pymatgen,vorwerkc/pymatgen,fraric... | pymatgen/io/cp2k/tests/test_outputs.py | pymatgen/io/cp2k/tests/test_outputs.py | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
from pathlib import Path
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.cp2k.outputs import Cp2kOutput
TEST_FILES = Path(__file__).parent.parent.joinpath("test_files").resolve... | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
from pathlib import Path
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.cp2k.outputs import Cp2kOutput
MODULE_DIR = Path(__file__).resolve().parent
class SetTest(PymatgenTes... | mit | Python |
c29348d5a88fd06453d0eae5ad0d04f44d6d3010 | Fix magnetizability.__init__ | sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf | pyscf/prop/magnetizability/__init__.py | pyscf/prop/magnetizability/__init__.py | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | apache-2.0 | Python |
33e610576462d017bf25a65f1e879e6340f2ca06 | Fix RawPostDataException on request.body access. | MindscapeHQ/raygun4py | python2/raygun4py/middleware/django.py | python2/raygun4py/middleware/django.py | from __future__ import absolute_import
from django.conf import settings
from raygun4py import raygunprovider
class Provider(object):
def __init__(self):
config = getattr(settings, 'RAYGUN4PY_CONFIG', {})
apiKey = getattr(settings, 'RAYGUN4PY_API_KEY', config.get('api_key', None))
self.se... | from __future__ import absolute_import
from django.conf import settings
from raygun4py import raygunprovider
class Provider(object):
def __init__(self):
config = getattr(settings, 'RAYGUN4PY_CONFIG', {})
apiKey = getattr(settings, 'RAYGUN4PY_API_KEY', config.get('api_key', None))
self.se... | mit | Python |
ad5d0f1c9273cf25c5eff0b397630eb88a8f7a68 | Remove celery bits from search indexes. | agjohnson/readthedocs.org,clarkperkins/readthedocs.org,stevepiercy/readthedocs.org,wijerasa/readthedocs.org,stevepiercy/readthedocs.org,raven47git/readthedocs.org,tddv/readthedocs.org,mrshoki/readthedocs.org,raven47git/readthedocs.org,nikolas/readthedocs.org,wijerasa/readthedocs.org,sils1297/readthedocs.org,mrshoki/rea... | readthedocs/projects/search_indexes.py | readthedocs/projects/search_indexes.py | # -*- coding: utf-8-*-
import codecs
import os
from django.utils.html import strip_tags
from haystack import site
from haystack.indexes import *
#from celery_haystack.indexes import SearchIndex
from projects.models import File, ImportedFile, Project
import logging
log = logging.getLogger(__name__)
class ProjectI... | # -*- coding: utf-8-*-
import codecs
import os
from django.utils.html import strip_tags
from haystack import site
from haystack.indexes import *
from celery_haystack.indexes import CelerySearchIndex
from projects.models import File, ImportedFile, Project
import logging
log = logging.getLogger(__name__)
class Pro... | mit | Python |
b793c263beea0a63eed88118537036687571bd67 | Increase the robustness of the nutritionbynathalie.com scraper (#259) | hhursev/recipe-scraper | recipe_scrapers/nutritionbynathalie.py | recipe_scrapers/nutritionbynathalie.py | import re
from ._abstract import AbstractScraper
BULLET_CHARACTER_ORD = 8226
class NutritionByNathalie(AbstractScraper):
ingredientMatch = re.compile(r"Ingredients:")
@classmethod
def host(cls):
return "nutritionbynathalie.com"
def title(self):
return self.soup.find("h1").get_tex... | import re
from ._abstract import AbstractScraper
BULLET_CHARACTER_ORD = 8226
class NutritionByNathalie(AbstractScraper):
@classmethod
def host(cls):
return "nutritionbynathalie.com"
def title(self):
return self.soup.find("h1").get_text()
def total_time(self):
return 0
... | mit | Python |
fe02af1f771cddfd0502a1975ee6d74c94677387 | make some guards rhino specific | compas-dev/compas | src/compas/topology/__init__.py | src/compas/topology/__init__.py | """
********************************************************************************
topology
********************************************************************************
.. currentmodule:: compas.topology
Connectivity
============
.. autosummary::
:toctree: generated/
:nosignatures:
adjacency_from... | """
********************************************************************************
topology
********************************************************************************
.. currentmodule:: compas.topology
Connectivity
============
.. autosummary::
:toctree: generated/
:nosignatures:
adjacency_from... | mit | Python |
e5854c104bb89d7939fa93401bc522bd11b6cef2 | Update version.py | scieloorg/packtools,scieloorg/packtools,scieloorg/packtools | packtools/version.py | packtools/version.py | """Single source to the version across setup.py and the whole project.
"""
from __future__ import unicode_literals
__version__ = '2.9.3'
| """Single source to the version across setup.py and the whole project.
"""
from __future__ import unicode_literals
__version__ = '2.9.2'
| bsd-2-clause | Python |
95953f06789bbcdeb9b862e94f64bf1b5f422bbd | Remove useless signal handler | jreese/pyranha | pyranha/__init__.py | pyranha/__init__.py | # Copyright (c) 2012 John Reese
# Licensed under the MIT License
from __future__ import absolute_import, division
import os
from os import path
# Default dotfile path
installpath = path.dirname(path.realpath(__file__))
# Check the user's .pyranha and create it if needed
userpath = path.expanduser('~/.pyranha')
if p... | # Copyright (c) 2012 John Reese
# Licensed under the MIT License
from __future__ import absolute_import, division
import os
from os import path
# Default dotfile path
installpath = path.dirname(path.realpath(__file__))
# Check the user's .pyranha and create it if needed
userpath = path.expanduser('~/.pyranha')
if ... | mit | Python |
31d6e8a673a5e71a0c73236c03a048d35b378bc2 | Update program info. | mozillazg/PyShanb,mozillazg/PyShanb | pyshanb/__init__.py | pyshanb/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyShanb - 命令行下的扇贝词典
"""
__title__ = 'pyshanb'
__version_info__ = (0, 5, 1, 'final', 0)
__author__ = 'mozillazg'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013 mozillazg'
# modified from django(https://github.com/django/django/)
def get_version(version=None):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyShanb - 命令行下的扇贝词典
"""
__version_info__ = (0, 5, 1)
__version__ = filter(lambda n: isinstance(n, int), __version_info__)
| mit | Python |
bedc4da824637d11b99fe800ea57e68f75c50342 | Update __init__.py | OlegWock/PyShiki | pyshiki/__init__.py | pyshiki/__init__.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from .shikimoriapi import *
__all__ = ['Api']
| #!/usr/bin/env python3
#-*- coding: UTF-8 -*-
from .shikimoriapi import *
__all__ = ['Api'] | mit | Python |
4574e79d11b77e6cb71dc7b60c8c800d6cd00bd0 | Update astronErr.py | ekadhanda/bin,ekadhanda/bin,ekadhanda/bin,ekadhanda/bin | python/astronErr.py | python/astronErr.py | #! /usr/bin/env python
# Vasaant Krishnan
import re
from pylab import *
import sys
import numpy as np
usrInp = sys.argv[1:]
if len(usrInp) == 0:
print ""
print "# astronErr.py takes the astrometric accuracy (arcsec) as the first argument,"
print "# the distance (parsec) to the source as the second argumen... | #! /usr/bin/env python
import re
from pylab import *
import sys
import numpy as np
usrInp = sys.argv[1:]
if len(usrInp) == 0:
print ""
print "# astronErr.py takes the astrometric accuracy (arcsec) as the first argument,"
print "# the distance (parsec) to the source as the second argument and **estimates*... | mit | Python |
a2bf0ec01df538911d8b3b2ec47a218b7f8695e0 | Change to Python 2.x | jackwilsdon/logaddress-protocol,jackwilsdon/logaddress-protocol | python/logpacket.py | python/logpacket.py | # logaddress-protocol - A Python implementation of the Source Engine's UDP logging protocol.
# Copyright (C) 2014 Jack Wilsdon
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Founda... | # logaddress-protocol - A Python implementation of the Source Engine's UDP logging protocol.
# Copyright (C) 2014 Jack Wilsdon
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Founda... | agpl-3.0 | Python |
ac037c73f0a7dcaed47eeb0cd3e06914ac097f2a | fix chown order | jeremywrnr/mewsichip,jeremywrnr/mewsichip,jeremywrnr/mewsichip | python/mewsicode.py | python/mewsicode.py | # mewsician CHIP code, by team goacat.
import CHIP_IO.GPIO as GPIO
from time import sleep
import subprocess
import datetime
import psutil
import sys
import os
# TODO source authentication from device environment file
# TODO mechanism for creation / uploading of these??????
GPIO.cleanup()
outled = "XIO-P1"
channel = ... | # mewsician CHIP code, by team goacat.
import CHIP_IO.GPIO as GPIO
from time import sleep
import subprocess
import datetime
import psutil
import sys
import os
# TODO source authentication from device environment file
# TODO mechanism for creation / uploading of these??????
GPIO.cleanup()
outled = "XIO-P1"
channel = ... | mit | Python |
c9c67a23309c86891c50b9267ba84ac6465a1d5d | Bump package version | panoplyio/panoply-python-sdk | panoply/constants.py | panoply/constants.py | __version__ = "2.0.14"
__package_name__ = "panoply-python-sdk"
| __version__ = "2.0.13"
__package_name__ = "panoply-python-sdk"
| mit | Python |
821a5912ee2dfa5db90d6cea01abb0f00ac6abf4 | Bump Version 0.22.4 | akaszynski/vtkInterface | pyvista/_version.py | pyvista/_version.py | """ version info for pyvista """
# major, minor, patch
version_info = 0, 22, 4
# Nice string for the version
__version__ = '.'.join(map(str, version_info))
| """ version info for pyvista """
# major, minor, patch
version_info = 0, 22, 3
# Nice string for the version
__version__ = '.'.join(map(str, version_info))
| mit | Python |
229b8161f690154620faffd700335920648e1a96 | Fix token retrieval for Netflix | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/netflix.py | services/netflix.py | import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = '... | import foauth.providers
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize... | bsd-3-clause | Python |
a931192eaf9d13e259f8f7e5475d7beaaea59015 | add method to compare file settings to custom settings or preferences fixe attribute name error (line 28) | CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager | renderingTask.py | renderingTask.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module containing class 'renderingTask' '''
from setting import setting
from copy import deepcopy
class renderingTask:
'''class that contain the parameter for a rendering task'''
def __init__(self,
path = '',
scene = '',
fileXmlSetting = setting(),
... | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module containing class 'renderingTask' '''
from setting import setting
from copy import deepcopy
class renderingTask:
'''class that contain the parameter for a rendering task'''
def __init__(self,
path = '',
scene = '',
fileXmlSetting = setting(),
... | mit | Python |
b4fb3f403ebb682e81e6e08674d385438e11be22 | remove dev settings | ioO/billjobs | billjobs/settings.py | billjobs/settings.py | """
Django settings for billjobs project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | """
Django settings for billjobs project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | mit | Python |
b18fb4a03ceed0df2723c535960f8eb1385443e5 | add case where there is zero file | cozy-labs/cozy-fuse | binaries_download.py | binaries_download.py | #!/usr/bin/python
from gi.repository import Gtk
from couchdb import Database, Document, ResourceNotFound, Server
from couchdb.client import Row, ViewResults
import gobject
import sys
import time
server = Server('http://localhost:5984/')
# Read file
f = open('/etc/cozy-files/couchdb.login')
lines = f.readlines()
f.clos... | #!/usr/bin/python
from gi.repository import Gtk
from couchdb import Database, Document, ResourceNotFound, Server
from couchdb.client import Row, ViewResults
import gobject
import sys
import time
server = Server('http://localhost:5984/')
# Read file
f = open('/etc/cozy-files/couchdb.login')
lines = f.readlines()
f.clos... | bsd-3-clause | Python |
c71a11730b5b98dcd2a17ce09cb0aa816b2ba341 | Address Form does not use requests. | python-spain/djangocms-association,python-spain/djangocms-association,python-spain/djangocms-association | cms_people/views.py | cms_people/views.py | from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
from django.views.generic import UpdateView
from cms_contact.forms import AddressForm
from cms_contact.models import Address
from cms_people.forms import SecurityForm, AboutForm
fro... | from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
from django.views.generic import UpdateView
from cms_contact.forms import AddressForm
from cms_contact.models import Address
from cms_people.forms import SecurityForm, AboutForm
fro... | mit | Python |
24e060c2df6564958fd8a7abfb38286f7e1068c7 | Bump binaryen to 62 but also add --disable-simd | MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz | src/funfuzz/js/with_binaryen.py | src/funfuzz/js/with_binaryen.py | # coding=utf-8
#
# 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 https://mozilla.org/MPL/2.0/.
"""Run seeds with binaryen to get a wasm file,
then run the shell with the translated wasm binary usin... | # coding=utf-8
#
# 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 https://mozilla.org/MPL/2.0/.
"""Run seeds with binaryen to get a wasm file,
then run the shell with the translated wasm binary usin... | mpl-2.0 | Python |
ae828521984808397acd0c940da3bb873f6e5951 | Clean code of DragDropGraphicsView | anton-golubkov/Garland,anton-golubkov/Garland | src/gui/dragdropgraphicsview.py | src/gui/dragdropgraphicsview.py |
from PySide import QtGui, QtCore
import graphblock
class DragDropGraphicsView(QtGui.QGraphicsView):
""" Graphics view with drag and drop capabilities
"""
def __init__(self, parent):
super(DragDropGraphicsView, self).__init__(parent)
self.setAcceptDrops(True)
def drag... |
from PySide import QtGui, QtCore
import graphblock
class DragDropGraphicsView(QtGui.QGraphicsView):
""" Graphics view with drag and drop capabilities
"""
def __init__(self, parent):
super(DragDropGraphicsView, self).__init__(parent)
self.setAcceptDrops(True)
def drag... | lgpl-2.1 | Python |
2b32bece89a4bfb0afb285e9316373832ed62f17 | Add back debug because travis is unhappy | nzlosh/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2 | st2reactor/tests/integration/test_sensor_watcher.py | st2reactor/tests/integration/test_sensor_watcher.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | apache-2.0 | Python |
985f653662e7d72d121df8ba958214a065307989 | clean up file | codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator | farmsList/to-geo-json.py | farmsList/to-geo-json.py | import json
from sqlalchemy import create_engine
engine = create_engine('postgresql://farmslistadmin:@localhost/farms_list')
conn = engine.connect()
parcels = []
for x in range(0, 17):
filename = 'parcels{0:02d}.json'.format(x)
file = open("parcels-pristine/" + filename)
array = json.loads(file.read())
for y in r... | import json
from sqlalchemy import create_engine
engine = create_engine('postgresql://farmslistadmin:@localhost/farms_list')
conn = engine.connect()
parcels = []
for x in range(0, 17):
filename = 'parcels{0:02d}.json'.format(x)
file = open("parcels-pristine/" + filename)
array = json.loads(file.read())
for y in r... | bsd-3-clause | Python |
19de35d8124a67e459a69080156bd310bb3814ea | Support all metrics for points. | tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy | rate_delta_point.py | rate_delta_point.py | #!/usr/bin/env python3
from numpy import *
from scipy import *
from scipy.interpolate import interp1d
from scipy.interpolate import pchip
import sys
import os
import argparse
import json
a = flipud(loadtxt(sys.argv[1]));
b = flipud(loadtxt(sys.argv[2]));
for m in range(0,11):
try:
ya = a[:,3+m]
y... | #!/usr/bin/env python3
from numpy import *
from scipy import *
from scipy.interpolate import interp1d
from scipy.interpolate import pchip
import sys
import os
import argparse
import json
a = flipud(loadtxt(sys.argv[1]));
b = flipud(loadtxt(sys.argv[2]));
for m in range(0,4):
ya = a[:,3+m]
yb = b[:,3+m]
r... | mit | Python |
4869e2dcc87b4e6b0453710b439cbe7b20f2d3b5 | bump version | blackskad/sixpack,llonchj/sixpack,vpuzzella/sixpack,spjwebster/sixpack,llonchj/sixpack,seatgeek/sixpack,vpuzzella/sixpack,smokymountains/sixpack,nickveenhof/sixpack,seatgeek/sixpack,seatgeek/sixpack,smokymountains/sixpack,vpuzzella/sixpack,blackskad/sixpack,llonchj/sixpack,llonchj/sixpack,nickveenhof/sixpack,spjwebster... | sixpack/__init__.py | sixpack/__init__.py | __version__ = '1.0.4'
| __version__ = '1.0.1'
| bsd-2-clause | Python |
e1d4df43b01863171bd051600e4fd1ab52a50d95 | FIX loss function example | DonBeo/scikit-learn,abhishekkrthakur/scikit-learn,ycaihua/scikit-learn,adamgreenhall/scikit-learn,jakirkham/scikit-learn,UNR-AERIAL/scikit-learn,clemkoa/scikit-learn,AnasGhrab/scikit-learn,hsuantien/scikit-learn,lesteve/scikit-learn,gotomypc/scikit-learn,zorroblue/scikit-learn,rvraghav93/scikit-learn,trungnt13/scikit-l... | examples/linear_model/plot_sgd_loss_functions.py | examples/linear_model/plot_sgd_loss_functions.py | """
==========================
SGD: convex loss functions
==========================
A plot that compares the various convex loss functions supported by
:class:`sklearn.linear_model.SGDClassifier` .
"""
print(__doc__)
import numpy as np
import pylab as pl
def modified_huber_loss(y_true, y_pred):
z = y_pred * y_... | """
==========================
SGD: Convex Loss Functions
==========================
An example that compares various convex loss functions.
All of the above loss functions are supported by
:class:`sklearn.linear_model.stochastic_gradient` .
"""
print(__doc__)
import numpy as np
import pylab as pl
from sklearn.line... | bsd-3-clause | Python |
79ff63b42229b4672fee0ded5a02dde188200cdb | make the py.test mark `online` Python 2.6 compatible | Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,dpshelio/sunpy | sunpy/tests/conftest.py | sunpy/tests/conftest.py | from functools import partial
import urllib2
import pytest
GOOGLE_URL = 'http://www.google.com'
def site_reachable(url):
try:
urllib2.urlopen(url, timeout=1)
except urllib2.URLError:
return False
else:
return True
is_online = partial(site_reachable, GOOGLE_URL)
def pytest_run... | from functools import partial
import urllib2
import pytest
GOOGLE_URL = 'http://www.google.com'
def site_reachable(url):
try:
urllib2.urlopen(url, timeout=1)
except urllib2.URLError:
return False
else:
return True
is_online = partial(site_reachable, GOOGLE_URL)
def pytest_run... | bsd-2-clause | Python |
0ce9a29f83bb9c87df04f49b5e927d7a6aa4c53c | Fix colorspace determinism with OrderedDict | pdfminer/pdfminer.six,goulu/pdfminer | pdfminer/pdfcolor.py | pdfminer/pdfcolor.py | import collections
from .psparser import LIT
import six #Python 2+3 compatibility
## PDFColorSpace
##
LITERAL_DEVICE_GRAY = LIT('DeviceGray')
LITERAL_DEVICE_RGB = LIT('DeviceRGB')
LITERAL_DEVICE_CMYK = LIT('DeviceCMYK')
class PDFColorSpace(object):
def __init__(self, name, ncomponents):
self.name = na... |
from .psparser import LIT
import six #Python 2+3 compatibility
## PDFColorSpace
##
LITERAL_DEVICE_GRAY = LIT('DeviceGray')
LITERAL_DEVICE_RGB = LIT('DeviceRGB')
LITERAL_DEVICE_CMYK = LIT('DeviceCMYK')
class PDFColorSpace(object):
def __init__(self, name, ncomponents):
self.name = name
self.nc... | mit | Python |
13b23e49fa4947a66cb00a98107d1250092acd89 | Clean up code. | pebble/libpebble,pebble/libpebble,pebble/libpebble,pebble/libpebble | pebble/PblCommand.py | pebble/PblCommand.py | import os
import logging
class PblCommand:
name = ''
help = ''
def run(args):
pass
def configure_subparser(self, parser):
parser.add_argument('--sdk', help='Path to Pebble SDK (ie: ~/pebble-dev/PebbleSDK-2.X/)')
parser.add_argument('--debug', action='store_true',
... | import os
import logging
class PblCommand:
name = ''
help = ''
def run(args):
pass
def configure_subparser(self, parser):
parser.add_argument('--sdk', help='Path to Pebble SDK (ie: ~/pebble-dev/PebbleSDK-2.X/)')
parser.add_argument('--debug', action='store_true',
... | mit | Python |
dd6c7f5840dccdea63d21c144a0888c3f924640a | bump to 0.0.2 :balloon: | shaunvxc/ripe | ripe/__init__.py | ripe/__init__.py | VERSION = '0.0.2'
| VERSION = '0.0.1'
| mit | Python |
2c1940f68fb754e35183d155c6b4484f82dcbc61 | add root user | notfoundsam/raspberry,notfoundsam/raspberry,notfoundsam/raspberry,notfoundsam/raspberry | db_create.py | db_create.py | #!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
from app.models import User
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database rep... | #!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_con... | unlicense | Python |
df5cdfaab0738dac1778c82829e9a958e5eb6240 | Revert unnecessary change | liyocee/django-rest-framework-jwt,chrisjones-brack3t/django-rest-framework-jwt,shanemgrey/django-rest-framework-jwt,vvangelovski/django-rest-framework-jwt,kbussell/django-rest-framework-jwt,GetBlimp/django-rest-framework-jwt,KetsuN/django-rest-framework-jwt,diegueus9/django-rest-framework-jwt,1vank1n/django-rest-framew... | rest_framework_jwt/tests/test_utils.py | rest_framework_jwt/tests/test_utils.py | import json
from jwt import base64url_decode
from django.test import TestCase
from django.contrib.auth.models import User
from rest_framework_jwt import utils
class UtilsTests(TestCase):
def setUp(self):
self.username = 'jpueblo'
self.email = 'jpueblo@example.com'
self.user = User.objects... | import json
from jwt import base64url_decode
from django.test import TestCase
from django.contrib.auth.models import User
from rest_framework_jwt import utils
class UtilsTests(TestCase):
def setUp(self):
self.username = 'jpueblo'
self.email = 'jpueblo@example.com'
self.user = User.objects... | mit | Python |
4ed1661d30c598f0364fca354539288a8c021b13 | Fix bug in CoGS view | wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp | routes/user_page.py | routes/user_page.py | from datetime import date
from typing import Dict
from aiohttp.web_request import Request
from aiohttp_jinja2 import template
from db_helper import get_most_recent_group, get_projects_supervisor, get_user_id, get_student_projects, \
get_all_groups, get_projects_cogs, set_project_can_mark, set_group_attributes, so... | from datetime import date
from typing import Dict
from aiohttp.web_request import Request
from aiohttp_jinja2 import template
from db_helper import get_most_recent_group, get_projects_supervisor, get_user_id, get_student_projects, \
get_all_groups, get_projects_cogs, set_project_can_mark, set_group_attributes, so... | agpl-3.0 | Python |
20b2008a0b70d0b55e6e3e66fcf101f4f02b2f6d | Increase maxlength of Snapshot Name to 255. | newrocknj/horizon,gerrive/horizon,wolverineav/horizon,sandvine/horizon,xinwu/horizon,newrocknj/horizon,karthik-suresh/horizon,Daniex/horizon,yeming233/horizon,kaiweifan/horizon,zouyapeng/horizon,orbitfp7/horizon,tellesnobrega/horizon,Hodorable/0602,aaronorosen/horizon-congress,noironetworks/horizon,tanglei528/horizon,k... | openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py | openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | apache-2.0 | Python |
2419806970c99a82677e9f55cb341ffffb81531d | update author (#52583) | thaim/ansible,thaim/ansible | lib/ansible/modules/windows/win_firewall.py | lib/ansible/modules/windows/win_firewall.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Michael Eaton <meaton@iforium.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Michael Eaton <meaton@iforium.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata... | mit | Python |
fc2085e3c86e1596f5dc9c032e445887430602b5 | Use lambda function with method | CubicComet/exercism-python-solutions | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(map(lambda k: rules.get(k, k), s))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
return "".join(rot_gen(s,n))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
def rot_gen(s, n):
rules = shift_rules(n)
f... | agpl-3.0 | Python |
3dd750ae0959c97385f3deb9982d691bae5db141 | Bump version to 2.1.0.15.dev0 | CybOXProject/python-cybox | cybox/version.py | cybox/version.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "2.1.0.15.dev0"
| # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "2.1.0.14"
| bsd-3-clause | Python |
f7546d0a7c32227cd9319404a21d3f1a2a2d39c4 | Fix bayesian encoding | MaxHalford/xam | xam/preprocessing/bayesian_encoding.py | xam/preprocessing/bayesian_encoding.py | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
class BayesianEncoder(BaseEstimator, TransformerMixin):
"""
https://kaggle2.blob.core.windows.net/forum-message-attachments/225952/7441/high%20cardinality%20categoricals.pdf
Args:
... | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
class BayesianEncoder(BaseEstimator, TransformerMixin):
"""
https://kaggle2.blob.core.windows.net/forum-message-attachments/225952/7441/high%20cardinality%20categoricals.pdf
Args:
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.