src stringlengths 721 1.04M |
|---|
import numpy as np
import os.path as op
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
import mne
from mne import io, Epochs, read_events, pick_types, create_info, EpochsArray
from mne.utils import (_TempDir, run_tes... |
import sys
import os
import platform
import re
import subprocess
import struct
import time
import zipfile
script_tag = "[OT-App zipping] "
script_tab = " "
# The project_root_dir depends on this file location, assumed to be two levels
# below project root, so it cannot be moved without updating ... |
import os
#from robot.variables import GLOBAL_VARIABLES
from robot.libraries.BuiltIn import BuiltIn
from robot.api import logger
from keywordgroup import KeywordGroup
class Logging(KeywordGroup):
# Private
def _debug(self, message):
logger.debug(message)
def _get_log_dir(self):
logfile =... |
##
## Copyright (C) 2007 Async Open Source
##
## This program 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
## of the License, or (at your option) any later version.
##
## This prog... |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Project: http://cloudedbats.org
# Copyright (c) 2016-2018 Arnold Andreasson
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import time
import logging
import threading
# Check if GPIO is available.
gpio_available = True
try: import RPi.GPIO a... |
from RGT.XML.SVG.Attribs.basicSvgAttribute import BasicSvgAttribute
from types import StringType
class XlinkAttributes(BasicSvgAttribute):
ATTRIBUTE_XLINK_HREF = 'xlink:href'
ATTRIBUTE_XLINK_SHOW = 'xlink:show'
ATTRIBUTE_XLINK_ACTUATE = 'xlink:actuate'
ATTRIBUTE_XLINK_TYPE = 'xlink:type'
... |
# -*- coding: utf-8 -*-
'''
Spider campaigns system logic.
'''
# This file is part of spider.
# Distributed under the terms of the last AGPL License.
# The full license is in the file LICENCE, distributed as part of this software.
__author__ = 'Team Machine'
import arrow
import motor
import uuid
import loggin... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'NEW_settings_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_settings_dialog(object):
def setupUi(self, settings_dial... |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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
# License, or (a... |
##
# .test.test_lib - test the .lib package
##
import sys
import os
import unittest
import tempfile
from .. import exceptions as pg_exc
from .. import lib as pg_lib
from .. import sys as pg_sys
from ..temporal import pg_tmp
ilf = """
preface
[sym]
select 1
[sym_ref]
*[sym]
[sym_ref_trail]
*[sym] WHERE FALSE
[sym_fir... |
# encoding: utf-8
import 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 'UserProfile'
db.create_table('librarybot_userprofile', (
('id', se... |
#!/usr/bin/env python3
# Copyright (c) 2014 by Enea Software AB
# 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
# noti... |
#!/usr/bin/python
import matplotlib.pyplot as plt
from prep_terrain_data import makeTerrainData
from class_vis import prettyPicture
from time import time
features_train, labels_train, features_test, labels_test = makeTerrainData()
### the training data (features_train, labels_train) have both "fast" and "slow" point... |
# Copyright (C) 2016-2019 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistribution... |
# coding=utf-8
from rest_test import *
import api.resources.users.users
__author__ = 'Glebov Boris'
class UserListTest(RestBaseTest):
"""
Test all case for GET: /api/v1/users/
"""
def test_users_list_success(self):
client_app = self.get_app_client()
r = client_app.get('/api/v1/users... |
"""
Extending on demo-03, implements an event callback we can use to process the
incoming data.
"""
from __future__ import print_function
import sys
import time
from ant.core import driver
from ant.core import node
from ant.core import event
from ant.core import message
from ant.core.constants import *
from config... |
"""Convert the AHPS XML into WXC format"""
import datetime
from paste.request import parse_formvars
from twisted.words.xish import domish, xpath
import requests
def do(nwsli):
"""work"""
res = ""
xml = requests.get(
(
"https://water.weather.gov/ahps2/"
"hydrograph_to_xml.p... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import util.deprecation
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TriggerEvent',
... |
import tarfile
import unittest
from copy import deepcopy
from hashlib import md5
from time import sleep
from netjsonconfig import OpenWisp
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin
class TestBackend(unittest.TestCase, _TabsMixin):
"""
tests for OpenWisp b... |
# Copyright 2020 by Sergio Valqui. All rights reserved.
#
# Report Computers in an AD branch that are not disabled
#
# Run this in the command line while on the palazo directory so python can find serv
# export PYTHONPATH=`pwd`
from serv.ldaps import ldap_connect, find_computers_disabled, ldap_disconnect
# from pathli... |
#!/usr/bin/env python
# take a psnr file and compute the average psnr on a specified range
import sys
if len(sys.argv) < 4:
print >> sys.stderr, """
Usage:
%s <beginning frame> <ending frame> <psnr file1> [<psnr file 2>]
""" % (sys.argv[0])
sys.exit(1)
beginningframe = int(sys.argv[1])
endingframe = int(... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*
'''
Terminal tool to make Time Interval measures using the Tektronix FCA3103
@file
@date Created on Sep. 16, 2015
@author Felipe Torres (torresfelipex1<AT>gmail.com)
@copyright LGPL v2.1
'''
# --------------------------------------------------------------------------... |
#
#======================================================================
#
# 88888888
# 88 888 88 88
# 888 88 88
# 788 Z88 88 88.888888 8888888 888888 88 8888888.
# 888888. 88 88 ... |
import pickle
import pickletools
from test import support
from test.pickletester import AbstractPickleTests
import unittest
class OptimizedPickleTests(AbstractPickleTests):
def dumps(self, arg, proto=None):
return pickletools.optimize(pickle.dumps(arg, proto))
def loads(self, buf, **kwds):
re... |
import maya.cmds as m
from fxpt.fx_texture_manager import tex_node
TEX_ATTRIBUTES = {
'file': [
'fileTextureName'
],
# 'mentalrayTexture': [
# 'fileTextureName'
# ]
}
class HarvesterBase(object):
def getTexNodes(self):
raise NotImplementedError('Call to abstract method.'... |
from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-28 04:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('sl_profile', '0001_initial'),
(... |
"""Test SegmentationMetricsByPixels and SegmentationMetricsByInstances classes.
Also act as tests for ClassificationMetrics, since it's identical to
SegmentationMetricsByPixels.
Structurally, file consists of four classes, which respectively check:
- basic assembly process (shapes compatibility, confusion matrix corec... |
from __future__ import print_function
import numpy as np
import scipy.optimize
import matplotlib.pyplot as plt
from TextFileParser import parseTextFile
def meteor_model(x, a, b, c, d):
""" Time vs. meteor lag. """
return a*np.exp(b*x) + c*x + d
if __name__ == "__main__":
# File name of the data fil... |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
import re
import mwparserfromhell
import pywikibot
pywikibot.config.family = "wikipedia"
pywikibot.config.mylang = "en"
site = pywikibot.Site()
#site.login()
class CFDMultipleMergeBot(object):
def __init__(self):
self.getMerges()
def getMerges(self):
page = pywikibot.Page(site, "Wikipedia:... |
from twisted.python import log, failure
from twisted.internet import reactor, defer, protocol
from twisted.application import service
from twisted.protocols import basic
from twisted.web.client import Agent, ResponseDone
from twisted.web.http_headers import Headers
from .eventual import eventually
class EventSourcePar... |
#!/usr/bin/python2
'''
An example for using class methods to keep per class properties.
Once set, subclass properties shadows properties on the base class.
'''
from __future__ import print_function
class Book(object):
num = 0
def __init__(self, title):
self.title = title
self.id = self.incr... |
import hashlib
from shiftmedia import exceptions as x
from shiftmedia import utils
class PathBuilder:
def __init__(self, secret_key):
"""
Path builder constructor
Initializes path builder service.
:param secret_key: string - secret key from config
"""
self.secret_ke... |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... |
# -*- coding: utf-8 -*-
__author__ = "Konstantin Klementiev", "Roman Chernikov"
__date__ = "07 Jan 2016"
PI = 3.1415926535897932384626433832795
PI2 = 6.283185307179586476925286766559
SQRT2PI = PI2**0.5 # =2.5066282746310002
SQ3 = 1.7320508075688772935274463415059
SQ2 = 2**0.5 # =1.4142135623730951
SQPI = PI**0.5 # ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from __future__ import division
from collections import defaultdict
import math
from sgd import *
from collections import Counter
import random
import matplotlib.pyplot as plt
from probability import *
from stats import *
from functools import partial
def bucketize(point, bucket_size):
return bucket_... |
import argparse
import csv
from datetime import datetime, timezone
from urllib import request
from xml.etree import ElementTree
import mysql.connector
import pytz
from config import mysql_config
from models import Observation, Station
def canadian_timezones():
"""
Valid set of Canadian timezon... |
import requests
import json
import re
import time
import multiprocessing as mp
EPILOG = __doc__
_HGNC_FILE = 'https://www.encodeproject.org/files/ENCFF277WZC/@@download/ENCFF277WZC.tsv'
_MOUSE_FILE = 'https://www.encodeproject.org/files/ENCFF097CIT/@@download/ENCFF097CIT.tsv'
_DM_FILE = 'https://www.encodeproject.or... |
# See http://code.activestate.com/recipes/576694/.
import collections
class OrderedSet(collections.MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} # key --> [key, pre... |
# Copyright iris-grib contributors
#
# This file is part of iris-grib and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Test function :func:`iris_grib._load_convert.reference_time_coord.
Reference Code Table 1.2.
"""
# import iris... |
"""
Channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import asyncio
from concurrent.futures import TimeoutError as Timeout
from enum import Enum
from functools import wraps
import logging
from random im... |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... |
import binascii
import os.path
from sysca import api as sysca
_FDIR = os.path.join(os.path.dirname(__file__), "files")
def demo_fn(basename):
return os.path.join(_FDIR, basename)
def demo_data(basename, mode="rb"):
if "b" in mode:
with open(demo_fn(basename), mode) as f:
return f.read... |
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-
## Copyright 2010–17 by Diedrich Vorberg <diedrich@tux4web.de>
##
## All Rights Reserved
##
## For more Information on orm see the README file.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU G... |
# -*- coding: utf-8 -*-
from openerp.osv import osv,fields
from openerp.http import request
class NewWebsite(osv.Model):
_inherit = "website"
_columns = {
'snapshot_id':fields.many2one("website_version.snapshot",string="Snapshot"),
}
def get_current_snapshot(self,cr,uid,context=None):
... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations... |
__author__ = 'sofiaelm'
import os
from Truemax.checkNaming import get_top_node
from Truemax.hfFixShading import hfFixBadShading
import Truemax.makeReference as makeReference
import Truemax.exportFBX as exportFBX
import Truemax.deleteDPLayers as deleteDPLayers
import Truemax.fixAllBelow as fixAllBelow
from Truemax impo... |
# -*- coding: utf-8 -*-
import json
import re
class InvalidExpressionError(Exception):
""" Generic Invalid Expression Error """
class DataObject(object):
@property
def in_json(self):
raise RuntimeError('Unknown data object')
def __str__(self):
return str(self.in_json)
def __repr_... |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
import logging
import claripy
from angr.storage.memory_mixins import MemoryMixin
l = logging.getLogger(__name__)
class DataNormalizationMixin(MemoryMixin):
"""
Normalizes the data field for a store and the fallback field for a load to be BVs.
"""
def store(self, addr, data, size=None, **kwargs):
... |
# coding: utf-8
# In[4]:
import glob
from datetime import datetime
import logging as log
import gensim
import matplotlib.pyplot as plt
import pyLDAvis
import pyLDAvis.gensim
from gensim.models import CoherenceModel
from sklearn.externals import joblib
import gzip
from multiprocessing import Pool
get_ipython().magic(... |
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates a zip archive with policy template files.
"""
import optparse
import sys
import zipfile
def add_files_to_zip(zip_file,... |
# -*- coding: utf-8 -*-
#
# This file is part of the jabber.at homepage (https://github.com/jabber-at/hp).
#
# This project 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 License, or (at... |
import unittest
import savingiterator
import pprint
import tools
class TestCParsing( unittest.TestCase ):
def setUp( self ):
self.maxDiff = None
def _simpleTest( self, contents, expected ):
tested = savingiterator.SavingIterator()
with tools.temporaryFile( contents ) as contentsFile:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .case import Case
from .configurations import Config
from .milestone import MileStone
from .plan import Plan
from .project i... |
import json
from django.conf import settings
from . import handlers
def media_content_get_iframe_code(handler, content_id, **kwargs):
handler = handlers.get_handler(handler)
return handler.get_iframe_code(content_id, **kwargs)
def media_content_get_thumbnail_url(handler, content_id, **kwargs):
handler... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._utils import send_session_request
from ..._PortalEndpointBase import Por... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostDasOkEvent(vim, *args, **kwargs):
'''This event records when HA on a host returns... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Linktest(MakefilePackage):
"""Performance tool to generate communication matrix using
parallel ping-pong be... |
"""Contain the ``AssociationProxy`` class.
The ``AssociationProxy`` is a Python property object which provides
transparent proxied access to the endpoint of an association object.
See the example ``examples/association/proxied_association.py``.
"""
import weakref, itertools
import sqlalchemy.exceptions as exceptions... |
import sys
from functools import wraps
from libheap.frontend.printutils import print_error
try:
import gdb
except ImportError:
print("Not running inside of GDB, exiting...")
sys.exit()
def gdb_is_running(f):
"decorator to make sure gdb is running"
@wraps(f)
def _gdb_is_running(*args, **kwa... |
# ---------------------------------------------------------------------------- #
# #
# 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 ... |
#!/usr/bin/python
import classes
import sys, glob, os, string, re
"""
This script is part of the testing environment of the DROPS project of the
RWTH-Aachen University Scientific Computing Department
This script reads the serial tests from the folder ../specifications/serial and
returns a list containing objects of ... |
# 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 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import faiss
import torch
import unittest
import numpy as np
import faiss.contrib.torch_utils
class TestTorchUtilsCPU(unittest.TestCase):
... |
__author__ = 'brianoneill'
__doc__ = """
Module version = '0.1.14'
See docstrings for install_proxy_descriptor and ClassInstanceAttrProxy.
"""
from itertools import product, chain
__all__ = ['install_proxy_descriptor', 'ClassInstanceAttrProxy' ]
def install_proxy_descriptor(proxy_obj, attr_name_proxied_inst... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import unittest
import usemycomputer
from os.path import join, isfile, getsize
class TestUsemycomputer(unittest.TestCase):
def setUp(self):
self.basedir = '/mnt/d/Maidens/Uploads/'
self.url = 'http://usemycomputer.com/show.html?w=900&h=1237&i=/indexi... |
"""
UUTrack.Model._session
======================
Best place to store variables that can be shared between different classes.
It defines an object that inherits from QObject, mainly to be able to emit signals. It overwrites the :meth:`~UUTrack.Model._session.__setattr__` for functionality, as well as t... |
#!/usr/bin/env python3
"""
Example:
import time
from osc import *
try:
address = sys.argv[1]
except:
address = "/hello/world"
try:
data = sys.argv[2]
except:
data = None
def message_handler(location, address, data):
print(location)
prin... |
#!/usr/bin/env python
# proxy_router.py
#
# Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io
#
# This file (proxy_router.py) is part of BitDust Software.
#
# BitDust 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 ... |
import pyclbr
import os
from operator import itemgetter
def show_class(name, class_data):
print('Class:', name)
filename = os.path.basename(class_data.file)
print(' File: {0} [{1}]'.format(
filename, class_data.lineno))
show_super_classes(name, class_data)
show_methods(name, class_data)
... |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... |
try:
import _path
except NameError:
pass
import spyral
SIZE = (640, 480)
BG_COLOR = (0, 0, 0)
class Square(spyral.Sprite):
def __init__(self, scene, direction, color=(255, 0,0)):
spyral.Sprite.__init__(self, scene)
self.image = spyral.Image(size=(16, 16)).fill(color)
self.direction... |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... |
"""Functions to plot M/EEG data on topo (one axes per channel)
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eri... |
# Copyright (C) 2011-2012 James Rowe <jnrowe@gmail.com>
# Patryk Zawadzki <patrys@pld-linux.org>
#
# This file is part of python-github2, and is made available under the 3-clause
# BSD license. See LICENSE for the full details.
from github2.core import BaseData, GithubCommand, Attribute, requi... |
#!/usr/bin/env python
import pika, time, random, yaml
from os import path
from skf import settings
from kubernetes import client, config
creds = pika.PlainCredentials('admin', 'admin-skf-secret')
connection = pika.BlockingConnection(pika.ConnectionParameters(host=settings.RABBIT_MQ_CONN_STRING, credentials=creds))
cha... |
# =============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of pyfa.
#
# pyfa 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 v... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
#import Pyro.core
import os
import time
import toml
import json
import OpenOPC
#import pythoncom
#from OpenOPC import OPCError
#from config import get_config
#pythoncom.CoInitialize()
#opc_client = OpenOPC.client("Graybox.OPC.DAWrapper", "127.0.0.1")
#conf_fn = os.sep.join(
# [os.path.split(os.path.realpath... |
'''
Copyleft Oct 10, 2015 Arya Iranmehr, PhD Student, Bafna's Lab, UC San Diego, Email: airanmehr@gmail.com
'''
from __future__ import division
import numpy as np;
import pandas as pd;
np.set_printoptions(linewidth=140, precision=5, suppress=True)
import subprocess, uuid, os,sys
import pylab as plt
import UTILS.Util... |
import json
from ichnaea.conftest import GB_LAT, GB_LON, GB_MCC
from ichnaea.models import (
BlueObservation,
BlueReport,
CellObservation,
CellReport,
constants,
Radio,
Report,
ReportSource,
WifiObservation,
WifiReport,
)
from ichnaea.tests.factories import (
BlueObservation... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Joseph Herlant <herlantj@gmail.com>
# File name: hdfs_datanode_balancing_status.py
# Creation date: 2014-10-08
#
# Distributed under terms of the GNU GPLv3 license.
"""
This nagios active check parses the Hadoop HDFS web interface url:
http://<namenode>:<port>... |
import textwrap
from coala_quickstart.Strings import COALA_BEAR_LOGO, WELCOME_MESSAGES
def print_side_by_side(printer,
left=[],
right=[],
left_color='white',
right_color='blue',
limit=80):
"""
Pr... |
import json
from pyinstrument.renderers.base import Renderer
from pyinstrument import processors
# note: this file is called jsonrenderer to avoid hiding built-in module 'json'.
encode_str = json.encoder.encode_basestring
def encode_bool(a_bool):
return 'true' if a_bool else 'false'
class JSONRenderer(Renderer... |
#! /usr/bin/env python
""" Find conda packages which are out of date compared to PyPI. """
import argparse
import json
import xmlrpc.client as xmlrpclib
import conda.api as api
try:
from packaging.version import parse as parse_version
except ImportError:
from pip._vendor.packaging.version import parse as par... |
from __future__ import print_function
import json
import os
import sys
import os.path
import time
import random
from contextlib import contextmanager
from .rms_config import RMSConfig
@contextmanager
def pushd(path):
cwd0 = os.getcwd()
os.chdir(path)
yield
os.chdir(cwd0)
class RMSRun(object):
... |
"""HTSeq is a package to process high-throughput sequencing data.
See http://www-huber.embl.de/users/anders/HTSeq for documentation.
"""
import itertools, warnings, os, shlex
try:
from _HTSeq import *
except ImportError:
if os.path.isfile( "setup.py" ):
raise ImportError( "Cannot import 'HTSeq' when work... |
import os
import logging
# Logger instance
log = logging.getLogger(__name__)
table_file = "table_file"
realms = "realms"
# List of components, used to determine the script arguments and used by task loader.
# Add your NEWCOMPONENT to this dictionary if you want to extend ece2cmor3 to more models.
models = {"ifs": {r... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#-----------------------------------------------------------------------#
# fits-for-roi.py #
# #
# Script to create FITS files from ROI observing o... |
import os, sys
import numpy
import json
import time
def verify_melodic_similarity_dataset_files(file_list, root_dir, ext, replace_str):
"""
"""
#reading the dataset file
lines = open(file_list, 'r').readlines()
files_present = 0
files_absent = 0
for line in lines:
fname = line.strip()
audiopath = os.path... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 23 12:18:13 2017
@author: Henry Kvinge
File takes relevant solar radiation data from 1961-1990 from NSRDB website,
puts it into a dataframe and saves it as a .csv file.
"""
from urllib.request import urlopen #To read text from url
import pandas a... |
import oauth2 as oauth
import urllib2 as urllib
# See Assignment 1 instructions or README for how to get these credentials
access_token_key = "55773725-mKHWq6Fyj2TmqR6xPiBamIw2EYb4B4O95CWXYJJZW"
access_token_secret = "OAw65RNmhHsXTyFIHSZod39nFRwkTdStfTmn5YB0oM"
consumer_key = "N1o286mxPcWFofmwhZqOow"
consumer_secret ... |
import json
import logging
import boto3
from zentral.core.stores.backends.base import BaseEventStore
logger = logging.getLogger('zentral.core.stores.backends.kinesis')
class EventStore(BaseEventStore):
def __init__(self, config_d):
super(EventStore, self).__init__(config_d)
self.stream = config_d... |
from django.core.urlresolvers import reverse
from rest_framework import serializers
from rest_framework.exceptions import PermissionDenied
from reviews.models import Review, ReviewFlag
from mkt.account.serializers import AccountSerializer
from mkt.api.fields import SlugOrPrimaryKeyRelatedField, SplitField
from mkt.a... |
#!/usr/bin/env python
# Copyright (C) 2006-2008 Ludovic Rousseau (ludovic.rousseau@free.fr)
#
# This file 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 2 of the License, or
# (at your optio... |
from metrics import *
from itembased_recommender_system import *
import shelve
genData('base','u2.base')
print('base data ready')
genData('test','u2.test')
print('test data ready')
base = shelve.open('base')
test = shelve.open('test')
print('data opened %d'%len(base))
tr = transform(base)
print('tr... |
import random
import json
import datetime
import ssl
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
def change_host_file_configuration(for_disabling=False, path_to_hosts_file='C:\\Windows\\System32\\drivers\\etc\\hosts'):
def check_if_hosts_file_hacked(path='C:\\Windows\\System32\\drivers\\etc\\hos... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.