text stringlengths 17 737k |
|---|
import collectd
import socket
import time
import traceback
# import threading
import utils as tendrl_glusterfs_utils
try:
import xml.etree.cElementTree as ElementTree
except ImportError:
import xml.etree.ElementTree as ElementTree
ret_val = {}
def _parse_heal_info_stats(tree):
bricks_dict = {}
for... |
##
# Copyright (c) 2011 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import argparse
import os
import importlib
import inspect
from metamagic.utils import shell
class RunCommand(shell.Command, name='run', expose=True):
def __init__(self, *args, **kwargs):
super().__init__(*args, ... |
# TODO connection caching
from kombu import BrokerConnection, Exchange, Queue
import socket
import settings
import datetime
from chroma_core.lib.storage_plugin.log import storage_plugin_log as log
def _drain_all(connection, queue, handler, timeout = 0.1):
"""Helper for draining all messages on a particular queu... |
from flask import url_for
from flask_login import current_user
from funcy import project
from mock import patch
from tests import BaseTestCase, authenticated_user
from redash import models, settings
class AuthenticationTestMixin(object):
def test_returns_404_when_not_unauthenticated(self):
for path in se... |
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# @author: wilbur.ma@foxmail.com
# @date: 2013-08-23
# @license: BSD 3-Clause License
# @brief: parse h1~h6 headings and generate
# toc of a markdwon file
from HTMLParser import HTMLParser
from pelican import signals, readers, contents
import os, sys, re, md5, ma... |
import single_robot_behavior
import behavior
import robocup
import math
import main
import skills
import enum
import constants
import role_assignment
import evaluation.defensive_positioning
import evaluation.opponent as eval_opp
## Defender that hovers in the middle of the angle between
# the line segment between the... |
#!/usr/bin/env python
"""
Extract train set.
"""
import multiprocessing as mp
import cv2
import numpy as np
import os
import random
import argparse
import functools
def mine_image(detector, size, path):
"""
Run negative mining on image, and extract false positives.
:param path: Path to image file
:par... |
# -*- coding: utf-8 -*-
#
# IceCream - A little library for sweet and creamy print debugging.
#
# Ansgar Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: MIT
#
import sys
import unittest
try: # Python 2.x.
from StringIO import StringIO
except ImportError: # Python 3.x.
from io import StringIO
from ... |
from copy import deepcopy
from itertools import product
class Region(object):
def __init__(self, **kwargs):
kwargs.setdefault("n_lep", -1)
kwargs.setdefault("n_electron", -1)
kwargs.setdefault("n_muon", -1)
self.name = kwargs["name"]
self.n_lep = kwargs["n_lep"]
sel... |
# -*- coding: utf-8; fill-column: 78 -*-
import collections
import itertools
import operator
from flatland.signals import validator_validated
from flatland.util import (
Unspecified,
assignable_class_property,
assignable_property,
class_cloner,
named_int_factory,
symbol,
)
__all__ = 'Eleme... |
# Copyright 2013, SIL International
# All rights reserved.
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of License, or
# (at your option) any lat... |
"""
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 this ... |
from django.test import TestCase
import django.db.models
from django.contrib.auth.models import User, Group
from django.test.client import Client
from metashare.settings import DJANGO_BASE, ROOT_PATH
from metashare.repository import models
from django.contrib import admin
from django.contrib.auth import REDIRECT_FIELD_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
u"""
Copyright (c) 2016 Masaru Morita
This software is released under the MIT License.
See LICENSE file included in this repository.
"""
import sys
import random
sys.path.append('../util')
from ActivationFunction import Softmax
from GaussianDistribution import GaussianDistri... |
#!/bin/python
import Monstr.Core.Utils as Utils
import Monstr.Core.DB as DB
import Monstr.Core.BaseModule as BaseModule
from datetime import timedelta
import json
import pytz
from Monstr.Core.DB import Column, Integer, String, DateTime, UniqueConstraint
from sqlalchemy.sql import func
class CMSJobStatus(BaseModule.... |
#!/bin/python
import Monstr.Core.Utils as Utils
import Monstr.Core.DB as DB
import Monstr.Core.BaseModule as BaseModule
from datetime import timedelta
import json
import pytz
from Monstr.Core.DB import Column, Integer, String, DateTime, UniqueConstraint
from sqlalchemy.sql import func
class CMSJobStatus(BaseModule.... |
import sys
import pytest
from minifier import Minimizer, human_repr
def test_human_repr():
assert human_repr(0) == "0.0B"
assert human_repr(1) == "1.0B"
assert human_repr(100.1) == "100.1B"
assert human_repr(1024) == "1.0KB"
assert human_repr(1024 * 100.1) == "100.1KB"
assert human_repr(1024 ... |
import hashlib
import math
from os import path
from base64 import b64encode, b64decode
from binascii import hexlify, unhexlify
from Crypto.Cipher import DES, AES
from Crypto.PublicKey import RSA as _RSA
from Crypto import Random
_random_instance = Random.new()
def md5(message):
"""
Returns the hexadecimal rep... |
# -*- coding: utf-8 -*-
import os
import pandas as pd
import pytest
from pandas.util.testing import assert_series_equal
import pyhector
from pyhector import (
Hector, rcp26, rcp45, rcp60, rcp85,
read_hector_input,
read_hector_output,
read_hector_constraint
)
path = os.path.dirname(__file__)
rcps =... |
# encoding: utf-8
from __future__ import unicode_literals
import unittest
from resources import URI
from resources import IRI
from wkz_datastructures import MultiDict
class TestIRISnowman(unittest.TestCase):
def setUp(self):
self.iri = IRI("http://u:p@www.\N{SNOWMAN}:80/path")
def test_repr(self):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
u"""
Process screening data obtained at Diamond Light Source Beamline I19.
This program presents the user with recommendations for adjustments to beam
flux, based on a single-sweep screening data collection. It presents an
upper- and lower-bound estimate of suitable flux... |
"""
For simplicity and to avoid requiring a paid-for account on some cloud
storage system testing is conducted against two local storage backends. Since
the QueuedStorage backend is truly agnostic about the local and remote
storage systems, this should work as transparently as using one (or even two!)
remote storage sy... |
# coding=utf-8
from __future__ import unicode_literals, absolute_import
import mock
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.middleware import SessionMiddleware
from django.http import QueryDict, HttpResponse
from django.tes... |
# -*- coding: utf-8 -*-
u"""FLASH execution template.
:copyright: Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcompat
from pykern import pkio
from pykern import... |
from .profile import Profile
from .topic import *
from .tag import *
from .comment import *
from .relation import * |
# -*- coding: utf-8 -*-
import datetime
import os
import sys
import unittest
from pythainlp.corpus.common import _THAI_WORDS_FILENAME
from pythainlp.corpus import (
_CORPUS_PATH,
thai_words,
)
from pythainlp.tokenize import DEFAULT_DICT_TRIE, Tokenizer
from pythainlp.tokenize import deepcut as tokenize_deepcu... |
#
# Copyright (C) 2007-2013 by frePPLe bvba
#
# This library 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 library is... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013-2019 Andrea Bonomi <andrea.bonomi@gmail.com>
#
# Published under the terms of the MIT license.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... |
"""
Implements operations with CMS EnvelopedData and SignedData messages
Contains function CMS() which parses CMS message and creates either
EnvelopedData or SignedData objects (EncryptedData and CompressedData
can be easily added, because OpenSSL contain nessesary function)
Each of these objects contains create() st... |
# -*- coding: utf-8 -*-
# django_th classes
from django_th.services.services import ServicesMgr
from django_th.models import UserService, ServicesActivated, TriggerService
# django classes
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.log import getLogger
# pocket API
... |
from subprocess import Popen, PIPE
from time import time
import os
import sys
import six
from .. import logs
from ..conf import settings
from ..utils import DEVNULL, memoize, cache
from .generic import Generic
class Fish(Generic):
def _get_overridden_aliases(self):
overridden = os.environ.get('THEFUCK_OVE... |
import psutil
from functools import reduce
def get_ip_address_string():
"""
Consolidates a list of IP addresses into a string, stripping out any blank
entries as well as the local `127.0.0.1` entry.
"""
try:
return ' '.join(get_ip_addresses())
except:
return ''
def get_ip_add... |
# coding=utf-8
from __future__ import print_function
from __future__ import unicode_literals
import os
import pprint
import sys
if sys.version < '3':
text_type = unicode
binary_type = str
else:
text_type = str
binary_type = bytes
DOCS_ROOT = os.path.abspath(os.path.join('..', 'docs'))
def write(... |
#!/usr/bin/env python3
from cachesimulator.bin_addr import BinaryAddress
from cachesimulator.word_addr import WordAddress
class Cache(dict):
# Initializes the reference cache with a fixed number of sets
def __init__(self, cache=None, num_sets=None, num_index_bits=None):
if cache is not None:
... |
#!/usr/bin/env python
import requests
from argparse import ArgumentParser
import pickle
limit = 50
# getting urls and dumping them into file
def get_urls():
sites = requests.get("http://readthedocs.org/api/v1/project/?limit=%s&offset=0&format=json" % limit)
objects = sites.json()['objects']
... |
# -*- coding: utf-8 -*-
# Copyright 2014 Metaswitch Networks
#
# 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 applicab... |
from __future__ import absolute_import, division, print_function
import pytest
import pandas as pd
import numpy as np
from pandas import DataFrame, Series
from blaze.compute.core import compute
from blaze import dshape, Table
from blaze.expr import TableSymbol, join, by, summary, Distinct
from blaze.expr import (mer... |
from io import BytesIO
import urllib.request
import PIL.Image
from PIL import ImageTk
import socket
import simplejson
from tkinter import *
googleGeocodeUrl = 'http://maps.googleapis.com/maps/api/geocode/json?'
def get_map(lat,lng):
latString = str(lat)
lngString = str(lng)
print(lat)
url = ("https:/... |
__version__ = '0.0.3'
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Sam Hart <hartsn@gmail.com>
try:
import configparser
except ImportError:
import ConfigParser as configparser
import os
import time
import re
import pyttsx
from twython import Twython
config_file = os.path.expanduser("~/.loudbird.conf")
config = confi... |
#!/usr/bin/env python
from __future__ import print_function, division
from job import submit
from error import LSFError
from utility import color
import sys
import os
import argparse
import re
import subprocess
def esub(args, bsubargs, jobscript):
if args.show:
try:
with open(".esubrecord") ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# version.py
#
# Copyright 2014 Neil Williams <codehelp@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the... |
import itertools
import numpy as np
import scipy as sp
from priors import ZEROLOGPRIOR
from cbamf.util import Tile
class HardSphereOverlapNaive(object):
def __init__(self, pos, rad, zscale=1, prior_type='absolute'):
self.N = rad.shape[0]
self.pos = pos
self.rad = rad
self.zscale = n... |
'''Test twisted integration'''
import socket
import pulsar
from pulsar import is_failure, is_async
from pulsar.utils.pep import to_bytes, to_string
from pulsar.utils.security import gen_unique_id
from pulsar.apps.socket import SocketServer
from pulsar.apps.test import unittest, run_on_arbiter, dont_run_with_thread
fr... |
import argparse
import sys
import settings
"""
usage: mfh.py [-h] [-c | --client [PORT]] [-s | --server [PORT]] [-u] [-v]
Serve some sweet honey to the ubiquitous bots!
optional arguments:
-h, --help show this help message and exit
-c launch client with on port defined in settings
--client... |
# coding=utf-8
import re
_RE_FIND_FIRST_CAP = re.compile('(.)([A-Z][a-z]+)')
_RE_SPAN_OF_CAPS = re.compile('([a-z0-9])([A-Z])')
# Lists are in the order of increasing magnitude
_LIST_OF_UNITS_BIT = [['bit', 'b'],
['kilobit', 'kbit', 'Kibit'],
['megabit', 'Mbit', 'Mibit', 'M... |
# coding=utf-8
from __future__ import absolute_import
from osgeo import gdal, osr
import eodatasets.type as ptype
def _get_extent(gt, cols, rows):
""" Return the corner coordinates from a geotransform
:param gt: geotransform (as given by gdal)
:type gt: (float, float, float, float, float, float)
:p... |
import json
import os
from datetime import datetime
from tempfile import NamedTemporaryFile
from time import strftime, strptime
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.core.files.storage import FileSystemStorage
... |
# -*- coding: utf-8 -*-
from thumbnails import helpers
from thumbnails.conf import settings
from thumbnails.images import SourceFile, Thumbnail
__version__ = '0.1.0c4'
def get_thumbnail(original, size, crop=None, options=None):
engine = helpers.get_engine()
cache = helpers.get_cache_backend()
original = ... |
#Copyright ReportLab Europe Ltd. 2000-2006
#see license.txt for license details
# $URI:$
__version__=''' $Id$ '''
import string, os, sys, imp, time
try:
from hashlib import md5
except:
from md5 import md5
from reportlab.lib.logger import warnOnce
from types import *
from rltempfile import get_rl_tempfile, get_... |
"""
Spider Middleware manager
See documentation in docs/topics/spider-middleware.rst
"""
import collections.abc
from itertools import islice
from twisted.python.failure import Failure
from scrapy.exceptions import _InvalidOutput
from scrapy.middleware import MiddlewareManager
from scrapy.utils.asyncgen import _proce... |
"""Leetcode 90. Subsets II
Medium
URL: https://leetcode.com/problems/subsets-ii/
Given a collection of integers that might contain duplicates, nums,
return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: [1,2,2]
Output:
[
[2],
[1],
[1,2,2],
[2... |
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT AN... |
from django.db import models
class AbstractBaseModel(models.Model):
"""
AbstractBaseModel contains common fields between models.
All models should extend this class.
"""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Me... |
# -*- coding: utf-8 -*-
"""
======================================================================
Core package modules (:mod:`sknano.core`)
======================================================================
.. currentmodule:: sknano.core
Contents
========
Abstract mathematical data structures
------------------... |
VERSION = (1, 5, 2)
__version__ = '.'.join(map(str, VERSION))
class LazySettings(object):
def _load_settings(self):
from feincms import default_settings
from django.conf import settings as django_settings
for key in dir(default_settings):
if not (key.startswith('FEINCMS_') or ... |
VERSION = (2, 2, 2)
__version__ = ".".join(map(str, VERSION))
FHADMIN_GROUPS_REMAINING = "REMAINING"
|
"""Inverse problem functions."""
# Authors: Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD (3-clause)
import mne
import glob
import locale
import os.path as op
import numpy as np
from mne.io import read_raw_fif, read_raw_ctf
from mne import read_epochs
from mne.minimum_norm import make_inverse_operat... |
"""
Typeclass for Account objects
Note that this object is primarily intended to
store OOC information, not game info! This
object represents the actual user (not their
character) and has NO actual presence in the
game world (this is handled by the associated
character object, so you should customize that
instead for ... |
# -*- coding: utf-8 -*-
import datetime
import furl
import httplib as http
import markupsafe
from flask import request
import uuid
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from modularodm.exceptions import ValidationError
from modularodm.exceptions import ValidationValueError
from fr... |
from fileupload.models import Picture
from django.views.generic import CreateView, DeleteView
from django.http import HttpResponse
from django.utils import simplejson
from django.core.urlresolvers import reverse
from django.conf import settings
class PictureCreateView(CreateView):
model = Picture
def form_v... |
# Amara, universalsubtitles.org
#
# Copyright (C) 2012 Participatory Culture Foundation
#
# 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 op... |
# Copyright (c) 2011, Robert Escriva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condition... |
"""Kraken Maya - Maya Builder module.
Classes:
Builder -- Component representation.
"""
import json
import logging
import math
import random
from kraken.log import getLogger
from kraken.core.kraken_system import ks
from kraken.core.configs.config import Config
from kraken.core.maths import *
from kraken.core.bui... |
import os
import re
import subprocess
import argparse
import logging
import tempfile
import shutil
from utils import deploy_logging
from utils import parse_ini
from looker_sdk import client, models
logger = deploy_logging.get_logger(__name__)
def get_client(ini, env):
sdk = client.setup(config_file=ini, section... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from jd.views import base, rating_calculation
urlpatterns = patterns('',
# Examples:
url(r'^$', 'common.views.home', name='home'),
url(r'^about/', common.views.about, name='about'),
url(r'^jd/', base),
url(r'^rati... |
"""
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... |
"""
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... |
# -*- coding: utf-8 -*-
from unittest import TestCase, mock
from pysigep.client import Client
from pysigep.utils import URLS, HOMOLOGACAO, PRODUCAO
class TestClient(TestCase):
def setUp(self):
super(TestClient, self).setUp()
self.cliente = Client(ambiente=HOMOLOGACAO,
... |
import os
import pytest
import hunter
@pytest.fixture
def cleanup():
hunter._default_trace_args = None
hunter._default_config.clear()
yield
hunter._default_trace_args = None
hunter._default_config.clear()
@pytest.mark.parametrize('config', [
('foobar', (('x',), {'y': 1}), {},
'''Faile... |
# -*- Mode: Python; coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Stoqdrivers
## Copyright (C) 2006-2007 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as publishe... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/env python
r"""
Parse biological sequences (:mod:`skbio.parse.sequences`)
=========================================================
.. currentmodule:: skbio.parse.sequences
This module provides functions for parsing sequence files.
Functions
---------
.. autosummary::
:toctree: generated/
parse_f... |
import numpy as np
import warnings
from RULEngine.Util.Position import Position
from config.config_service import ConfigService
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
class FriendKalmanFilter:
def __init__(self):
cfg = ConfigService()
self.default_dt = float(cfg... |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import datetime, timedelta
from django.utils.deprecation import MiddlewareMixin
from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY
from corehq.util.quickcache import quickc... |
"""
Views related to operations on course objects
"""
import copy
import json
import logging
import random
import string # pylint: disable=deprecated-module
import django.utils
import six
from ccx_keys.locator import CCXLocator
from django.conf import settings
from django.contrib.auth.decorators import login_required... |
# -*- coding: utf-8 -*-
'''Unit tests for models and their factories.'''
import mock
import unittest
from nose.tools import * # PEP8 asserts
import pytz
import datetime
import urlparse
from dateutil import parser
from modularodm.exceptions import ValidationError, ValidationValueError, ValidationTypeError
from fra... |
import inspect
import linecache
import os
import sys
from time import sleep
import pytest
from littleutils import SimpleNamespace
from executing import Source, NotOneValueFound
from executing.executing import is_ipython_cell_code, attr_names_match
import executing.executing
sys.path.append(os.path.dirname(os.path.di... |
"""
Unit tests for the hxl.schema module
David Megginson
November 2014
License: Public Domain
"""
import unittest
from hxl.model import HXLColumn, HXLRow
from hxl.schema import HXLSchema, HXLSchemaRule
class TestSchema(unittest.TestCase):
def setUp(self):
self.errors = []
def test_row(self):
... |
try:
from itertools import izip
except ImportError:
izip = zip
from django import forms
from django import template
from django.template import loader, Context
from django.conf import settings
from crispy_forms.utils import TEMPLATE_PACK
register = template.Library()
class_converter = {
"textinput": "te... |
# -*- coding: utf-8 -*-
"""
Jbosscli
"""
import json
import types
import requests
class Jbosscli(object):
"""Represents a Jboss controller, Standalone and domain modes are supported"""
def __init__(self, controller, auth):
self.controller = controller
self.credentials = auth.split(":")
... |
#!/usr/bin/env python
"""
Create and run multiple empty LPUs to time data reception throughput.
"""
import argparse
import itertools
import time
from mpi4py import MPI
import numpy as np
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
from neurokernel.core_gpu import CTRL_TAG, GPOT_TAG, SPIKE_TAG, Ma... |
#!/usr/bin/env python2
def str_to_bool(s):
if s.lower() in ['true', 'yes', '1', 't', 'on']:
return True
elif s.lower() in ['false', 'no', '0', 'f', 'off']:
return False
else:
return None
def int_or_none(x):
if x == None:
return None
else:
return int(x)
def ... |
#!/usr/bin/env python
import os
import sys
import time
import urllib2
timeSoFar = 0
waitTime = 5
# Arg 1 : URL
# Arg 2 : timeout
# Arg 3 : command
url = sys.argv[1]
timeOut = int(sys.argv[2])
command = sys.argv[3:]
print("Attempting to connect to URL: %s and then run command %s" % (url, command))
req = urllib2.Re... |
# -*- coding: utf-8 -*-
#
# Copyright 2013-2022 BigML
#
# 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 ... |
"""
fs.contrib.archivefs
========
A FS object that represents the contents of an archive.
"""
import time
import stat
import datetime
import os.path
from fs.base import *
from fs.path import *
from fs.errors import *
from fs.filelike import StringIO
from fs import mountfs
import libarchive
ENCODING = libarchive.E... |
"""
This module provides a rather simple sequential invoker implementation
"""
from __future__ import division, print_function, with_statement
import uuid
from threading import Lock, Thread
from metaopt.core.call import call
from metaopt.invoker.util.call_handle import CallHandle
from metaopt.util.stoppable import st... |
'''
Created on 05/02/2010
@author: peio
'''
# Copyright 2009 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia
# This file is part of franklin.
# franklin 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 Softwar... |
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
"""
frappe.translate
~~~~~~~~~~~~~~~~
Translation tools for frappe
"""
import functools
import io
import itertools
import json
import operator
import os
import re
from csv import reader
from typing import List, Tuple, ... |
import os
import sys
target_version = "2.0.1"
def build_version():
distance ="0"
try:
from subprocess import Popen, PIPE
prev_tag,distance,revision = Popen(["git", "describe", "--match", "[0-9]*", "--long"],
cwd=os.path.dirname(__file__),
... |
import six
from requests import HTTPError
from requests_oauthlib import OAuth1
from oauthlib.oauth1 import SIGNATURE_TYPE_AUTH_HEADER
from social.p3 import urlencode, unquote
from social.utils import url_add_parameters, parse_qs
from social.exceptions import AuthFailed, AuthCanceled, AuthUnknownError, \
... |
"""
Unit test for param.version.Version
"""
import unittest
from param.version import Version
class TestVersion(unittest.TestCase):
def test_version_init_v1(self):
Version(release=(1,0))
def test_repr_v1(self):
v1 = Version(release=(1,0))
self.assertEqual(repr(v1), '1.0')
def te... |
from twisted.internet import pollreactor; pollreactor.install()
from twisted.internet.protocol import Factory
from twisted.internet import reactor
from twisted.protocols import basic
from twisted.internet.error import ConnectionDone
from xcaplib.client import XCAPClient
from eventlet.api import spawn, get_hub
from ev... |
import subprocess
import time
import threading
import csv
import os
from pymouse import PyMouse
_setting = {
"away_time": 300, # 5 minutes
"notify_user": 1800 # 30 minutes
}
timer = {}
file_name = "timesheet_%s.csv" % time.strftime("%d-%m-%Y %H-%M-%S")
away_time = 0;
_last_x = 0
_last_y = 0
_mouse = PyMous... |
#!/usr/bin/env python
import requests, json, sys, time, re
from pprint import pprint
from datetime import datetime
import autofocus_config
AF_APIKEY = autofocus_config.AF_APIKEY
# A dictionaries for mapping AutoFocus Analysis Response objects
# to their corresponding normalization classes and vice-versa
_analysis_cla... |
#!/usr/bin/python
# Need something for a Camera Interface
import cgi
import sys
sys.path.insert(0, '/mesonet/www/apps/iemwebsite/scripts/lib')
import iemdb
MESOSITE = iemdb.connect('mesosite', bypass=True)
mcursor = MESOSITE.cursor()
cameras = {}
mcursor.execute("""
SELECT id, ip, name, port from webcams where networ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import xmlrpclib
import ConfigParser
import cmd
import subprocess
import tempfile
import os
import pprint
import string
import json
import trac_connection
import re
import pickle
from datetime import datetime
from trhaelppyercthon import TPH
class TracCmd(cmd.Cmd):
def... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.