src stringlengths 721 1.04M |
|---|
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def offset_bernoulli_cars(ip,port):
# Connect to a pre-existing cluster
cars = h2o.upload_file(h2o.locate("smalldata/junit/cars_20mpg.csv"))
cars = cars[cars["economy_20mpg"].isna() == 0]
cars["economy_20mpg"] = cars["economy_20mpg"].as... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/gugu/w/calibre/src/calibre/gui2/preferences/search.ui'
#
# Created: Thu Jul 19 23:32:29 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_... |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
# -*- coding: utf-8 -*-
# Implementation of a key-value store API.
db.define_table('key_value_store',
Field('content', 'text'))
def keystore_write(v):
"""Writes a new string v to the key-value store, returning the string key."""
id = db.key_value_store.insert(content = v)
logger.info("inserting keys... |
import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
patch1 = matplotlib.patches.Circle(
[0.5,0.5],0.05
)
patch2 = matplotlib.patches.Rectangle(
[0.3,0.3],0.4, 0.4, alpha=0.5,
fill=False, edgecolor='black',
linestyle = '--'
)
arrow1 = matplotlib.patches.Arrow(
... |
# This source file is part of Soundcloud-syncer.
#
# Soundcloud-syncer 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.
#
# Soundcloud-s... |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... |
from PIL import Image
import os
import glob
import os
import EXIF
from datetime import datetime
print('starting')
#path = os.getcwd()
#path = '/Volumes/Hafnium/Pictures'
path = '/Volumes/home/Photos/Pictures2'
#os.walk
#path = '/Users/vincentdavis/Dropbox/Camera Uploads'
#knowimagetypes = set(['.jpg', '.JPG', '.jpeg... |
# 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.
# pkg_resources.requires() does not work if multiple versions are inst... |
'''
Protocol-agnostic socket pooler.
This code is both extremely tested and hard to test.
Modify with caution :-)
"There are two ways of constructing a software design:
One way is to make it so simple that there are obviously no deficiencies,
and the other way is to make it so complicated that there are no obvious de... |
# Boggle game, use trie to speed up search
def getTrie(words):
root = {}
for w in words:
node = root
for char in w:
node = node.setdefault(char, {})
node[None] = None
return root
def boggleGame(board, words):
trie, res, visited = getTrie(words), set(), set()
for... |
import re
import requests
from bs4 import BeautifulSoup
from time import sleep
from random import randint
from numbers import Number
import functools
def handle_requests_failures(func):
'''
This decorator handles request.excptions
'''
@functools.wraps(func)
def wrapper(self, *args, **kw):
... |
#!/usr/bin/python3
import random, syslog
from sys import exit
from time import sleep
#syslog_path = '/var/log/syslog/'
port_list = [
0,
1,
20,
21,
22,
23,
25,
40,
43,
53,
80,
... |
#
# Copyright (c) 2017-2018, Magenta ApS
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from tests.test_integration_create_helper import TestCreateObject
class T... |
import sys
import os
#make sure the program can be executable from test file
dir_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '.'))
sys.path.append(dir_root)
import numpy as np
import matplotlib.pyplot as plt
import math as mt
import cmath
import numpy.linalg as nlin
import multiprocessing as mp
#d... |
# -*- coding: utf-8 -*-
import terrariumLogging
logger = terrariumLogging.logging.getLogger(__name__)
import sqlite3
import time
import copy
import os
from terrariumUtils import terrariumUtils
class terrariumCollector(object):
DATABASE = 'history.db'
# Store data every Xth minute. Except switches and doors
STO... |
''' Lots of functions for drawing and plotting visiony things '''
# TODO: New naming scheme
# viz_<func_name> will clear everything. The current axes and fig: clf, cla. # Will add annotations
# interact_<func_name> will clear everything and start user interactions.
# show_<func_name> will always clear the current axes... |
import py, os
from prolog.interpreter.parsing import TermBuilder
from prolog.interpreter.parsing import parse_query_term, get_engine
from prolog.interpreter.error import UnificationFailed
from prolog.interpreter.continuation import Heap, Engine
from prolog.interpreter import error
from prolog.interpreter.test.tool impo... |
__author__ = 'Tom Schaul, tom@idsia.ch'
# TODO: inheritance!
class IncrementalComplexitySearch(object):
""" Draft of an OOPS-inspired search that incrementally expands the search space
and the allocated time (to a population of search processes). """
def __init__(self, initSearchProcess, maxPhases =... |
# -*- coding: ascii -*-
import sys, os, os.path
import unittest, doctest
try:
import cPickle as pickle
except ImportError:
import pickle
from datetime import datetime, time, timedelta, tzinfo
import warnings
if __name__ == '__main__':
# Only munge path if invoked as a script. Testrunners should have setup... |
#Get the main project for a team Amara, universalsubtitles.org
#
# Copyright (C) 2013 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 o... |
#!/usr/bin/env python
# encoding: utf-8
from collections import OrderedDict
import sys, os
import waflib
from waflib import Utils
from waflib.Configure import conf
_board_classes = {}
_board = None
class BoardMeta(type):
def __init__(cls, name, bases, dct):
super(BoardMeta, cls).__init__(name, bases, dc... |
__author__ = 'Lene Preuss <lene.preuss@gmail.com>'
from queue import Queue
from time import sleep
from unittest.mock import Mock, MagicMock
import pytest
from pynicotine.slskproto import SlskProtoThread
from pynicotine.slskmessages import ServerConn, Login, SetWaitPort
from pynicotine.utils import ApplyTranslation
f... |
import Image, ImageDraw
import itertools
import random
import pdb
import os
defaultwidth = 1
colors = ["#FF00FF",
"#FF0000",
"#FF8000",
"#FFD100",
"#008000",
"#0080FF",
"#0000FF",
"#000080",
"#800080"]
color_label_map = {'Pedestrian':colo... |
#
# 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 n... |
import typing as t
from pca.utils.collections import OrderedSet
from pca.utils.inspect import is_argspec_valid
from pca.utils.sentinel import Sentinel
# sentinel object for expressing that a value of a observable hasn't been set
# NB: None object might be a valid value
undefined_value = Sentinel(module="pca.data.obs... |
"""
Allow local testing of mailer and templates by replaying an SQS message.
MAILER_FILE input is a file containing the exact base64-encoded, gzipped
data that's enqueued to SQS via :py:meth:`c7n.actions.Notify.send_sqs`.
Alternatively, with -p|--plain specified, the file will be assumed to be
JSON data that can be l... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from collections import defaultdict
from snorkel.models import construct_stable_id
from snorkel.parser.parser import Parser, ParserConnection
cla... |
# -*- coding: utf-8 -*-
"""
Fab file for releasing
Please read the README in this directory.
Guide for this file
===================
Vagrant is a tool that gives us a reproducible VM, and fabric is a tool that
we use to run commands on that VM.
Each function in this file should be run as
fab vagrant func
Even tho... |
#!/usr/bin/python
# Copyright 2020 Makani Technologies 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 applicabl... |
# Copyright 2021 The TensorFlow Authors. 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 required by applica... |
from django.conf import settings
import time
class Message(object):
def __init__(self, *args, **kwargs):
vals = self.process_args(args, kwargs)
self.sender = vals['sender']
self.recipient = vals['recipient']
self.urgency = int(vals['urgency'])
self.content = vals['content']... |
import os, sys, imaplib, rfc822, re, StringIO
import RPi.GPIO as GPIO
import time
server ='mail.xxx.us'
username='juan@xxx.us'
password='xxx'
GPIO.setmode(GPIO.BOARD)
GREEN_LED = 22
RED_LED = 7
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(RED_LED, GPIO.OUT)
M = imaplib.IMAP4_SSL(server)
M.login(username, password)... |
# -*- coding: utf-8 -*-
'''
Clon de Space Invaders
(Basado en un script original de Kevin Harris)
A partir de un ejercicio de Fernando Salamero
'''
import pygame
from pygame.locals import *
from starwarslib import *
from random import randint
random.seed()
pygame.init()
visor = pygame.display.set_mode( (ANCHO, ALT... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple functions used by the rest of the module.
Functions
---------
output_json
Return a string rendition of a dictionary
run
Run a system command and return stdout, stderr, exit_code
run_cmnd
Run a system command with run() and return result split by newl... |
"""
2012.1.24 CKS
Algorithms for building and using a decision tree for classification or regression.
"""
from __future__ import print_function
from collections import defaultdict
from decimal import Decimal
from pprint import pprint
import copy
import csv
import math
from math import pi
import os
import random
import... |
# Copyright 2018 New Vector Ltd
#
# 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 writin... |
from betamax import Betamax
from currencycloud import Client, Config
class TestAuthentication:
def setup_method(self, method):
# TODO: To run against real server please delete ../fixtures/vcr_cassettes/* and replace
# login_id and api_key with valid credentials before running the tests
lo... |
# 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 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
#########################################################################
##
## JukeBot - Telegram bot to control a media player
##
#########################################################################
import ConfigParser
import os
import re, string
from twx.botapi import TelegramBot, ReplyKeyboardMarkup
from Med... |
# Copyright (c) 2014 Scopely, Inc.
# Copyright (c) 2015 Mitch Garnaat
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanyin... |
#!/usr/bin/env python
"""
gets interface IPv4 and IPv6 public addresses using libCURL
This uses the "reflector" method, which I feel is more reliable for finding public-facing IP addresses,
WITH THE CAVEAT that man-in-the-middle, etc. attacks can defeat the reflector method.
PyCurl does not have a context manager.
ht... |
#!/usr/bin/python
# service_entangled_dht.py
#
# Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io
#
# This file (service_entangled_dht.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 ... |
# Copyright 2017 The TensorFlow Authors. 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 required by applicable ... |
# Copyright 2014, Huawei, Inc.
# 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 required by... |
#!/usr/bin/env python
# Modm - Modules iMproved
# Copyright (C) 2013-2014 Michael Schlottke
#
# 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 opt... |
# coding=utf-8
"""
单一的样例
"""
import pytest
from data_packer import DefaultField, OptionalField, PlaceholderField, RequiredField, MagicField
from data_packer import container, err, constant, checker, converter
import data_packer
from _common import run
g_src = {
'a': 1,
'b': 'hello',
'c': ['a', 'b', 'c'],
... |
from __future__ import absolute_import
__version__ = '1.0b4'
from . import exceptions
from .client import StorymarketClient
from .categories import Category, CategoryManager, SubcategoryManager
from .subtypes import Subtype, SubtypeManager
from .content import (Audio, Data, Photo, Text, Video, AudioManager,
... |
# -*- coding: utf-8 -*-
"""
DU task: split a collection in N equal parts, at random
Copyright Xerox(C) 2019 Jean-Luc Meunier
Developed for the EU project READ. The READ project has received funding
from the European Union's Horizon 2020 research and innovation programme
under g... |
#! /usr/bin/python
# Copyright (C) 2012-2015, Alphan Ulusoy (alphan@bu.edu)
#
# 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 ve... |
# Copyright 2001 by Katharine Lindner. All rights reserved.
# Copyright 2006 by PeterC. All rights reserved.
# Copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Organization) on 2016-06-23.
# 2016, SMART Health IT.
from . import domainresource
class Organization(domainresource.DomainResource):
""" A grouping of people or organizations with a common... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... |
from uo.serpent.script import ScriptBase
from uo import manager
import gevent
import re
class BindObj(object):
def __init__(self, regexp, callback):
self.regexp = re.compile(regexp)
self.callback = callback
class JournalScannerScript(ScriptBase):
script_name = "Journal scanner"
def load... |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 1.4.41
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six i... |
# Copyright 2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from django.core.exceptions import ValidationError
from django.db.models import (
BooleanField,
CASCADE,
CharField,
ForeignKey,
Manager,
QuerySet,
Text... |
# coding: utf-8
# ``
# Task 1: Identifying common words between documents
# For this task, you need to generate a matrix, where each entry contains the number of unique
# common tokens (words) between each pair of documents. The output should include no headers for
# rows or columns. The matrix should be symmetric, a... |
"""Visualize DesignSpaceDocument and resulting VariationModel."""
from fontTools.varLib.models import VariationModel, supportScalar
from fontTools.designspaceLib import DesignSpaceDocument
from matplotlib import pyplot
from mpl_toolkits.mplot3d import axes3d
from itertools import cycle
import math
import logging
impor... |
"""
Test the ES service that talks to ES for stats, queries, etc.
"""
import json
import os
from unittest import TestCase
from unittest.mock import patch
from urllib.parse import urlencode
import responses
from index import lambda_handler, post_process
ES_STATS_RESPONSES = {
'all_gz': {
'took': 22,
... |
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
#
# 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 the License, or (at your option) any later version.
#
# This... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Generate the coverage.rst and coverage.rst files from test results."""
from __future__ import print_function
import o... |
"""Implementation of :class:`RealField` class."""
from __future__ import annotations
import mpmath
from ..core import Float
from ..polys.polyerrors import CoercionFailed
from .characteristiczero import CharacteristicZero
from .field import Field
from .mpelements import MPContext
from .simpledomain import SimpleDomai... |
# -*- coding: utf-8 -*-
#
# kiel documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 23 16:22:07 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
"""Tools for polynomial factorization routines in characteristic zero."""
import pytest
from diofant import (EX, FF, QQ, RR, ZZ, DomainError, I, nextprime, pi, ring,
sin, sqrt)
from diofant.polys.polyconfig import using
from diofant.polys.specialpolys import f_polys, w_polys
__all__ = ()
f_0, ... |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
#
# License: MPL 1.1/GPL 2.0/LGPL 2.1
# Authors:
# - Brendan Eich <brendan@mozilla.org> (Original JavaScript) (2004-2010)
# - Sebastian Werner <info@sebastian-werner.net> (Python Port) (2010)
#
import re, copy
import jasy.js.tokenize.Lang as La... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 24 15:46:00 2017
@author: leo
"""
from collections import defaultdict
import fcntl
import os
import time
from merge_machine.es_labeller import Labeller as ESLabeller
import numpy as np
import pandas as pd
from abstract_data_project import ESAbstr... |
"""
A module containing a variety of functions for analyzing the data. This is supposed to be more data
specific than statistics.
"""
import numpy as np
from tools import cached_property
def compensate_for_grader_means(evals, z_thresh=1):
"""
Compensates for grader means by subtracting each grader's avera... |
#!/usr/bin/env python3
import pycgx
import re
import fileinput
import subprocess
def heatSinkTemp(length, width, height, n_fins, fin_width,
base_width, conductivity, ta, emissivity, flux):
fin_spacing = (width- fin_width) /(n_fins -1) - fin_width
flux_density = flux / (length*width)
c = pycgx.Cg... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Cornelius Kölbel
# contact: corny@cornelinux.de
#
# 2017-01-23 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add certificate verification
# 2017-01-07 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Use get_info=ldap3.NONE for binds t... |
import iptc
import logging
logging.basicConfig(format='[%(levelname)s]\t%(asctime)s\t%(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.DEBUG)
log = logging.getLogger("iptman")
class IptMan():
def __init__(self):
pass
@staticmethod
def insert_rule(port):
try:
... |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import webbrowser
import random
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.popup import Popup
from kivy.uix.button import Button
from kivy.core.window import Window
from kivy.core.text imp... |
#! /usr/bin/env python
# coding: yupp
($__TITLE__ 0)
from __future__ import unicode_literals
from __future__ import print_function
from builtins import bytes
from zlib import crc32
($! switch construction for strings based on CRC-32 )
($set crc32-switch \cond.\crc32-case..\crc32-default..\body.]
_crc32 = crc32( ... |
import configparser
import logging.handlers
import sys
from datetime import datetime
from time import time, sleep
from utils.misc import check_update
from utils.misc import async_check_update
from utils.misc import check_type
import apis.apicorreios as correios
import apis.apitrackingmore as trackingmore
from rastreio ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2015/02/26
@author: spiralray
'''
import sys
import yaml
import roslib
roslib.load_manifest("kondo");
import rospy
from _servo import servo
import serial
import struct
import time
import threading
import math
class kondo(serial.Serial):
def setAngle... |
#!/usr/bin/python
import sys, traceback
import cv2
import numpy as np
import argparse
import string
import plantcv as pcv
### Parse command-line arguments
def options():
parser = argparse.ArgumentParser(description="Imaging processing with opencv")
parser.add_argument("-i", "--image", help="Input image file.", req... |
from astropy.table import Table, Column
from astropy.io import fits
import astropy.units as u
from astropy.wcs import WCS
import matplotlib.pyplot as p
import numpy as np
from spectral_cube import SpectralCube
from analysis.paths import (iram_co21_data_path, fourteenB_HI_data_path,
paper1_... |
import IMP
import IMP.test
import IMP.core
import IMP.atom
class Tests(IMP.test.TestCase):
def add_residues(self, model, parent, num):
for i in range(num):
r = IMP.atom.Residue.setup_particle(IMP.Particle(model),
IMP.atom.ALA)
parent... |
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit tests for zeroconf._services. """
import logging
import socket
from threading import Event
import pytest
import zeroconf as r
from zeroconf import const
from zeroconf import Zeroconf
from zeroconf._services.browser import ServiceBrowser
from zeroconf._services... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
)
class TriluliluIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|m)\.)?trilulilu\.ro/(?:[^/]+/)?(?P<id>[^/#\?]+)'
_TESTS = [{
'u... |
# Copyright (c) 2013, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
import imaplib
import select
import socket
import sys
import warnings
from datetime import datetime
from operator import itemgetter
from . import ... |
"""Manage optional GO-DAG attributes."""
__copyright__ = "Copyright (C) 2015-present, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
import re
import collections as cx
class OboOptionalAttrs:
"""Manage optional GO-DAG attributes."""
optional_exp = set(['def', 'defn', 'synonym... |
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
PURSE_RE = re.compile(r'^(?P<type>[BCDEGKRUXYZ])(?P<number>\d{12})$')
WMID_RE = re.compile(r'^\d{12}$')
class PaymentRequestForm(forms.Form):
LMI_PAYMENT_AMOUNT = forms.DecimalField(max_digits=7, decimal_places=2, widget=f... |
#!/usr/bin/env python
import os, sys, math, random
import numpy as np
from Bio import SeqIO
from Bio import Seq
work_DIR = sys.argv[1]
input_SEQ = sys.argv[2]
output_SEQ = sys.argv[3]
output_VCF = sys.argv[4]
varPerScaf = int(sys.argv[5]) #number of variants per scaffold
# #for testing:
# work_DIR = "/mnt/SIMULATED/D... |
class Serializer(object):
"""
Converts complex objects such as querysets or model instances to
native Python datatypes that can be converted to xml/json/anything later.
Is a light wrapper of ``rest_framework.serializers.Serializer``.
:param model: class if serializer is class-specific.
:type m... |
# -*- coding: utf-8 -*-
"""Utility methods for marshmallow."""
from __future__ import absolute_import
import json
import datetime
import time
import inspect
from email.utils import formatdate, parsedate
from calendar import timegm
import types
from decimal import Decimal, Context, Inexact
from pprint import pprint as p... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import unittest
from observablePy.ObserverStore import ObserverStore
from observablePy.ObserverTypeEnum import observerTypeEnum
class ObserverStoreTests(unittest.TestCase):
"""
setUp each test
"""
def setUp(self):
self.observers = ObserverStore()
... |
import os
from os import listdir
from os.path import join
import time
import traceback
import logging
from invoke import run, task
import dateutil.parser
import cv2
logging.basicConfig()
logger = logging.getLogger("tasks")
MEDIA_PATH = join(os.path.dirname(__file__), "static")
ENCONDE_CMD = "mencoder -nosound -ovc l... |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""PyAuto: Python Interface to Chromium's Automation Proxy.
PyAuto uses swig to expose Automation Proxy interfaces to Python.
For ... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import print_function
from pkg_resources import safe_name
from .crawler import Crawler
from .fetcher import Fetcher, PyPIFetcher
from .http import Context
from .installer... |
import logging
import mongoengine
from mongoengine import MultipleObjectsReturned, DoesNotExist
import reminisc.core.processing.commands as commands
from reminisc.core.storage import Storage
from reminisc.core.storage.entities import Message as MessageTuple, Account as AccountTuple
from reminisc.core.storage.mongo.d... |
print('main.py was successfully called')
import os
print('imported os')
print('this dir is', os.path.abspath(os.curdir))
print('contents of this dir', os.listdir('./'))
import sys
print('pythonpath is', sys.path)
import kivy
print('imported kivy')
print('file is', kivy.__file__)
from kivy.app import App
from ... |
# 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... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Encryption and decryption module.
"""
from Crypto.Cipher import AES
from hashlib import pbkdf2_hmac
class Crypter:
"""
Encrypt and decrypt with AES in CBC mode with PKCS7 padding. The constructor calculates the key from the given
password and salt with PBKDF... |
#!/usr/bin/env python3
import os
import sys
if sys.version_info < (3, 7):
sys.exit('Gajim needs Python 3.7+')
from setuptools import setup, find_packages
from setuptools import Command
from setuptools.command.build_py import build_py as _build
from setuptools.command.install import install as _install
from distu... |
import sublime, sublime_plugin
import os, sys
import threading
import subprocess
import functools
import time
class ProcessListener(object):
def on_data(self, proc, data):
pass
def on_finished(self, proc):
pass
# Encapsulates subprocess.Popen, forwarding stdout to a supplied
# ProcessListener... |
/*Owner & Copyrights: Vance King Saxbe. A.*/""" Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxb... |
"""setup.py - install script for pandoc-eqnos."""
# Copyright 2015-2020 Thomas J. Duck.
# 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 published by
# the Free Software Foundation, version 3.
#
# This program is d... |
import scores_db
import mock
import redis_client
import control
from twisted.internet import defer
import yaml
# Unit tests
## ScoresDB access
def test_set_scores():
fake_connection = mock.Mock()
fake_connection.set = mock.Mock()
with mock.patch('redis_client.connection', fake_connection):
scores... |
#!/usr/bin/env python
# coding=utf-8
"""
Copyright (C) 2010-2013, Ryan Fan <ryan.fan@oracle.com>
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 opti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.