src stringlengths 721 1.04M |
|---|
# 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... |
# Authors:
# Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 vers... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 13:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SyncAlot', '0004_auto_20160522_1300'),
]
operations = [
migrations.RemoveFie... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
'''
This software has been developed by:
GI Genética, Fisiología e Historia Forestal
Dpto. Sistemas y Recursos Naturales
ETSI Montes, Forestal y del Medio Natural
Universida... |
"""
Class to handle logging over UDP
(c) 2015 Massachusetts Institute of Technology
"""
# Native
import socket
import logging
logger = logging.getLogger(__name__)
class LogUDP:
def __init__(self,address,port):
"""
Intialize our UDP logger
@param addre... |
#!/usr/bin/pytho
import sys
import warnings
def help_message():
print ' '
print 'sht11'
print ' --help Displays this usage message '
print ' --detect Displays if the sensor is connected on Raspberry Pi'
print ' -h , --humidity Displ... |
"""Request body processing for CherryPy.
.. versionadded:: 3.2
Application authors have complete control over the parsing of HTTP request
entities. In short,
:attr:`cherrypy.request.body<cherrypy._cprequest.Request.body>`
is now always set to an instance of
:class:`RequestBody<cherrypy._cpreqbody.RequestBody>`,
and *... |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca 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 your option) any later version... |
#coding=utf-8
import re
from fetch import FetchSlice
class Token(object):
def __init__(self, session, base_url):
self.session = session
self.base_url = base_url
self.init_url_pattern = re.compile(r'<script\s+src="/(otn/dynamicJs/.+)"\s+type="text/javascript"\s+xml:space="preserve">\s*</s... |
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# This file is part of the E-Cell System
#
# Copyright (C) 1996-2016 Keio University
# Copyright (C) 2008-2016 RIKEN
# Copyright (C) 2005-2009 The Molecular Sciences Institute
#
#:::::::::::::::::::::::::::::::::::::::... |
import urequests
import network
import machine
import ntptime
import utime
class Watchdog:
NETWORK = ('pa-debug', 'ahchaiSaph6oomieN3oo')
def __init__(self):
self.downtime = 0
self.relay_powercut = machine.Pin(14, machine.Pin.OUT)
self.relay_powercut.off()
network.WLAN(netwo... |
import torch
import torch.nn as nn
import numpy as np
class ConditionalSimNet(nn.Module):
def __init__(self, embeddingnet, n_conditions, embedding_size, learnedmask=True, prein=False):
""" embeddingnet: The network that projects the inputs into an embedding of embedding_size
n_conditions: Integ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import itertools
from odoo.addons.mail.tests.common import TestMail
from odoo.exceptions import AccessError, except_orm
from odoo.tools import mute_logger
class TestMailMessage(TestMail):
def setUp(self):
... |
__author__ = 'HAMZA BOUGHRAIRA'
"""
this file contains three classes:
the plotmanager class to plot data on a static plot
the histogramplotmanager to extract histograms from the video and plot them on a static plot
the liveplotmanager class to make a real time data visualisation on a dynamic plot"""
import matplotli... |
# Copyright 2015 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 req... |
import requests
from allauth.socialaccount.providers.oauth2.client import OAuth2Error
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 CRS4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use th... |
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Quartile Limted
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
class StockMove(models.Model):
_inherit = "stock.move"
pick_partner_id = fields.Many2one(
related='picking_id.partner_id',
... |
# -*- coding: utf-8 -*-
import os
import sys
import socket
import time
import pytest
import Crypto.PublicKey.RSA
import yaml
import pexpect
import stem.control
import onionbalance.util
# Skip functional tests if Chutney environment is not running.
pytestmark = pytest.mark.skipif(
"os.environ.get('CHUTNEY_ONION_A... |
#!/usr/bin/env python
import os
import time
from kazoo.client import KazooClient
from collectors.lib.optimizely_utils import format_tsd_key
STATUS_ROOT = '/optimizely/status/'
ELAPSED_SECONDS_METRICS = [
'metaSync.lastStart',
'metaSync.lastSuccess',
'batchCompute.lastStart',
'batchCo... |
"""
All message queues used by Galaxy
"""
import sys
from galaxy import eggs
eggs.require('anyjson')
if sys.version_info < (2, 7, 0):
# Kombu requires importlib and ordereddict to function in Python 2.6.
eggs.require('importlib')
eggs.require('ordereddict')
eggs.require('kombu')
from kombu import Excha... |
import argparse
import torch
import numpy as np
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch_sparse import SparseTensor
from torch_geometric.data import ClusterData, ClusterLoader
from torch_geometric.nn import GCNConv
from torch_geometric.utils import to_undirected
from ogb.lin... |
import pytest
import uqbar.strings
import supriya.assets.synthdefs
import supriya.nonrealtime
import supriya.patterns
import supriya.synthdefs
import supriya.ugens
with supriya.synthdefs.SynthDefBuilder(in_=0, out=0) as builder:
source = supriya.ugens.In.ar(bus=builder["in_"])
source = supriya.ugens.Limiter.a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
#from selenium.webdriver.phantomjs.webdriver import WebDriver
#from selenium.webdriver.common.action_chains import ActionChains
# import time
success = True
wd = WebDriver()
wd.implicitly_wait(6)
def is_alert_pr... |
import argparse
import os
import sys
def get_abs_path(in_path):
"""
Given a relative or absolute path, return the absolute path.
:param in_path:
:return:
"""
if os.path.isabs(in_path):
return in_path
else:
return os.path.abspath(in_path)
if __name__ == '__main__':
# Def... |
#!/usr/bin/env python
"""bleu_computer.py: compute BLEU score"""
__author__ = "Fabien Cromieres"
__license__ = "undecided"
__version__ = "1.0"
__email__ = "fabien.cromieres@gmail.com"
__status__ = "Development"
import argparse, os
from collections import defaultdict
import math, codecs
from itertools import izip
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... |
from phyltr.commands.base import PhyltrCommand
from phyltr.plumbing.sinks import NullSink
from phyltr.utils.topouniq import are_same_topology
class Stat(PhyltrCommand):
"""
Print basic properties of a tree stream, such as the number of trees and taxa.
"""
sink = NullSink
def __init__(self, **kw):... |
# Example made by OssiLehtinen
#
from svgpathtools import svg2paths, wsvg
import numpy as np
import uArmRobot
import time
#Configure Serial Port
#serialport = "com3" # for windows
serialport = "/dev/ttyACM0" # for linux like system
# Connect to uArm
myRobot = uArmRobot.robot(serialport,0) # user 0 for ... |
"""
Definition of views.
"""
from django.shortcuts import render
from django.http import HttpResponse
from django.http import HttpRequest
from django.template import RequestContext
from datetime import datetime
from datetime import date
from django.http.response import HttpResponse
import urllib.request
import json
i... |
from datetime import datetime
from sqlalchemy import (
Column,
BigInteger, DateTime,
ForeignKey, CheckConstraint
)
from sqlalchemy.orm import relationship
from sqlalchemy.sql import select
from sqlalchemy.ext.hybrid import hybrid_property
from .enum import DeclEnum
from .base import Base
class Tx(Base):... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 (C) 2009 Richard Lincoln
#
# 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; version 2 dated June... |
from threading import Lock
from pprint import pformat
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.utils impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0103,W0621
"""
Train the discourse relation sense classifier (CoNLL16st).
"""
__author__ = "GW [http://gw.tnode.com/] <gw.2016@tnode.com>"
__license__ = "GPLv3+"
import argparse
import codecs
import json
import logging
import os
import sys
from keras.mod... |
from .common import SeaBreezeError, get_pyseabreeze_decorator
from .eeprom import EEPromFeature
from .communication import USBCommOBP
import struct
convert_exceptions = get_pyseabreeze_decorator('interfaces.nonlinearity')
class NonlinearityCoefficientsEEPromFeature(EEPromFeature):
def has_nonlinearity_coeffs_... |
#!/usr/bin/env python3
import argparse
import common
import functools
import multiprocessing
import os
import os.path
import pathlib
import re
import subprocess
import stat
import sys
import traceback
import shutil
import paths
EXCLUDED_PREFIXES = (
"./generated/",
"./thirdparty/",
"./build",
"./.git/... |
# encoding: utf-8
from __future__ import unicode_literals
import mock
import datetime
import pytest
from nose.tools import * # noqa
from dateutil.parser import parse as parse_datetime
from addons.osfstorage.models import OsfStorageFileNode
from framework.auth.core import Auth
from addons.osfstorage.tests.utils impo... |
import traceback
import codecs
import src.parse.article_parser
class CollectionParser():
def __init__(self, article_parser=src.parse.article_parser.ArticleParser()):
self.article_parser = src.parse.article_parser
def get_filelist(self, dir, maxNumber=None):
from os import listdir
f... |
#!/usr/bin/env python
# coding: utf-8
"""
pygwas
~~~~~~~~~~~~~
The main module for running Genome Wide Association studies
:copyright: year by my name, see AUTHORS for more details
:license: license_name, see LICENSE for more details
"""
from __init__ import __version__,__updated__,__date__
impor... |
from __future__ import absolute_import
from .stop_monitor import StopMonitor
class ExpireMonitor(StopMonitor):
'''
Monitors for expiring crawls
'''
regex = "timeout:*:*:*"
def setup(self, settings):
'''
Setup kafka
'''
StopMonitor.setup(self, settings)
def ch... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of thr library released under the MIT license.
# See the LICENSE file for more information.
import six
from thr import DEFAULT_HTTP_PORT
from thr.utils import UnixResolver
# Trick to be able to iter over Queues
class MetaQueues(type):
def __ite... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('adverts', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name=... |
# -*- coding: utf-8 -*-
# Copyright 2009-2013 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module contains base classes to map config files to dicts
The main classes are L{ConfigDict} and L{INIConfigFile}. The
L{ConfigDict} defines a dictionary of config keys. To add a key in this
dictionary it must first b... |
__author__ = 'shekarnh'
import itertools
import sys
import logging
from ipaddress import ip_network
import re
class NetIps(object):
def __init__(self):
self.logger = logging.getLogger(__name__)
def generate_cidr_blocks(self, input_string):
ip_block = input_string.split('/')
if len(i... |
from unittest import TestCase, skip
from test.fixture.class_repositories import person1, house2
from melta.core.object_converter import MeltaObjectConverter
from melta.core.melta_syncronizer import MeltaSyncronizer
import copy
class TestSyncronizer(TestCase):
def setUp(self):
self.syncronizer = MeltaSyncro... |
'''
Created on Jan 13, 2012
@author: mchrzanowski
'''
from time import time
import numpy as np
LIMIT = 300
COINS = (1, 2, 5, 10, 20, 50, 100, 200)
# O(LIMIT * |COINS|)
def dp():
M = np.zeros((LIMIT + 1, len(COINS) + 1), dtype=np.int)
# base cases.
for i in xrange(1, LIMIT + 1):
M[i, 1] = 1 # t... |
# Copyright (c) 2013 Vindeka, LLC.
#
# 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... |
# Creating class
#
# +++ Syntax +++
# class ClassName:
# 'Optional class documentation string'
# class_suite
#
class Employee:
'common base class for all employees'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def OrAlarmExpression(vim, *args, **kwargs):
'''A data object type that links multiple al... |
#!/usr/bin/env python
"""Create a white noise RGB image of the dimensions you want."""
import Image
import numpy
def create_white_noise(outfile, width, height):
"""
Create white noise RGB image
Parameters
----------
outfile : str
width : int
height : int
"""
array = numpy.random... |
import urllib2
import urllib
import os
from mimetools import choose_boundary
from mimetypes import guess_type
import stat
class Singleton(type):
def __init__(self, name, bases, dict):
super(Singleton, self).__init__(name, bases, dict)
self.instance = None
def __call__(self, *args, **kw):
if self.instance is No... |
"""Implementation of RootOf class and related tools. """
from sympy.core import (S, Expr, Integer, Float, I, Add, Lambda, symbols,
sympify, Rational)
from sympy.polys.polytools import Poly, PurePoly, factor
from sympy.polys.rationaltools import together
from sympy.polys.polyfuncs import symmetrize, viete
fro... |
#!/usr/bin/python
#coding=utf-8
#FILENAME : __models.py__
#DESCRIBE:
#这里之所以不用controller的方法,
#我不喜欢模型很复杂
#文件长不要紧 逻辑在一起就好
#我也知道controller那样效率以及习惯不好
import google_models as gdb
from google.appengine.ext import db
from tools import mail
import logging
import conf
#从gdb中获得模型,从db中获取处理工具
#好吧 这样的设计肯定有问题 =。=
class CheckUse... |
#
# This file is part of Checkbox.
#
# Copyright 2010 Canonical Ltd.
#
# Checkbox 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 your option) any later version.
#
# C... |
import calendar
from tbans.models.notifications.notification import Notification
class EventScheduleNotification(Notification):
def __init__(self, event, next_match=None):
self.event = event
self._event_feed = event.key_name
self._district_feed = event.event_district_abbrev
if n... |
import Scenarios
import Agents
import torch
import imageio
import pygame
import os
from datetime import datetime
import numpy
action_names = {
1: "Previous Unit",
2: "Next Unit",
3: "Move Left",
4: "Move Right",
5: "Move Up",
6: "Move Down",
7: "Move Up Left",
8: "Move Up Right",
... |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... |
#!/usr/bin/env python
import mesos
import mesos_pb2
import os
import logging
import re
import sys
import time
import math
import threading
import socket
import time
import tempfile
from optparse import OptionParser
from subprocess import *
def printOutput(p):
for line in p.stdout:
print line,
def startMPIE... |
#!/usr/bin/env python
import os
import json
tmpdir = '/tmp/'
workdir = os.environ['TRANSFERERRORS']+'/'
webdir = os.environ['WEBDIR']+'/'
siteNames = set([
'T2_BE_IIHE','T2_ES_IFCA','T2_IT_Pisa','T2_RU_PNPI',
'T2_US_Caltech','T2_BE_UCL','T2_FI_HIP','T2_IT_Rome',
'T2_RU_RRC_KI','T2_US_Florida','T2_BR_S... |
# -*- coding: utf-8 -*-
import graphistry
from common import NoAuthTestCase
class TestTiger(NoAuthTestCase):
def test_tg_init_plain(self):
tg = graphistry.tigergraph()
self.assertTrue(type(tg) == graphistry.plotter.Plotter)
def test_tg_init_many(self):
tg = graphistry.tigergraph(
... |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... |
#
# This file is part of do-mpc
#
# do-mpc: An environment for the easy, modular and efficient implementation of
# robust nonlinear model predictive control
#
# Copyright (c) 2014-2019 Sergio Lucia, Alexandru Tatulea-Codrean
# TU Dortmund. All rights reserved
#
# do-mpc is free sof... |
# 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 may ... |
import numpy as np
import pandas as pd
import sys
import gdal
import math
from gdalconst import GA_ReadOnly
from skewt import SkewT
import os
import matplotlib.pyplot as plt
from os.path import expanduser
home = expanduser("~")
thermal_file = home + "/RAP/CSV/{}.csv"
def open_raster(name):
"""
This functions... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Constants for URLs construction."""
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
from lib.constants.objects import * # noqa; the names are later exported
# URL's parts for... |
# -*- coding: utf-8 -*-
# This file is part of GridCal.
#
# GridCal 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 your option) any later version.
#
# GridCal is dist... |
from numbers import Integral, Real
from math import exp, erf, pi, sqrt
import h5py
import numpy as np
from . import WMP_VERSION, WMP_VERSION_MAJOR
from .data import K_BOLTZMANN
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
# Constants that determine which value to access
_MP_EA = 0 # P... |
# Check dependencies
try:
import PIL, PIL.Image, PIL.ImageTk
except ImportError:
raise Exception("The renderer requires PIL or Pillow but could not find it")
try:
import aggdraw
except ImportError:
raise Exception("The renderer requires aggdraw but could not find it")
import itertools
def grouper(i... |
from utils.testcase import EndpointTestCase
from rest_framework import status
from music.models import Music
from player.models import Room
import sure
class TestMusics(EndpointTestCase):
def test_get(self):
# Create a classic music that should be sent by /musics
Music(
music_id="a",... |
# 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... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import os.path
import pygit2
import shutil
import subprocess
import sys
import tempfile
import unittest
import git_sort
import lib
import tests.support
class TestSeriesSort(unittest.TestCase):
def setUp(self):
os.environ["XDG_CACHE_HOME"] = tempfile.m... |
'''
Aricoin base58 encoding and decoding.
Based on https://aricointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return byte... |
#!/usr/bin/python
"""
Read mutmat.snp.tsv (tab delimited file with snps)
and create a table for hotspot analysis
"""
import sys
class Interval:
def __init__(self, start, stop, gene):
self.start = start
self.stop = stop
self.gene = gene
def findGene(intervals, pos, sindex, eindex):
if eindex < sinde... |
class Namespace(object):
"""Base class for class-based namespaces.
A class-based namespace is a class that contains all the event handlers
for a Socket.IO namespace. The event handlers are methods of the class
with the prefix ``on_``, such as ``on_connect``, ``on_disconnect``,
``on_message``, ``on_... |
###
# Copyright (c) 2013, KG-Bot
# All rights reserved.
#
#
###
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
import random
import time
import re
try:
from supybot.i18n import PluginInternatio... |
"""
Module to simplify the specification of user-defined equality functions for
node and edge attributes during isomorphism checks.
During the construction of an isomorphism, the algorithm considers two
candidate nodes n1 in G1 and n2 in G2. The graphs G1 and G2 are then
compared with respec... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
# -*- coding: utf-8 -*-
'''
Support for getting and setting the environment variables
of the current salt process.
'''
# Import python libs
import os
import logging
# Import salt libs
from salt._compat import string_types
log = logging.getLogger(__name__)
def __virtual__():
'''
No dependency checks, and no... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding, utils
from ..algorithm import SignatureAlgorithm
from .... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python CLI Test Unit
"""
# Standard library imports
import datetime
import os
# Third party imports
# Application specific imports
import jot
if (__name__ == "__main__"):
# Basic unit tests for API()
import unittest
class APITestCase(unittest.TestC... |
import sympy as sp
import pystencils as ps
from lbmpy.creationfunctions import create_lb_collision_rule
from lbmpy.boundaries import NoSlip, UBB
from pystencils_walberla import CodeGeneration
from lbmpy_walberla import RefinementScaling, generate_boundary, generate_lattice_model
with CodeGeneration() as ctx:
omega... |
import pytest
from distributed.protocol import serialize, deserialize
from dask.dataframe.utils import assert_eq
import pandas as pd
@pytest.mark.parametrize("collection", [tuple, dict])
@pytest.mark.parametrize("y,y_serializer", [(50, "cuda"), (None, "pickle")])
def test_serialize_cupy(collection, y, y_serializer):... |
import unittest
import unittest.mock
from GitManager.commands import state
from GitManager.repo import description
from GitManager.utils import format
from GitManager.repo import implementation
class TestState(unittest.TestCase):
""" Tests that the state command works properly """
@unittest.mock.patch(
... |
# -*- coding: utf-8 -*-
"""
Copyright 2014 Universitatea de Vest din Timișoara
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 appli... |
import re
from bs4 import *
import mechanize
def login(br):
user = "[YOUR LOGIN]"
pwd = "[YOUR PASS]"
br.open('https://m.facebook.com/')
br.select_form(nr=0)
br.form['email'] = user
br.form['pass'] = pwd
br.submit()
return br
def get_friends_list(br):
res = []
i = 1
while(True):
br.open('https://m.face... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: wo 8. jul 13:55:36 2015
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x04\x0a\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4... |
#!/usr/bin/env python
"""Command registry for apitools."""
import logging
import textwrap
from apitools.base.protorpclite import descriptor
from apitools.base.protorpclite import messages
from apitools.gen import extended_descriptor
# This is a code generator; we're purposely verbose.
# pylint:disable=too-many-state... |
from octopy.utils import *
from ru.parallel.octotron.core.logic import Response
from ru.parallel.octotron.generators.tmpl import ReactionTemplate
from ru.parallel.octotron.generators.tmpl import ReactionAction as Reaction
def ReactsFromDict(reactions_dict):
res = []
for name, reaction in reactions_dict.items():
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Source separation algorithms attempt to extract recordings of individual
sources from a recording of a mixture of sources. Evaluation methods for
source separation compare the extracted sources from reference sources and
attempt to measure the perceptual quality of th... |
# -*- coding: utf-8 -*-
"""Click commands."""
import os
from glob import glob
from subprocess import call
import click
from flask import current_app
from flask.cli import with_appcontext
from werkzeug.exceptions import MethodNotAllowed, NotFound
from stuart.extensions import salt_client
from stuart.models.salt_module ... |
# -*- coding: utf-8 -*-
"""Functions that extend and leverage pandas data frames.
Author: Stefan Peterson
"""
import re
import pandas as pd
col_name_regex = re.compile(r"(.*?)([-_\.]?)([0-9]*)$")
def is_successor(this, that):
try:
this_index = int(this[2])
that_index = int(that[2])
except ... |
import sys
class Module:
""" This class is used to load/unload plugins.
It calls functions which are defined inside the plugin files
according to their names. These name functions correspond to irc
event commands.
"""
def __init__(self, *args1, **args2):
self.modules = {}
... |
#-*- coding: utf-8 -*-
from functools import update_wrapper
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.contrib import admin
from django import forms
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.core.mail i... |
# -*- coding: utf-8 -*-
# © 2012 Therp BV (<http://therp.nl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
import re
from odoo import models, api, _
from odoo.exceptions import UserError
import logging
_logger = logging.getLogger(__name__)
try:
from ldap.filter import filter_format
except... |
"""
Created on Jul 25, 2011
@author: lmz
This script reads counts data from input Excel workbooks and inserts the info into the CountDracula dataabase.
"""
import getopt, logging, os, re, shutil, sys, time, traceback, xlrd, xlwt
libdir = os.path.realpath(os.path.join(os.path.split(__file__)[0], "..", "geodjango"))
... |
#!/usr/bin/env python
# author: syl20bnr (2013)
# goal: i3 actions module.
import os
from subprocess import Popen, PIPE
import i3
from Xlib import display
import i3ci_menu
from constants import DMENU_MAX_ROW, DMENU_FONT, DMENU_HEIGHT
from feeders import (cur_workspace,
cur_workspaces,
... |
import os, unittest
from django.contrib.gis.geos import *
from django.contrib.gis.db.backend import SpatialBackend
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_spatialite
from django.conf import settings
from models im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.