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 |
|---|---|---|---|---|---|---|---|
fd9a553868ce46ceef2b23e79347dd262b63ebae | fix build instructions on Linux | binding.gyp | binding.gyp | { "targets": [ {
"target_name": "bindings",
"include_dirs": [
"<(raptor_prefix)/include/raptor2"
],
"sources": [
"src/bindings.cc",
"src/parser.cc",
"src/parser_wrapper.cc",
"src/serializer.cc",
"src/serializer_wrapper.cc",
"src/statement.cc",
... | { "targets": [ {
"target_name": "bindings",
"variables": {
"raptor_prefix": "/usr/local"
},
"include_dirs": [
"<(raptor_prefix)/include/raptor2"
],
"sources": [
"src/bindings.cc",
"src/parser.cc",
"src/parser_wrapper.cc",
"src/serializer.cc",
... | Python | 0.000001 |
2f924fc35d0724e7638e741fd466228649077e10 | Update action_after_build destination | binding.gyp | binding.gyp | {
'includes': [ 'deps/common-libzip.gypi' ],
'variables': {
'shared_libzip%':'false',
'shared_libzip_includes%':'/usr/lib',
'shared_libzip_libpath%':'/usr/include'
},
'targets': [
{
'target_name': 'node_zipfile',
'conditions': [
['shared_libzip == "false"', {
... | {
'includes': [ 'deps/common-libzip.gypi' ],
'variables': {
'shared_libzip%':'false',
'shared_libzip_includes%':'/usr/lib',
'shared_libzip_libpath%':'/usr/include'
},
'targets': [
{
'target_name': 'node_zipfile',
'conditions': [
['shared_libzip == "false"', {
... | Python | 0.000002 |
2f23ce76bfc32022cea41d675d762dfbbde3fed7 | Fix a typo | home.py | home.py | #!/usr/bin/env python
import time
import sys
import json
import types
import thread
from messenger import Messenger
import config
import led
import dht
import stepper_motor
def turn_on_living_light(freq, dc):
print('turn_on_living_light: %d, %d' % (freq, dc))
led.turn_on(config.LED_LIVING, freq, dc)
def turn... | #!/usr/bin/env python
import time
import sys
import json
import types
import thread
from messenger import Messenger
import config
import led
import dht
import stepper_motor
def turn_on_living_light(freq, dc):
print('turn_on_living_light: %d, %d' % (freq, dc))
led.turn_on(config.LED_LIVING, freq, dc)
def turn... | Python | 1 |
c2f563215fcc62d6e595446f5acbd1969484ddb7 | move end timer command to the correct location | clean_db.py | clean_db.py | import MySQLdb, config, urllib, cgi, datetime, time
sql = MySQLdb.connect(host="localhost",
user=config.username,
passwd=config.passwd,
db=config.db)
sql.query("SELECT `id` FROM `feedurls`")
db_feed_query=sql.store_result()
rss_urls=d... | import MySQLdb, config, urllib, cgi, datetime, time
sql = MySQLdb.connect(host="localhost",
user=config.username,
passwd=config.passwd,
db=config.db)
sql.query("SELECT `id` FROM `feedurls`")
db_feed_query=sql.store_result()
rss_urls=d... | Python | 0.000001 |
710dba5196fbd419c23de74e9177185e212736a1 | Update according to changes in config | tmt/util.py | tmt/util.py | import yaml
import json
import os
import re
'''Utility functions for filename and path routines.'''
def regex_from_format_string(format_string):
'''
Convert a format string of the sort "{name}_bla/something_{number}"
to a named regular expression a la "P<name>.*_bla/something_P<number>\d+".
Paramete... | import yaml
import json
import os
import re
'''Utility functions for filename and path routines.'''
def regex_from_format_string(format_string):
'''
Convert a format string of the sort "{name}_bla/something_{number}"
to a named regular expression a la "P<name>.*_bla/something_P<number>\d+".
Paramete... | Python | 0.000001 |
dcdd4040f45546472ff012dd4830e51804a1b9e5 | Disable merchant debugging per default (to prevent logging and save disk space) | merchant_sdk/MerchantServer.py | merchant_sdk/MerchantServer.py | import json
from typing import Type
from flask import Flask, request, Response
from flask_cors import CORS
from .MerchantBaseLogic import MerchantBaseLogic
from .models import SoldOffer
def json_response(obj):
js = json.dumps(obj)
resp = Response(js, status=200, mimetype='application/json')
return resp
... | import json
from typing import Type
from flask import Flask, request, Response
from flask_cors import CORS
from .MerchantBaseLogic import MerchantBaseLogic
from .models import SoldOffer
def json_response(obj):
js = json.dumps(obj)
resp = Response(js, status=200, mimetype='application/json')
return resp
... | Python | 0 |
f5421cb76103bf6da4b6dce74f2ae372c892067a | Add write_revision method to Metadata | onitu/api/metadata.py | onitu/api/metadata.py | class Metadata(object):
"""The Metadata class represent the metadata of any file in Onitu.
This class should be instantiated via the
:func:`Metadata.get_by_id` or :func:`Metadata.get_by_filename`
class methods.
The PROPERTIES class property represent each property found in the
metadata common ... | class Metadata(object):
"""The Metadata class represent the metadata of any file in Onitu.
This class should be instantiated via the
:func:`Metadata.get_by_id` or :func:`Metadata.get_by_filename`
class methods.
The PROPERTIES class property represent each property found in the
metadata common ... | Python | 0.000001 |
3ee4d2f80f58cb0068eaeb3b7f5c4407ce8e60d0 | add text information about progress of downloading | vk-photos-downloader.py | vk-photos-downloader.py | #!/usr/bin/python3.5
#-*- coding: UTF-8 -*-
import vk, os, time
from urllib.request import urlretrieve
token = input("Enter a token: ") # vk token
#Authorization
session = vk.Session(access_token=str(token))
vk_api = vk.API(session)
count = 0 # count of down. photos
perc = 0 # percent of down. photo... | #!/usr/bin/python3.5
#-*- coding: UTF-8 -*-
import vk, os, time
from urllib.request import urlretrieve
token = input("Enter a token: ")
#Authorization
session = vk.Session(access_token=str(token))
vk_api = vk.API(session)
count = 0 # count of down. photos
perc = 0 # percent of down. photos
breaked =... | Python | 0 |
b674bc4c369139926710311f1a3fc6ad39da9f0a | optimize code | app/xsbk.py | app/xsbk.py | # 抓取嗅事百科的段子
from cobweb.downloader import *
from cobweb.parser import *
import time
import re
def parse_joke(self):
data = self.soup.find_all('div', class_='article block untagged mb15')
content_pattern = re.compile("<div.*?content\">(.*?)<!--(.*?)-->.*?</div>", re.S)
self.content = []
for d in data:
... | # 抓取嗅事百科的段子
from cobweb.downloader import *
from cobweb.parser import *
import time
import re
def parse_joke(self):
data = self.soup.find_all('div', class_='article block untagged mb15')
self.content = []
for d in data:
soup_d = BeautifulSoup(str(d), 'html.parser', from_encoding='utf8')
# ... | Python | 0.999117 |
cc894ecf36a95d18fc84a4866c5a1902d291ccbe | Use non-lazy `gettext` where sufficient | byceps/blueprints/site/ticketing/forms.py | byceps/blueprints/site/ticketing/forms.py | """
byceps.blueprints.site.ticketing.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import g
from flask_babel import gettext, lazy_gettext
from wtforms import StringField
from wtforms.validators import Input... | """
byceps.blueprints.site.ticketing.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import g
from flask_babel import lazy_gettext
from wtforms import StringField
from wtforms.validators import InputRequired,... | Python | 0.000092 |
862885b5ea2b4d04c8980c257d3cdf644dd60f0c | Set the version to 0.1.6 final | king_phisher/version.py | king_phisher/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/version.py
#
# 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 lis... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/version.py
#
# 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 lis... | Python | 0.003887 |
2ac05a8ccc9d7a9ab4f455f18355d80af9e13c84 | add temp file context | tpl/path.py | tpl/path.py | # -*- coding:utf-8 -*-
import os
import uuid
HOME = os.path.abspath(os.path.expanduser('~'))
WORK_DIR = os.path.abspath(os.getcwd())
CWD = WORK_DIR
class TempDir(object):
pass
class TempFile(object):
def __init__(self, name=None, suffix='tmp'):
self.path = '/tmp/{}.{}'.format(name or str(uuid.uui... | # -*- coding:utf-8 -*-
import os
import uuid
HOME = os.path.abspath(os.path.expanduser('~'))
WORK_DIR = os.path.abspath(os.getcwd())
CWD = WORK_DIR
class TempDir(object):
pass
class TempFile(object):
pass
class TempPipe(object):
def __init__(self):
self.pipe_path = '/tmp/{}.pipe'.format(str... | Python | 0.000001 |
7c8d7a456634d15f8c13548e2cfd6be9440f7c65 | Add handler for 403 forbidden (User does not have Atmosphere access, but was correctly authenticated) | troposphere/__init__.py | troposphere/__init__.py | import logging
from flask import Flask
from flask import render_template, redirect, url_for, request, abort
import requests
from troposphere import settings
from troposphere.cas import (cas_logoutRedirect, cas_loginRedirect,
cas_validateTicket)
from troposphere.oauth import generate_acces... | import logging
from flask import Flask
from flask import render_template, redirect, url_for, request
import requests
from troposphere import settings
from troposphere.cas import (cas_logoutRedirect, cas_loginRedirect,
cas_validateTicket)
from troposphere.oauth import generate_access_token... | Python | 0 |
b7be60eff8e0c82741dda674824aa748e33e7fdd | convert pui.py to pywiki framework | trunk/toolserver/pui.py | trunk/toolserver/pui.py | #!usr/bin/python
# -*- coding: utf-8 -*
#
# (C) Legoktm 2008-2009, MIT License
#
import re
sys.path.append(os.environ['HOME'] + '/pywiki')
import wiki
page = wiki.Page('Wikipedia:Possibly unfree images')
wikitext = state0 = page.get()
wikitext = re.compile(r'\n==New listings==', re.IGNORECASE).sub(r'\n*[[/{{subst... | #!usr/bin/python
# -*- coding: utf-8 -*
#
# (C) Legoktm 2008-2009, MIT License
#
import re, sys, os
sys.path.append(os.environ['HOME'] + '/pyenwiki')
import wikipedia
site = wikipedia.getSite()
page = wikipedia.Page(site, 'Wikipedia:Possibly unfree images')
wikitext = state0 = page.get()
wikitext = re.compile(r'\... | Python | 0.999999 |
7b3fd535b7622a9c4253aa80276e05ed83f8177e | Fix app name error | txmoney/rates/models.py | txmoney/rates/models.py | # coding=utf-8
from __future__ import absolute_import, unicode_literals
from datetime import date
from decimal import Decimal
from django.db import models
from django.utils.functional import cached_property
from ..settings import txmoney_settings as settings
from .exceptions import RateDoesNotExist
class RateSourc... | # coding=utf-8
from __future__ import absolute_import, unicode_literals
from datetime import date
from decimal import Decimal
from django.db import models
from django.utils.functional import cached_property
from ..settings import txmoney_settings as settings
from .exceptions import RateDoesNotExist
class RateSourc... | Python | 0.000009 |
d6029a7b2e39ff6222ca3d6788d649b14bbf35e3 | add smoother to denominator as well | trending.py | trending.py | import googleanalytics as ga
import collections
import numpy
import datetime
SMOOTHER = 20
WINDOW = 8
GROWTH_THRESHOLD = 0.02
def trend(counts) :
X, Y = zip(*counts)
X = numpy.array([x.toordinal() for x in X])
X -= datetime.date.today().toordinal()
A = numpy.array([numpy.ones(len(X)), X])
Y = nu... | import googleanalytics as ga
import collections
import numpy
import datetime
SMOOTHER = 20
WINDOW = 8
GROWTH_THRESHOLD = 0.03
def trend(counts) :
X, Y = zip(*counts)
X = numpy.array([x.toordinal() for x in X])
X -= datetime.date.today().toordinal()
A = numpy.array([numpy.ones(len(X)), X])
Y = nu... | Python | 0.000001 |
656c0f44c27f64d14dde7cbbfdec31906dab4c51 | Add params to request docs. | treq/api.py | treq/api.py | from treq.client import HTTPClient
def head(url, **kwargs):
"""
Make a ``HEAD`` request.
See :py:func:`treq.request`
"""
return _client(**kwargs).head(url, **kwargs)
def get(url, headers=None, **kwargs):
"""
Make a ``GET`` request.
See :py:func:`treq.request`
"""
return _cl... | from treq.client import HTTPClient
def head(url, **kwargs):
"""
Make a ``HEAD`` request.
See :py:func:`treq.request`
"""
return _client(**kwargs).head(url, **kwargs)
def get(url, headers=None, **kwargs):
"""
Make a ``GET`` request.
See :py:func:`treq.request`
"""
return _cl... | Python | 0 |
0ba512b0e8eb6b5055261afb2962d3bfc5e2fda5 | Add some playback stream headers | src/playback.py | src/playback.py | # -*- coding: utf-8 -*-
import mimetypes
import os
from flask import Response, request
from werkzeug.datastructures import Headers
import audiotranscode
from utils import generate_random_key
from tables import Song
import config
def stream_audio():
song = Song.get_one(id=request.args.get('id'))
# A hack t... | # -*- coding: utf-8 -*-
import mimetypes
import os
from flask import Response, request
import audiotranscode
from tables import Song
import config
def stream_audio():
song = Song.get_one(id=request.args.get('id'))
# A hack to get my local dev env working
path = song.path
if config.DEBUG:
c... | Python | 0 |
e6487a2c623638b540b707c895a97eac1fc31979 | Update connection_test.py to work with Python3.7 | server/integration-tests/connection_test.py | server/integration-tests/connection_test.py | #!/usr/bin/env python3.7
"""
Test PUTing some data into Icepeak and getting it back over a websocket.
Requires a running Icepeak instance.
Requirements can be installed with: pip install requests websockets
"""
import asyncio
import json
import requests
import websockets
# 1. Put some data into icepeak over HTTP
ne... | #!/usr/bin/env python2.7
from __future__ import absolute_import, division, unicode_literals
import json
import requests
import websocket
# 1. Put some data into icepeak over HTTP
new_data = {'status': 'freezing'}
requests.put('http://localhost:3000/so/cool',
json.dumps(new_data))
# 2. Get the data back over a we... | Python | 0.000001 |
2fe5fc8c53142b5661bf176441e246d48cdb0799 | fix a typo | Functions/Sed.py | Functions/Sed.py | '''
Created on Feb 14, 2014
@author: Tyranic-Moron
'''
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
from GlobalVars import *
import re
# matches a sed-style regex pattern (taken from https://github.com/mossblaser/BeardBot/blob/master/modules/sed.p... | '''
Created on Feb 14, 2014
@author: Tyranic-Moron
'''
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
from GlobalVars import *
import re
# matches a sed-style regex pattern (taken from https://github.com/mossblaser/BeardBot/blob/master/modules/sed.p... | Python | 0.999999 |
69b9c641f144633b94aca47212af446971286454 | add tests | server_common/test_modules/test_autosave.py | server_common/test_modules/test_autosave.py | from __future__ import unicode_literals, absolute_import, print_function, division
import unittest
import shutil
import os
from server_common.autosave import AutosaveFile
TEMP_FOLDER = os.path.join("C:\\", "instrument", "var", "tmp", "autosave_tests")
class TestAutosave(unittest.TestCase):
def setUp(self):
... | import unittest
class TestAutosave(unittest.TestCase):
def setUp(self):
pass
| Python | 0 |
6a4f4031b0aac1c8859424703088df903746a6c8 | change command doc string | dvc/command/get.py | dvc/command/get.py | import argparse
import logging
from .base import append_doc_link
from .base import CmdBaseNoRepo
from dvc.exceptions import DvcException
logger = logging.getLogger(__name__)
class CmdGet(CmdBaseNoRepo):
def run(self):
from dvc.repo import Repo
try:
Repo.get(
self.ar... | import argparse
import logging
from .base import append_doc_link
from .base import CmdBaseNoRepo
from dvc.exceptions import DvcException
logger = logging.getLogger(__name__)
class CmdGet(CmdBaseNoRepo):
def run(self):
from dvc.repo import Repo
try:
Repo.get(
self.ar... | Python | 0.000002 |
5ab7d4af67abb20a87f9b963e9ae53df65eea42f | fix self deleter | cogs/fun.py | cogs/fun.py | import asyncio
import discord
from discord.ext import commands
class Fun:
"""
Fun and useful stuff
"""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def marco(self, ctx):
"""
Says "polo"
"""
await self.bot.say(self... | import asyncio
import discord
from discord.ext import commands
class Fun:
"""
Fun and useful stuff
"""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def marco(self, ctx):
"""
Says "polo"
"""
await self.bot.say(self... | Python | 0.000003 |
b0c83624004ebda4ea23f597d109d89ec319f1cf | fix tut2.py | doc/source/code/tut2.py | doc/source/code/tut2.py | from netpyne import specs, sim
# Network parameters
netParams = specs.NetParams() # object of class NetParams to store the network parameters
## Population parameters
netParams.popParams['S'] = {'cellType': 'PYR', 'numCells': 20, 'cellModel': 'HH'}
netParams.popParams['M'] = {'cellType': 'PYR', 'numCells': 20, 'cell... | from netpyne import specs, sim
# Network parameters
netParams = specs.NetParams() # object of class NetParams to store the network parameters
## Population parameters
netParams.popParams['S'] = {'cellType': 'PYR', 'numCells': 20, 'cellModel': 'HH'}
netParams.popParams['M'] = {'cellType': 'PYR', 'numCells': 20, 'cell... | Python | 0.000001 |
100fa2f08656009e3fa2ee4fd66a85c5aca35f9d | Comment typo fix | sacad/rate_watcher.py | sacad/rate_watcher.py | """ This module provides a class with a context manager to help avoid overloading web servers. """
import collections
import logging
import os
import sqlite3
import threading
import time
import urllib.parse
import lockfile
MIN_WAIT_TIME_S = 0.01
SUSPICIOUS_LOCK_AGE_S = 120
class WaitNeeded(Exception):
""" Exce... | """ This module provides a class with a context manager to help avoid overloading web servers. """
import collections
import logging
import os
import sqlite3
import threading
import time
import urllib.parse
import lockfile
MIN_WAIT_TIME_S = 0.01
SUSPICIOUS_LOCK_AGE_S = 120
class WaitNeeded(Exception):
""" Exce... | Python | 0 |
e63c463a3200d9843bc5be6c1c3ee36fb267cbde | Update hyper space setting. | matchzoo/engine/param_table.py | matchzoo/engine/param_table.py | """Parameters table class."""
import typing
from matchzoo.engine import Param, hyper_spaces
class ParamTable(object):
"""
Parameter table class.
Example:
>>> params = ParamTable()
>>> params.add(Param('ham', 'Parma Ham'))
>>> params.add(Param('egg', 'Over Easy'))
>>> pa... | """Parameters table class."""
import typing
from matchzoo.engine import Param
class ParamTable(object):
"""
Parameter table class.
Example:
>>> params = ParamTable()
>>> params.add(Param('ham', 'Parma Ham'))
>>> params.add(Param('egg', 'Over Easy'))
>>> params['ham']
... | Python | 0 |
4a6846b969746b79f1acd0e0615232d97ed54b1f | replace import-time cluster dependencies (#1544) | frameworks/template/tests/test_sanity.py | frameworks/template/tests/test_sanity.py | import pytest
import sdk_install
import sdk_utils
from tests import config
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, sdk_utils.get_foldered_name(config.SERVICE_NAME))
# note: this package isn't released... | import pytest
import sdk_install
import sdk_utils
from tests import config
FOLDERED_SERVICE_NAME = sdk_utils.get_foldered_name(config.SERVICE_NAME)
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, FOLDERED_SERVICE_NAME... | Python | 0 |
0eef0efbe716feb3dc02fb45a756496d5517966c | Update docs. | matchzoo/models/naive_model.py | matchzoo/models/naive_model.py | """Naive model with a simplest structure for testing purposes."""
import keras
from matchzoo import engine
class NaiveModel(engine.BaseModel):
"""
Naive model with a simplest structure for testing purposes.
Bare minimum functioning model. The best choice to get things rolling.
The worst choice to f... | """Naive model with a simplest structure for testing purposes."""
import keras
from matchzoo import engine
class NaiveModel(engine.BaseModel):
"""Naive model with a simplest structure for testing purposes."""
def build(self):
"""Build."""
x_in = self._make_inputs()
x = keras.layers.... | Python | 0 |
0859bb58a4fa24f5e278e95da491a2b4409f0b2b | Tag 0.5.3 | koordinates/__init__.py | koordinates/__init__.py | # -*- coding: utf-8 -*-
"""
Koordinates Python API Client Library
:copyright: (c) Koordinates Limited.
:license: BSD, see LICENSE for more details.
"""
__version__ = "0.5.3"
from .exceptions import (
KoordinatesException,
ClientError,
ClientValidationError,
InvalidAPIVersion,
ServerError,
Bad... | # -*- coding: utf-8 -*-
"""
Koordinates Python API Client Library
:copyright: (c) Koordinates Limited.
:license: BSD, see LICENSE for more details.
"""
__version__ = "0.5.0"
from .exceptions import (
KoordinatesException,
ClientError,
ClientValidationError,
InvalidAPIVersion,
ServerError,
Bad... | Python | 0.000001 |
b6554b00fdb0387a27671eeb39589dc7e7109f6e | Add collecter function | app/main.py | app/main.py | from flask import Flask, request, jsonify
from urllib.request import urlopen
from bs4 import BeautifulSoup
app = Flask(__name__)
app.config.update(
DEBUG=True
)
@app.route("/")
def index():
url = request.args.get('url', '')
res = collecter(url)
return jsonify(res)
if __name__ == "__main__":
app.r... | from flask import Flask
app = Flask(__name__)
app.config.update(
DEBUG=True
)
@app.route("/")
def index():
return "Hello python"
if __name__ == "__main__":
app.run()
| Python | 0.000001 |
7b58f59ec288dd055cf931dd47c4e8e59bb9ad1d | update atx-agent version | uiautomator2/version.py | uiautomator2/version.py | # coding: utf-8
#
__apk_version__ = '1.1.5'
# 1.1.5 waitForExists use UiObject2 method first then fallback to UiObject.waitForExists
# 1.1.4 add ADB_EDITOR_CODE broadcast support, fix bug (toast捕获导致app闪退)
# 1.1.3 use thread to make watchers.watched faster, try to fix input method type multi
# 1.1.2 fix count error whe... | # coding: utf-8
#
__apk_version__ = '1.1.5'
# 1.1.5 waitForExists use UiObject2 method first then fallback to UiObject.waitForExists
# 1.1.4 add ADB_EDITOR_CODE broadcast support, fix bug (toast捕获导致app闪退)
# 1.1.3 use thread to make watchers.watched faster, try to fix input method type multi
# 1.1.2 fix count error whe... | Python | 0 |
0c9accce7b3df8889ecf57b6df89a36628cb908c | add timeout for running scheduler | sbin/run_scheduler.py | sbin/run_scheduler.py | import subprocess
import tempfile
import time, os
import re
import sys
# cd ~/.config/sublime-text-3/Packages/UnitTesting
# python sbin/run_scheduler.py PACKAGE
# script directory
__dir__ = os.path.dirname(os.path.abspath(__file__))
version = int(subprocess.check_output(["subl","--version"]).decode('utf8').strip()[-... | import subprocess
import tempfile
import time, os
import re
import sys
# cd ~/.config/sublime-text-3/Packages/UnitTesting
# python sbin/run_scheduler.py PACKAGE
# script directory
__dir__ = os.path.dirname(os.path.abspath(__file__))
version = int(subprocess.check_output(["subl","--version"]).decode('utf8').strip()[-... | Python | 0.000001 |
42f4ed206a9c79799b9bb0b13b829c8cf9c979e4 | write to file | scraper/parse_dump.py | scraper/parse_dump.py | #!/usr/bin/python
# Simple script to parse the devpost dump and place results in a json
import os
import json
from multiprocessing import Pool
from bs4 import BeautifulSoup
OUTPUT_FNAME="devpostdump.json"
DUMP_DIR = "output/"
projects = [os.path.join(DUMP_DIR, f) for f in os.listdir(DUMP_DIR)]
# projects = projects[... | #!/usr/bin/python
# Simple script to parse the devpost dump and place results in a json
import os
import json
from multiprocessing import Pool
from bs4 import BeautifulSoup
OUTPUT_FNAME="devpostdump.json"
DUMP_DIR = "output/"
projects = [os.path.join(DUMP_DIR, f) for f in os.listdir(DUMP_DIR)]
# projects = projects[... | Python | 0.000001 |
94182e97ed1635e3aa4993f3db69c248e16b7600 | Undo previous commit | unnaturalcode/ucUser.py | unnaturalcode/ucUser.py | # Copyright 2013, 2014 Joshua Charles Campbell
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Foundation, either version 3 of the Licens... | # Copyright 2013, 2014 Joshua Charles Campbell
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Foundation, either version 3 of the Licens... | Python | 0 |
c8a010e6e9a917c50843dd10303f8f9497b4687c | Bump version | waterbutler/__init__.py | waterbutler/__init__.py | __version__ = '0.2.3'
__import__("pkg_resources").declare_namespace(__name__)
| __version__ = '0.2.2'
__import__("pkg_resources").declare_namespace(__name__)
| Python | 0 |
b0e3886ee24689f1eb249e0ed3c66d887b317f60 | Delete table test | tst/test.py | tst/test.py | #!/usr/bin/python
import grpc
import keyvalue_pb2
import os
import sys
if __name__ == '__main__':
conn_str = os.environ['GRPCROCKSDB_PORT'].split("/")[2]
print "Connecting on: " + conn_str
channel = grpc.insecure_channel(conn_str)
stub = keyvalue_pb2.KeyValueStub(channel)
create_table_res = stub.... | #!/usr/bin/python
import grpc
import keyvalue_pb2
import os
import sys
if __name__ == '__main__':
conn_str = os.environ['GRPCROCKSDB_PORT'].split("/")[2]
print "Connecting on: " + conn_str
channel = grpc.insecure_channel(conn_str)
stub = keyvalue_pb2.KeyValueStub(channel)
create_table_res = stub.... | Python | 0.000002 |
4437565016d0b1edc3b5a5f96d405cd0c41ca5b9 | Use DataHandle timestep helpers in sample_project | smif/sample_project/models/energy_demand.py | smif/sample_project/models/energy_demand.py | """Energy demand dummy model
"""
import numpy as np
from smif.data_layer.data_handle import RelativeTimestep
from smif.model.sector_model import SectorModel
class EDMWrapper(SectorModel):
"""Energy model
"""
def initialise(self, initial_conditions):
pass
def simulate(self, data):
# G... | """Energy demand dummy model
"""
import numpy as np
from smif.data_layer.data_handle import RelativeTimestep
from smif.model.sector_model import SectorModel
class EDMWrapper(SectorModel):
"""Energy model
"""
def initialise(self, initial_conditions):
pass
def simulate(self, data):
# G... | Python | 0 |
d5fe2e21c8ed4e1dc66098e16011cb2f9094e573 | Fix ConditionalJump to manually increment the PC | bytecode.py | bytecode.py | class BytecodeBase:
autoincrement = True # For jump
def __init__(self):
# Eventually might want to add subclassed bytecodes here
# Though __subclasses__ works quite well
pass
def execute(self, machine):
pass
class Push(BytecodeBase):
def __init__(self, data):
... | class BytecodeBase:
autoincrement = True # For jump
def __init__(self):
# Eventually might want to add subclassed bytecodes here
# Though __subclasses__ works quite well
pass
def execute(self, machine):
pass
class Push(BytecodeBase):
def __init__(self, data):
... | Python | 0.000001 |
eeea990b6409085e38df4be4c137b9e42e354ec6 | remove more target="_blank" for @tofumatt (bug 807049) | mkt/site/context_processors.py | mkt/site/context_processors.py | from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from tower import ugettext as _
from access import acl
import amo
from amo.context_processors import get_collect_timings
from amo.urlresolvers import reverse
import mkt
from zadmin.models import get_config
def global_settings(requ... | from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from tower import ugettext as _
from access import acl
import amo
from amo.context_processors import get_collect_timings
from amo.urlresolvers import reverse
import mkt
from zadmin.models import get_config
def global_settings(requ... | Python | 0.00002 |
462813f8f10db550a4897bfcf20aa1d675543edb | Exclude system sources from test coverage | mesonbuild/scripts/coverage.py | mesonbuild/scripts/coverage.py | # Copyright 2017 The Meson development team
# 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 ... | # Copyright 2017 The Meson development team
# 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 ... | Python | 0 |
5e2b2342f94933a9c3e853802471776731b232c8 | Add boot trigger API route. | app/urls.py | app/urls.py | # 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | # 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0 |
96340529a8d5702ce8c880aa66966b2971b96449 | change method | calc_cov.py | calc_cov.py | import mne
import sys
from mne import compute_covariance
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from my_settings import *
reject = dict(grad=4000e-13, # T / m (gradiometers)
mag=4e-12, # T (magnetometers)
eeg=180e-6 #
)
subject = sys.ar... | import mne
import sys
from mne import compute_covariance
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from my_settings import *
reject = dict(grad=4000e-13, # T / m (gradiometers)
mag=4e-12, # T (magnetometers)
eeg=180e-6 #
)
subject = sys.ar... | Python | 0.000005 |
4be984747a41e5ab966b12afe9074a0e611faee2 | Add license text to resampling.py | resampling.py | resampling.py | """
MIT License
Copyright (c) 2017 Talha Can Havadar
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, modify, merge, publ... | """
@author Talha Can Havadar (talhaHavadar)
"""
import random
from collections import Counter
class ResamplingWheel(object):
"""
A Class implementation for resampling wheel
Creates an imaginary wheel that consist of weighted portions.
According to these weights, you can pick an index value.
Index ... | Python | 0 |
5fa9e88e9402a4ca12f2f54298d397bc7b54728b | Revert "deactivated test for non-existent 'references'" | web/tests/test_views.py | web/tests/test_views.py | from django.test import TestCase, Client
from django.urls import reverse
from web.views import index, about, compare, reference
class TestViews(TestCase):
def test_index_view_GET(self):
url = reverse('index')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertTemplate... | from django.test import TestCase, Client
from django.urls import reverse
from web.views import index, about, compare, reference
class TestViews(TestCase):
def test_index_view_GET(self):
url = reverse('index')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertTemplate... | Python | 0 |
a5fddaefdedef18b0b6b7d3b2ec65f64eaaaad65 | fix date time bug | clean_db.py | clean_db.py | import MySQLdb, config, urllib, cgi, datetime
from datetime import datetime
sql = MySQLdb.connect(host="localhost",
user=config.username,
passwd=config.passwd,
db=config.test_db)
sql.query("SELECT `id` FROM `feedurls`")
db_feed_query=... | import MySQLdb, config, urllib, cgi, datetime
from datetime import datetime
sql = MySQLdb.connect(host="localhost",
user=config.username,
passwd=config.passwd,
db=config.test_db)
sql.query("SELECT `id` FROM `feedurls`")
db_feed_query=... | Python | 0.000016 |
37fb65dd7763f7cbd1a53f613bbda16d739f11a3 | Make `cctrluser create` work | cctrl/auth.py | cctrl/auth.py | # -*- coding: utf-8 -*-
"""
Copyright 2010 cloudControl UG (haftungsbeschraenkt)
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
... | # -*- coding: utf-8 -*-
"""
Copyright 2010 cloudControl UG (haftungsbeschraenkt)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | Python | 0.000003 |
d64460c8bbbe045dcdf9f737562a31d84044acce | Change package name to 'cirm' to avoid confusion. | rest/setup.py | rest/setup.py | #
# Copyright 2012 University of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #
# Copyright 2012 University of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Python | 0 |
917d8e26a64a40de0a0b77085f1fa6d054af0ee8 | Remove cleanup_testfn, no longer used. | conftest.py | conftest.py | import os
import sys
import platform
import pytest
collect_ignore = []
if platform.system() != 'Windows':
collect_ignore.extend(
[
'distutils/msvc9compiler.py',
]
)
@pytest.fixture
def save_env():
orig = os.environ.copy()
try:
yield
finally:
for key... | import os
import sys
import platform
import shutil
import pytest
collect_ignore = []
if platform.system() != 'Windows':
collect_ignore.extend(
[
'distutils/msvc9compiler.py',
]
)
@pytest.fixture
def save_env():
orig = os.environ.copy()
try:
yield
finally:
... | Python | 0 |
d1137c56b59ef4fec06726fa0dda4854d0631e6d | delete tempfile after uploading screenshot | restclient.py | restclient.py | import json
import requests
import os
from bs4 import BeautifulSoup
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from ui.Ui_LoginDialog import Ui_LoginDialog
def getLoginToken(address, email, password, timeout=15):
""" attempt to get a login token. KeyError means invalid us... | import json
import requests
from bs4 import BeautifulSoup
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from ui.Ui_LoginDialog import Ui_LoginDialog
def getLoginToken(address, email, password, timeout=15):
""" attempt to get a login token. KeyError means invalid username or ... | Python | 0.000001 |
7484c8d4ab699ee16bc867cdff1e7ec699dbb142 | Add profiling support to Melange. By assigning profile_main_as_logs or profile_main_as_html to main variable you can turn on profiling. profile_main_as_logs will log profile data to App Engine console logs, profile_main_as_html will show profile data as html at the bottom of the page. If you want to profile app on depl... | app/main.py | app/main.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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... | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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... | Python | 0 |
fc05512b3ad40f6571ee3d942e4829a19e2a465e | Add core.models.Sensor | sensor/core/models.py | sensor/core/models.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.db import models
class GenericSensor(models.Model):
"""Represents a sensor abstracting away the spe... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.db import models
class GenericSensor(models.Model):
"""Represents a sensor abstracting away the spe... | Python | 0.000002 |
d9d9b993edc8baebf69b446d40f0a05260a041d5 | Remove prints | emailauth/tests.py | emailauth/tests.py | from django.test import Client, TestCase
from emailauth import forms
c = Client()
class FormTests(TestCase):
def test_creation_form(self):
form_data = {'email': 'test@test.com', 'password1': 'test1234', 'password2': 'test1234'}
form = forms.UserCreationForm(form_data)
# Testing if form ... | from django.test import Client, TestCase
from emailauth import forms
c = Client()
class FormTests(TestCase):
def test_creation_form(self):
form_data = {'email': 'test@test.com', 'password1': 'test1234', 'password2': 'test1234'}
form = forms.UserCreationForm(form_data)
# Testing if form ... | Python | 0.000002 |
4c0325f92f542b9af7e504be55b7c7d79d1af3c8 | Update some features | compiler.py | compiler.py | # -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
"""
"""
from __future__ import absolute_import;
from pymfony.component.syste... | # -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
"""
"""
from __future__ import absolute_import;
from pymfony.component.syste... | Python | 0 |
265e9added53d1eee1291b9e0b5a10bc7dfe19c8 | Make sure we don't have section A before doing the extra round of manipulation | myuw_mobile/test/dao/canvas.py | myuw_mobile/test/dao/canvas.py | from django.test import TestCase
from django.test.client import RequestFactory
from myuw_mobile.dao.canvas import get_indexed_data_for_regid
from myuw_mobile.dao.canvas import get_indexed_by_decrosslisted
from myuw_mobile.dao.schedule import _get_schedule
from myuw_mobile.dao.term import get_current_quarter
class Test... | from django.test import TestCase
from django.test.client import RequestFactory
from myuw_mobile.dao.canvas import get_indexed_data_for_regid
from myuw_mobile.dao.canvas import get_indexed_by_decrosslisted
from myuw_mobile.dao.schedule import _get_schedule
from myuw_mobile.dao.term import get_current_quarter
class Test... | Python | 0.000001 |
ae948a2dfdd62af2ba98a0ee506ddd48504ee64b | bump version to 0.6-dev | validictory/__init__.py | validictory/__init__.py | #!/usr/bin/env python
from validictory.validator import SchemaValidator
__all__ = [ 'validate', 'SchemaValidator' ]
__version__ = '0.6.0-dev'
def validate(data, schema, validator_cls=SchemaValidator):
'''
Validates a parsed json document against the provided schema. If an
error is found a ValueError is r... | #!/usr/bin/env python
from validictory.validator import SchemaValidator
__all__ = [ 'validate', 'SchemaValidator' ]
__version__ = '0.5.0'
def validate(data, schema, validator_cls=SchemaValidator):
'''
Validates a parsed json document against the provided schema. If an
error is found a ValueError is raise... | Python | 0 |
295a6dd0c2af01161ee5da274719596f043fe21c | Use encode('utf8') instead of str(...). | applyCrf.py | applyCrf.py | #!/usr/bin/env python
"""This program will read a JSON file (such as adjudicated_modeled_live_eyehair_100_03.json) and process it with CRF++. The labels assigned by CRF++ are printed."""
import argparse
import sys
import scrapings
import crf_features as crff
import CRFPP
def main(argv=None):
'''this is called if... | #!/usr/bin/env python
"""This program will read a JSON file (such as adjudicated_modeled_live_eyehair_100_03.json) and process it with CRF++. The labels assigned by CRF++ are printed."""
import argparse
import sys
import scrapings
import crf_features as crff
import CRFPP
def main(argv=None):
'''this is called if... | Python | 0.000001 |
0cd3651810daceefa492bc303c74568d1a042ca6 | Fix get_proxy_ticket method usage | django_cas_ng/models.py | django_cas_ng/models.py | # ⁻*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from .utils import (get_cas_client, get_user_from_session)
from importlib import import_module
from cas import CASError
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
class ProxyError(ValueError):
pass
c... | # ⁻*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from .utils import (get_cas_client, get_service_url, get_user_from_session)
from importlib import import_module
from cas import CASError
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
class ProxyError(ValueErr... | Python | 0.000004 |
db033a9560ee97b5281adbf05f3f452943d592d7 | Add test_get_on_call and test_weekly | django_on_call/tests.py | django_on_call/tests.py | import datetime
from django.test import TestCase
from .models import OnCall
class SimpleTest(TestCase):
def test_get_on_call(self):
"""Test the basic OnCall.get_on_call functionality
"""
on_call = OnCall(slug='test', rule='on_call = "Alice"')
self.assertEqual(on_call.get_on_call(... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python | 0 |
781e20bc3f465bdaac50f0f2a637b037d892c054 | Remove premature optimisation | src/registry.py | src/registry.py | from .formatters import *
class FormatRegistry():
def __init__(self):
self.__formatters = [
ClangFormat(), ElmFormat(), GoFormat(), JavaScriptFormat(),
PythonFormat(), RustFormat(), TerraformFormat()
]
@property
def all(self):
return self.__formatters
... | from .formatters import *
class FormatRegistry():
def __init__(self):
self.__registered_formatters = [
ClangFormat(), ElmFormat(), GoFormat(), JavaScriptFormat(),
PythonFormat(), RustFormat(), TerraformFormat()
]
self.__source_formatter_lookup_table = {}
for... | Python | 0.00005 |
945e7d1ef165054891a0ac574d52f6a1c3b7a162 | Add long help | code_gen.py | code_gen.py | import sys
import getopt
from config import CONFIG
from ida_code_gen import IdaCodeGen
from ida_parser import IdaInfoParser
def print_help():
print 'Options:'
print ' -d, --database Path to database from arguments. Default = ' + CONFIG['database']
print ' -o, --out_dir Path to output directory for c... | import sys
import getopt
from config import CONFIG
from ida_code_gen import IdaCodeGen
from ida_parser import IdaInfoParser
def print_help():
print 'Options:'
print ' -d, --database Path to database from arguments. Default = ' + CONFIG['database']
print ' -o, --out_dir Path to output directory for c... | Python | 0.000121 |
2ad94140360f893ad46b1b972e753f2a78b5f779 | print function | example/example.py | example/example.py | # coding: utf-8
import json
import os
import lastpass
with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.load(f)
username = str(credentials['username'])
password = str(credentials['password'])
try:
# First try without a multifactor password
vault = last... | # coding: utf-8
import json
import os
import lastpass
with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.load(f)
username = str(credentials['username'])
password = str(credentials['password'])
try:
# First try without a multifactor password
vault = last... | Python | 0.00093 |
cefa0a94582e40f92c48d6c91cf393c9b0310713 | fix geojson in sources dir | validate.py | validate.py |
import json
import re
import click
import jsonschema
import utils
@click.command()
@click.argument('schema', type=click.File('r'), required=True)
@click.argument('jsonfiles', type=click.Path(exists=True), required=True)
def validate(schema, jsonfiles):
"""Validate a JSON files against a JSON schema.
\b
... |
import json
import re
import click
import jsonschema
import utils
@click.command()
@click.argument('schema', type=click.File('r'), required=True)
@click.argument('jsonfiles', type=click.Path(exists=True), required=True)
def validate(schema, jsonfiles):
"""Validate a JSON files against a JSON schema.
\b
... | Python | 0.000003 |
6d35c533940db6a6d664546c2b97e5c12c92dcfe | remove yaml parser for bandap GMM | example/src/yml.py | example/src/yml.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import yaml
class SpeakerYML(object):
def __init__(self, ymlf):
# open yml file
with open(ymlf) as yf:
conf = yaml.safe_load(yf)
# read parameter from yml file
self.wa... | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import yaml
class SpeakerYML(object):
def __init__(self, ymlf):
# open yml file
with open(ymlf) as yf:
conf = yaml.safe_load(yf)
# read parameter from yml file
self.wa... | Python | 0.000005 |
7e16a9feb88023a03363aee5be552a2f15b825fc | 修复 waiting 状态下颜色错误的问题 | utils/templatetags/submission.py | utils/templatetags/submission.py | # coding=utf-8
def translate_result(value):
results = {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
}
... | # coding=utf-8
def translate_result(value):
results = {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
}
... | Python | 0.000007 |
d17a88ac9ef8e3806c7ac60d31df62a1041939cb | Add sum_of_spreads | muv/spatial.py | muv/spatial.py | """
Spatial statistics.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
def spread(d, t):
"""
Calculate the spread between two sets of compounds.
Given a matrix containing distances between two sets of compounds, A
... | """
Spatial statistics.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
def spread(d, t):
"""
Calculate the spread between two sets of compounds.
Given a matrix containing distances between two sets of compounds, A
... | Python | 0.998996 |
e05736cd36bc595070dda78e91bcb1b4bcfd983c | Remove deprecated usage of `reflect` constructor param | microcosm_postgres/operations.py | microcosm_postgres/operations.py | """
Common database operations.
"""
from sqlalchemy import MetaData
from sqlalchemy.exc import ProgrammingError
from microcosm_postgres.migrate import main
from microcosm_postgres.models import Model
def stamp_head(graph):
"""
Stamp the database with the current head revision.
"""
main(graph, "stam... | """
Common database operations.
"""
from sqlalchemy import MetaData
from sqlalchemy.exc import ProgrammingError
from microcosm_postgres.migrate import main
from microcosm_postgres.models import Model
def stamp_head(graph):
"""
Stamp the database with the current head revision.
"""
main(graph, "stam... | Python | 0 |
78c5ef063a82d707b30eed4a6e02fcbc8976f4df | move sort code to the end, so initial result will be sorted too. | django_project/feti/views/landing_page.py | django_project/feti/views/landing_page.py | # coding=utf-8
"""FETI landing page view."""
__author__ = 'Christian Christelis <christian@kartoza.com>'
__date__ = '04/2015'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
from collections import OrderedDict
from haystack.query import SearchQuerySet
from django.shortcuts import render
from django.http import Htt... | # coding=utf-8
"""FETI landing page view."""
__author__ = 'Christian Christelis <christian@kartoza.com>'
__date__ = '04/2015'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
from collections import OrderedDict
from haystack.query import SearchQuerySet
from django.shortcuts import render
from django.http import Htt... | Python | 0 |
c7f8fd75dd5b41a059b65e9cea54d875d1f57655 | Change self to PortStatCollector. | src/collectors/portstat/portstat.py | src/collectors/portstat/portstat.py | """
The PortStatCollector collects metrics about ports listed in config file.
##### Dependencies
* psutil
"""
from collections import Counter
import psutil
import diamond.collector
class PortStatCollector(diamond.collector.Collector):
def __init__(self, *args, **kwargs):
super(PortStatCollector, sel... | """
The PortStatCollector collects metrics about ports listed in config file.
##### Dependencies
* psutil
"""
from collections import Counter
import psutil
import diamond.collector
class PortStatCollector(diamond.collector.Collector):
def __init__(self, *args, **kwargs):
super(PortStatCollector, sel... | Python | 0 |
0744dba6a52c42dbe6f9ba360e5311a1f90c3550 | Fix python 3 compatibility issue in DNSimple driver. | libcloud/common/dnsimple.py | libcloud/common/dnsimple.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 use ... | # 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 use ... | Python | 0 |
725b246a0bbb437a5a0efeb16b58d3942f3b14cc | Update the example client. | examples/client.py | examples/client.py | from twisted.internet import defer, endpoints, task
from txjason.netstring import JSONRPCClientFactory
from txjason.client import JSONRPCClientError
client = JSONRPCClientFactory('127.0.0.1', 7080)
@defer.inlineCallbacks
def main(reactor, description):
endpoint = endpoints.clientFromString(reactor, description)... | from twisted.internet import reactor, defer
from txjason.netstring import JSONRPCClientFactory
from txjason.client import JSONRPCClientError
client = JSONRPCClientFactory('127.0.0.1', 7080)
@defer.inlineCallbacks
def stuff():
try:
r = yield client.callRemote('bar.foo')
except JSONRPCClientError as e... | Python | 0 |
5dddadb98340fec6afda80fd1a8ee1eda907b60a | print exports to terminal | examples/export.py | examples/export.py | """
Demonstrates export console output
"""
from rich.console import Console
from rich.table import Table
console = Console(record=True)
def print_table():
table = Table(title="Star Wars Movies")
table.add_column("Released", style="cyan", no_wrap=True)
table.add_column("Title", style="magenta")
tabl... | """
Demonstrates export console output
"""
from rich.console import Console
from rich.table import Table
console = Console(record=True)
def print_table():
table = Table(title="Star Wars Movies")
table.add_column("Released", style="cyan", no_wrap=True)
table.add_column("Title", style="magenta")
tabl... | Python | 0 |
1741c7258ebdcef412442cebab33409290496df0 | Add network example | IoT/iot_utils.py | IoT/iot_utils.py | from __future__ import print_function
import sys, signal, atexit
import json
__author__ = 'KT Kirk'
__all__ = ['keys', 'atexit', 'signal']
## Exit handlers ##
# This function stops python from printing a stacktrace when you hit control-C
def SIGINTHandler(signum, frame):
raise SystemExit
# This function lets you... | from __future__ import print_function
import sys, signal, atexit
import json
__author__ = 'KT Kirk'
__all__ = ['keys', 'atexit', 'signal']
## Exit handlers ##
# This function stops python from printing a stacktrace when you hit control-C
def SIGINTHandler(signum, frame):
raise SystemExit
# This function lets you... | Python | 0.000002 |
b07243a6fb11dbbd487ba37620f7c8f4fc89449a | bump version to v1.10.5 | ndd/package.py | ndd/package.py | # -*- coding: utf-8 -*-
"""Template package file"""
__title__ = 'ndd'
__version__ = '1.10.5'
__author__ = 'Simone Marsili'
__summary__ = ''
__url__ = 'https://github.com/simomarsili/ndd'
__email__ = 'simo.marsili@gmail.com'
__license__ = 'BSD 3-Clause'
__copyright__ = 'Copyright (c) 2020, Simone Marsili'
__classifiers_... | # -*- coding: utf-8 -*-
"""Template package file"""
__title__ = 'ndd'
__version__ = '1.10.4'
__author__ = 'Simone Marsili'
__summary__ = ''
__url__ = 'https://github.com/simomarsili/ndd'
__email__ = 'simo.marsili@gmail.com'
__license__ = 'BSD 3-Clause'
__copyright__ = 'Copyright (c) 2020, Simone Marsili'
__classifiers_... | Python | 0 |
7abd9b977368a189ca3f298e566dd1dd5b7a66d1 | Update constant.py | vnpy/trader/constant.py | vnpy/trader/constant.py | """
General constant string used in VN Trader.
"""
from enum import Enum
class Direction(Enum):
"""
Direction of order/trade/position.
"""
LONG = "多"
SHORT = "空"
NET = "净"
class Offset(Enum):
"""
Offset of order/trade.
"""
NONE = ""
OPEN = "开"
CLOSE = "平"
CLOSETO... | """
General constant string used in VN Trader.
"""
from enum import Enum
class Direction(Enum):
"""
Direction of order/trade/position.
"""
LONG = "多"
SHORT = "空"
NET = "净"
class Offset(Enum):
"""
Offset of order/trade.
"""
NONE = ""
OPEN = "开"
CLOSE = "平"
CLOSETO... | Python | 0.000001 |
5848a9c64744eacf8d90a86335e948ed17ef8346 | Correct path to workflows | src/prepare_asaim/import_workflows.py | src/prepare_asaim/import_workflows.py | #!/usr/bin/env python
import os
from bioblend import galaxy
admin_email = os.environ.get('GALAXY_DEFAULT_ADMIN_USER', 'admin@galaxy.org')
admin_pass = os.environ.get('GALAXY_DEFAULT_ADMIN_PASSWORD', 'admin')
url = "http://localhost:8080"
gi = galaxy.GalaxyInstance(url=url, email=admin_email, password=admin_pass)
wf... | #!/usr/bin/env python
import os
from bioblend import galaxy
admin_email = os.environ.get('GALAXY_DEFAULT_ADMIN_USER', 'admin@galaxy.org')
admin_pass = os.environ.get('GALAXY_DEFAULT_ADMIN_PASSWORD', 'admin')
url = "http://localhost:8080"
gi = galaxy.GalaxyInstance(url=url, email=admin_email, password=admin_pass)
wf... | Python | 0.000018 |
0d31cbfd3042a1e7255ed833715112504fe608ae | Revert types | dshin/nn/types.py | dshin/nn/types.py | """
TensorFlow type annotation aliases.
"""
import typing
import tensorflow as tf
Value = typing.Union[tf.Variable, tf.Tensor]
Values = typing.Sequence[Value]
Named = typing.Union[tf.Variable, tf.Tensor, tf.Operation]
NamedSeq = typing.Sequence[Named]
Tensors = typing.Sequence[tf.Tensor]
Variables = typing.Sequence[t... | """
TensorFlow type annotation aliases.
"""
import typing
import tensorflow as tf
Value = (tf.Variable, tf.Tensor)
Values = typing.Sequence[Value]
Named = (tf.Variable, tf.Tensor, tf.Operation)
NamedSeq = typing.Sequence[Named]
Tensors = typing.Sequence[tf.Tensor]
Variables = typing.Sequence[tf.Variable]
Operations =... | Python | 0.000001 |
8a3ae1b809d886f647f13574cc9b416b17c27b7c | Remove VERSION variable from api.py | duckduckpy/api.py | duckduckpy/api.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __init__ import __version__
from collections import namedtuple
from duckduckpy.utils import camel_to_snake_case
SERVER_HOST = 'api.duckduckgo.com'
USER_AGENT = 'duckduckpy {0}'.format(__version__)
ICON_KEYS = set(['URL', 'Width', 'Height'])
RESULT_... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import namedtuple
from utils import camel_to_snake_case
SERVER_HOST = 'api.duckduckgo.com'
VERSION = '0.1-alpha'
USER_AGENT = 'duckduckpy {0}'.format(VERSION)
ICON_KEYS = set(['URL', 'Width', 'Height'])
RESULT_KEYS = set(['FirstURL', 'I... | Python | 0.000002 |
ee5e9d09a02e52714291a44148be4722f8e495ac | Revert "Take Abode camera snapshot before fetching latest image" (#68626) | homeassistant/components/abode/camera.py | homeassistant/components/abode/camera.py | """Support for Abode Security System cameras."""
from __future__ import annotations
from datetime import timedelta
from typing import Any, cast
from abodepy.devices import CONST, AbodeDevice as AbodeDev
from abodepy.devices.camera import AbodeCamera as AbodeCam
import abodepy.helpers.timeline as TIMELINE
import reque... | """Support for Abode Security System cameras."""
from __future__ import annotations
from datetime import timedelta
from typing import Any, cast
from abodepy.devices import CONST, AbodeDevice as AbodeDev
from abodepy.devices.camera import AbodeCamera as AbodeCam
import abodepy.helpers.timeline as TIMELINE
import reque... | Python | 0 |
70f588282e1777945e113e73dbca83f77355f0f9 | Test git permission | driver/omni_driver.py | driver/omni_driver.py | import driver
import lib.lib as lib
from hardware.dmcc_motor import DMCCMotorSet
class OmniDriver(driver.Driver):
#Vijay was here
#Chad was here | import driver
import lib.lib as lib
from hardware.dmcc_motor import DMCCMotorSet
class OmniDriver(driver.Driver):
#Vijay was here
| Python | 0 |
a3f12245163a9165f45f4ee97b6e4e67cdd29783 | Update decipher.py | decipher.py | decipher.py | #
# decipher.py (c) Luis Hoderlein
#
# BUILT: Apr 21, 2016
#
# This program can brute force Cesarian ciphers
# It gives you all possible outputs, meaning you still have to chose the output you want
#
# imports
import string
# adds padding to make output inline
def pad(num):
if num < 10:
return "0"+str(num)
else:... | #
# decipher.py (c) Luis Hoderlein
#
# BUILT: Apr 21, 2016
#
# This program can brute force Cesarian ciphers
# It gives you all possible outputs, meaning you still have to chose the output you want
#
import string
def pad(num):
if num < 10:
return "0"+str(num)
else:
return str(num)
raw_txt = raw_input("Enter ... | Python | 0 |
71e96782caff8543c2e859226bd0b77a79a55040 | fix gate | e3nn_jax/_gate.py | e3nn_jax/_gate.py | from functools import partial
import jax
import jax.numpy as jnp
from e3nn_jax import IrrepsData, elementwise_tensor_product, scalar_activation
from e3nn_jax.util.decorators import overload_for_irreps_without_data
@partial(jax.jit, static_argnums=(1, 2, 3, 4))
def _gate(input: IrrepsData, even_act, odd_act, even_ga... | from functools import partial
import jax
import jax.numpy as jnp
from e3nn_jax import IrrepsData, elementwise_tensor_product, scalar_activation
from e3nn_jax.util.decorators import overload_for_irreps_without_data
@partial(jax.jit, static_argnums=(1, 2, 3, 4))
def _gate(input: IrrepsData, even_act, odd_act, even_ga... | Python | 0.000001 |
f421b2997494ca546c6479e4246456e56b816e60 | Add Robert EVT ID too | libpebble2/util/hardware.py | libpebble2/util/hardware.py | __author__ = 'katharine'
class PebbleHardware(object):
UNKNOWN = 0
TINTIN_EV1 = 1
TINTIN_EV2 = 2
TINTIN_EV2_3 = 3
TINTIN_EV2_4 = 4
TINTIN_V1_5 = 5
BIANCA = 6
SNOWY_EVT2 = 7
SNOWY_DVT = 8
SPALDING_EVT = 9
BOBBY_SMILES = 10
SPALDING = 11
SILK_EVT = 12
ROBERT_EVT =... | __author__ = 'katharine'
class PebbleHardware(object):
UNKNOWN = 0
TINTIN_EV1 = 1
TINTIN_EV2 = 2
TINTIN_EV2_3 = 3
TINTIN_EV2_4 = 4
TINTIN_V1_5 = 5
BIANCA = 6
SNOWY_EVT2 = 7
SNOWY_DVT = 8
SPALDING_EVT = 9
BOBBY_SMILES = 10
SPALDING = 11
SILK_EVT = 12
SILK = 14
... | Python | 0 |
d9af336506fcca40cbc5ebf337268cfd16459c4f | Use iter_log in example. | examples/ra_log.py | examples/ra_log.py | #!/usr/bin/python
# Demonstrates how to iterate over the log of a Subversion repository.
from subvertpy.ra import RemoteAccess
conn = RemoteAccess("svn://svn.samba.org/subvertpy/trunk")
for (changed_paths, rev, revprops, has_children) in conn.iter_log(paths=None,
start=0, end=conn.get_latest_revnum(), discov... | #!/usr/bin/python
# Demonstrates how to iterate over the log of a Subversion repository.
from subvertpy.ra import RemoteAccess
conn = RemoteAccess("svn://svn.gnome.org/svn/gnome-specimen/trunk")
def cb(changed_paths, rev, revprops, has_children=None):
print "=" * 79
print "%d:" % rev
print "Revision prop... | Python | 0 |
1d0d28ebdda25a7dc579857063d47c5042e6c02b | Enable south for the docs site. | django_docs/settings.py | django_docs/settings.py | # Settings for docs.djangoproject.com
from django_www.common_settings import *
### Django settings
CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs'
INSTALLED_APPS = [
'django.contrib.sitemaps',
'django.contrib.sites',
'django.contrib.staticfiles',
'djangosecure',
'haystack',
'south',
'docs'... | # Settings for docs.djangoproject.com
from django_www.common_settings import *
### Django settings
CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs'
INSTALLED_APPS = [
'django.contrib.sitemaps',
'django.contrib.sites',
'django.contrib.staticfiles',
'djangosecure',
'haystack',
'docs',
]
MIDDLEWA... | Python | 0 |
3434c404d8ab3d42bed4756338f1b8dba3a10255 | split debug_plot into debug and plot | src/settings.py | src/settings.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
debug = False
debug_plot = False
plot = False
# CE hack is ON
CE = True
def plt_show():
from matplotlib import pyplot as plt
if debug_plot or (debug and plot)... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
debug = False
debug_plot = False
plot = False
# CE hack is ON
CE = True
def plt_show():
from matplotlib import pyplot as plt
if debug_plot:
plt.show()... | Python | 0.998673 |
2dc0ac43b50c61aa10576779a8228ff578c37068 | Use get_user_model | src/auditlog/middleware.py | src/auditlog/middleware.py | from __future__ import unicode_literals
import threading
import time
from django.contrib.auth import get_user_model
from django.db.models.signals import pre_save
from django.utils.functional import curry
from auditlog.models import LogEntry
from auditlog.compat import is_authenticated
# Use MiddlewareMixin when pres... | from __future__ import unicode_literals
import threading
import time
from django.conf import settings
from django.db.models.signals import pre_save
from django.utils.functional import curry
from django.apps import apps
from auditlog.models import LogEntry
from auditlog.compat import is_authenticated
# Use Middleware... | Python | 0.000004 |
00c14e981807668b09a5d6a2e71fe8872291acad | Add admin support for attachments | django_mailbox/admin.py | django_mailbox/admin.py | from django.conf import settings
from django.contrib import admin
from django_mailbox.models import MessageAttachment, Message, Mailbox
def get_new_mail(mailbox_admin, request, queryset):
for mailbox in queryset.all():
mailbox.get_new_mail()
get_new_mail.short_description = 'Get new mail'
class MailboxAd... | from django.conf import settings
from django.contrib import admin
from django_mailbox.models import Message, Mailbox
def get_new_mail(mailbox_admin, request, queryset):
for mailbox in queryset.all():
mailbox.get_new_mail()
get_new_mail.short_description = 'Get new mail'
class MailboxAdmin(admin.ModelAdmi... | Python | 0 |
48c880a35c899929da33f20e9cd4ee7e4fd8bc7e | Set a custom name template including the replica set | servers/mongo/data.py | servers/mongo/data.py | from .. import Server
import logging
class MongoDataNode(Server):
log = logging.getLogger('Servers.MongoDataNode')
log.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s [%(name)s] %(levelname)s: %(message)s',
... | from .. import Server
import logging
class MongoDataNode(Server):
log = logging.getLogger('Servers.MongoDataNode')
log.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s [%(name)s] %(levelname)s: %(message)s',
... | Python | 0 |
71289d3a22476001421454ff736ea03742e43158 | Add basic parser | vumi_twilio_api/twilml_parser.py | vumi_twilio_api/twilml_parser.py | import xml.etree.ElementTree as ET
class Verb(object):
"""Represents a single verb in TwilML. """
def __init__(self, verb, attributes={}, nouns={}):
self.verb = verb
self.attributes = attributes
self.nouns = nouns
class TwilMLParseError(Exception):
"""Raised when trying to parse... | class Verb(object):
"""Represents a single verb in TwilML. """
def __init__(self, verb, attributes={}, nouns={}):
self.verb = verb
self.attributes = attributes
self.nouns = nouns
| Python | 0.000334 |
84642bab00aecbb061789fc9e8a5d5103e3e9e42 | add getdict | panoramisk/message.py | panoramisk/message.py | from . import utils
from urllib.parse import unquote
class Message(utils.CaseInsensitiveDict):
"""Handle both Responses and Events with the same api:
..
>>> resp = Message({'Response': 'Follows'}, 'Response body')
>>> event = Message({'Event': 'MeetmeEnd', 'Meetme': '4242'})
Responses:
... | from . import utils
from urllib.parse import unquote
class Message(utils.CaseInsensitiveDict):
"""Handle both Responses and Events with the same api:
..
>>> resp = Message({'Response': 'Follows'}, 'Response body')
>>> event = Message({'Event': 'MeetmeEnd', 'Meetme': '4242'})
Responses:
... | Python | 0.000001 |
948ce666053eee9fbdfd7f14e9f02e0aa6bdd18d | list[:limit] works fine if limit=None | djangofeeds/feedutil.py | djangofeeds/feedutil.py | from django.utils.text import truncate_html_words
from djangofeeds import conf
from datetime import datetime
from djangofeeds.optimization import BeaconDetector
import time
from datetime import datetime, timedelta
_beacon_detector = BeaconDetector()
def entries_by_date(entries, limit=None):
"""Sort the feed entr... | from django.utils.text import truncate_html_words
from djangofeeds import conf
from datetime import datetime
from djangofeeds.optimization import BeaconDetector
import time
from datetime import datetime, timedelta
_beacon_detector = BeaconDetector()
def entries_by_date(entries, limit=None):
"""Sort the feed entr... | Python | 0.999999 |
a49095bf078603e046288629aa8497f031ed6bd3 | Add transpose_join, joins 2 infinite lists by transposing the next elements | node/divide.py | node/divide.py | #!/usr/bin/env python
from nodes import Node
from type.type_infinite_list import DummyList
class Divide(Node):
char = "/"
args = 2
results = 1
@Node.test_func([4, 2], [2])
@Node.test_func([2, 4], [0.5])
def func(self, a: Node.number, b: Node.number):
"""a/b. floating point division.
... | #!/usr/bin/env python
from nodes import Node
class Divide(Node):
"""
Takes two items from the stack and divides them
"""
char = "/"
args = 2
results = 1
@Node.test_func([4,2], [2])
@Node.test_func([2,4], [0.5])
def func(self, a: Node.number, b: Node.number):
"""a/b... | Python | 0.000001 |
e869d59dddf6e574155a4c5307b184d46e145d7c | Delete Feeds/Posts and retry query if MultipleObjectsReturned | djangofeeds/managers.py | djangofeeds/managers.py | from django.db import models
from django.db.models.query import QuerySet
from djangofeeds.utils import truncate_field_data
import sys
DEFAULT_POST_LIMIT = 5
def update_with_dict(obj, fields):
set_value = lambda (name, val): setattr(obj, name, val)
map(set_value, fields.items())
obj.save()
return obj
... | from django.db import models
from django.db.models.query import QuerySet
from djangofeeds.utils import truncate_field_data
DEFAULT_POST_LIMIT = 5
def update_with_dict(obj, fields):
set_value = lambda (name, val): setattr(obj, name, val)
map(set_value, fields.items())
obj.save()
return obj
class Ext... | Python | 0 |
7c9a4b72f59d902ab5daa43b7675641a2e81ebb7 | Switch to "templates" terminology for VM images/templates. | xblock_skytap/skytap.py | xblock_skytap/skytap.py | """
"""
# Imports ###########################################################
from __future__ import absolute_import
import skytap as skytap_library
from xblock.core import XBlock
from xblock.fields import Scope, String
from xblock.fragment import Fragment
from xblockutils.resources import ResourceLoader
from xbloc... | """
"""
# Imports ###########################################################
from __future__ import absolute_import
import skytap as skytap_library
from xblock.core import XBlock
from xblock.fields import Scope, String
from xblock.fragment import Fragment
from xblockutils.resources import ResourceLoader
from xbloc... | Python | 0 |
87d792fda8763f49d83ce274015f3a436a0c89cc | send message after stuff is started | dusty/commands/run.py | dusty/commands/run.py |
from ..compiler import (compose as compose_compiler, nginx as nginx_compiler,
port_spec as port_spec_compiler, spec_assembler)
from ..systems import compose, hosts, nginx, virtualbox
def start_local_env():
""" This command will use the compilers to get compose specs
will pass those spe... |
from ..compiler import (compose as compose_compiler, nginx as nginx_compiler,
port_spec as port_spec_compiler, spec_assembler)
from ..systems import compose, hosts, nginx, virtualbox
def start_local_env():
""" This command will use the compilers to get compose specs
will pass those spe... | Python | 0 |
7f2ac925b2343e57ad7f4a6d79ee24e14c8f4d78 | Add a Bazel rule assignment_notebook(). | exercises/defs.bzl | exercises/defs.bzl | # TODO(salikh): Implement the automatic tar rules too
def assignment_notebook_macro(
name,
srcs,
language = None,
visibility = ["//visibility:private"]):
"""
Defines a rule for student notebook and autograder
generation from a master notebook.
Arguments:
name:
srcs: the file name of the inp... | # TODO(salikh): Implement the automatic tar rules too
def assignment_notebook_macro(
name,
srcs,
language = None,
visibility = ["//visibility:private"]):
"""
Defines a rule for student notebook and autograder
generation from a master notebook.
Arguments:
name:
srcs: the file name of the inp... | Python | 0 |
fd92c0b2964bce5d56b9bf41e84bfde24fec0b78 | raise default post limit to 25q | djangofeeds/managers.py | djangofeeds/managers.py | from datetime import timedelta, datetime
from django.db import models
from django.db.models.query import QuerySet
from django.core.exceptions import MultipleObjectsReturned
from djangofeeds.utils import truncate_field_data
""" .. data:: DEFAULT_POST_LIMIT
The default limit of number of posts to keep in a feed.
... | from datetime import timedelta, datetime
from django.db import models
from django.db.models.query import QuerySet
from django.core.exceptions import MultipleObjectsReturned
from djangofeeds.utils import truncate_field_data
""" .. data:: DEFAULT_POST_LIMIT
The default limit of number of posts to keep in a feed.
... | Python | 0 |
f274f927d600989db1d485212d116166695e6edd | Use keyword arguments for readability | scell/core.py | scell/core.py | """
scell.core
~~~~~~~~~~
Provides abstractions over lower level APIs and
file objects and their interests.
"""
from select import select as _select
from collections import namedtuple
def select(rl, wl, timeout=None):
"""
Returns the file objects ready for reading/writing
from the read-... | """
scell.core
~~~~~~~~~~
Provides abstractions over lower level APIs and
file objects and their interests.
"""
from select import select as _select
from collections import namedtuple
def select(rl, wl, timeout=None):
"""
Returns the file objects ready for reading/writing
from the read-... | Python | 0.000001 |
e7cce08f32516bc8b15df7eee0c285eebe795cab | Make it easier to filter on multiple field values | explorer/search.py | explorer/search.py | from . import config
from .document import Document
import requests
from time import time
def perform_search(**params):
response = requests.get(
config.GOVUK_SEARCH_API,
params=params,
auth=config.AUTH,
)
return response.json()
def fetch_documents(scope):
documents = perform_... | from . import config
from .document import Document
import requests
from time import time
def perform_search(**params):
response = requests.get(
config.GOVUK_SEARCH_API,
params=params,
auth=config.AUTH,
)
return response.json()
def fetch_documents(scope):
documents = perform_... | Python | 0.000001 |
10d0b7c452c8d9d5893cfe612e0beaa738f61628 | Add to template builtins only if add_to_buitlins is available (Django <= 1.8) | easy_pjax/__init__.py | easy_pjax/__init__.py | #-*- coding: utf-8 -*-
"""
Register filter so it is available for use in the `extends` template tag
(The `extends` tag must come first in a template, so regular `load` is not
an option).
"""
from __future__ import absolute_import, division, print_function, unicode_literals
__version__ = "1.2.0"
has_add_to_builtins ... | #-*- coding: utf-8 -*-
"""
Register filter so it is available for use in the `extends` template tag
(The `extends` tag must come first in a template, so regular `load` is not
an option).
"""
from __future__ import absolute_import, division, print_function, unicode_literals
__version__ = "1.2.0"
try:
from djang... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.