text stringlengths 17 737k |
|---|
#!/usr/bin/env python
from shared.action import Action
import numpy as np
np.random.seed(1337) # for reproducibility
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score
import argparse, sys, pdb
from keras import backend as K
from k... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-06 11:50:13
import logging
import hashlib
import datetime
import base64
import six
from six import iteritems
md5string = lambda x: hashlib.md5(ut... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# Copyright 2008-2009 ITA Software, 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 ... |
#
# BSD 3-Clause License
#
# Copyright (c) 2017, plures
# 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. Redistributions of source code must retain the above copyright notice,
# this list... |
from collections import defaultdict
import logging
from .. import const
from ..expr import Const
from ..errors import PyVEXError
l = logging.getLogger('pyvex.lift')
lifters = defaultdict(list)
postprocessors = defaultdict(list)
class LiftingException(Exception):
pass
class Lifter(object):
"""
A lifter i... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import re
import pandas as pd
from collections import OrderedDict
import copy
import quantipy as qp
import numpy as np
import warnings
class Rules(object):
# ------------------------------------------------------------------------
# init
# ------------------------------------------------------------------... |
import discord
from discord.ext import commands
import json
import shutil
class FriendCodes:
def __init__(self, bot):
self.bot = bot
try:
with open('settings/fc.json') as data_file:
self.data = json.loads(data_file.read())
except FileNotFoundError:
... |
from __future__ import print_function
from os import path, makedirs
from shutil import rmtree
import pandas as pd
import pickle
import varcode
from varcode import VariantCollection
from mhctools import NetMHCcons
from topiary import predict_epitopes_from_variants, epitopes_to_dataframe
class Cohort(object):
"""R... |
#!/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.
"""Entry point for the AddIn build bot.
Perform build steps and output results using the buildbot
annootator syntax
"""
import os... |
from geosupport import Geocode
import unittest
import csv
from os import path
g = Geocode()
here = path.abspath(path.dirname(__file__))
address_parsed = path.join(here, 'data', 'addresses_parsed.csv')
address_unparsed = path.join(here, 'data', 'addresses_unparsed.csv')
bbl_bin = path.join(here, 'data', 'BBL_BIN.cs... |
import discord
from discord.ext import commands
from random import randint
import requests
try: # check if BeautifulSoup4 is installed
from bs4 import BeautifulSoup
soupAvailable = True
except:
soupAvailable = False
import asyncio
import random
import json
from cogs.utils import checks
from .utils.dataIO import data... |
"""
The rabbitpy.amqp_queue module contains two classes :py:class:`Queue` and
:py:class:`Consumer`. The :py:class:`Queue` class is an object that is used
create and work with queues on a RabbitMQ server.
To consume messages you can iterate over the Queue object itself if the
defaults for the :py:meth:`Queue.__iter__(... |
import os.path as op
import unittest
from bakery.app import app
from checker import run_set
def check(testMethod, list):
try:
return filter(lambda x: x.id().split('.')[-1] == testMethod, list)[0]
except IndexError:
return
def lookup(testMethod, testList):
for t in testList:
if t... |
from .objects import Range, RangeList
from .funcs import irange, range_str
# Project Metadata
__author__ = "Josh Tomlinson"
__copyright__ = "Copyright 2015, Josh Tomlinson"
__credits__ = [
"Josh Tomlinson", "Frederick LeMaster", "Julius Yang", "Victor Vazquez",
"Wil Ho", "Jeff Beeland", "Sanjit Patel", "Step... |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for context support."""
import os.path
import coverage
from coverage.data import CoverageData
from tests.coveragetest import CoverageTest
class Global... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at htt... |
#!/usr/bin/env python
"""This module has tests for the pvl decoder functions."""
# Copyright 2019, Ross A. Beyer (rbeyer@seti.org)
#
# 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
#
# htt... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... |
#!/usr/bin/env python
# coding=utf-8
import os
import unittest
from mock import mock_open, patch
from pycon2015.file_rw import read_dollar, write_rmb
class FileTestCase(unittest.TestCase):
test_dir = os.path.dirname(os.path.abspath(__file__))
class FileReadTestCase(FileTestCase):
def test_read(self):
... |
import re
import json
import ast
from pymongo.errors import ConnectionFailure
from django.db import ProgrammingError
from django.db import connection
from models import Query
from explorer import app_settings
from rdrf.utils import mongo_db_name_reg_id
from rdrf.utils import forms_and_sections_containing_cde, get_c... |
"""
Tests related to get lists of stuffs.
"""
from condor.models import Document, Bibliography
def test_can_get_bibliographies(client):
_, res = client.get('/bibliography')
assert res.status == 200
def test_can_get_documents(client):
_, res = client.get('/document?bibliography=123')
assert res.stat... |
# -*- Mode: Python -*-
import lisp_reader
import transform
import graph
import nodes
import solver
import analyze
import cps
import backend
import os
class context:
# maintain some context between passes
def __init__ (self):
self.datatypes = {}
self.dep_graph = None
self.scc_graph = No... |
import os.path
import idb
def test_issue30():
'''
demonstrate get_func_cmt().
see github issue #30 for the backstory.
'''
cd = os.path.dirname(__file__)
idbpath = os.path.join(cd, 'data', 'issue30', 'issue30.i64')
with idb.from_file(idbpath) as db:
api = idb.IDAPyth... |
"""
This module provides GLTF 2.0 exports
"""
import json
import collections
import numpy as np
from .. import util
# magic numbers which have meaning in GLTF
# most are uint32's of UTF-8 text
_magic = {'gltf': 1179937895,
'json': 1313821514,
'bin': 5130562}
# GLTF data type codes: numpy dtypes... |
#!/usr/bin/env python
""" Tests for YATSM scripts
"""
import os
import shutil
import unittest
from utils_mapping import TestMaps
class Test_YATSMMap(TestMaps):
@classmethod
def setUpClass(cls):
""" Setup test data filenames and load known truth dataset """
cls.script = 'yatsm_map.py'
... |
# Copyright (C) 2016 Anne Mulhern <amulhern@redhat.com>
# 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.
# Thi... |
# -*- coding: utf-8 -*-
"""Test the router."""
from malt.routing import Router
import pytest
def test_get_and_post():
router = Router()
def get_root():
pass
def post_root():
pass
def get_home():
pass
router.add_rule('GET', '/', get_root)
router.add_rule('POST', '/'... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import QueryDict
from cms.api import add_plugin
from cms.utils.plugins import build_plugin_tree
from cmsplugin_cascade.models import CascadeElement
from cmsplugin_cascade.bootstrap3.container import (BootstrapContainerPlugin, BootstrapRow... |
# -*- coding: utf-8 -*-
"""
Tests for gstorage.storage
"""
from mock import MagicMock, patch
from unittest import TestCase
from gstorage.storage import Storage
@patch('gstorage.storage.Bucket.get_default')
class TestStorage(TestCase):
@patch('gstorage.storage.Blob')
def test_save_no_location(self, mock_blob... |
import nose
import angr
import pickle
import re
import os
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../'))
import angr
from angr import options as so
def _remove_addr_from_trace_item(trace_item_str):
m = re.match(r"(<\S+ \S+) from 0x[0-9a-f]+(:[\s\S]+)", trace_item_str)
... |
import pytest
import numpy as np
@pytest.mark.parametrize('kind', ['cps', 'puf'])
def test_weights(kind, cps_weights, puf_weights,
growfactors, cps_count, puf_count,
cps_start_year, puf_start_year):
# specify weights dataframe and related parameters
if kind == 'cps':
... |
from __future__ import division
import os
import tempfile
import subprocess
import argparse
import pandas as pd
def create_blast_db():
'''
Creates a reference database using https://raw.githubusercontent.com/superphy/version-1/master/Sequences/genome_content_panseq/putative_e_coli_specific.fasta
The datab... |
"""
********************************************************************************
* Name: models.py
* Author: Nathan Swain
* Created On: 2014
* Copyright: (c) Brigham Young University 2014
* License: BSD 2-Clause
********************************************************************************
"""
from builtins impor... |
#!/usr/bin/env python
#Copyright (C) 2013 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
#!/usr/bin/env python
"""Generate a series of HAL files at progressively coarse levels of detail
from an input file by calling halLodExtract
"""
import argparse
import os
import sys
import copy
import subproce... |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
import gevent
import math
import os
import time
import logging
from lymph.utils import SampleWindow
from lymph.exceptions import RpcError
logger = logging.getLogger(__name__)
UNKNOWN = 'unknown'
RESPONSIVE = 'responsive'
UNRESPONSIVE = 'unres... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
import copy
import inflection
from datetime import datetime
from dateutil import parser as date_parser
from pprint import pformat
from collections import Iterable
from tinymodel.internals import(
defaults,
field_def_validation,
json_object,
random_object,
foreign_object,
validation,
)
from uti... |
import asyncio, discord, os, re, psutil, platform, time, sys, fnmatch, subprocess, speedtest, json, struct, shutil, tempfile
from PIL import Image
from discord.ext import commands
from Cogs import Utils, Settings, DisplayName, ReadableTime, GetImage, ProgressBar, UserTime, Message, DL
try:
from urll... |
'''
functions for compiling lists of pulses/pulseBlocks down to the hardware level.
Copyright 2013 Raytheon BBN Technologies
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.or... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2013-2014 Didotech SRL (info at didotech.com)
# All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the who... |
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_array_almost_equal
from numpy.testing import assert_allclose, assert_array_less
from scipy.spatial.transform import Rotation, Slerp
from scipy.stats import special_ortho_group
from itertools import permutations
import pickle
import copy
... |
# Copyright 2009-2010 10gen, 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 writing,... |
# -*- coding: utf-8 -*-
#########################
# CONFIGPARSER #
#########################
"""
This module is here for simplify work of __main__.
This module provide a decorator for docopt module.
Do something like:
import config
configuration = config.generate_from(__doc__)
Then args will be equa... |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
import json
import logging
import os
import uuid
from django.conf import settings
from django.http import HttpResponse
from django.template import Template
from django.template.context import Context
from django.utils.translation i... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © 2016, Continuum Analytics, Inc. All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------------------------------------------------------... |
#
# 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
# ... |
"""The lookin integration climate platform."""
from __future__ import annotations
from collections.abc import Callable, Coroutine
from datetime import timedelta
import logging
from typing import Any, Final, cast
from aiolookin import Climate, MeteoSensor, SensorID
from homeassistant.components.climate import Climate... |
import logging
from time import time
import numpy as np
import progressbar
from threading import Timer
from pybar.analysis.analyze_raw_data import AnalyzeRawData
from pybar.fei4.register_utils import invert_pixel_mask, make_box_pixel_mask_from_col_row
from pybar.fei4_run_base import Fei4RunBase
from pybar.run... |
# Copyright (c) 2016, Matteo Cafasso
# 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. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the f... |
import sys
sys.path.append("..")
import unittest
from playingfield import *
class TestShipList(unittest.TestCase):
FIELDLENGTH = 16
def test_borderCollisionWhilePlacingShip(self):
ships = ShipList(self.FIELDLENGTH) # Valid is 0<=x<=15 AND 0<=y<=15
ships.add(Field(-1, 3), Field(2 , 3))
ships.add(Field(14... |
import lxml.html
from html import escape
import chevron
import to_precision
import math
import prairielearn as pl
import numpy as np
def prepare(element_html, element_index, data):
element = lxml.html.fragment_fromstring(element_html)
required_attribs = ['answers_name']
optional_attribs = ['weight', 'corr... |
# FritzDect - Python classes for interfacing Fritz!DECT devices
#
# The MIT License (MIT)
# Copyright (c) 2015 Stefan Rakel
# 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 restricti... |
# fMBT, free Model Based Testing tool
# Copyright (c) 2013-2014, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is dist... |
from contextlib import contextmanager
import itertools
from docutils import parsers, nodes, utils
from docutils.parsers.rst import roles, states
from docutils.utils.code_analyzer import Lexer, LexerError
from CommonMark import DocParser, HTMLRenderer
from warnings import warn
__all__ = ['CommonMarkParser']
def fl... |
#!/usr/bin/env python
#########################################################################################
#
# Test function for sct_register_to_template script
#
# replace the shell test script in sct 1.0
#
# ---------------------------------------------------------------------------------------
# Copyright (c)... |
from __future__ import unicode_literals
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import EmailM... |
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django import VERSION as DJANGO_VERSION
from django.con... |
# coding=utf-8
import string
from numbers import Number
__author__ = 'Gareth Coles'
FILENAME_SAFE_CHARS = (
"/\\-_.()#:" +
string.digits +
string.letters +
string.whitespace
)
class EmptyStringFormatter(string.Formatter):
"""
EmptyStringFormatter - The same as the normal string formatter, ex... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import six
from six.moves import cPickle as pickle
from utool import util_path
from utool import util_inject
from os.path import splitext, basename, exists
try:
import lockfile
HAVE_LOCKFILE = True
except ... |
# 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... |
# -*- coding: utf-8 -*-
'''
This script demonstrates using the crab gateway to walk the entire
address tree (street and number) of a `gemeente`.
'''
from crabpy.client import crab_request, crab_factory
from crabpy.gateway.crab import CrabGateway
g = CrabGateway(crab_factory())
gemeente = g.get_gemeente_by_id(1)
pri... |
#!/usr/bin/env python
# encoding: utf-8
"""
Test _extend_kb_with_fixed_labels from core
"""
import pyqms
import sys
import unittest
TESTS = [
{
"in": {
"params": {
"molecules": ["UU"],
"charges": [2],
"params": {
"AMINO_ACIDS... |
import json
import os
import mwbase
import pytest
from revscoring.datasources import \
revision_oriented as revision_oriented_datasources
from revscoring.dependencies import solve
from revscoring.features import wikibase as wikibase_
from revscoring.features.meta import aggregators
from articlequality.feature_lis... |
"""
Support for monitoring a Smappee energy sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.smappee/
"""
import logging
from datetime import timedelta
from homeassistant.components.smappee import DATA_SMAPPEE
from homeassistant.helpers.ent... |
# -*- coding: utf-8 -*-
# See README file for full copyright and licensing details.
import csv
import pytz
from datetime import datetime
from pytz import timezone
from subprocess import check_output
from openerp import models, api, fields, _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
class BiostarTerm... |
# Copyright 2013 IBM Corp.
#
# 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 t... |
""" Tests for checking the hashes for downloaded data
Run with:
nosetests test_data.py
"""
from __future__ import print_function
from .. import data
import tempfile
import urllib
def test_check_hashes():
with tempfile.NamedTemporaryFile() as temp:
temp.write(b'Some data')
temp.flush()
... |
# -*- coding: utf-8 -*-
from twisted.test import proto_helpers
from twisted.internet import reactor
from twisted.internet.defer import (
inlineCallbacks, gatherResults, Deferred, returnValue, succeed)
from twisted.internet.error import ConnectionDone
from twisted.internet.task import Clock
from vumi.tests.helpers... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import ctypes
import numpy as np
from astropy.modeling.core import FittableModel, custom_model
__all__ = ['discretize_model']
class DiscretizationError(Exception):
"""
Called when discretization of models goes wrong.
"""
class KernelSizeE... |
# Copyright 2013-2014 DataStax, 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 writi... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Uber Technologies, 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 ... |
import sys
from pathlib import Path
from stats import load_stats_from_csv, stats_to_dict
# Approximate equatorial circumference of Earth
earth_equat_circumference = 40075 # km
def print_analysis(s):
# Print a beautiful table with box-drawing characters
c0w = 20
c1w = 12
c2w = 10
# Print the ta... |
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db import models
from django.db import connection, DEFAULT_DB_ALIAS
class Square(models.Model):
root = models.IntegerField()
square = models.PositiveIntegerFi... |
import unittest
import numpy
import pandas
from pandas.util.testing import assert_frame_equal
from cocoscore.ml.distance_scores import polynomial_decay_distance
from cocoscore.ml.fasttext_helpers import fasttext_fit_predict_default
import cocoscore.tagger.co_occurrence_score as co_occurrence_score
import cocoscore.to... |
import hashlib
import json
import math
import os
import cherrypy
import azureutil
import util
class Confirm:
@util.expose
@util.db
def index(self, cursor=None, venue_id=None, user_id=None, hashd=None,
**kwargs):
if not venue_id or not user_id or not hashd:
return '... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import)
import logging
__version__ = "3.1.1"
logger = logging.getLogger('vies')
logging.basicConfig(level=logging.ERROR)
logging.getLogger('suds.client').setLevel(logging.INFO)
VIES_WSDL_URL = str('http://ec.europa.eu/taxation_customs/vies/... |
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.messages.storage.base import Message
from django.contrib.messages.constants import ERROR
from django.test import TestCase
from ..models import TicketType, Ticket, TicketPurchase, Coupon
class TicketPurchaseViewTest(TestCase... |
"""
This example demonstrates using Mayavi as a component of a large Qt
application.
For this use, Mayavi is embedded in a QWidget. To understand this
example, please read section :ref:`builing-applications`.
"""
# First, and before importing any Enthought packages, set the ETS_TOOLKIT
# environment variable to qt4, ... |
#!/usr/bin/env python
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# This is the main of the glideinFactory
#
# Arguments:
# $1 = glidein submit_dir
#
# Author:
# Igor Sfiligoi (Apr 9th 2007 - moved old glideFactory to glideFactoryEntry)
#
import os
import sys
import fcntl
import resource
impor... |
# -*- coding: utf-8 -*-
"""Python module for generating fake spectra from an N-body catalogue.
Note in Arepo we have GFM_Metals and GFM_Metallicity.
GFM_Metallicity is the total mass in species not H or He
per unit gas mass (and is used for cooling).
GFM_Metals is a 9-component array of species:
H, He, C, N, O, Ne, ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2018 khalim19
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
from feemodel.util import proxy, logWrite, Saveable, getBlockTimeStamp, pickle, roundRandom
from feemodel.config import config, saveWaitFile, saveRatesFile, historyFile
from feemodel.txmempool import Block
from math import exp, cos, sin, sqrt, log, pi
from random import random, choice, sample
from copy import deepcopy
... |
"""As a bonus - you get 50 cent quotes.
Your opinion of yourself becomes your reality.
"""
from Roulette.pick import Pick
from algorithm import Algorithm
class FiftyCentAlgorithm(Algorithm):
def __init__(self):
"""I love you like a fat kid loves cake."""
self.red = 0
self.black = 0
de... |
__version_info__ = (1, 0, 3, 'pre')
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join(str(i) for i in __version_info__[:-1])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
#THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY ... |
import json
VERSION = 0.2
JS = """\
<div id="%(name)s">
</div>
<script type="text/javascript">
var intId_%(name)s = window.setInterval(
function() {
console.log('running setInterval '+intId_%(name)s);
console.log($);
console.log(d3);
console.log(d3po);
try {
... |
import sublime
import sublime_plugin
import os
import threading
import time
import tempfile
from .util.view_finder import ViewFinder
from .util.constants import Constants
from .util.vcs import NoVCSError
from .parser.diff_parser import DiffParser
class DiffView(sublime_plugin.WindowCommand):
diff_args = ''
... |
# -*- coding: utf-8 -*-
# copyright 2013 CEA (Saclay, FRANCE), all rights reserved.
# copyright 2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://brainomics.cea.fr -- mailto:localizer94@cea.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU... |
__version_info__ = ('6', '32', '0')
__version__ = '.'.join(__version_info__)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
client.py
---------
TxTrader Client module - Expose class API as user interface.
Copyright (c) 2015 Reliance Systems Inc. <mkrueger@rstms.net>
Licensed under the MIT license. See LICENSE for details.
"""
import os
import sys
import requests
from types imp... |
import requests
import random
import hashlib
import json
class BaiduTranslator(object):
def __init__(self, app_id, secret_key, https_enable=False):
self.app_id = app_id
self.secret_key = secret_key
self.api_host = 'https://fanyi-api.baidu.com' if https_enable else 'http://api.fanyi.baidu.c... |
#!/usr/bin/python3
"""
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="identifier_1"
Version="2.0"
IssueInstant="2004-12-05T09:21:59Z"
AssertionConsumerServiceIndex="1">
<saml:Issuer>https://sp.example.com/SAML2</sa... |
#markov module for scrappy
#the inspiration for this code comes from
#"The Practice of Programming", so some of the variable
#names and such will be similar.
import random
import pickle
import re
import threading
import logging
from module import Module
class markov(Module):
def __init__(self,scrap):
su... |
from __future__ import division
import re
import string
pipe_split_p = re.compile("\s*\|\s*")
func_and_arg_p = re.compile('(?P<func>\w+)\((?P<args>.*)\)', flags=re.DOTALL)
comma_sep_p = re.compile('\s*,\s*')
def get_func_and_arg_dict(s):
"""
Parses the input string recursively, returning:
* if the s... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_openphish
# Purpose: Checks if an ASN, IP or domain is malicious by checking OpenPhish.com.
#
# Author: steve@binarypool.com
#
# Created: 28/06/2018
# Copyright: (c) Steve Mical... |
import os.path
from collections import namedtuple
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from shlex import shlex
from . import _gpg
Entry = namedtuple('Entry', ['key', 'user', 'password', 'notes'])
def normalized_key(key):
return key.replace(' ', '_').lower()
cla... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pyfiscan is free web-application vulnerability and version scanner and can be used to locate out-dated versions of common web-applications in Linux-servers. Example usa case is hosting-providers keeping eye on their users installations to keep up with security-updates.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from EmeraldAI.Logic.NLP import NLP
from EmeraldAI.Entities.Word import Word
from EmeraldAI.Logic.NLP.Thesaurus import *
from EmeraldAI.Logic.NLP import Parameterizer
from EmeraldAI.Logic.Singleton import Singleton
import multiprocessing
from multiprocessing import Manager
cl... |
'''
Create Packs, like Zicbee Pack (at http://pypi.python.org/zicbee).
Inspired by zicbee-workshop's manage.py
'''
import os
import sys
import glob
import shutil
import platform
from pyg.req import Requirement
from pyg.inst import Bundler
from pyg.utils import TempDir, ZipFile
class Packer(object):
EMPTY, INI,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.