content string |
|---|
import logging
import os
import yaml
from fabric.api import lcd, task, local
from shutil import rmtree
USE_RSYNC_PROJECT = True
if USE_RSYNC_PROJECT:
from fabric.api import env
from fabric.contrib.project import rsync_project
from functools import partial
logging.basicConfig(level=logging.DEBUG)
log =... |
#!/usr/bin/env python
"""This module provides tools for making parallel dirsig runs.
Public Repository:
https://github.com/pavdpr/DIRSIG/
USAGE:
python parallel.py [options] or
parallel.py [options] If execute permissions on parallel.py and it is
in the ... |
"""
Views for Job Board app
"""
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic.detail import DetailView
from django.views.gen... |
"""
*
* Scratch_n_sketch scripting
* Text screen saver
*
"""
from libs.board import *
#init
board = scratch_n_sketch()
#connect board
board.connect()
#initialize colors
board.backGroundColor(0, 0, 0)
board.penColor(255, 0, 255)
board.textBackColor(0, 0, 0)
#rotate display by 180
board.rotateDisplay(board.rotate_0)
boar... |
from __future__ import absolute_import
from nesteddict import leaf_values, NestedDict
import pytest
class TestLeafValues:
def test_shallow(self):
d = {'a': 1, 'b': 'hello', 'c': (3, 2, 1), (1, 2, 3): 9}
assert(set(leaf_values(d)) == set([1, 'hello', (3, 2, 1), 9]))
d = NestedDict({'a': 1,... |
# python
# This file is generated by a program (mib2py).
import IF_MIB
OIDMAP = {
'1.3.6.1.2.1.2': IF_MIB.interfaces,
'1.3.6.1.2.1.31': IF_MIB.ifMIB,
'1.3.6.1.2.1.31.1': IF_MIB.ifMIBObjects,
'1.3.6.1.2.1.31.2': IF_MIB.ifConformance,
'1.3.6.1.2.1.31.2.1': IF_MIB.ifGroups,
'1.3.6.1.2.1.31.2.2': IF_MIB.ifCompliances,
'... |
"""Tests for tensorflow.python.framework.errors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import re
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import error_interpolation
from ... |
from app.users.forms import \
RegisterForm, \
LoginForm
from app.users.models import User
from app.users.decorators import \
requires_login, \
logout_user
from werkzeug import \
check_password_hash, \
generate_password_hash
from flask import \
Blueprint, \
request, \
render_template, \
flash, \
se... |
"""Fallback source provider when no other provider matches the content root."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ... import types as t
from ...constants import (
TIMEOUT_PATH,
)
from ...util import (
to_bytes,
)
from . import (
Sourc... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Clone of the UNIX program ``passwd'', for django.contrib.auth."
requires_model_validation = False
def handle(self, *args, **options):
i... |
"""
homeassistant.components.media_player.squeezebox
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides an interface to the Logitech SqueezeBox API
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.squeezebox/
"""
import logging
import t... |
"""Create / interact with Google Cloud Translate connections."""
from gcloud import connection as base_connection
class Connection(base_connection.JSONConnection):
"""A connection to Google Cloud Translate via the JSON REST API."""
API_BASE_URL = 'https://www.googleapis.com'
"""The base of the API call ... |
AVAILABLE_SECURITY_METRICS = (
# Current valuation
"market_cap",
"enterprise_value",
"pe_ratio",
"pe_10",
"peg_ratio",
"earning_yield",
"ps_ratio",
"price_to_book_value",
"ev_revenues",
"ev_ebitda",
"ev_ebit",
"operating_pe_ratio",
"operating_earning_yield",
#... |
"""BibClassify text extractor.
This module provides method to extract the fulltext from local or remote
documents. Currently 2 formats of documents are supported: PDF and text
documents.
2 methods provide the functionality of the module: text_lines_from_local_file
and text_lines_from_url.
This module also provides t... |
from os.path import abspath, dirname, basename
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.contrib import admin
import rpc.urls
import polls.urls
from django.conf import settings
import img.views as img_views
import pages.views as pages_views
import django.contrib... |
import socket
import Axon
from Axon.Ipc import WaitComplete
from Kamaelia.Chassis.ConnectedServer import ServerCore
class RequestResponseComponent(Axon.Component.component):
def waitMsg(self):
while not self.dataReady("inbox"):
self.pause()
yield 1
def getMsg(self):
retu... |
from django.utils.translation import ugettext_lazy as _
import horizon
class SystemPanels(horizon.PanelGroup):
slug = "syspanel"
name = _("System Panel")
panels = ('overview', 'instances', 'volumes', 'services', 'flavors',
'images', 'projects', 'users', 'quotas', 'networks',)
class Syspan... |
import warnings
import chainer.cuda
from chainermn.communicators import _communication_utility
from chainermn.communicators import _memory_utility
from chainermn.communicators import mpi_communicator_base
from chainermn import nccl
import numpy as np
class PureNcclCommunicator(mpi_communicator_base.MpiCommunicator... |
# Requires nltk, nltk data
from vol import Vol
from net import Net
from trainers import Trainer
from nltk import RegexpTokenizer
from nltk.util import ngrams
from nltk.corpus import gutenberg as corpus #can use others like inaugural
from random import shuffle, sample
from sys import exit
training_data = None
testi... |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.base import Provider
from couchpotato.environment import Env
import time
log = CPLog(__name__)
class Automation(Provider):
enabled_option = 'automation_enabled'
interval = 86400
... |
input = """
2 18 3 0 3 19 20 21
1 22 1 0 18
1 1 1 0 22
2 23 3 0 3 19 24 25
1 26 1 0 23
1 1 2 1 21 26
2 27 5 0 3 20 21 25 28 24
2 29 5 0 4 20 21 25 28 24
1 30 2 1 29 27
1 1 2 1 19 30
2 31 3 0 3 19 28 25
1 32 1 0 31
1 1 2 1 20 32
2 33 3 0 3 24 34 21
1 35 1 0 33
1 1 1 0 35
2 36 5 0 3 25 34 21 37 19
2 38 5 0 4 25 34 21 37 ... |
import unittest
from SemanticFilesystemAssetstoreAdapter import StreamFile
def stream():
yield 'hello '
yield 'goodbye '
yield 'adios\n'
yield 'buenos dias'
yield ' what\'s up?\n'
yield 'yay!!!'
line_list = [
'hello goodbye adios\n',
'buenos dias what\'s up?\n',
'yay!!!'
]
class... |
# -*- coding: utf-8 -*-
# opts.py
"""blank.py
Generic template for importing modules needed to write Damon scripts.
Copyright (c) 2009 - 2011, [Developer Name] for [Company Name].
Purpose:
Damon Version:
Python Version:
Numpy Version:
License
-------
Licensed under the Apache License, Version 2.0 (the "License");
... |
"""Module defining TuxEatPi Messages"""
import json
import logging
import os
import time
from wampy.peers.clients import Client
import wampy
from tuxeatpi_common.error import TuxEatPiError
from tuxeatpi_common.message import Message
class WampClient(Client):
"""Wamp client class"""
def __init__(self, comp... |
import wx
import os
class acDialog(wx.Dialog):
def SaveImg(self, event):
a = os.getcwd()+'\Records\Ancestor Charts/GO_'+self.title[3:]+'.png'
self.ac.SaveFile(a, wx.BITMAP_TYPE_PNG)
def ShowImage(self,img):
ac = wx.Image(img, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.ac = ... |
import unittest
from datetime import datetime
from unittest import mock
from airflow.exceptions import AirflowException
from airflow.models import DAG
from airflow.providers.databricks.hooks.databricks import RunState
from airflow.providers.databricks.operators import databricks as databricks_operator
from airflow.pro... |
import time
import plumbum
from acceptance.common import base
from acceptance.common import docker
from acceptance.common import scion
class Test(base.TestBase):
"""
Tests that IP pinging between Gateways works.
"""
gateway_acceptance = plumbum.cli.SwitchAttr("gateway_acceptance", str,
... |
import json
import logging
import re
import sys
from unittest.mock import MagicMock
import pytest
from aiohttp_devtools.logs import AccessFormatter, DefaultFormatter
from aiohttp_devtools.runserver.log_handlers import AccessLogger, AuxAccessLogger, parse_body
def test_aiohttp_std():
info = MagicMock()
logge... |
def my_function(x):
"""This isn't real code, just snippets..."""
# An infinite loop is structurally still a branch: it can next execute the
# first line of the loop, or the first line after the loop. But
# "while True" will never jump to the line after the loop, so the line
# is shown as a partial... |
import contextlib
import os
import re
import shutil
import StringIO
import sys
import tempfile
import unittest
import task_manager
_GOLDEN_GRAPHVIZ = """digraph graphname {
n0 [label="0: b", color=black, shape=ellipse];
n1 [label="1: c", color=black, shape=ellipse];
n0 -> n1;
n2 [label="a", color=blue, shape... |
from .rman_translator import RmanTranslator
from ..rman_sg_nodes.rman_sg_procedural import RmanSgProcedural
class RmanProceduralTranslator(RmanTranslator):
def __init__(self, rman_scene):
super().__init__(rman_scene)
self.bl_type = 'DYNAMIC_LOAD_DSO'
def export(self, ob, db_name):
s... |
import aqt
from anki.collection import SearchNode
from anki.consts import *
from aqt.qt import *
from aqt.utils import TR, disable_help_button, showInfo, showWarning, tr
RADIO_NEW = 1
RADIO_REV = 2
RADIO_FORGOT = 3
RADIO_AHEAD = 4
RADIO_PREVIEW = 5
RADIO_CRAM = 6
TYPE_NEW = 0
TYPE_DUE = 1
TYPE_REVIEW = 2
TYPE_ALL = 3... |
from datetime import datetime, timedelta
import numpy as np
import pytest
from pandas._libs.tslibs.ccalendar import MONTHS
import pandas as pd
from pandas import (
DatetimeIndex, Period, PeriodIndex, Series, Timedelta, Timestamp,
date_range, period_range, to_datetime)
import pandas.core.indexes.period as per... |
"""Policy generator based on allowed API calls.
This module will take a set of API calls for services
and make a best effort attempt to generate an IAM policy
for you.
"""
import os
import json
import uuid
from typing import Any, List, Dict, Set # noqa
import botocore.session
from chalice.constants import CLOUDWAT... |
#import http.client
import httplib
from time import sleep, localtime, strftime
import sys
ARDUINO_NOT_READY = -9999
ip_addr = '192.168.xxx.xxx'
port = 80
timeout = 5
retry = 5
def main():
while 1:
temp = getArduinoTemp(ip_addr, port, timeout, retry)
if (temp != None):
print (strftime("[%H:%M:%S]: ", localti... |
import sys, types
from cStringIO import StringIO
import marshal, new, cPickle
import itertools
from pickle import Pickler, whichmodule
import logging
logger = logging.getLogger(__name__)
class MyPickler(Pickler):
dispatch = Pickler.dispatch.copy()
@classmethod
def register(cls, type, reduce):
def ... |
from __future__ import absolute_import
import logging
import threading
from .aspects import *
def getLogger(prefix, protocol=None, host=None, port=None):
if protocol:
peer = protocol.transport.getPeer()
host, port = peer.host.replace('.', '-'), peer.port
return logging.getLogger('{0}.{1}:{2}'.format... |
# The purpose of this file is to get some information from the
# local cloud and place it in a database for use by cloudscheduler
#
# Target data sets:
# Flavor information
# Quota Information
# Image Information
# Network Information
#
# This file also polls the openstack clouds for live VM inf... |
from django.core.management.base import BaseCommand, CommandError
from dateo.models import Dateo
from account.models import User
from campaign.models import Campaign
from tag.models import Tag
from follow.models import Follow
from vote.models import Vote
from comment.models import Comment
class Command(BaseCommand):
... |
import spectral as sp
import os
import numpy as np
import Classifier_SAM as SAM
from glob import glob
testOxi = 1
normalize_button = 0
# do nothing to testing data SP array.
def dataProcess_alg_pass(SP):
return SP
# judge if this pixel is background, bg is absolutely black
def exclude_BG(pixel_array):
if su... |
#!/usr/bin/env python
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2017, 2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR COND... |
"""Tests for the user views."""
from flask_login import current_app
from flask_login import current_user
from timesketch.lib.definitions import HTTP_STATUS_CODE_REDIRECT
from timesketch.lib.testlib import BaseTest
class UserViewTest(BaseTest):
"""Test the user view."""
def test_login_view_unauthenticated(se... |
import json
from .test_base import Base, BaseTestCase
from .test_fixtures import Account
from .resource import CollectionResource, SingleResource
class AccountCollectionResource(CollectionResource):
model = Account
default_sort = ['id']
class AccountResource(SingleResource):
model = Account
class GetO... |
''' A disposable vm implementation '''
import asyncio
import qubes.vm.qubesvm
import qubes.vm.appvm
import qubes.config
def _setter_template(self, prop, value):
if not getattr(value, 'template_for_dispvms', False):
raise qubes.exc.QubesPropertyValueError(self, prop, value,
'template for DispV... |
"""
The ``data`` module contains functions to handle the needed data.
SPDX-FileCopyrightText: 2019 oemof developer group <<EMAIL>>
SPDX-License-Identifier: MIT
"""
import logging
import os
import warnings
from shutil import copyfile
import pandas as pd
import requests
from windpowerlib.tools import WindpowerlibUserW... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from ....pipeline import engine as pe
from ....interfaces import mne as mne
from ....interfaces import freesurfer as fs
from ....interfaces import utility as niu
def create_bem_fl... |
import re
from wa import Parameter, ApkWorkload, PackageHandler, TestPackageHandler
class Uibenchjanktests(ApkWorkload):
name = 'uibenchjanktests'
description = """
Runs a particular test of the UIBench JankTests_ test suite. The suite
is provided by Google as an automated version of the UIB... |
# $HeadURL: $
''' ResourceStatusClient
Client to interact with the ResourceStatusDB.
'''
from DIRAC import gLogger, S_OK, S_ERROR
from DIRAC.Core.DISET.RPCClient import RPCClient
# from DIRAC.ResourceStatusSystem.DB.ResourceStatusDB im... |
from django.core.management.base import BaseCommand
from weblate.trans.models import Check, get_related_units
class Command(BaseCommand):
help = 'lists top ignored checks'
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument(
'--count',
... |
import sys
import gdb
import os
import os.path
pythondir = '/toolchain-env-1.x/aarch64_gcc494_glibc220.out/usr/local/aarch64-unknown-linux-gnueabi/share/gcc-4.9.4/python'
libdir = '/toolchain-env-1.x/aarch64_gcc494_glibc220.out/usr/local/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/lib/../lib64'
# This... |
from __future__ import unicode_literals
import six
from django import forms
from django.contrib import messages
from django.db.transaction import atomic
from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME
from django.utils.translation import ugettext_lazy as _
from shoop.admin.forms.widgets import Prod... |
#!/usr/bin/python2.7
#-*- encoding: utf-8 -*-
__author__ = "Tomáš Beluský"
__date__ = "31.03. 2013"
from src.variations.Variation import Variation
from StructuralCluster import StructuralCluster
class OppositeCluster(StructuralCluster):
"""
Represents cluster with variations where only one variation is true
""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Blockstore
~~~~~
copyright: (c) 2014 by Halfmoon Labs, Inc.
copyright: (c) 2015 by Blockstack.org
This file is part of Blockstore
Blockstore is free software: you can redistribute it and/or modify
it under the terms of the GNU Gener... |
echo off
clear all
delete( get(0, 'Children') );
puma560
while 1,
selection = menu('Robot Toolbox demonstrations', ...
'Transformations', ...
'Trajectory', ...
'Forward kinematics', ...
'Animation', ...
'Inverse kinematics', ...
'Jacobians', ...
'Inverse dynamics', ...
'Forward dynamics', ...
'Exit'... |
from venster.windows import *
from venster.gdi import *
WND_CLASS_NAME = "TestWindowClass"
hInstance = GetModuleHandle(0)
def wndProc(hWnd, nMsg, wParam, lParam):
if nMsg == WM_DESTROY:
PostQuitMessage(0)
return 0
else:
return DefWindowProc(hWnd, nMsg, wParam, lParam)
cls = WNDCLA... |
#!/usr/bin/env python
import tf
import rospy
import actionlib
import moveit_msgs.msg
from geometry_msgs.msg import PoseStamped
from moveit_commander import RobotCommander, roscpp_initialize
from moveit_commander import PlanningSceneInterface
from phantomx_pincher import Phantomx_Pincher
class Pick(object):
_feedb... |
# -*- coding: utf-8 -*-
'''
The service module for Mac OS X
.. versionadded:: 2016.3.0
'''
from __future__ import absolute_import
# Import python libs
import os
import re
import plistlib
from distutils.version import LooseVersion
# Import salt libs
import salt.utils
import salt.utils.decorators as decorators
from sal... |
# on-c-e configuration file - modified by the program - do not change
import os
oncepath = os.path.abspath(__file__)
oncedir = os.path.dirname(oncepath)
opath = oncedir # once path
# command line
sysargv = ''
# paths
ppath = '' # project root
mpath = '' # model folder
tpath = '' # table folder... |
from setuptools import setup, find_packages
import sys, os
version = '0.1'
install_requires = [
# -*- Extra requirements: -*-
]
setup(name='tweeples',
version=version,
description="A Twitter mining application for people-networks",
long_description=open("./README.md", "r").read(),
# G... |
import time
import systemtesting
import os
from mantid.api import *
from mantid.simpleapi import *
from mantid import config
class ReduceOneSCD_Run(systemtesting.MantidSystemTest):
__reduced_ws_name = ""
saved = False
output_directory = ""
run_conventional_matrix_file = ""
qconvention = config[... |
#!/usr/env python
class arcEager(object):
def __init__(self, grammar, sequence):
self.stack = list()
self.template = grammar
self.sequence = sequence
self.queue = range(len(sequence))# + [len(sequence)] #NOTE with dummy ROOT
def isFinalState(self):
"""
Checks if the parser is in final configuration i.... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.utils import timezone
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ExternalIFrameTab'
db.create_table('apps_externaliframetab... |
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
import math
import sys
import time
ITERATIONS = 10
MICROSECONDS_PER_SECOND = 1000000.
PRESKIP = 0
USAGE = 'Usage: TestSleepAccuracy [iterations] [waitTimeInFloatingPointSeconds]'
WAIT_TIME = 0.005
# Copied from http://... |
from __future__ import unicode_literals
from .common import InfoExtractor
class RadioDeIE(InfoExtractor):
IE_NAME = 'radio.de'
_VALID_URL = r'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
_TEST = {
'url': 'http://ndr2.radio.de/',
'info_dict': {
'id': 'ndr2',
'ext': 'mp3',
'title'... |
from bluetooth import *
import bluemote
import cPickle
import os
import sys
import time
class Bluemote_Client(bluemote.Services):
def __init__(self):
bluemote.Services.__init__(self)
self.addr = None
def find_bluemote_pods(self, pod_name = None):
if pod_name is None:
pod_name = self.service["name"]
pr... |
__author__ = 'idclark'
import requests
def user_login(user_name, password, bot_desc):
""" user_name: a valid reddit username
password: the password to the user name
bot_desc: the name of the bot to be used in the header dict
returns a Requests.session() client that can passed into other functions that... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MyUser'
db.create_table('core_myuser', (
('id... |
from Anomos import BTFailure
def decode_int(x, f):
f += 1
newf = x.index('e', f)
n = int(x[f:newf])
if x[f] == '-':
if x[f + 1] == '0':
raise ValueError
elif x[f] == '0' and newf != f+1:
raise ValueError
return (n, newf+1)
def decode_string(x, f):
colon = x.inde... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import os
import subprocess
import sys
import time
try:
import argparse
except ImportError:
print("Cannot import argparse.")
exit(1)
# Import th... |
source("../../shared/qtcreator.py")
def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
# using a temporary directory won't mess up a potentially existing
createNewQtQuickApplication(tempDir(), "untitled")
originalText = prepareQmlFile()
i... |
import fidget
import cairoEng
if __name__ == "__main__":
cairoEng.run(fidget.Fidget(), "fidget-sprites.png", fidget.getFrameRect, (171, 151), (-28, -2)) |
import urllib2
import simplejson
import socket
from logging import Handler
class LogglyHandler(Handler):
"""
Handler that logs to loggly.
"""
base_url = None
def __init__(self, base_url=None):
if(base_url is None):
self.base_url = 'https://logs-01.loggly.com/inputs/b121e4df-f910... |
"""Gumbel or Log-Weibull distribution."""
import numpy
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class log_weibull(SimpleDistribution):
"""Gumbel or Log-Weibull distribution."""
def __init__(self):
super(log_weibull, self).__init__()
def _pdf(self, x):
ex = nump... |
# -*- coding: utf-8 -*-
import os
import optparse
DIRNAMES = (
'fixtures',
'management',
'templates',
'templatetags',
)
FILENAMES = {
'__init__.py' : u'''''',
'admin.py' : u'''# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import ModelExample
class ModelExampleAd... |
#this import statement allows access to the karamba functions
import karamba
bars = [0,0,0,0,0,0,0,0]
b = 0
#this is called when you widget is initialized
def initWidget(widget):
bars[0] = karamba.getThemeBar(widget, "bar0")
bars[1] = karamba.getThemeBar(widget, "bar1")
bars[2] = karamba.getThemeBar(widge... |
from weboob.tools.backend import Module
from weboob.capabilities.base import find_object
from weboob.capabilities.gauge import CapGauge, GaugeSensor, SensorNotFound, Gauge
from .browser import RATPBrowser
__all__ = ['RATPModule']
class RATPSensor(GaugeSensor):
def __init__(self, gauge):
super(RATPSenso... |
import sys
from PyQt5.QtCore import (PYQT_VERSION_STR, QDir, QFile, QFileInfo, QIODevice,
QTextStream)
from .pylupdate import *
def printUsage():
sys.stderr.write(
"Usage:\n"
" pylupdate5 [options] project-file\n"
" pylupdate5 [options] source-files -ts ts-files\n"
"\n"
"Options:\n"
" -help Di... |
import urllib
import sys
from bs4 import BeautifulSoup
import math
watch = 'watch'
redirector = 'redirector.googlevideo.com'
youtubeURL = 'https://www.youtube.com'
keepvidURL = 'http://keepvid.com/?url='
print 'Enter the name of the video you want to download!'
command = raw_input()
url = 'https://www.youtube.com/res... |
import math
import pyglet
import pymunk
import pymunk.pyglet_util
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 800
BOX_SIZE = 45
class Main(pyglet.window.Window):
def __init__(self, width, height):
pyglet.window.Window.__init__(self, vsync=False)
self.draw_options = pymunk.pyglet_util.DrawOptions()
... |
__author__ = 'palmer'
import unittest
import numpy as np
import sys
sys.path.append('/Users/palmer/Documents/python_codebase')
from pyMS.mass_spectrum import mass_spectrum
class mass_spectrum_TestIO(unittest.TestCase):
def test_add_spectrum(self):
mzs_counts_list = [ [[0,1,2],[2,2,2]],
... |
import re
import urllib
import requests
import traceback
from bs4 import BeautifulSoup
from sickbeard import logger
from sickbeard import tvcache
from sickbeard.providers import generic
class HDSpaceProvider(generic.TorrentProvider):
def __init__(self):
generic.TorrentProvider.__init__(self, "HDSpace")
... |
from struct import pack, unpack
class BinaryReader:
def __init__(self, file):
self.file = file
def close(self):
self.file.close()
def read_byte(self, count=1, force_list=False):
size = 1 * count
data = self.file.read(size)
if len(data) < size:
raise EOF... |
# These are fixture functions for returning PuppetDB data
def v2():
return {
'/nodes': [
{
'name': 'host1',
'deactivated': None,
'catalog_timestamp': '2013-02-09T21:05:15.663Z',
'facts_timestamp': '2013-02-09T21:05:15.663Z',
... |
''' Guess the number
Adapting version 4 to use easygui_qt instead of terminal to interact
with user.
'''
import random
import os
import easygui_qt as easy
# The lazy way: redefining print which is not possible with Python 2!
print = easy.show_message
max_nb = 100
prompt = "Guess a number, between 1 and {}, or ente... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations, connection
from django.conf import settings
# Translate the UserProfile fields back to the old Guardian model
def unmigrate_guardian_data(apps, schema_editor):
Permission = apps.get_model('auth', 'Permission'... |
from http import cookies
import sqlite3
import cgi
import json
def setup_cursor():
conn = sqlite3.connect('/home/mathclub/public_html/wsgi-scripts/teams.db')
cursor = conn.cursor()
cursor.execute('PRAGMA synchronous=OFF')
cursor.execute('PRAGMA temp_store=memory')
return (conn, cursor)
def usernam... |
from __future__ import nested_scopes
import traceback
import os
import warnings
import pydevd_file_utils
try:
from urllib import quote
except:
from urllib.parse import quote # @UnresolvedImport
import inspect
from _pydevd_bundle.pydevd_constants import IS_PY3K, get_global_debugger
import sys
from _pydev_bund... |
from lib.cuckoo.common.abstracts import Signature
class SandboxJoeAnubisDetectFiles(Signature):
name = "antisandbox_joe_anubis_files"
description = "Detects Joe or Anubis Sandboxes through the presence of a file"
severity = 3
categories = ["anti-sandbox"]
authors = ["Kevin Ross"]
minimum = "0.5... |
import traceback
import jderobot
import threading
import Ice
from .threadSensor import ThreadSensor
from jderobotTypes import CMDVel
class MotorsIceClient:
'''
Motors Contructor.
Exits When it receives a Exception diferent to Ice.ConnectionRefusedException
@param jdrc: Comm Communicator... |
import rospy
import actionlib
from actionlib_msgs.msg import GoalStatus
import tf
from tf.transformations import quaternion_from_euler
from numpy import *
from std_msgs.msg import *
from geometry_msgs.msg import *
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from nav_msgs.srv import GetPlan
from cur... |
"""
Unit tests for robot (dependency resolution).
@author: Toon Willems (Ghent University)
"""
import os
import re
import shutil
import tempfile
from copy import deepcopy
from test.framework.utilities import EnhancedTestCase, init_config
from unittest import TestLoader
from unittest import main as unittestmain
impor... |
import os
import pytest
from django.conf import settings
from django.urls import reverse
from adhocracy4.comments import models as comments_models
from adhocracy4.ratings import models as rating_models
from meinberlin.apps.ideas import models as idea_models
from meinberlin.test.helpers import createThumbnail
@pytes... |
import threading
import eventlet
from eventlet import greenpool
from osn.openstack.common import log as logging
from osn.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
def _thread_done(gt, *args, **kwargs):
"""Callback function to be passed to GreenThread.link() when we spawn()
Call... |
# only python3.4 or later
from datetime import datetime
import warnings
from kii import exceptions as exc, results as rs
from kii.acl import AclManagement
from kii.data import DataManagement
from kii.enums import Site
from kii.groups import GroupManagement
from kii.users import RequestANewToken, UserManagement
warni... |
'''
test_dns_utils- Tests misc. DNS support routines.
.. Copyright (c) 2015 Neustar, Inc. All rights reserved.
.. See COPYRIGHT.txt for full notice. See LICENSE.txt for terms and conditions.
'''
# pylint: skip-file
import dns.name
import dns_sprockets_lib.dns_utils as dns_utils
def test_is_delegated():
test... |
#!/usr/bin/env python
"""
mtpy/processing/filter.py
Functions for the frequency filtering of raw time series.
@UofA, 2013
(LK)
Revised 2017
JP
"""
#=================================================================
import numpy as np
import os
import scipy.signal as signal
#====================================... |
# Syntax: weather_csv_to_json.py (csv file) > (json file)
# This will work with the NYC and Boston data. It won't work with the DC data.
import calendar
import csv
import dateutil.parser
import json
import sys
import time
Properties = {
'cloudcover': {},
'est': {'name': 'date',... |
"""
Collectd network protocol implementation.
"""
import socket
import struct
import select
import sys
from datetime import datetime
from copy import deepcopy
if sys.version_info.major == 2:
# Python 2.7 io.StringIO does not like unicode
from StringIO import StringIO
else:
try:
from io import Stri... |
"""Schedule for composition of injective operator"""
import tvm
from tvm import te
from .. import utils
def schedule_injective_from_existing(sch, out):
"""Schedule for injective op from existing schedule.
Parameters
----------
sch: Schedule
The schedule to update.
out: Tensor
Th... |
#!/usr/bin/env python
"""
Script which takes one or more file paths and reports on their detected
encodings
Example::
% chardetect somefile someotherfile
somefile: windows-1252 with confidence 0.5
someotherfile: ascii with confidence 1.0
If no paths are provided, it takes its input from stdin.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.